Source:
<code>private void mapInstance(Set<MappedRelationship> mappedRelationships, Object parent, FieldInfo reader, Object reference) { String type = reader.relationshipType(); Direction direction = reader.relationshipDirection(); ClassInfo parentInfo = this.session.metaData().classInfo(parent); Long parentId = session.context().nativeId(parent); ClassInfo referenceInfo = this.session.metaData().classInfo(reference); if (referenceInfo != null) { Long referenceId = session.context().nativeId(reference); if (!referenceInfo.isRelationshipEntity()) { <START> if (direction.equals(Direction.OUTGOING)) { <END> MappedRelationship edge = new MappedRelationship(parentId, type, referenceId, null, parentInfo.getUnderlyingClass(), referenceInfo.getUnderlyingClass()); mappedRelationships.add(edge); } else { MappedRelationship edge = new MappedRelationship(referenceId, type, parentId, null, referenceInfo.getUnderlyingClass(), parentInfo.getUnderlyingClass()); mappedRelationships.add(edge); } } else { Object startNode = referenceInfo.getStartNodeReader().read(reference); ClassInfo startNodeInfo = this.session.metaData().classInfo(startNode); Long startNodeId = session.context().nativeId(startNode); Object endNode = referenceInfo.getEndNodeReader().read(reference); ClassInfo endNodeInfo = this.session.metaData().classInfo(endNode); Long endNodeId = session.context().nativeId(endNode); MappedRelationship edge = new MappedRelationship(startNodeId, type, endNodeId, referenceId, startNodeInfo.getUnderlyingClass(), endNodeInfo.getUnderlyingClass()); mappedRelationships.add(edge); } } }</code><technical_language>suggestion if (direction == Direction.OUTGOING) {</technical_language>

Target:
private void mapInstance(Set<MappedRelationship> mappedRelationships, Object parent, FieldInfo reader, Object reference) { String type = reader.relationshipType(); Direction direction = reader.relationshipDirection(); ClassInfo parentInfo = this.session.metaData().classInfo(parent); Long parentId = session.context().nativeId(parent); ClassInfo referenceInfo = this.session.metaData().classInfo(reference); if (referenceInfo != null) { Long referenceId = session.context().nativeId(reference); if (!referenceInfo.isRelationshipEntity()) { if (direction == Direction.OUTGOING) { MappedRelationship edge = new MappedRelationship(parentId, type, referenceId, null, parentInfo.getUnderlyingClass(), referenceInfo.getUnderlyingClass()); mappedRelationships.add(edge); } else { MappedRelationship edge = new MappedRelationship(referenceId, type, parentId, null, referenceInfo.getUnderlyingClass(), parentInfo.getUnderlyingClass()); mappedRelationships.add(edge); } } else { Object startNode = referenceInfo.getStartNodeReader().read(reference); ClassInfo startNodeInfo = this.session.metaData().classInfo(startNode); Long startNodeId = session.context().nativeId(startNode); Object endNode = referenceInfo.getEndNodeReader().read(reference); ClassInfo endNodeInfo = this.session.metaData().classInfo(endNode); Long endNodeId = session.context().nativeId(endNode); MappedRelationship edge = new MappedRelationship(startNodeId, type, endNodeId, referenceId, startNodeInfo.getUnderlyingClass(), endNodeInfo.getUnderlyingClass()); mappedRelationships.add(edge); } } }