use of com.b2international.snowowl.snomed.core.domain.SnomedDescription in project snow-owl by b2ihealthcare.
the class SnomedCompareRestRequestTest method prepareNewChanges.
private Set<ComponentIdentifier> prepareNewChanges(String conceptId, IBranchPath branchPath) {
final SnomedConcept concept = getComponent(branchPath, SnomedComponentType.CONCEPT, conceptId, "descriptions(expand(members())),relationships()").extract().as(SnomedConcept.class);
final Set<ComponentIdentifier> newIds = newHashSet();
newIds.add(ComponentIdentifier.of(SnomedConcept.TYPE, concept.getId()));
for (SnomedDescription description : concept.getDescriptions()) {
newIds.add(ComponentIdentifier.of(SnomedDescription.TYPE, description.getId()));
for (SnomedReferenceSetMember member : description.getMembers()) {
newIds.add(ComponentIdentifier.of(SnomedReferenceSetMember.TYPE, member.getId()));
}
}
for (SnomedRelationship relationship : concept.getRelationships()) {
newIds.add(ComponentIdentifier.of(SnomedRelationship.TYPE, relationship.getId()));
}
return newIds;
}
use of com.b2international.snowowl.snomed.core.domain.SnomedDescription in project snow-owl by b2ihealthcare.
the class SnomedDescriptionConverter method expandType.
private void expandType(List<SnomedDescription> results, final Set<String> descriptionIds) {
if (expand().containsKey("type")) {
final Options expandOptions = expand().get("type", Options.class);
final Iterable<String> typeIds = FluentIterable.from(results).transform(SnomedDescription::getTypeId);
context().service(SnomedConceptRequestCache.class).request(typeIds, expandOptions.getOptions("expand"), locales(), typesById -> {
for (SnomedDescription description : results) {
((SnomedDescription) description).setType(typesById.get(description.getTypeId()));
}
});
}
}
use of com.b2international.snowowl.snomed.core.domain.SnomedDescription in project snow-owl by b2ihealthcare.
the class SnomedDescriptionConverter method expandConcept.
private void expandConcept(List<SnomedDescription> results, final Set<String> descriptionIds) {
if (expand().containsKey("concept")) {
final Options expandOptions = expand().get("concept", Options.class);
final Iterable<String> conceptIds = FluentIterable.from(results).transform(SnomedDescription::getConceptId);
context().service(SnomedConceptRequestCache.class).request(conceptIds, expandOptions.getOptions("expand"), locales(), conceptsById -> {
for (SnomedDescription description : results) {
((SnomedDescription) description).setConcept(conceptsById.get(description.getConceptId()));
}
});
}
}
use of com.b2international.snowowl.snomed.core.domain.SnomedDescription in project snow-owl by b2ihealthcare.
the class SnomedDescriptionConverter method expandCaseSignificance.
private void expandCaseSignificance(List<SnomedDescription> results) {
if (!expand().containsKey("caseSignificance")) {
return;
}
final Iterable<String> caseSignificanceIds = results.stream().map(SnomedDescription::getCaseSignificanceId)::iterator;
final Options caseSignificanceExpand = expand().get("caseSignificance", Options.class);
context().service(SnomedConceptRequestCache.class).request(caseSignificanceIds, caseSignificanceExpand.getOptions("expand"), locales(), caseSignificancesById -> {
for (SnomedDescription result : results) {
result.setCaseSignificance(caseSignificancesById.get(result.getCaseSignificanceId()));
}
});
}
use of com.b2international.snowowl.snomed.core.domain.SnomedDescription in project snow-owl by b2ihealthcare.
the class SnomedReferenceSetMemberConverter method setReferencedComponent.
private void setReferencedComponent(SnomedReferenceSetMember member, String referencedComponentId, String referencedComponentType) {
// XXX: partial field loading support
if (referencedComponentType == null || referencedComponentId == null)
return;
final SnomedCoreComponent component;
switch(referencedComponentType) {
// TODO support query type refset refcomp expansion, currently it's a concept
case SnomedConcept.REFSET_TYPE:
case SnomedConcept.TYPE:
component = new SnomedConcept();
((SnomedConcept) component).setId(referencedComponentId);
break;
case SnomedDescription.TYPE:
component = new SnomedDescription();
((SnomedDescription) component).setId(referencedComponentId);
break;
case SnomedRelationship.TYPE:
component = new SnomedRelationship();
((SnomedRelationship) component).setId(referencedComponentId);
break;
default:
throw new UnsupportedOperationException("UnsupportedReferencedComponentType: " + referencedComponentType);
}
member.setReferencedComponent(component);
}
Aggregations