@Override public String toString() { StringBuilder string = new StringBuilder(); string.append( '(' ).append( nodes[0] ).append( ')' ); boolean inTx = true; for ( int i = 0; i < relationships.length; i++ ) { int type = directedTypes[i]; string.append( type < 0 ? "<-[" : "-[" ); string.append( relationships[i] ); if ( inTx ) { try { String name = proxySPI.getRelationshipTypeById( type < 0 ? ~type : type ).name(); string.append( ':' ).append( name ); } catch ( Exception e ) { inTx = false; } } string.append( type < 0 ? "]-(" : "]->(" ).append( nodes[i + 1] ).append( ')' ); } return string.toString(); }
@Override public RelationshipType getType() { spi.assertInUnterminatedTransaction(); return spi.getRelationshipTypeById( typeId() ); }
@Override public boolean isType( RelationshipType type ) { spi.assertInUnterminatedTransaction(); return spi.getRelationshipTypeById( typeId() ).name().equals( type.name() ); }
@Override public String toString() { String relType; try { relType = spi.getRelationshipTypeById( typeId() ).name(); return format( "(%d)-[%s,%d]->(%d)", sourceId(), relType, getId(), targetId() ); } catch ( NotInTransactionException | DatabaseShutdownException e ) { // We don't keep the rel-name lookup if the database is shut down. Source ID and target ID also requires // database access in a transaction. However, failing on toString would be uncomfortably evil, so we fall // back to noting the relationship type id. } relType = "RELTYPE(" + type + ")"; return format( "(?)-[%s,%d]->(?)", relType, getId() ); }
when( actions.newNodeProxy( anyLong() ) ).then( invocation -> nodeWithId( invocation.getArgument( 0 ) ) ); when( actions.getRelationshipTypeById( anyInt() ) ).then( invocation -> new NamedToken( "whatever", invocation.getArgument( 0 ) ) );
@Override public String toString() { StringBuilder string = new StringBuilder(); string.append( '(' ).append( nodes[0] ).append( ')' ); boolean inTx = true; for ( int i = 0; i < relationships.length; i++ ) { int type = directedTypes[i]; string.append( type < 0 ? "<-[" : "-[" ); string.append( relationships[i] ); if ( inTx ) { try { String name = proxySPI.getRelationshipTypeById( type < 0 ? ~type : type ).name(); string.append( ':' ).append( name ); } catch ( Exception e ) { inTx = false; } } string.append( type < 0 ? "]-(" : "]->(" ).append( nodes[i + 1] ).append( ')' ); } return string.toString(); }
@Override public RelationshipType getType() { spi.assertInUnterminatedTransaction(); return spi.getRelationshipTypeById( typeId() ); }
@Override public boolean isType( RelationshipType type ) { spi.assertInUnterminatedTransaction(); return spi.getRelationshipTypeById( typeId() ).name().equals( type.name() ); }
@Override public String toString() { String relType; try { relType = spi.getRelationshipTypeById( typeId() ).name(); return format( "(%d)-[%s,%d]->(%d)", sourceId(), relType, getId(), targetId() ); } catch ( NotInTransactionException | DatabaseShutdownException e ) { // We don't keep the rel-name lookup if the database is shut down. Source ID and target ID also requires // database access in a transaction. However, failing on toString would be uncomfortably evil, so we fall // back to noting the relationship type id. } relType = "RELTYPE(" + type + ")"; return format( "(?)-[%s,%d]->(?)", relType, getId() ); }