use of org.kie.workbench.common.stunner.core.validation.ElementViolation in project kie-wb-common by kiegroup.
the class CanvasDiagramValidator method checkViolations.
@SuppressWarnings("unchecked")
private void checkViolations(final H canvasHandler, final Collection<DiagramElementViolation<RuleViolation>> elementViolations) {
final String uuid = canvasHandler.getUuid();
final Diagram diagram = canvasHandler.getDiagram();
final String name = diagram.getName();
final String title = diagram.getMetadata().getTitle();
final Stream<ElementViolation> violationsStream = getElementViolationsStream(elementViolations);
final List<ElementViolation> violationsList = violationsStream.collect(Collectors.toList());
final boolean valid = violationsList.stream().noneMatch(v -> applyViolation(canvasHandler, v));
if (valid) {
validationSuccessEvent.fire(new CanvasValidationSuccessEvent(uuid, name, title));
} else {
validationFailEvent.fire(new CanvasValidationFailEvent(uuid, name, title, elementViolations));
}
}
Aggregations