@Override public QueryableIterable<ExtendedDataRow> getExtendedData(String tableName) { return new ExtendedDataQueryableIterable( getGraph(), this, tableName, getGraph().getExtendedData(ElementType.getTypeFromElement(this), getId(), tableName, getAuthorizations()) ); }
@Override public Property getProperty(String name) { if (ID_PROPERTY_NAME.equals(name)) { return getIdProperty(); } else if (Edge.LABEL_PROPERTY_NAME.equals(name) && this instanceof Edge) { return getEdgeLabelProperty(); } else if (Edge.OUT_VERTEX_ID_PROPERTY_NAME.equals(name) && this instanceof Edge) { return getOutVertexIdProperty(); } else if (Edge.IN_VERTEX_ID_PROPERTY_NAME.equals(name) && this instanceof Edge) { return getInVertexIdProperty(); } else if (Edge.IN_OR_OUT_VERTEX_ID_PROPERTY_NAME.equals(name) && this instanceof Edge) { return getInOrOutVertexIdProperty(); } Iterator<Property> propertiesWithName = getProperties(name).iterator(); if (propertiesWithName.hasNext()) { return propertiesWithName.next(); } return null; }
@Override public ImmutableSet<String> getExtendedDataTableNames() { if (!getFetchHints().isIncludeExtendedDataTableNames()) { throw new VertexiumMissingFetchHintException(getFetchHints(), "includeExtendedDataTableNames"); } return extendedDataTableNames; }
@Override public void softDeleteProperty(String key, String name, Visibility visibility, Authorizations authorizations) { Property property = getProperty(key, name, visibility); if (property != null) { this.properties.removeProperty(property); getGraph().softDeleteProperty(this, property, authorizations); } }
void alterPropertyMetadatas(AccumuloElement element, List<SetPropertyMetadata> setPropertyMetadatas) { if (setPropertyMetadatas.size() == 0) { return; } String elementRowKey = element.getId(); Mutation m = new Mutation(elementRowKey); for (SetPropertyMetadata apm : setPropertyMetadatas) { Property property = element.getProperty(apm.getPropertyKey(), apm.getPropertyName(), apm.getPropertyVisibility()); if (property == null) { throw new VertexiumException(String.format("Could not find property %s:%s(%s)", apm.getPropertyKey(), apm.getPropertyName(), apm.getPropertyVisibility())); } if (property.getFetchHints().isIncludePropertyAndMetadata(property.getName())) { property.getMetadata().add(apm.getMetadataName(), apm.getNewValue(), apm.getMetadataVisibility()); } elementMutationBuilder.addPropertyMetadataItemToMutation( m, property, apm.getMetadataName(), apm.getNewValue(), apm.getMetadataVisibility() ); } addMutations(element, m); }
@Override public int hashCode() { return getId().hashCode(); }
void deleteProperty(AccumuloElement element, Property property, Authorizations authorizations) { if (!element.getFetchHints().isIncludePropertyAndMetadata(property.getName())) { throw new VertexiumMissingFetchHintException(element.getFetchHints(), "Property " + property.getName() + " needs to be included with metadata"); } Mutation m = new Mutation(element.getId()); elementMutationBuilder.addPropertyDeleteToMutation(m, property); addMutations(element, m); getSearchIndex().deleteProperty( this, element, PropertyDescriptor.fromProperty(property), authorizations ); if (hasEventListeners()) { queueEvent(new DeletePropertyEvent(this, element, property)); } }
void alterElementVisibility(AccumuloElement element, Visibility newVisibility) { String elementRowKey = element.getId(); Span trace = Trace.start("alterElementVisibility"); trace.data("elementRowKey", elementRowKey); try { if (element instanceof Edge) { Edge edge = (Edge) element; String vertexOutRowKey = edge.getVertexId(Direction.OUT); Mutation vertexOutMutation = new Mutation(vertexOutRowKey); if (elementMutationBuilder.alterEdgeVertexOutVertex(vertexOutMutation, edge, newVisibility)) { addMutations(VertexiumObjectType.VERTEX, vertexOutMutation); } String vertexInRowKey = edge.getVertexId(Direction.IN); Mutation vertexInMutation = new Mutation(vertexInRowKey); if (elementMutationBuilder.alterEdgeVertexInVertex(vertexInMutation, edge, newVisibility)) { addMutations(VertexiumObjectType.VERTEX, vertexInMutation); } } Mutation m = new Mutation(elementRowKey); if (elementMutationBuilder.alterElementVisibility(m, element, newVisibility)) { addMutations(element, m); } element.setVisibility(newVisibility); } finally { trace.stop(); } }
this.propertyDeleteMutations = new ConcurrentSkipListSet<>(); for (PropertyDeleteMutation propertyDeleteMutation : propertyDeleteMutations) { removePropertyInternal( propertyDeleteMutation.getKey(), propertyDeleteMutation.getName(), this.propertySoftDeleteMutations = new ConcurrentSkipListSet<>(); for (PropertySoftDeleteMutation propertySoftDeleteMutation : propertySoftDeleteMutations) { removePropertyInternal( propertySoftDeleteMutation.getKey(), propertySoftDeleteMutation.getName(), addPropertyInternal(property);
getGraph().alterPropertyMetadatas(element, mutation.getSetPropertyMetadatas()); getGraph().alterElementPropertyVisibilities(element, mutation.getAlterPropertyVisibilities()); Iterable<Property> properties = mutation.getProperties(); updatePropertiesInternal(properties, propertyDeletes, propertySoftDeletes); getGraph().saveProperties(element, properties, propertyDeletes, propertySoftDeletes); getGraph().alterElementVisibility(element, mutation.getNewElementVisibility()); getGraph().alterEdgeLabel((AccumuloEdge) mutation.getElement(), newEdgeLabel); getGraph().getSearchIndex().updateElement(graph, mutation, authorizations); getGraph().saveExtendedDataMutations( mutation.getElement(), elementType,
@Override public void markPropertyHidden(Property property, Long timestamp, Visibility visibility, Authorizations authorizations) { getGraph().markPropertyHidden(this, property, timestamp, visibility, authorizations); }
@Override public void deleteProperty(String key, String name, Visibility visibility, Authorizations authorizations) { Property property = getProperty(key, name, visibility); if (property != null) { this.properties.removeProperty(property); getGraph().deleteProperty(this, property, authorizations); } }
String elementRowKey = element.getId(); MutableProperty property = (MutableProperty) element.getProperty( apv.getKey(), apv.getName(),
@Override public int hashCode() { return getId().hashCode(); }
void deleteProperty(AccumuloElement element, Property property, Authorizations authorizations) { if (!element.getFetchHints().isIncludePropertyAndMetadata(property.getName())) { throw new VertexiumMissingFetchHintException(element.getFetchHints(), "Property " + property.getName() + " needs to be included with metadata"); } Mutation m = new Mutation(element.getId()); elementMutationBuilder.addPropertyDeleteToMutation(m, property); addMutations(element, m); getSearchIndex().deleteProperty( this, element, PropertyDescriptor.fromProperty(property), authorizations ); if (hasEventListeners()) { queueEvent(new DeletePropertyEvent(this, element, property)); } }
void alterElementVisibility(AccumuloElement element, Visibility newVisibility) { String elementRowKey = element.getId(); Span trace = Trace.start("alterElementVisibility"); trace.data("elementRowKey", elementRowKey); try { if (element instanceof Edge) { Edge edge = (Edge) element; String vertexOutRowKey = edge.getVertexId(Direction.OUT); Mutation vertexOutMutation = new Mutation(vertexOutRowKey); if (elementMutationBuilder.alterEdgeVertexOutVertex(vertexOutMutation, edge, newVisibility)) { addMutations(VertexiumObjectType.VERTEX, vertexOutMutation); } String vertexInRowKey = edge.getVertexId(Direction.IN); Mutation vertexInMutation = new Mutation(vertexInRowKey); if (elementMutationBuilder.alterEdgeVertexInVertex(vertexInMutation, edge, newVisibility)) { addMutations(VertexiumObjectType.VERTEX, vertexInMutation); } } Mutation m = new Mutation(elementRowKey); if (elementMutationBuilder.alterElementVisibility(m, element, newVisibility)) { addMutations(element, m); } element.setVisibility(newVisibility); } finally { trace.stop(); } }
this.propertyDeleteMutations = new ConcurrentSkipListSet<>(); for (PropertyDeleteMutation propertyDeleteMutation : propertyDeleteMutations) { removePropertyInternal( propertyDeleteMutation.getKey(), propertyDeleteMutation.getName(), this.propertySoftDeleteMutations = new ConcurrentSkipListSet<>(); for (PropertySoftDeleteMutation propertySoftDeleteMutation : propertySoftDeleteMutations) { removePropertyInternal( propertySoftDeleteMutation.getKey(), propertySoftDeleteMutation.getName(), addPropertyInternal(property);
getGraph().alterPropertyMetadatas(element, mutation.getSetPropertyMetadatas()); getGraph().alterElementPropertyVisibilities(element, mutation.getAlterPropertyVisibilities()); Iterable<Property> properties = mutation.getProperties(); updatePropertiesInternal(properties, propertyDeletes, propertySoftDeletes); getGraph().saveProperties(element, properties, propertyDeletes, propertySoftDeletes); getGraph().alterElementVisibility(element, mutation.getNewElementVisibility()); getGraph().alterEdgeLabel((AccumuloEdge) mutation.getElement(), newEdgeLabel); getGraph().getSearchIndex().updateElement(graph, mutation, authorizations); getGraph().saveExtendedDataMutations( mutation.getElement(), elementType,
@Override public void markPropertyVisible(Property property, Long timestamp, Visibility visibility, Authorizations authorizations) { getGraph().markPropertyVisible(this, property, timestamp, visibility, authorizations); }
@Override public Property getProperty(String name) { if (ID_PROPERTY_NAME.equals(name)) { return getIdProperty(); } else if (Edge.LABEL_PROPERTY_NAME.equals(name) && this instanceof Edge) { return getEdgeLabelProperty(); } else if (Edge.OUT_VERTEX_ID_PROPERTY_NAME.equals(name) && this instanceof Edge) { return getOutVertexIdProperty(); } else if (Edge.IN_VERTEX_ID_PROPERTY_NAME.equals(name) && this instanceof Edge) { return getInVertexIdProperty(); } else if (Edge.IN_OR_OUT_VERTEX_ID_PROPERTY_NAME.equals(name) && this instanceof Edge) { return getInOrOutVertexIdProperty(); } Iterator<Property> propertiesWithName = getProperties(name).iterator(); if (propertiesWithName.hasNext()) { return propertiesWithName.next(); } return null; }