use of org.neo4j.graphdb.Direction in project neo4j by neo4j.
the class TestLoopRelationships method verifyRelationships.
private void verifyRelationships(String message, Node root, boolean[] loop, Relationship... relationships) {
for (Direction dir : Direction.values()) {
Set<Relationship> expected = new HashSet<Relationship>();
for (int i = 0; i < relationships.length; i++) {
if (relationships[i] != null && (dir != Direction.INCOMING || loop[i])) {
expected.add(relationships[i]);
}
}
for (Relationship rel : root.getRelationships(dir)) {
assertTrue(message + ": unexpected relationship: " + rel, expected.remove(rel));
}
assertTrue(message + ": expected relationships not seen " + expected, expected.isEmpty());
}
}
use of org.neo4j.graphdb.Direction in project jo-client-platform by jo-source.
the class SyncNeo4JSimpleRelatedReaderServiceImpl method getAllRelatedNodes.
private List<Tuple<Node, Relationship>> getAllRelatedNodes(final List<Tuple<Node, Relationship>> parentNodes, final Tuple<RelationshipType, Direction> relation, final IExecutionCallback executionCallback) {
final List<Tuple<Node, Relationship>> result = new LinkedList<Tuple<Node, Relationship>>();
final RelationshipType relationshipType = relation.getFirst();
final Direction direction = relation.getSecond();
for (final Tuple<Node, Relationship> parentNodeTuple : parentNodes) {
CapServiceToolkit.checkCanceled(executionCallback);
final Node parentNode = parentNodeTuple.getFirst();
for (final Relationship relationship : parentNode.getRelationships(direction, relationshipType)) {
CapServiceToolkit.checkCanceled(executionCallback);
result.add(new Tuple<Node, Relationship>(relationship.getOtherNode(parentNode), relationship));
}
}
return result;
}
Aggregations