@Override public String toString() { return "RemovePropertyEvent{element=" + getElement() + ", property=" + getKey() + ":" + getName() + ":" + getVisibility() + '}'; }
@Override public int hashCode() { return getKey().hashCode() ^ getName().hashCode() ^ getVisibility().hashCode(); }
public void removeProperty(Element element, Property property, Authorizations authorizations) { if (element instanceof Vertex) { InMemoryVertex vertex = vertices.get(element.getId()); vertex.removePropertyInternal(property.getKey(), property.getName()); } else if (element instanceof Edge) { InMemoryEdge edge = edges.get(element.getId()); edge.removePropertyInternal(property.getKey(), property.getName()); } else { throw new IllegalArgumentException("Unexpected element type: " + element.getClass().getName()); } getSearchIndex().removeProperty(this, element, property, authorizations); if (hasEventListeners()) { fireGraphEvent(new RemovePropertyEvent(this, element, property)); } }
fireGraphEvent(new RemovePropertyEvent(InMemoryGraph.this, inMemoryElement, propertyRemoveMutation));
@Override public int hashCode() { return getKey().hashCode() ^ getName().hashCode() ^ getVisibility().hashCode(); }
void removeProperty(AccumuloElement element, Property property, Authorizations authorizations) { String rowPrefix = getRowPrefixForElement(element); Mutation m = new Mutation(rowPrefix + element.getId()); elementMutationBuilder.addPropertyRemoveToMutation(m, property); addMutations(getWriterFromElementType(element), m); getSearchIndex().removeProperty(this, element, property, authorizations); if (hasEventListeners()) { queueEvent(new RemovePropertyEvent(this, element, property)); } }
@Override public String toString() { return "RemovePropertyEvent{element=" + getElement() + ", property=" + getKey() + ":" + getName() + ":" + getVisibility() + '}'; }
@Override public Vertex save(Authorizations authorizations) { AccumuloVertex vertex = new AccumuloVertex( AccumuloGraph.this, getVertexId(), getVisibility(), getProperties(), getPropertyRemoves(), null, authorizations, System.currentTimeMillis() ); elementMutationBuilder.saveVertex(vertex); if (getIndexHint() != IndexHint.DO_NOT_INDEX) { getSearchIndex().addElement(AccumuloGraph.this, vertex, authorizations); } if (hasEventListeners()) { queueEvent(new AddVertexEvent(AccumuloGraph.this, vertex)); for (Property property : getProperties()) { queueEvent(new AddPropertyEvent(AccumuloGraph.this, vertex, property)); } for (PropertyRemoveMutation propertyRemoveMutation : getPropertyRemoves()) { queueEvent(new RemovePropertyEvent(AccumuloGraph.this, vertex, propertyRemoveMutation)); } } return vertex; } };
@Override public boolean equals(Object obj) { if (!(obj instanceof RemovePropertyEvent)) { return false; } RemovePropertyEvent other = (RemovePropertyEvent) obj; return getElement().equals(other.getElement()) && getKey().equals(other.getKey()) && getName().equals(other.getName()) && getVisibility().equals(other.getVisibility()) && super.equals(obj); } }
@Override public Vertex save(Authorizations authorizations) { InMemoryVertex newVertex = new InMemoryVertex(InMemoryGraph.this, getVertexId(), getVisibility(), getProperties(), getPropertyRemoves(), null, authorizations); // to more closely simulate how accumulo works. add a potentially sparse (in case of an update) vertex to the search index. if (getIndexHint() != IndexHint.DO_NOT_INDEX) { getSearchIndex().addElement(InMemoryGraph.this, newVertex, authorizations); } InMemoryVertex existingVertex = (InMemoryVertex) getVertex(getVertexId(), authorizations); InMemoryVertex vertex = InMemoryVertex.updateOrCreate(InMemoryGraph.this, existingVertex, newVertex, authorizations); vertices.put(getVertexId(), vertex); if (hasEventListeners()) { fireGraphEvent(new AddVertexEvent(InMemoryGraph.this, vertex)); for (Property property : getProperties()) { fireGraphEvent(new AddPropertyEvent(InMemoryGraph.this, vertex, property)); } for (PropertyRemoveMutation propertyRemoveMutation : getPropertyRemoves()) { fireGraphEvent(new RemovePropertyEvent(InMemoryGraph.this, vertex, propertyRemoveMutation)); } } return vertex; } };
@Override public boolean equals(Object obj) { if (!(obj instanceof RemovePropertyEvent)) { return false; } RemovePropertyEvent other = (RemovePropertyEvent) obj; return getElement().equals(other.getElement()) && getKey().equals(other.getKey()) && getName().equals(other.getName()) && getVisibility().equals(other.getVisibility()) && super.equals(obj); } }
fireGraphEvent(new RemovePropertyEvent(InMemoryGraph.this, edge, propertyRemoveMutation));
assertEquals(0, count(graph.query(AUTHORIZATIONS_A_AND_B).has("prop1", "value1a").vertices())); assertEvents( new RemovePropertyEvent(graph, v, prop1_propid1a), new RemovePropertyEvent(graph, v, prop1_propid1b) ); this.graphEvents.clear(); new RemovePropertyEvent(graph, v, prop2_propid2a) );
assertEquals(0, count(graph.query(AUTHORIZATIONS_A_AND_B).has("prop1", "value1a").vertices())); assertEvents( new RemovePropertyEvent(graph, v, prop1_propid1a), new RemovePropertyEvent(graph, v, prop1_propid1b) ); this.graphEvents.clear(); new RemovePropertyEvent(graph, v, prop2_propid2a) );
queueEvent(new RemovePropertyEvent(AccumuloGraph.this, edge, propertyRemoveMutation));
assertEquals(0, count(graph.query(AUTHORIZATIONS_A_AND_B).has("prop1", "value1a").vertices())); assertEvents( new RemovePropertyEvent(graph, v1, prop1_propid1a), new RemovePropertyEvent(graph, v1, prop1_propid1b) ); this.graphEvents.clear(); assertEquals(0, count(v1.getProperties())); assertEvents( new RemovePropertyEvent(graph, v1, prop2_propid2a) ); this.graphEvents.clear(); assertEquals(0, count(e1.getProperties())); assertEvents( new RemovePropertyEvent(graph, e1, edgeProperty) );
assertEquals(0, count(graph.query(AUTHORIZATIONS_A_AND_B).has("prop1", "value1a").vertices())); assertEvents( new RemovePropertyEvent(graph, v1, prop1_propid1a), new RemovePropertyEvent(graph, v1, prop1_propid1b) ); this.graphEvents.clear(); assertEquals(0, count(v1.getProperties())); assertEvents( new RemovePropertyEvent(graph, v1, prop2_propid2a) ); this.graphEvents.clear(); assertEquals(0, count(e1.getProperties())); assertEvents( new RemovePropertyEvent(graph, e1, edgeProperty) );
queueEvent(new RemovePropertyEvent(AccumuloGraph.this, element, propertyRemoveMutation));