use of com.b2international.snowowl.core.validation.ValidationDeleteNotification in project snow-owl by b2ihealthcare.
the class ValidationIssueDeleteRequest method execute.
@Override
public Boolean execute(ServiceProvider context) {
ExpressionBuilder query = Expressions.builder();
if (!CompareUtils.isEmpty(resourceURIs)) {
query.filter(Expressions.matchAny(ValidationIssue.Fields.RESOURCE_URI, resourceURIs));
}
if (!CompareUtils.isEmpty(toolingIds)) {
final Set<String> rulesToDelete = ValidationRequests.rules().prepareSearch().all().filterByToolings(toolingIds).build().execute(context).stream().map(ValidationRule::getId).collect(Collectors.toSet());
query.filter(Expressions.matchAny(ValidationIssue.Fields.RULE_ID, rulesToDelete));
}
return context.service(ValidationRepository.class).write(writer -> {
writer.bulkDelete(new BulkDelete<>(ValidationIssue.class, query.build()));
writer.commit();
new ValidationDeleteNotification(resourceURIs, toolingIds).publish(context.service(IEventBus.class));
return Boolean.TRUE;
});
}
Aggregations