use of com.b2international.snowowl.core.domain.ConceptMapMapping.Builder in project snow-owl by b2ihealthcare.
the class SnomedConceptMapSearchRequestEvaluator method toMapping.
private ConceptMapMapping toMapping(SnomedReferenceSetMember member, ResourceURI codeSystemURI, ComponentURI targetURI, final SnomedDisplayTermType snomedDisplayTermType, final Map<String, SnomedConcept> refSetsByIds) {
final String iconId = member.getReferencedComponent().getIconId();
final String componentType = member.getReferencedComponent().getComponentType();
final SnomedConcept concept = (SnomedConcept) member.getReferencedComponent();
final String term = snomedDisplayTermType.getLabel(concept);
Builder mappingBuilder = ConceptMapMapping.builder();
Map<String, Object> properties = member.getProperties();
String mapTarget = (String) properties.get(SnomedRf2Headers.FIELD_MAP_TARGET);
if (ComponentURI.isValid(mapTarget)) {
mappingBuilder.targetComponentURI(ComponentURI.of(mapTarget));
} else {
mappingBuilder.targetComponentURI(ComponentURI.of(targetURI.resourceUri(), targetURI.componentType(), mapTarget));
}
if (properties.containsKey(SnomedRf2Headers.FIELD_MAP_PRIORITY)) {
int mapPriority = (int) properties.get(SnomedRf2Headers.FIELD_MAP_PRIORITY);
mappingBuilder.mapPriority(mapPriority);
}
if (properties.containsKey(SnomedRf2Headers.FIELD_MAP_GROUP)) {
int mapGroup = (int) properties.get(SnomedRf2Headers.FIELD_MAP_GROUP);
mappingBuilder.mapGroup(mapGroup);
}
mappingBuilder.mapAdvice((String) properties.get(SnomedRf2Headers.FIELD_MAP_ADVICE));
mappingBuilder.mapRule((String) properties.get(SnomedRf2Headers.FIELD_MAP_RULE));
final SnomedConcept referenceSet = refSetsByIds.get(member.getRefsetId());
return mappingBuilder.uri(ComponentURI.of(codeSystemURI, SnomedReferenceSetMember.TYPE, member.getId()).toString()).conceptMapUri(ComponentURI.of(codeSystemURI, SnomedConcept.REFSET_TYPE, member.getRefsetId()).toString()).conceptMapTerm(referenceSet.getPt().getTerm()).conceptMapIconId(referenceSet.getIconId()).sourceComponentURI(ComponentURI.of(codeSystemURI, componentType, member.getReferencedComponentId())).sourceIconId(iconId).sourceTerm(term).targetTerm(mapTarget).active(member.isActive()).mappingCorrelation(getEquivalence(member)).build();
}
Aggregations