Search in sources :

Example 1 with RelationshipChanges

use of com.b2international.snowowl.snomed.reasoner.domain.RelationshipChanges 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()));
    }
}
Also used : Options(com.b2international.commons.options.Options) ClassificationTask(com.b2international.snowowl.snomed.reasoner.domain.ClassificationTask) RelationshipChange(com.b2international.snowowl.snomed.reasoner.domain.RelationshipChange) RelationshipChangeSearchRequestBuilder(com.b2international.snowowl.snomed.reasoner.request.RelationshipChangeSearchRequestBuilder) RelationshipChanges(com.b2international.snowowl.snomed.reasoner.domain.RelationshipChanges)

Aggregations

Options (com.b2international.commons.options.Options)1 ClassificationTask (com.b2international.snowowl.snomed.reasoner.domain.ClassificationTask)1 RelationshipChange (com.b2international.snowowl.snomed.reasoner.domain.RelationshipChange)1 RelationshipChanges (com.b2international.snowowl.snomed.reasoner.domain.RelationshipChanges)1 RelationshipChangeSearchRequestBuilder (com.b2international.snowowl.snomed.reasoner.request.RelationshipChangeSearchRequestBuilder)1