use of org.neo4j.graphdb.PathExpanderBuilder in project neo4j by neo4j.
the class DatabaseActions method getNodeRelationships.
@SuppressWarnings("unchecked")
public ListRepresentation getNodeRelationships(long nodeId, RelationshipDirection direction, Collection<String> types) throws NodeNotFoundException {
Node node = node(nodeId);
PathExpander expander;
if (types.isEmpty()) {
expander = PathExpanders.forDirection(direction.internal);
} else {
PathExpanderBuilder builder = PathExpanderBuilder.empty();
for (String type : types) {
builder = builder.add(RelationshipType.withName(type), direction.internal);
}
expander = builder.build();
}
return RelationshipRepresentation.list(expander.expand(Paths.singleNodePath(node), BranchState.NO_STATE));
}
Aggregations