Search in sources :

Example 1 with DockingRuleViolation

use of org.kie.workbench.common.stunner.core.rule.violations.DockingRuleViolation in project kie-wb-common by kiegroup.

the class DockingEvaluationHandler method evaluate.

@Override
public RuleViolations evaluate(final CanDock rule, final DockingContext context) {
    final DefaultRuleViolations results = new DefaultRuleViolations();
    final boolean present = context.getCandidateRoles().stream().filter(cr -> rule.getAllowedRoles().contains(cr)).findAny().isPresent();
    if (!present) {
        results.addViolation(new DockingRuleViolation(rule.getRole(), context.getCandidateRoles().toString()));
    }
    return results;
}
Also used : DockingRuleViolation(org.kie.workbench.common.stunner.core.rule.violations.DockingRuleViolation) DefaultRuleViolations(org.kie.workbench.common.stunner.core.rule.violations.DefaultRuleViolations)

Aggregations

DefaultRuleViolations (org.kie.workbench.common.stunner.core.rule.violations.DefaultRuleViolations)1 DockingRuleViolation (org.kie.workbench.common.stunner.core.rule.violations.DockingRuleViolation)1