use of com.b2international.snowowl.core.events.DelegatingRequest in project snow-owl by b2ihealthcare.
the class IdRequest method collectComponentCreateRequests.
private static void collectComponentCreateRequests(Request<?, ?> request, ImmutableMultimap.Builder<ComponentCategory, SnomedComponentCreateRequest> resultBuilder) {
if (request instanceof DelegatingRequest) {
collectComponentCreateRequests(((DelegatingRequest<?, ?, ?>) request).next(), resultBuilder);
} else if (request instanceof TransactionalRequest) {
collectComponentCreateRequests(((TransactionalRequest) request).getNext(), resultBuilder);
} else if (request instanceof BaseSnomedComponentCreateRequest) {
final BaseSnomedComponentCreateRequest createRequest = (BaseSnomedComponentCreateRequest) request;
for (SnomedCoreComponentCreateRequest nestedRequest : Iterables.filter(createRequest.getNestedRequests(), SnomedCoreComponentCreateRequest.class)) {
ComponentCategory category = getComponentCategory(nestedRequest);
resultBuilder.put(category, (BaseSnomedComponentCreateRequest) nestedRequest);
// XXX: we could recurse here, but only concept creation requests have actual nested requests at the moment
}
} else if (request instanceof SnomedRefSetMemberCreateRequest) {
final SnomedRefSetMemberCreateRequest createRequest = (SnomedRefSetMemberCreateRequest) request;
final ComponentCategory category = getComponentCategory(createRequest);
resultBuilder.put(category, createRequest);
} else if (request instanceof BulkRequest) {
final BulkRequest<?> bulkRequest = (BulkRequest<?>) request;
for (Request<?, ?> bulkRequestItem : bulkRequest.getRequests()) {
collectComponentCreateRequests(bulkRequestItem, resultBuilder);
}
}
}
Aggregations