Search in sources :

Example 16 with WorkflowDefinition

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

WorkflowDefinition (com.liferay.ide.kaleo.core.model.WorkflowDefinition)16 Transition (com.liferay.ide.kaleo.core.model.Transition)6 Node (com.liferay.ide.kaleo.core.model.Node)5 WorkflowNode (com.liferay.ide.kaleo.core.model.WorkflowNode)5 CanTransition (com.liferay.ide.kaleo.core.model.CanTransition)4 Join (com.liferay.ide.kaleo.core.model.Join)4 Fork (com.liferay.ide.kaleo.core.model.Fork)3 State (com.liferay.ide.kaleo.core.model.State)3 Task (com.liferay.ide.kaleo.core.model.Task)3 NewNodeOp (com.liferay.ide.kaleo.core.op.NewNodeOp)3 Value (org.eclipse.sapphire.Value)3 Version (org.eclipse.sapphire.Version)3 Condition (com.liferay.ide.kaleo.core.model.Condition)2 JoinXor (com.liferay.ide.kaleo.core.model.JoinXor)2 AssignableOp (com.liferay.ide.kaleo.core.op.AssignableOp)2 ArrayList (java.util.ArrayList)2 IFile (org.eclipse.core.resources.IFile)2 IProject (org.eclipse.core.resources.IProject)2 Element (org.eclipse.sapphire.Element)2 RootXmlResource (org.eclipse.sapphire.modeling.xml.RootXmlResource)2