Source:
private void handleRelationOtherMetadata(Context c, Item item, String element, List<String> values) throws SQLException, AuthorizeException { Entity entity = entityService.findByItemId(c, item.getID()); boolean left = false; List<RelationshipType> acceptableRelationshipTypes = new LinkedList<>(); String[] components = values.get(0).split("-"); String url = handleService.resolveToURL(c, values.get(0)); if (components.length != 5 && StringUtils.isNotBlank(url)) { return; } Entity relationEntity = entityService.findByItemId(c, UUID.fromString(values.get(0))); 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, values, left, acceptableRelationshipTypes); }

Target:
private void handleRelationOtherMetadata(Context c, Item item, String element, List<String> values) throws SQLException, AuthorizeException { Entity entity = entityService.findByItemId(c, item.getID()); boolean left = false; List<RelationshipType> acceptableRelationshipTypes = new LinkedList<>(); String url = handleService.resolveToURL(c, values.get(0)); UUID uuid = UUIDUtils.fromString(values.get(0)); 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, values, left, acceptableRelationshipTypes); }