Search in sources :

Example 16 with ServiceProvider

use of com.b2international.snowowl.core.ServiceProvider in project snow-owl by b2ihealthcare.

the class ComponentInactivationChangeProcessor method processReactivations.

private void processReactivations(StagingArea staging, RevisionSearcher searcher, Set<String> reactivatedConceptIds, Set<String> reactivatedComponentIds) throws IOException {
    ServiceProvider context = (ServiceProvider) staging.getContext();
    ModuleIdProvider moduleIdProvider = context.service(ModuleIdProvider.class);
    try {
        Query.select(String.class).from(SnomedDescriptionIndexEntry.class).fields(SnomedDescriptionIndexEntry.Fields.ID).where(Expressions.builder().filter(SnomedDescriptionIndexEntry.Expressions.active()).filter(SnomedDescriptionIndexEntry.Expressions.concepts(reactivatedConceptIds)).filter(SnomedDescriptionIndexEntry.Expressions.activeMemberOf(Concepts.REFSET_DESCRIPTION_INACTIVITY_INDICATOR)).build()).limit(PAGE_SIZE).build().stream(searcher).forEachOrdered(hits -> {
            try {
                reactivateDescriptions(staging, searcher, moduleIdProvider, hits);
            } catch (IOException e) {
                throw new UndeclaredThrowableException(e);
            }
        });
    } catch (UndeclaredThrowableException ute) {
        // Unwrap and throw checked exception from lambda above
        throw (IOException) ute.getCause();
    }
}
Also used : ModuleIdProvider(com.b2international.snowowl.snomed.datastore.request.ModuleRequest.ModuleIdProvider) ServiceProvider(com.b2international.snowowl.core.ServiceProvider) UndeclaredThrowableException(java.lang.reflect.UndeclaredThrowableException) IOException(java.io.IOException)

Aggregations

ServiceProvider (com.b2international.snowowl.core.ServiceProvider)16 List (java.util.List)9 Collectors (java.util.stream.Collectors)9 Set (java.util.Set)8 IOException (java.io.IOException)6 ResourceURI (com.b2international.snowowl.core.ResourceURI)5 Map (java.util.Map)5 Options (com.b2international.commons.options.Options)4 BadRequestException (com.b2international.commons.exceptions.BadRequestException)3 RepositoryManager (com.b2international.snowowl.core.RepositoryManager)3 CodeSystemRequests (com.b2international.snowowl.core.codesystem.CodeSystemRequests)3 Request (com.b2international.snowowl.core.events.Request)3 User (com.b2international.snowowl.core.identity.User)3 ApiException (com.b2international.commons.exceptions.ApiException)2 Branch (com.b2international.snowowl.core.branch.Branch)2 Concept (com.b2international.snowowl.core.domain.Concept)2 ConceptMapMappings (com.b2international.snowowl.core.domain.ConceptMapMappings)2 RequestHeaders (com.b2international.snowowl.core.events.util.RequestHeaders)2 Permission (com.b2international.snowowl.core.identity.Permission)2 IEventBus (com.b2international.snowowl.eventbus.IEventBus)2