Search in sources :

Example 11 with WorkflowNode

use of com.liferay.ide.kaleo.core.model.WorkflowNode 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)

Example 12 with WorkflowNode

use of com.liferay.ide.kaleo.core.model.WorkflowNode 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)

Example 13 with WorkflowNode

use of com.liferay.ide.kaleo.core.model.WorkflowNode in project liferay-ide by liferay.

the class NewNodeNameValidationService method compute.

@Override
public Status compute() {
    Status retval = Status.createOkStatus();
    WorkflowNode newNode = context(WorkflowNode.class);
    WorkflowDefinition workflowDefinition = newNode.adapt(WorkflowDefinition.class);
    if (workflowDefinition != null) {
        for (WorkflowNode node : workflowDefinition.getDiagramNodes()) {
            Value<String> nodeName = node.getName();
            String name = nodeName.content();
            if ((name != null) && name.equals(newNode.getName().content())) {
                retval = Status.createErrorStatus("Name already in use.");
                break;
            }
        }
    }
    return retval;
}
Also used : Status(org.eclipse.sapphire.modeling.Status) WorkflowDefinition(com.liferay.ide.kaleo.core.model.WorkflowDefinition) WorkflowNode(com.liferay.ide.kaleo.core.model.WorkflowNode)

Aggregations

WorkflowNode (com.liferay.ide.kaleo.core.model.WorkflowNode)13 CanTransition (com.liferay.ide.kaleo.core.model.CanTransition)7 Transition (com.liferay.ide.kaleo.core.model.Transition)7 WorkflowDefinition (com.liferay.ide.kaleo.core.model.WorkflowDefinition)6 DiagramConnectionPart (org.eclipse.sapphire.ui.diagram.DiagramConnectionPart)5 ConnectionBendpoint (com.liferay.ide.kaleo.core.model.ConnectionBendpoint)4 TransitionMetadata (com.liferay.ide.kaleo.core.model.TransitionMetadata)4 WorkflowNodeMetadata (com.liferay.ide.kaleo.core.model.WorkflowNodeMetadata)4 Point (org.eclipse.sapphire.ui.Point)4 ConnectionService (org.eclipse.sapphire.ui.diagram.ConnectionService)4 DiagramNodePart (org.eclipse.sapphire.ui.diagram.editor.DiagramNodePart)4 Node (com.liferay.ide.kaleo.core.model.Node)3 Position (com.liferay.ide.kaleo.core.model.Position)3 DiagramNodeBounds (org.eclipse.sapphire.ui.diagram.editor.DiagramNodeBounds)3 Assignable (com.liferay.ide.kaleo.core.model.Assignable)2 Join (com.liferay.ide.kaleo.core.model.Join)2 Role (com.liferay.ide.kaleo.core.model.Role)2 RoleName (com.liferay.ide.kaleo.core.model.RoleName)2 ArrayList (java.util.ArrayList)2 SapphireDiagramEditorPagePart (org.eclipse.sapphire.ui.diagram.editor.SapphireDiagramEditorPagePart)2