protected FL_Link buildResultFromDocument(SolrDocument sd) { FL_Link.Builder linkBuilder = FL_Link.newBuilder(); FL_PropertyDescriptors linkDescriptors = _applicationConfiguration.getLinkDescriptors(); FL_PropertyDescriptors entityDescriptors = _applicationConfiguration.getEntityDescriptors(); final String type = getTypeFromDocument(sd, linkDescriptors); Boolean isMultitype = (entityDescriptors.getTypes().size() > 1); String uid = sd.getFieldValue( PropertyDescriptorHelper.mapKey( FL_RequiredPropertyKey.ID.name(), linkDescriptors.getProperties(), type)) .toString(); Object oSource = sd.getFieldValue( PropertyDescriptorHelper.mapKey( FL_RequiredPropertyKey.FROM.name(), linkDescriptors.getProperties(), type)); String sSource = oSource instanceof String ? (String) oSource : oSource instanceof Integer ? Integer.toString((Integer) oSource) : null; linkBuilder.setProvenance(null); linkBuilder.setUncertainty(null); linkBuilder.setType(type); List<FL_Property> props = getPropertiesFromDocument(sd, type, linkDescriptors.getProperties()); linkBuilder.setProperties(props); linkBuilder.setLinkTypes(null); linkBuilder.setUid(_namespaceHandler.globalFromLocalEntityId(InfluentId.LINK, type, uid)); String sourceUID = null; if (sSource != null) { InfluentId infId; if (isMultitype) { infId = InfluentId.fromTypedId(InfluentId.ACCOUNT, sSource); } else { infId = InfluentId.fromNativeId( InfluentId.ACCOUNT, entityDescriptors.getTypes().get(0).getKey(), sSource); } sourceUID = infId.toString(); } linkBuilder.setSource(sourceUID); linkBuilder.setTarget(getTarget(sd)); return linkBuilder.build(); }