@Override public ResourceIterable<Relationship> getRelationships() { return getRelationships( Direction.BOTH ); }
@Override public ResourceIterable<Relationship> getRelationships( RelationshipType type, Direction dir ) { return getRelationships( dir, type ); }
@Override public ResourceIterable<Relationship> getRelationships( RelationshipType... types ) { return getRelationships( Direction.BOTH, types ); }
@Override public Relationship getSingleRelationship( RelationshipType type, Direction dir ) { try ( ResourceIterator<Relationship> rels = getRelationships( dir, type ).iterator() ) { if ( !rels.hasNext() ) { return null; } Relationship rel = rels.next(); while ( rels.hasNext() ) { Relationship other = rels.next(); if ( !other.equals( rel ) ) { throw new NotFoundException( "More than one relationship[" + type + ", " + dir + "] found for " + this ); } } return rel; } }
@Override public ResourceIterable<Relationship> getRelationships( RelationshipType... types ) { return getRelationships( Direction.BOTH, types ); }
@Override public ResourceIterable<Relationship> getRelationships() { return getRelationships( Direction.BOTH ); }
@Override public ResourceIterable<Relationship> getRelationships( RelationshipType type, Direction dir ) { return getRelationships( dir, type ); }
@Override public Relationship getSingleRelationship( RelationshipType type, Direction dir ) { try ( ResourceIterator<Relationship> rels = getRelationships( dir, type ).iterator() ) { if ( !rels.hasNext() ) { return null; } Relationship rel = rels.next(); while ( rels.hasNext() ) { Relationship other = rels.next(); if ( !other.equals( rel ) ) { throw new NotFoundException( "More than one relationship[" + type + ", " + dir + "] found for " + this ); } } return rel; } }