@Override public void deleteExtendedDataRow(ExtendedDataRowId id, Authorizations authorizations) { List<ExtendedDataRow> rows = Lists.newArrayList(getExtendedData(Lists.newArrayList(id), authorizations)); if (rows.size() > 1) { throw new VertexiumException("Found too many extended data rows for id: " + id); } if (rows.size() != 1) { return; } this.extendedDataTable.remove(id); getSearchIndex().deleteExtendedData(this, id, authorizations); if (hasEventListeners()) { fireGraphEvent(new DeleteExtendedDataRowEvent(this, id)); } }
public void markPropertyVisible(InMemoryElement element, InMemoryTableElement inMemoryTableElement, String key, String name, Visibility propertyVisibility, Long timestamp, Visibility visibility, Authorizations authorizations) { if (!element.canRead(authorizations)) { return; } Property property = inMemoryTableElement.appendMarkPropertyVisibleMutation(key, name, propertyVisibility, timestamp, visibility, authorizations); getSearchIndex().markPropertyVisible(this, element, property, visibility, authorizations); if (property != null && hasEventListeners()) { fireGraphEvent(new MarkVisiblePropertyEvent(this, element, property, visibility)); } }
protected void deleteProperty( InMemoryElement element, InMemoryTableElement inMemoryTableElement, String key, String name, Visibility visibility, Authorizations authorizations ) { Property property = inMemoryTableElement.getProperty(key, name, visibility, FetchHints.ALL_INCLUDING_HIDDEN, authorizations); inMemoryTableElement.deleteProperty(key, name, visibility, authorizations); getSearchIndex().deleteProperty(this, element, PropertyDescriptor.fromProperty(property), authorizations); if (hasEventListeners()) { fireGraphEvent(new DeletePropertyEvent(this, element, property)); } }
protected void softDeleteProperty(InMemoryTableElement inMemoryTableElement, Property property, Long timestamp, IndexHint indexHint, Authorizations authorizations) { Element element; if (inMemoryTableElement instanceof InMemoryTableVertex) { inMemoryTableElement.appendSoftDeletePropertyMutation(property.getKey(), property.getName(), property.getVisibility(), timestamp); element = getVertex(inMemoryTableElement.getId(), FetchHints.ALL_INCLUDING_HIDDEN, authorizations); } else if (inMemoryTableElement instanceof InMemoryTableEdge) { inMemoryTableElement.appendSoftDeletePropertyMutation(property.getKey(), property.getName(), property.getVisibility(), timestamp); element = getEdge(inMemoryTableElement.getId(), FetchHints.ALL_INCLUDING_HIDDEN, authorizations); } else { throw new IllegalArgumentException("Unexpected element type: " + inMemoryTableElement.getClass().getName()); } if (indexHint != IndexHint.DO_NOT_INDEX) { getSearchIndex().deleteProperty(this, element, PropertyDescriptor.fromProperty(property), authorizations); } if (hasEventListeners()) { fireGraphEvent(new SoftDeletePropertyEvent(this, element, property)); } }
@Override public void deleteEdge(Edge edge, Authorizations authorizations) { checkNotNull(edge, "Edge cannot be null"); if (!((InMemoryEdge) edge).canRead(authorizations)) { return; } deleteAllExtendedDataForElement(edge, authorizations); this.edges.remove(edge.getId()); getSearchIndex().deleteElement(this, edge, authorizations); if (hasEventListeners()) { fireGraphEvent(new DeleteEdgeEvent(this, edge)); } }
public void deleteExtendedData( InMemoryElement element, String tableName, String row, String columnName, String key, Visibility visibility, Authorizations authorizations ) { extendedDataTable.removeColumn( new ExtendedDataRowId(ElementType.getTypeFromElement(element), element.getId(), tableName, row), columnName, key, visibility ); getSearchIndex().deleteExtendedData(this, element, tableName, row, columnName, key, visibility, authorizations); if (hasEventListeners()) { fireGraphEvent(new DeleteExtendedDataEvent(this, element, tableName, row, columnName, key)); } }
@Override public void softDeleteEdge(Edge edge, Long timestamp, Authorizations authorizations) { checkNotNull(edge, "Edge cannot be null"); if (!((InMemoryEdge) edge).canRead(authorizations)) { return; } if (timestamp == null) { timestamp = IncreasingTime.currentTimeMillis(); } this.edges.getTableElement(edge.getId()).appendSoftDeleteMutation(timestamp); getSearchIndex().deleteElement(this, edge, authorizations); if (hasEventListeners()) { fireGraphEvent(new SoftDeleteEdgeEvent(this, edge)); } }
fireGraphEvent(new AddPropertyEvent(this, element, property));
@Override public void deleteVertex(Vertex vertex, Authorizations authorizations) { if (!((InMemoryVertex) vertex).canRead(authorizations)) { return; } List<Edge> edgesToDelete = IterableUtils.toList(vertex.getEdges(Direction.BOTH, authorizations)); for (Edge edgeToDelete : edgesToDelete) { deleteEdge(edgeToDelete, authorizations); } deleteAllExtendedDataForElement(vertex, authorizations); this.vertices.remove(vertex.getId()); getSearchIndex().deleteElement(this, vertex, authorizations); if (hasEventListeners()) { fireGraphEvent(new DeleteVertexEvent(this, vertex)); } }
public void markPropertyHidden( InMemoryElement element, InMemoryTableElement inMemoryTableElement, Property property, Long timestamp, Visibility visibility, Authorizations authorizations ) { if (!element.canRead(authorizations)) { return; } Property hiddenProperty = inMemoryTableElement.appendMarkPropertyHiddenMutation( property.getKey(), property.getName(), property.getVisibility(), timestamp, visibility, authorizations ); getSearchIndex().markPropertyHidden(this, element, property, visibility, authorizations); if (hiddenProperty != null && hasEventListeners()) { fireGraphEvent(new MarkHiddenPropertyEvent(this, element, hiddenProperty, visibility)); } }
public void extendedData( Element element, ExtendedDataRowId rowId, ExtendedDataMutation extendedData, Authorizations authorizations ) { extendedDataTable.addData(rowId, extendedData.getColumnName(), extendedData.getKey(), extendedData.getValue(), extendedData.getTimestamp(), extendedData.getVisibility()); getSearchIndex().addElementExtendedData(this, element, Collections.singleton(extendedData), authorizations); if (hasEventListeners()) { fireGraphEvent(new AddExtendedDataEvent( this, element, rowId.getTableName(), rowId.getRowId(), extendedData.getColumnName(), extendedData.getKey(), extendedData.getValue(), extendedData.getVisibility() )); } }
@Override public void markVertexHidden(Vertex vertex, Visibility visibility, Authorizations authorizations) { if (!((InMemoryVertex) vertex).canRead(authorizations)) { return; } List<Edge> edgesToMarkHidden = IterableUtils.toList(vertex.getEdges(Direction.BOTH, authorizations)); for (Edge edgeToMarkHidden : edgesToMarkHidden) { markEdgeHidden(edgeToMarkHidden, visibility, authorizations); } this.vertices.getTableElement(vertex.getId()).appendMarkHiddenMutation(visibility); refreshVertexInMemoryTableElement(vertex); getSearchIndex().markElementHidden(this, vertex, visibility, authorizations); if (hasEventListeners()) { fireGraphEvent(new MarkHiddenVertexEvent(this, vertex)); } }
@Override public void markVertexVisible(Vertex vertex, Visibility visibility, Authorizations authorizations) { if (!((InMemoryVertex) vertex).canRead(authorizations)) { return; } List<Edge> edgesToMarkVisible = IterableUtils.toList(vertex.getEdges(Direction.BOTH, FetchHints.ALL_INCLUDING_HIDDEN, authorizations)); for (Edge edgeToMarkVisible : edgesToMarkVisible) { markEdgeVisible(edgeToMarkVisible, visibility, authorizations); } this.vertices.getTableElement(vertex.getId()).appendMarkVisibleMutation(visibility); refreshVertexInMemoryTableElement(vertex); getSearchIndex().markElementVisible(this, vertex, visibility, authorizations); if (hasEventListeners()) { fireGraphEvent(new MarkVisibleVertexEvent(this, vertex)); } }
@Override public void markEdgeHidden(Edge edge, Visibility visibility, Authorizations authorizations) { if (!((InMemoryEdge) edge).canRead(authorizations)) { return; } Vertex inVertex = getVertex(edge.getVertexId(Direction.IN), authorizations); checkNotNull(inVertex, "Could not find in vertex \"" + edge.getVertexId(Direction.IN) + "\" on edge \"" + edge.getId() + "\""); Vertex outVertex = getVertex(edge.getVertexId(Direction.OUT), authorizations); checkNotNull(outVertex, "Could not find out vertex \"" + edge.getVertexId(Direction.OUT) + "\" on edge \"" + edge.getId() + "\""); this.edges.getTableElement(edge.getId()).appendMarkHiddenMutation(visibility); getSearchIndex().markElementHidden(this, edge, visibility, authorizations); if (hasEventListeners()) { fireGraphEvent(new MarkHiddenEdgeEvent(this, edge)); } }
@Override public void markEdgeVisible(Edge edge, Visibility visibility, Authorizations authorizations) { if (!((InMemoryEdge) edge).canRead(authorizations)) { return; } Vertex inVertex = getVertex(edge.getVertexId(Direction.IN), FetchHints.ALL_INCLUDING_HIDDEN, authorizations); checkNotNull(inVertex, "Could not find in vertex \"" + edge.getVertexId(Direction.IN) + "\" on edge \"" + edge.getId() + "\""); Vertex outVertex = getVertex(edge.getVertexId(Direction.OUT), FetchHints.ALL_INCLUDING_HIDDEN, authorizations); checkNotNull(outVertex, "Could not find out vertex \"" + edge.getVertexId(Direction.OUT) + "\" on edge \"" + edge.getId() + "\""); this.edges.getTableElement(edge.getId()).appendMarkVisibleMutation(visibility); getSearchIndex().markElementVisible(this, edge, visibility, authorizations); if (hasEventListeners()) { fireGraphEvent(new MarkVisibleEdgeEvent(this, edge)); } }
@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)); } }
fireGraphEvent(new AddEdgeEvent(InMemoryGraph.this, edge));