use of org.kie.workbench.common.stunner.core.graph.Node in project kie-wb-common by kiegroup.
the class DecisionConverter method nodeFromDMN.
@Override
public Node<View<Decision>, ?> nodeFromDMN(final org.kie.dmn.model.v1_1.Decision dmn) {
@SuppressWarnings("unchecked") Node<View<Decision>, ?> node = (Node<View<Decision>, ?>) factoryManager.newElement(dmn.getId(), Decision.class).asNode();
Id id = new Id(dmn.getId());
Description description = DescriptionPropertyConverter.wbFromDMN(dmn.getDescription());
Name name = new Name(dmn.getName());
InformationItem informationItem = InformationItemPropertyConverter.wbFromDMN(dmn.getVariable());
Expression expression = ExpressionPropertyConverter.wbFromDMN(dmn.getExpression());
Decision decision = new Decision(id, description, name, new Question(), new AllowedAnswers(), informationItem, expression, new BackgroundSet(), new FontSet(), new RectangleDimensionsSet());
node.getContent().setDefinition(decision);
return node;
}
use of org.kie.workbench.common.stunner.core.graph.Node in project kie-wb-common by kiegroup.
the class InputDataConverter method nodeFromDMN.
@Override
public Node<View<InputData>, ?> nodeFromDMN(final org.kie.dmn.model.v1_1.InputData dmn) {
@SuppressWarnings("unchecked") Node<View<InputData>, ?> node = (Node<View<InputData>, ?>) factoryManager.newElement(dmn.getId(), InputData.class).asNode();
Id id = new Id(dmn.getId());
Description description = DescriptionPropertyConverter.wbFromDMN(dmn.getDescription());
Name name = new Name(dmn.getName());
InformationItem informationItem = InformationItemPropertyConverter.wbFromDMN(dmn.getVariable());
InputData inputData = new InputData(id, description, name, informationItem, new BackgroundSet(), new FontSet(), new RectangleDimensionsSet());
node.getContent().setDefinition(inputData);
return node;
}
use of org.kie.workbench.common.stunner.core.graph.Node in project kie-wb-common by kiegroup.
the class GraphBuilder method addDockedNode.
private void addDockedNode(String parentId, String candidateId) {
Node parent = executionContext.getGraphIndex().getNode(parentId);
Node candidate = executionContext.getGraphIndex().getNode(candidateId);
addDockedNode(parent, candidate);
}
use of org.kie.workbench.common.stunner.core.graph.Node in project kie-wb-common by kiegroup.
the class SequenceFlowConverter method convertEdge.
public BpmnEdge convertEdge(org.eclipse.bpmn2.SequenceFlow seq, Map<String, BpmnNode> nodes) {
Edge<View<SequenceFlow>, Node> edge = factoryManager.newEdge(seq.getId(), SequenceFlow.class);
SequenceFlow definition = edge.getContent().getDefinition();
SequenceFlowPropertyReader p = propertyReaderFactory.of(seq);
definition.setGeneral(new BPMNGeneralSet(new Name(seq.getName()), new Documentation(p.getDocumentation())));
definition.setExecutionSet(new SequenceFlowExecutionSet(new Priority(p.getPriority()), new ConditionExpression(p.getConditionExpression())));
return BpmnEdge.of(edge, nodes.get(p.getSourceId()), p.getSourceConnection(), nodes.get(p.getTargetId()), p.getTargetConnection());
}
use of org.kie.workbench.common.stunner.core.graph.Node in project kie-wb-common by kiegroup.
the class GraphValidatorImplTest method testValidateEmptyViewConnectorNodes.
@Test
@SuppressWarnings("unchecked")
public void testValidateEmptyViewConnectorNodes() {
final RuleSet ruleSet = graphTestHandler.ruleSet;
final Graph<DefinitionSet, Node> graph = graphTestHandler.graph;
final TestingGraphInstanceBuilder.TestGraph1 testGraph1 = TestingGraphInstanceBuilder.newGraph1(graphTestHandler);
// Update the edge2 and remove the connection's target node.
// From this point, a validation error is expected.
graphTestHandler.removeTargetConnection(testGraph1.edge2);
tested.validate(graph, ruleSet, ruleViolations -> {
assertEquals(1, ruleViolations.size());
final RuleViolation violation = ruleViolations.iterator().next();
assertNotNull(violation);
assertTrue(violation instanceof EmptyConnectionViolation);
EmptyConnectionViolation v = (EmptyConnectionViolation) violation;
final Optional<Object[]> arguments = v.getArguments();
assertTrue(arguments.isPresent());
assertEquals(testGraph1.edge2.getUUID(), arguments.get()[0]);
assertEquals(testGraph1.intermNode.getUUID(), arguments.get()[1]);
assertNull(arguments.get()[2]);
});
}
Aggregations