public static EdgeKeyBuilder newBuilder(EdgeKey.EDGE_FORMAT format) { EdgeKeyBuilder builder = EdgeKey.newBuilder(); return builder.setFormat(format); }
/** * Decode the key leaving the row portion native to the accumulo key, leaving the source and sink as they are in the accumulo row. Iterators which create * new keys without the builders, can safely decode with this method and reseek to the same position, without knowledge of the underlying escaping encodings * * @param key * a key from the Datawave edge table * @return an immutable EdgeKey object */ public static EdgeKey decodeForInternal(Key key) { EdgeKeyBuilder builder = EdgeKey.newBuilder(); builder.unescape = false; builder.escape = false; return decode(key, builder); }
/** * Parses edge table keys into the various fields encoded within the key. The source and sink are unescaped, ready to send to external clients. * * @param key * a key from the Datawave edge table * @return an immutable EdgeKey object */ public static EdgeKey decode(Key key) { return decode(key, EdgeKey.newBuilder().unescape()); }
public static EdgeKey swapSourceSink(EdgeKey swap) { EdgeKeyBuilder builder = newBuilder(swap); builder.setSourceData(swap.getSinkData()); builder.setSinkData(swap.getSourceData()); builder.setSourceRelationship(swap.getSinkRelationship()); builder.setSinkRelationship(swap.getSourceRelationship()); builder.setSourceAttribute1(swap.getSinkAttribute1()); builder.setSinkAttribute1(swap.getSourceAttribute1()); return builder.build(); }
protected Key createStatsKey(STATS_TYPE statsType, EdgeDataBundle edgeValue, VertexValue vertex, String value, Text visibility, EdgeKey.DATE_TYPE date_type) { String typeName = edgeValue.getDataTypeName(); datawave.edge.util.EdgeKey.EdgeKeyBuilder builder = datawave.edge.util.EdgeKey.newBuilder(EDGE_FORMAT.STATS).escape(); builder.setSourceData(value).setStatsType(statsType).setType(edgeValue.getEdgeType()).setYyyymmdd(edgeValue.getYyyyMMdd(date_type)) .setSourceRelationship(vertex.getRelationshipType()).setSourceAttribute1(vertex.getCollectionType())
private Key createEdgeKey(EdgeDataBundle edgeValue, VertexValue source, String sourceValue, VertexValue sink, String sinkValue, Text visibility, long timestamp, EdgeKey.DATE_TYPE date_type) { String typeName = edgeValue.getDataTypeName(); datawave.edge.util.EdgeKey.EdgeKeyBuilder builder = datawave.edge.util.EdgeKey.newBuilder(EDGE_FORMAT.STANDARD).escape(); builder.setSourceData(sourceValue).setSinkData(sinkValue).setType(edgeValue.getEdgeType()).setYyyymmdd(edgeValue.getYyyyMMdd(date_type)) .setSourceRelationship(source.getRelationshipType()).setSinkRelationship(sink.getRelationshipType()) .setSourceAttribute1(source.getCollectionType()).setSinkAttribute1(sink.getCollectionType()) .setAttribute3(edgeValue.getEdgeAttribute3()).setAttribute2(edgeValue.getEdgeAttribute2()).setColvis(visibility) .setTimestamp(timestamp).setDateType(date_type); builder.setDeleted(edgeValue.isDeleting()); return builder.build().encode(); }