Search in sources :

Example 1 with NewJoinXorNodeOp

use of com.liferay.ide.kaleo.core.op.NewJoinXorNodeOp in project liferay-ide by liferay.

the class JoinXorNodeAddActionHandler method postDiagramNodePartAdded.

@Override
public void postDiagramNodePartAdded(NewNodeOp op, CanTransition newNodeFromWizard, CanTransition newNode) {
    NewJoinXorNodeOp newJoinXorNodeOp = op.nearest(NewJoinXorNodeOp.class);
    JoinXor newJoinXor = newNode.nearest(JoinXor.class);
    WorkflowDefinition workflowDefinition = newJoinXor.nearest(WorkflowDefinition.class);
    for (Node nodeName : newJoinXorNodeOp.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(newJoinXor.getName().content());
                    newTransition.setTarget(newJoinXor.getName().content());
                }
            }
        }
    }
    if (newJoinXorNodeOp.getExitTransitionName().content() != null) {
        Transition newTransition = newJoinXor.getTransitions().insert();
        newTransition.setTarget(newJoinXorNodeOp.getExitTransitionName().content());
        newTransition.setName(newJoinXorNodeOp.getExitTransitionName().content());
    }
}
Also used : JoinXor(com.liferay.ide.kaleo.core.model.JoinXor) NewJoinXorNodeOp(com.liferay.ide.kaleo.core.op.NewJoinXorNodeOp) 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) WorkflowDefinition(com.liferay.ide.kaleo.core.model.WorkflowDefinition) CanTransition(com.liferay.ide.kaleo.core.model.CanTransition) WorkflowNode(com.liferay.ide.kaleo.core.model.WorkflowNode)

Aggregations

CanTransition (com.liferay.ide.kaleo.core.model.CanTransition)1 JoinXor (com.liferay.ide.kaleo.core.model.JoinXor)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 NewJoinXorNodeOp (com.liferay.ide.kaleo.core.op.NewJoinXorNodeOp)1