public ElementMutation<T> setProperty(String name, Object value, Metadata metadata, Visibility visibility) { return addPropertyValue(DEFAULT_KEY, name, value, metadata, visibility); }
@Override public ExistingElementMutation<T> alterPropertyVisibility(String name, Visibility visibility) { return alterPropertyVisibility(DEFAULT_KEY, name, visibility); }
protected <TElement extends Element> void saveExistingElementMutation(ExistingElementMutationImpl<TElement> mutation, Authorizations authorizations) { // Order matters a lot here // metadata must be altered first because the lookup of a property can include visibility which will be altered by alterElementPropertyVisibilities getGraph().alterPropertyMetadatas((AccumuloElement) mutation.getElement(), mutation.getSetPropertyMetadatas()); // altering properties comes next because alterElementVisibility may alter the vertex and we won't find it getGraph().alterElementPropertyVisibilities((AccumuloElement) mutation.getElement(), mutation.getAlterPropertyVisibilities()); Iterable<PropertyRemoveMutation> propertyRemoves = mutation.getPropertyRemoves(); Iterable<Property> properties = mutation.getProperties(); updatePropertiesInternal(properties, propertyRemoves); getGraph().saveProperties((AccumuloElement) mutation.getElement(), properties, propertyRemoves, mutation.getIndexHint(), authorizations); if (mutation.getNewElementVisibility() != null) { getGraph().alterElementVisibility((AccumuloElement) mutation.getElement(), mutation.getNewElementVisibility()); } if (mutation instanceof EdgeMutation) { EdgeMutation edgeMutation = (EdgeMutation) mutation; String newEdgeLabel = edgeMutation.getNewEdgeLabel(); if (newEdgeLabel != null) { getGraph().alterEdgeLabel((AccumuloEdge) mutation.getElement(), newEdgeLabel); } } }
@Override public ExistingElementMutation<T> removeProperties(String key, String name) { for (Property prop : this.element.getProperties(key, name)) { removeProperty(prop); } return this; }
protected <TElement extends Element> void saveExistingElementMutation(ExistingElementMutationImpl<TElement> mutation, Authorizations authorizations) { Iterable<Property> properties = mutation.getProperties(); Iterable<PropertyRemoveMutation> propertyRemoves = mutation.getPropertyRemoves(); updatePropertiesInternal(properties, propertyRemoves); getGraph().saveProperties(mutation.getElement(), properties, propertyRemoves, mutation.getIndexHint(), authorizations); if (mutation.getElement() instanceof Edge) { if (mutation.getNewElementVisibility() != null) { getGraph().alterEdgeVisibility(mutation.getElement().getId(), mutation.getNewElementVisibility()); } getGraph().alterEdgePropertyVisibilities(mutation.getElement().getId(), mutation.getAlterPropertyVisibilities(), authorizations); getGraph().alterEdgePropertyMetadata(mutation.getElement().getId(), mutation.getSetPropertyMetadatas()); if (mutation instanceof EdgeMutation) { EdgeMutation edgeMutation = (EdgeMutation) mutation; if (edgeMutation.getNewEdgeLabel() != null) { getGraph().alterEdgeLabel(mutation.getElement().getId(), edgeMutation.getNewEdgeLabel()); } } } else if (mutation.getElement() instanceof Vertex) { if (mutation.getNewElementVisibility() != null) { getGraph().alterVertexVisibility(mutation.getElement().getId(), mutation.getNewElementVisibility()); } getGraph().alterVertexPropertyVisibilities(mutation.getElement().getId(), mutation.getAlterPropertyVisibilities(), authorizations); getGraph().alterVertexPropertyMetadata(mutation.getElement().getId(), mutation.getSetPropertyMetadatas()); } else { throw new IllegalStateException("Unexpected element type: " + mutation.getElement()); } }
@Override public ElementMutation<T> removeProperty(String key, String name, Visibility visibility) { Property property = this.element.getProperty(key, name, visibility); if (property != null) { removeProperty(property); } return this; }
@Override public ExistingElementMutation<T> removeProperties(String name) { for (Property prop : this.element.getProperties(name)) { removeProperty(prop); } return this; }
public ElementMutation<T> setProperty(String name, Object value, Metadata metadata, Visibility visibility) { return addPropertyValue(DEFAULT_KEY, name, value, metadata, visibility); }
@Override public ExistingElementMutation<T> alterPropertyVisibility(String name, Visibility visibility) { return alterPropertyVisibility(DEFAULT_KEY, name, visibility); }
@Override public ExistingElementMutation<T> removeProperties(String key, String name) { for (Property prop : this.element.getProperties(key, name)) { removeProperty(prop); } return this; }
public ElementMutation<T> addPropertyValue(String key, String name, Object value, Visibility visibility) { return addPropertyValue(key, name, value, new Metadata(), visibility); }
@Override public ElementMutation<T> removeProperty(String name, Visibility visibility) { Property property = this.element.getProperty(name, visibility); if (property != null) { removeProperty(property); } return this; }
public ElementMutation<T> addPropertyValue(String key, String name, Object value, Visibility visibility) { return addPropertyValue(key, name, value, new Metadata(), visibility); }
@Override public ElementMutation<T> removeProperty(String key, String name, Visibility visibility) { Property property = this.element.getProperty(key, name, visibility); if (property != null) { removeProperty(property); } return this; }
@Override public ExistingElementMutation<T> removeProperties(String name) { for (Property prop : this.element.getProperties(name)) { removeProperty(prop); } return this; }
@Override public ElementMutation<T> removeProperty(String name, Visibility visibility) { Property property = this.element.getProperty(name, visibility); if (property != null) { removeProperty(property); } return this; }