use of org.kie.workbench.common.stunner.core.rule.context.NodeContainmentContext in project kie-wb-common by kiegroup.
the class CanvasLayoutUtils method canContain.
private boolean canContain(final CanvasHandler canvasHandler, final Node container, final Node candidate) {
boolean canContain = true;
NodeContainmentContext containmentContext = RuleContextBuilder.GraphContexts.containment(canvasHandler.getDiagram().getGraph(), container, candidate);
String definitionSetId = canvasHandler.getDiagram().getMetadata().getDefinitionSetId();
Object definitionSet = definitionManager.definitionSets().getDefinitionSetById(definitionSetId);
RuleSet ruleSet = definitionManager.adapters().forRules().getRuleSet(definitionSet);
RuleViolations violations = ruleManager.evaluate(ruleSet, containmentContext);
if (violations.violations(Violation.Type.ERROR).iterator().hasNext()) {
canContain = false;
}
return canContain;
}
Aggregations