use of com.liferay.ide.kaleo.core.op.NewForkNodeOp in project liferay-ide by liferay.
the class ForkNodeAddActionHandler method postDiagramNodePartAdded.
@Override
public void postDiagramNodePartAdded(NewNodeOp op, CanTransition newNodeFromWizard, CanTransition newNode) {
NewForkNodeOp newForkOp = op.nearest(NewForkNodeOp.class);
NewForkNode newForkNodeFromWizard = newNodeFromWizard.nearest(NewForkNode.class);
Fork newFork = newNode.nearest(Fork.class);
WorkflowDefinition workflowDefinition = newFork.nearest(WorkflowDefinition.class);
if (newForkOp.isAddJoin().content(true)) {
Join newJoin = workflowDefinition.getJoins().insert();
String newJoinName = newForkNodeFromWizard.getName().content() + " Join";
newJoin.setName(newJoinName);
for (Node connectedNode : op.getConnectedNodes()) {
for (WorkflowNode diagramNode : workflowDefinition.getDiagramNodes()) {
Value<String> nodeName = connectedNode.getName();
if (nodeName.content().equals(diagramNode.getName().content())) {
CanTransition canTransition = diagramNode.nearest(CanTransition.class);
ElementList<Transition> transitions = canTransition.getTransitions();
Transition newTransition = transitions.insert();
newTransition.setName(newJoinName);
newTransition.setTarget(newJoinName);
}
}
}
}
}
Aggregations