Exemplo n.º 1
0
  public Iterable<KeyValuePair> getEdgeTableKeyValuePairsEdge(AccumuloEdge edge) {
    List<KeyValuePair> results = new ArrayList<>();

    ColumnVisibility edgeColumnVisibility = visibilityToAccumuloVisibility(edge.getVisibility());
    Text edgeRowKey = new Text(edge.getId());
    String edgeLabel = edge.getLabel();
    if (edge.getNewEdgeLabel() != null) {
      throw new VertexiumException("Cannot get key/value pairs for label changes");
    }
    results.add(
        new KeyValuePair(
            new Key(
                edgeRowKey,
                AccumuloEdge.CF_SIGNAL,
                new Text(edgeLabel),
                edgeColumnVisibility,
                edge.getTimestamp()),
            ElementMutationBuilder.EMPTY_VALUE));
    results.add(
        new KeyValuePair(
            new Key(
                edgeRowKey,
                AccumuloEdge.CF_OUT_VERTEX,
                new Text(edge.getVertexId(Direction.OUT)),
                edgeColumnVisibility,
                edge.getTimestamp()),
            ElementMutationBuilder.EMPTY_VALUE));
    results.add(
        new KeyValuePair(
            new Key(
                edgeRowKey,
                AccumuloEdge.CF_IN_VERTEX,
                new Text(edge.getVertexId(Direction.IN)),
                edgeColumnVisibility,
                edge.getTimestamp()),
            ElementMutationBuilder.EMPTY_VALUE));
    if (edge.getPropertyDeleteMutations().iterator().hasNext()) {
      throw new VertexiumException("Cannot get key/value pairs for property deletions");
    }
    for (PropertySoftDeleteMutation propertySoftDeleteMutation :
        edge.getPropertySoftDeleteMutations()) {
      addPropertySoftDeleteToKeyValuePairs(results, edgeRowKey, propertySoftDeleteMutation);
    }
    for (Property property : edge.getProperties()) {
      addPropertyToKeyValuePairs(results, edgeRowKey, property);
    }
    return results;
  }
Exemplo n.º 2
0
 private Mutation createMutationForEdge(AccumuloEdge edge, ColumnVisibility edgeColumnVisibility) {
   String edgeRowKey = edge.getId();
   Mutation m = new Mutation(edgeRowKey);
   String edgeLabel = edge.getLabel();
   if (edge.getNewEdgeLabel() != null) {
     edgeLabel = edge.getNewEdgeLabel();
     m.putDelete(
         AccumuloEdge.CF_SIGNAL,
         new Text(edge.getLabel()),
         edgeColumnVisibility,
         currentTimeMillis());
   }
   m.put(
       AccumuloEdge.CF_SIGNAL,
       new Text(edgeLabel),
       edgeColumnVisibility,
       edge.getTimestamp(),
       ElementMutationBuilder.EMPTY_VALUE);
   m.put(
       AccumuloEdge.CF_OUT_VERTEX,
       new Text(edge.getVertexId(Direction.OUT)),
       edgeColumnVisibility,
       edge.getTimestamp(),
       ElementMutationBuilder.EMPTY_VALUE);
   m.put(
       AccumuloEdge.CF_IN_VERTEX,
       new Text(edge.getVertexId(Direction.IN)),
       edgeColumnVisibility,
       edge.getTimestamp(),
       ElementMutationBuilder.EMPTY_VALUE);
   for (PropertyDeleteMutation propertyDeleteMutation : edge.getPropertyDeleteMutations()) {
     addPropertyDeleteToMutation(m, propertyDeleteMutation);
   }
   for (PropertySoftDeleteMutation propertySoftDeleteMutation :
       edge.getPropertySoftDeleteMutations()) {
     addPropertySoftDeleteToMutation(m, propertySoftDeleteMutation);
   }
   for (Property property : edge.getProperties()) {
     addPropertyToMutation(edge.getGraph(), m, edgeRowKey, property);
   }
   return m;
 }