Search in sources :

Example 1 with NewJoinNodeOp

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());
    }
}
Also used : Node(com.liferay.ide.kaleo.core.model.Node) WorkflowNode(com.liferay.ide.kaleo.core.model.WorkflowNode) CanTransition(com.liferay.ide.kaleo.core.model.CanTransition) Transition(com.liferay.ide.kaleo.core.model.Transition) Join(com.liferay.ide.kaleo.core.model.Join) WorkflowDefinition(com.liferay.ide.kaleo.core.model.WorkflowDefinition) CanTransition(com.liferay.ide.kaleo.core.model.CanTransition) NewJoinNodeOp(com.liferay.ide.kaleo.core.op.NewJoinNodeOp) WorkflowNode(com.liferay.ide.kaleo.core.model.WorkflowNode)

Aggregations

CanTransition (com.liferay.ide.kaleo.core.model.CanTransition)1 Join (com.liferay.ide.kaleo.core.model.Join)1 Node (com.liferay.ide.kaleo.core.model.Node)1 Transition (com.liferay.ide.kaleo.core.model.Transition)1 WorkflowDefinition (com.liferay.ide.kaleo.core.model.WorkflowDefinition)1 WorkflowNode (com.liferay.ide.kaleo.core.model.WorkflowNode)1 NewJoinNodeOp (com.liferay.ide.kaleo.core.op.NewJoinNodeOp)1