Source:
private void handleRelationOtherMetadata(Context c, Item item, String element, String value) throws SQLException, AuthorizeException { Entity entity = entityService.findByItemId(c, item.getID()); boolean left = false; List<RelationshipType> acceptableRelationshipTypes = new LinkedList<>(); String url = handleService.resolveToURL(c, value); UUID uuid = UUIDUtils.fromString(value); if (uuid == null && StringUtils.isNotBlank(url)) { return; } Entity relationEntity = entityService.findByItemId(c, uuid); List<RelationshipType> leftRelationshipTypesForEntity = entityService.getLeftRelationshipTypes(c, entity); List<RelationshipType> rightRelationshipTypesForEntity = entityService.getRightRelationshipTypes(c, entity); for (RelationshipType relationshipType : entityService.getAllRelationshipTypes(c, entity)) { if (StringUtils.equalsIgnoreCase(relationshipType.getLeftLabel(), element)) { left = handleLeftLabelEqualityRelationshipTypeElement(c, entity, relationEntity, left, acceptableRelationshipTypes, leftRelationshipTypesForEntity, relationshipType); } else if (StringUtils.equalsIgnoreCase(relationshipType.getRightLabel(), element)) { left = handleRightLabelEqualityRelationshipTypeElement(c, entity, relationEntity, left, acceptableRelationshipTypes, rightRelationshipTypesForEntity, relationshipType); } } if (acceptableRelationshipTypes.size() > 1) { System.out.println("Ambiguous relationship_types were found"); log.error("Ambiguous relationship_types were found"); return; } if (acceptableRelationshipTypes.size() == 0) { System.out.println("no relationship_types were found"); log.error("no relationship_types were found"); return; } buildRelationObject(c, item, value, left, acceptableRelationshipTypes); }

Target:
private void handleRelationOtherMetadata(Context c, Item item, String element, String value) throws SQLException, AuthorizeException { Entity entity = entityService.findByItemId(c, item.getID()); boolean left = false; List<RelationshipType> acceptableRelationshipTypes = new LinkedList<>(); String url = handleService.resolveToURL(c, value); UUID uuid = UUIDUtils.fromString(value); if (uuid == null && StringUtils.isNotBlank(url)) { return; } Entity relationEntity = entityService.findByItemId(c, uuid); List<RelationshipType> leftRelationshipTypesForEntity = entityService.getLeftRelationshipTypes(c, entity); List<RelationshipType> rightRelationshipTypesForEntity = entityService.getRightRelationshipTypes(c, entity); for (RelationshipType relationshipType : entityService.getAllRelationshipTypes(c, entity)) { if (StringUtils.equalsIgnoreCase(relationshipType.getLeftLabel(), element)) { left = handleLeftLabelEqualityRelationshipTypeElement(c, entity, relationEntity, left, acceptableRelationshipTypes, leftRelationshipTypesForEntity, relationshipType); } else if (StringUtils.equalsIgnoreCase(relationshipType.getRightLabel(), element)) { left = handleRightLabelEqualityRelationshipTypeElement(c, entity, relationEntity, left, acceptableRelationshipTypes, rightRelationshipTypesForEntity, relationshipType); } } if (acceptableRelationshipTypes.size() > 1) { log.error("Ambiguous relationship_types were found"); return; } if (acceptableRelationshipTypes.size() == 0) { log.error("no relationship_types were found"); return; } buildRelationObject(c, item, value, left, acceptableRelationshipTypes.get(0)); }