public AbstractRelationship getRelationship ( final String id , final String nodeId ) { if ( id == null ) { return null ; } if ( nodeId == null ) { return getRelationship ( id ) ; } final SecurityContext securityContext = getWebSocket ( ) . getSecurityContext ( ) ; final App app = StructrApp . getInstance ( securityContext ) ; try ( final Tx tx = app . tx ( ) ) { final AbstractNode node = ( AbstractNode ) app . getNodeById ( nodeId ) ; for ( final AbstractRelationship rel : node . getRelationships ( ) ) { if ( rel . getUuid ( ) . equals ( id ) ) { return rel ; } } tx . success ( ) ; } catch ( FrameworkException fex ) { logger . warn ( "Unable to get relationship" , fex ) ; } return null ; }
Returns the relationship with the given id by looking up a node with the given nodeId and filtering the relationships .