@Override protected boolean isIncluded(ExtendedDataRow row) { ExtendedDataRowId rowId = row.getId(); return elementType.equals(rowId.getElementType()) && elementIdRange.isInRange(rowId.getElementId()); } };
public MapMetadata(Metadata copyFromMetadata, FetchHints fetchHints) { this(fetchHints); if (copyFromMetadata != null) { for (Metadata.Entry entry : copyFromMetadata.entrySet()) { add(entry.getKey(), entry.getValue(), entry.getVisibility()); } } }
/** * Get the attach vertex on either side of the edge. * * @param direction The side of the edge to get the vertex from (IN or OUT). * @param fetchHints Hint on what should be fetched from the datastore. * @return The vertex. */ default Vertex getVertex(Direction direction, FetchHints fetchHints, Authorizations authorizations) { String vertexId = getVertexId(direction); return getGraph().getVertex(vertexId, fetchHints, authorizations); }
public static Metadata mergeMetadata(Metadata... metadatas) { Metadata mergedMetadata = new Metadata(); for (Metadata metadata : metadatas) { for (Metadata.Entry entry : metadata.entrySet()) { mergedMetadata.add(entry.getKey(), entry.getValue(), entry.getVisibility()); } } return mergedMetadata; } }
@Override public void cleanUpElements(Graph graph, Vertex productVertex, Authorizations authorizations) { Iterable<Edge> productElementEdges = productVertex.getEdges( Direction.OUT, WorkspaceProperties.PRODUCT_TO_ENTITY_RELATIONSHIP_IRI, authorizations ); for (Edge productToElement : productElementEdges) { graph.softDeleteEdge(productToElement, authorizations); } graph.flush(); }
@Override public Object getPropertyValue(String key, String name) { Property prop = getProperty(key, name); if (prop == null) { return null; } return prop.getValue(); }
@Override public Iterable<RelatedEdge> findRelatedEdgeSummary(Iterable<String> vertexIds, Long endTime, Authorizations authorizations) { FetchHints fetchHints = new FetchHintsBuilder() .setIncludeOutEdgeRefs(true) .build(); return findRelatedEdgeSummaryForVertices(getVertices(vertexIds, fetchHints, endTime, authorizations), authorizations); }
@Override public Iterable<String> findRelatedEdgeIds(Iterable<String> vertexIds, Long endTime, Authorizations authorizations) { FetchHints fetchHints = new FetchHintsBuilder() .setIncludeOutEdgeRefs(true) .build(); return findRelatedEdgeIdsForVertices(getVertices(vertexIds, fetchHints, endTime, authorizations), authorizations); }
/** * Given a vertexId that represents one side of a relationship, get me the vertex of the other side. */ default Vertex getOtherVertex(String myVertexId, Authorizations authorizations) { return getOtherVertex(myVertexId, getGraph().getDefaultFetchHints(), authorizations); }
/** * Gets both in and out vertices of this edge. */ default EdgeVertices getVertices(Authorizations authorizations) { return getVertices(getGraph().getDefaultFetchHints(), authorizations); }
@Override public PropertyDefinition define() { PropertyDefinition propertyDefinition = super.define(); savePropertyDefinition(propertyDefinition); return propertyDefinition; } };
public void assertPropertyIncluded(String name) { if (isIncludeProperty(name)) { return; } throw new VertexiumMissingFetchHintException(this, "property:" + name); }
public void assertMetadataIncluded(String key) { if (isIncludeMetadata(key)) { return; } throw new VertexiumMissingFetchHintException(this, "metadata:" + key); } }
protected Iterable<Property> internalGetProperties(String key, String name) { getFetchHints().assertPropertyIncluded(name); return new FilterIterable<Property>(getProperties()) { @Override protected boolean isIncluded(Property property) { if (key != null && !property.getKey().equals(key)) { return false; } return property.getName().equals(name); } }; }
@Override public String getVertexId(Direction direction) { if (direction.equals(Direction.IN)) { return inVertexId; } else if (direction.equals(Direction.OUT)) { return outVertexId; } throw new VertexiumNotSupportedException(direction.name() + " is not supported"); }
public MapMetadata(Metadata copyFromMetadata, FetchHints fetchHints) { this(fetchHints); if (copyFromMetadata != null) { for (Metadata.Entry entry : copyFromMetadata.entrySet()) { add(entry.getKey(), entry.getValue(), entry.getVisibility()); } } }
@Override protected boolean isIncluded(ExtendedDataRow row) { ExtendedDataRowId rowId = row.getId(); return elementType.equals(rowId.getElementType()) && elementIdRange.isInRange(rowId.getElementId()); } };