use of com.liferay.ide.kaleo.core.op.NewJoinNodeOp in project liferay-ide by liferay.
the class JoinNodeAddActionHandler method postDiagramNodePartAdded.
@Override
public void postDiagramNodePartAdded(NewNodeOp op, CanTransition newNodeFromWizard, CanTransition newNode) {
NewJoinNodeOp newJoinNodeOp = op.nearest(NewJoinNodeOp.class);
Join newJoin = newNode.nearest(Join.class);
WorkflowDefinition workflowDefinition = newJoin.nearest(WorkflowDefinition.class);
for (Node nodeName : newJoinNodeOp.getConnectedNodes()) {
for (WorkflowNode diagramNode : workflowDefinition.getDiagramNodes()) {
if (nodeName.getName().content() != null) {
String name = nodeName.getName().content();
if (name.equals(diagramNode.getName().content())) {
CanTransition canTransition = diagramNode.nearest(CanTransition.class);
Transition newTransition = canTransition.getTransitions().insert();
newTransition.setName(newJoin.getName().content());
newTransition.setTarget(newJoin.getName().content());
}
}
}
}
if (newJoinNodeOp.getExitTransitionName().content() != null) {
Transition newTransition = newJoin.getTransitions().insert();
newTransition.setTarget(newJoinNodeOp.getExitTransitionName().content());
newTransition.setName(newJoinNodeOp.getExitTransitionName().content());
}
}
Aggregations