use of com.b2international.snowowl.snomed.reasoner.request.RelationshipChangeSearchRequestBuilder in project snow-owl by b2ihealthcare.
the class ClassificationTaskConverter method expandRelationshipChanges.
private void expandRelationshipChanges(final List<ClassificationTask> results, final Set<String> classificationTaskIds) {
if (!expand().containsKey(ClassificationTask.Expand.RELATIONSHIP_CHANGES)) {
return;
}
final Options expandOptions = expand().get(ClassificationTask.Expand.RELATIONSHIP_CHANGES, Options.class);
final RelationshipChangeSearchRequestBuilder builder = ClassificationRequests.prepareSearchRelationshipChange().all().filterByClassificationId(classificationTaskIds);
if (expandOptions.containsKey("sourceId")) {
builder.filterBySourceId(expandOptions.getCollection("sourceId", String.class));
}
final RelationshipChanges relationshipChanges = builder.setExpand(expandOptions.get("expand", Options.class)).setLocales(locales()).build().execute(context());
final ListMultimap<String, RelationshipChange> relationshipChangesByTaskId = Multimaps.index(relationshipChanges, RelationshipChange::getClassificationId);
for (final ClassificationTask classificationTask : results) {
final List<RelationshipChange> taskChanges = relationshipChangesByTaskId.get(classificationTask.getId());
classificationTask.setRelationshipChanges(new RelationshipChanges(taskChanges, null, taskChanges.size(), taskChanges.size()));
}
}
Aggregations