@SuppressWarnings("unchecked") private RuleViolations evaluateCardinality(final RuleSet ruleSet, final Graph graph) { log(" CARDINALITY [graph=" + graph + "]"); return ruleManager .evaluate(ruleSet, RuleContextBuilder.GraphContexts.cardinality(graph, Optional.empty(), Optional.empty())); }
/** * Actually the different commands allows removing nodes that have * incoming or outgoing view connectors, as connectors can be re-attached to * a different node, but the graph structure is not considered valid, so the * diagram cannot be updated until fixing that connections. * So there exist no rule for empty connections, actually it's just a common validation. */ @SuppressWarnings("unchecked") private Optional<RuleViolation> evaluateNotEmptyConnections(final Graph<?, ? extends Node> graph, final Edge<? extends View<?>, ? extends Node> connector, final Optional<Node<? extends View<?>, ? extends Edge>> sourceNode, final Optional<Node<? extends View<?>, ? extends Edge>> targetNode) { log(" NOT_EMPTY_CONNECTIONS " + "[edge=" + connector + ",source=" + sourceNode.orElse(null) + ",target=" + targetNode.orElse(null) + "]"); if (!sourceNode.isPresent() || !targetNode.isPresent()) { return Optional.of(EmptyConnectionViolation.Builder.build(connector, sourceNode, targetNode)); } return Optional.empty(); }
@SuppressWarnings("unchecked") private RuleViolations evaluateConnection(final RuleSet ruleSet, final Graph<?, ? extends Node> graph, final Edge<? extends View<?>, ? extends Node> connector, final Optional<Node<? extends View<?>, ? extends Edge>> sourceNode, final Optional<Node<? extends View<?>, ? extends Edge>> targetNode) { log(" CONNECTION " + "[edge=" + connector + ",source=" + sourceNode.orElse(null) + ",target=" + targetNode.orElse(null) + "]"); return ruleManager .evaluate(ruleSet, RuleContextBuilder.GraphContexts.connection(graph, connector, sourceNode, targetNode)); }
@SuppressWarnings("unchecked") private RuleViolations evaluateContainment(final RuleSet ruleSet, final Graph graph, final Element<? extends Definition<?>> parent, final Node candidate) { log(" CONTAINMENT " + "[parent=" + parent + ",candidate=" + candidate + "]"); return ruleManager .evaluate(ruleSet, RuleContextBuilder.GraphContexts.containment(graph, parent, candidate)); }
@SuppressWarnings("unchecked") private RuleViolations evaluateIncomingEdgeCardinality(final RuleSet ruleSet, final org.kie.workbench.common.stunner.core.graph.Graph graph, final Edge<? extends View, Node> edge) { log(" IN-EDGE CARDINALITY [edge=" + edge + "]"); return ruleManager .evaluate(ruleSet, RuleContextBuilder.GraphContexts.edgeCardinality(graph, edge.getTargetNode(), (Edge<? extends View<?>, Node>) edge, EdgeCardinalityContext.Direction.INCOMING, Optional.empty())); }
@SuppressWarnings("unchecked") private RuleViolations evaluateOutgoingEdgeCardinality(final RuleSet ruleSet, final org.kie.workbench.common.stunner.core.graph.Graph graph, final Edge<? extends View, Node> edge) { log(" OUT-EDGE CARDINALITY [edge=" + edge + "]"); return ruleManager .evaluate(ruleSet, RuleContextBuilder.GraphContexts.edgeCardinality(graph, edge.getSourceNode(), (Edge<? extends View<?>, Node>) edge, EdgeCardinalityContext.Direction.OUTGOING, Optional.empty())); }
@SuppressWarnings("unchecked") private RuleViolations evaluateDocking(final RuleSet ruleSet, final Graph graph, final Element<? extends Definition<?>> parent, final Node candidate) { log(" DOCKING " + "[parent=" + (parent.getUUID()) + ",candidate=" + candidate.getUUID() + "]"); return ruleManager .evaluate(ruleSet, RuleContextBuilder.GraphContexts.docking(graph, parent, candidate)); }