private void deleteChangeableProperties(Vertex vertex, Authorizations authorizations) { for (Property property : vertex.getProperties()) { if (OntologyProperties.CHANGEABLE_PROPERTY_IRI.contains(property.getName())) { vertex.softDeleteProperty(property.getKey(), property.getName(), authorizations); } } graph.flush(); }
@Override public void removeProperty(String name, Authorizations authorizations) { getVertex().softDeleteProperty(ElementMutation.DEFAULT_KEY, name, authorizations); getVertex().getGraph().flush(); }
public void removeProperty(String key, String name, Authorizations authorizations) { getVertex().softDeleteProperty(key, name, authorizations); getVertex().getGraph().flush(); }
@Test public void testSoftDeletePropertyOnAHiddenVertex() { Vertex v1 = graph.prepareVertex("v1", VISIBILITY_EMPTY) .addPropertyValue("key1", "name1", "value1", VISIBILITY_EMPTY) .save(AUTHORIZATIONS_A); graph.flush(); graph.markVertexHidden(v1, VISIBILITY_A, AUTHORIZATIONS_A); graph.flush(); v1 = graph.getVertex("v1", FetchHints.ALL_INCLUDING_HIDDEN, AUTHORIZATIONS_A); v1.softDeleteProperty("key1", "name1", AUTHORIZATIONS_A); graph.flush(); v1 = graph.getVertex("v1", FetchHints.ALL_INCLUDING_HIDDEN, AUTHORIZATIONS_A); assertNull(v1.getProperty("key1", "name1", VISIBILITY_EMPTY)); }
@Test public void testSoftDeletePropertyOnAHiddenVertex() { Vertex v1 = graph.prepareVertex("v1", VISIBILITY_EMPTY) .addPropertyValue("key1", "name1", "value1", VISIBILITY_EMPTY) .save(AUTHORIZATIONS_A); graph.flush(); graph.markVertexHidden(v1, VISIBILITY_A, AUTHORIZATIONS_A); graph.flush(); v1 = graph.getVertex("v1", FetchHints.ALL_INCLUDING_HIDDEN, AUTHORIZATIONS_A); v1.softDeleteProperty("key1", "name1", AUTHORIZATIONS_A); graph.flush(); v1 = graph.getVertex("v1", FetchHints.ALL_INCLUDING_HIDDEN, AUTHORIZATIONS_A); assertNull(v1.getProperty("key1", "name1", VISIBILITY_EMPTY)); }
v1.addPropertyValue("key1", "firstName", "Joseph", VISIBILITY_B, AUTHORIZATIONS_A_AND_B); graph.flush(); v1.softDeleteProperty("key1", "firstName", VISIBILITY_B, AUTHORIZATIONS_A_AND_B); graph.flush(); v1.markPropertyVisible("key1", "firstName", VISIBILITY_A, VISIBILITY_B, AUTHORIZATIONS_A_AND_B); v2.addPropertyValue("key1", "firstName", "Joseph", VISIBILITY_B, AUTHORIZATIONS_A_AND_B); graph.flush(); v2.softDeleteProperty("key1", "firstName", VISIBILITY_B, AUTHORIZATIONS_A_AND_B); graph.flush(); v2.markPropertyVisible("key1", "firstName", VISIBILITY_A, VISIBILITY_B, AUTHORIZATIONS_A_AND_B);
@Override public void softDeleteVertex(Vertex vertex, Long timestamp, Authorizations authorizations) { if (!((InMemoryVertex) vertex).canRead(authorizations)) { return; } if (timestamp == null) { timestamp = IncreasingTime.currentTimeMillis(); } for (Property property : vertex.getProperties()) { vertex.softDeleteProperty(property.getKey(), property.getName(), property.getVisibility(), authorizations); } List<Edge> edgesToSoftDelete = IterableUtils.toList(vertex.getEdges(Direction.BOTH, authorizations)); for (Edge edgeToSoftDelete : edgesToSoftDelete) { softDeleteEdge(edgeToSoftDelete, timestamp, authorizations); } this.vertices.getTableElement(vertex.getId()).appendSoftDeleteMutation(timestamp); getSearchIndex().deleteElement(this, vertex, authorizations); if (hasEventListeners()) { fireGraphEvent(new SoftDeleteVertexEvent(this, vertex)); } }
v1.addPropertyValue("key1", "firstName", "Joseph", VISIBILITY_B, AUTHORIZATIONS_A_AND_B); graph.flush(); v1.softDeleteProperty("key1", "firstName", VISIBILITY_B, AUTHORIZATIONS_A_AND_B); graph.flush(); v1.markPropertyVisible("key1", "firstName", VISIBILITY_A, VISIBILITY_B, AUTHORIZATIONS_A_AND_B); v2.addPropertyValue("key1", "firstName", "Joseph", VISIBILITY_B, AUTHORIZATIONS_A_AND_B); graph.flush(); v2.softDeleteProperty("key1", "firstName", VISIBILITY_B, AUTHORIZATIONS_A_AND_B); graph.flush(); v2.markPropertyVisible("key1", "firstName", VISIBILITY_A, VISIBILITY_B, AUTHORIZATIONS_A_AND_B);
Property entityHasImage = outVertex.getProperty(VisalloProperties.ENTITY_IMAGE_VERTEX_ID.getPropertyName()); if (entityHasImage != null) { outVertex.softDeleteProperty(entityHasImage.getKey(), entityHasImage.getName(), authorizations); this.workQueueRepository.pushElementImageQueue(outVertex, entityHasImage, priority);
@Test public void testSoftDeletePropertyWithVisibility() { Vertex v1 = graph.prepareVertex("v1", VISIBILITY_A) .addPropertyValue("key1", "name1", "value1", VISIBILITY_A) .addPropertyValue("key1", "name1", "value2", VISIBILITY_B) .save(AUTHORIZATIONS_A_AND_B); graph.flush(); assertEquals(2, count(graph.getVertex("v1", AUTHORIZATIONS_A_AND_B).getProperties())); org.vertexium.test.util.IterableUtils.assertContains("value1", v1.getPropertyValues("name1")); org.vertexium.test.util.IterableUtils.assertContains("value2", v1.getPropertyValues("name1")); graph.getVertex("v1", AUTHORIZATIONS_A_AND_B).softDeleteProperty("key1", "name1", VISIBILITY_A, AUTHORIZATIONS_A_AND_B); graph.flush(); assertEquals(1, count(graph.getVertex("v1", AUTHORIZATIONS_A_AND_B).getProperties())); assertEquals(1, count(graph.getVertex("v1", AUTHORIZATIONS_A_AND_B).getPropertyValues("key1", "name1"))); org.vertexium.test.util.IterableUtils.assertContains("value2", graph.getVertex("v1", AUTHORIZATIONS_A_AND_B).getPropertyValues("name1")); }
@Test public void testSoftDeletePropertyWithVisibility() { Vertex v1 = graph.prepareVertex("v1", VISIBILITY_A) .addPropertyValue("key1", "name1", "value1", VISIBILITY_A) .addPropertyValue("key1", "name1", "value2", VISIBILITY_B) .save(AUTHORIZATIONS_A_AND_B); graph.flush(); assertEquals(2, count(graph.getVertex("v1", AUTHORIZATIONS_A_AND_B).getProperties())); org.vertexium.test.util.IterableUtils.assertContains("value1", v1.getPropertyValues("name1")); org.vertexium.test.util.IterableUtils.assertContains("value2", v1.getPropertyValues("name1")); graph.getVertex("v1", AUTHORIZATIONS_A_AND_B).softDeleteProperty("key1", "name1", VISIBILITY_A, AUTHORIZATIONS_A_AND_B); graph.flush(); assertEquals(1, count(graph.getVertex("v1", AUTHORIZATIONS_A_AND_B).getProperties())); assertEquals(1, count(graph.getVertex("v1", AUTHORIZATIONS_A_AND_B).getPropertyValues("key1", "name1"))); org.vertexium.test.util.IterableUtils.assertContains("value2", graph.getVertex("v1", AUTHORIZATIONS_A_AND_B).getPropertyValues("name1")); }
Vertex outVertex = edge.getVertex(Direction.OUT, authorizations); Property entityHasImage = outVertex.getProperty(VisalloProperties.ENTITY_IMAGE_VERTEX_ID.getPropertyName()); outVertex.softDeleteProperty(entityHasImage.getKey(), entityHasImage.getName(), authorizations); workQueueRepository.pushElementImageQueue(outVertex, entityHasImage, priority); graph.softDeleteEdge(edge, authorizations);