Examples of StartState


Examples of org.drools.jpdl.core.node.StartState

    }

    private JpdlNode classifyNode(org.jbpm.graph.def.ProcessDefinition processDefinition, org.jbpm.graph.def.Node jPDLnode, SwimlaneContext swimlaneContext) {
        JpdlNode node = null;
        if (jPDLnode instanceof org.jbpm.graph.node.StartState) {
            StartState newNode = new StartState();
            Task task = processDefinition.getTaskMgmtDefinition().getStartTask();
            if (task != null) {
                newNode.setTask(task);
                org.jbpm.taskmgmt.def.Swimlane jPDLswimlane = task.getSwimlane();
                if (jPDLswimlane != null) {
                    String swimlaneName = jPDLswimlane.getName();
                    if (swimlaneContext.getSwimlane(swimlaneName) == null) {
                        Swimlane swimlane = new Swimlane();
                        swimlane.setName(swimlaneName);
                        swimlane.setActorId(jPDLswimlane.getActorIdExpression());
                        // TODO support other types of actor expressions as well
                        swimlaneContext.addSwimlane(swimlane);
                    }
                }
            }
            node = newNode;
        } else if (jPDLnode instanceof org.jbpm.graph.node.EndState) {
            node = new EndState();
        } else if (org.jbpm.graph.def.Node.class.equals(jPDLnode.getClass())) {
            JpdlNode newNode = new JpdlNode();
            setDefaultNodeProperties(jPDLnode, newNode);
            node = newNode;
        } else if (jPDLnode instanceof org.jbpm.graph.node.Fork) {
            org.jbpm.graph.node.Fork jPDLfork =
                    (org.jbpm.graph.node.Fork) jPDLnode;
            Fork newNode = new Fork();
            newNode.setScript(jPDLfork.getScript());
            node = newNode;
        } else if (jPDLnode instanceof org.jbpm.graph.node.Join) {
            org.jbpm.graph.node.Join jPDLjoin =
                    (org.jbpm.graph.node.Join) jPDLnode;
            Join newNode = new Join();
            newNode.setDiscriminator(jPDLjoin.isDiscriminator());
            newNode.setTokenNames(jPDLjoin.getTokenNames());
            newNode.setScript(jPDLjoin.getScript());
            newNode.setNOutOfM(jPDLjoin.getNOutOfM());
            node = newNode;
        } else if (jPDLnode instanceof org.jbpm.graph.node.MailNode) {
            String config = jPDLnode.getAction().getActionDelegation().getConfiguration();

            MailNode newNode = new MailNode();
            Matcher matcher = MAIL_TEMPLATE_PATTERN.matcher(config);
            if (matcher.find()) {
                newNode.setTemplate(matcher.group(1));
            }
            matcher = MAIL_ACTORS_PATTERN.matcher(config);
            if (matcher.find()) {
                newNode.setActors(matcher.group(1));
            }
            matcher = MAIL_TO_PATTERN.matcher(config);
            if (matcher.find()) {
                newNode.setToEmail(matcher.group(1));
            }
            matcher = MAIL_SUBJECT_PATTERN.matcher(config);
            if (matcher.find()) {
                newNode.setSubject(matcher.group(1));
            }
            matcher = MAIL_TEXT_PATTERN.matcher(config);
            if (matcher.find()) {
                newNode.setText(matcher.group(1));
            }
            node = newNode;
        } else if (jPDLnode instanceof org.jbpm.graph.node.Decision) {
            org.jbpm.graph.node.Decision jPDLdecision =
                    (org.jbpm.graph.node.Decision) jPDLnode;
            Decision newNode = new Decision();
            newNode.setDecisionConditions(jPDLdecision.getDecisionConditions());
            // TODO: unable to access decisionDelegation
            // TODO: unable to access decisionExpression
            node = newNode;
        } else if (jPDLnode instanceof org.jbpm.graph.node.ProcessState) {
            org.jbpm.graph.node.ProcessState jPDLprocessState =
                    (org.jbpm.graph.node.ProcessState) jPDLnode;
            ProcessState newNode = new ProcessState();
            ProcessDefinition subProcessDefinition =
                    jPDLprocessState.getSubProcessDefinition();
            if (subProcessDefinition != null) {
                newNode.setSubProcessName(subProcessDefinition.getName());
                // TODO: parse sub process definition as well
            }
            // TODO: unable to access subProcessName
            // TODO: unable to access variableAccesses
            node = newNode;
        } else if (jPDLnode instanceof org.jbpm.graph.def.SuperState) {
            org.jbpm.graph.def.SuperState jPDLsuperState =
                    (org.jbpm.graph.def.SuperState) jPDLnode;
            SuperState newNode = new SuperState();
            List<org.jbpm.graph.def.Node> nodes = jPDLsuperState.getNodes();
            Map<org.jbpm.graph.def.Node, Node> mapping = new HashMap<org.jbpm.graph.def.Node, Node>();
            for (org.jbpm.graph.def.Node nodeInsideSuperState : nodes) {
                JpdlNode nodeToAdd = classifyNode(processDefinition, nodeInsideSuperState, swimlaneContext);
                if (nodeToAdd == null) {
                    throw new IllegalArgumentException(
                            "Unknown node type: " + jPDLnode.getClass().getName() + " " + jPDLnode);
                }
                setDefaultNodeProperties(nodeInsideSuperState, (JpdlNode) nodeToAdd);
                nodeToAdd.setId(++nodeId);
                mapping.put(nodeInsideSuperState, nodeToAdd);
                newNode.addNode(nodeToAdd);
            }
            generateConnections(mapping);
            node = newNode;
        } else if (jPDLnode instanceof org.jbpm.graph.node.TaskNode) {
            org.jbpm.graph.node.TaskNode jPDLtaskNode =
                    (org.jbpm.graph.node.TaskNode) jPDLnode;
            TaskNode newNode = new TaskNode();
            Set<Task> tasks = jPDLtaskNode.getTasks();
            newNode.setTasks(tasks);
            newNode.setSignal(jPDLtaskNode.getSignal());
            newNode.setCreateTasks(jPDLtaskNode.getCreateTasks());
            newNode.setEndTasks(jPDLtaskNode.isEndTasks());
            for (Task task : tasks) {
                org.jbpm.taskmgmt.def.Swimlane jPDLswimlane = task.getSwimlane();
                if (jPDLswimlane != null) {
                    String swimlaneName = jPDLswimlane.getName();
                    if (swimlaneContext.getSwimlane(swimlaneName) == null) {
View Full Code Here

Examples of org.drools.jpdl.core.node.StartState

   
    private void validateNodes(Node[] nodes, List<ProcessValidationError> errors, JpdlProcess process) {
        for ( int i = 0; i < nodes.length; i++ ) {
            final Node node = nodes[i];
            if (node instanceof StartState) {
                final StartState startState = (StartState) node;
                if (startState.getOutgoingConnections().size() == 0) {
                    errors.add(new ProcessValidationErrorImpl(process,
                        "Start state '" + node.getName() + "' [" + node.getId() + "] has no outgoing connections."));
                }
                boolean outgoingConnection = false;
                for (List<Connection> connections: startState.getOutgoingConnections().values()) {
                  if (connections.size() > 0) {
                    outgoingConnection = true;
                    break;
                  }
                }
View Full Code Here

Examples of org.jbpm.graph.node.StartState

    assertEquals("start", processDefinition.getStartState().getName());
  }

  public void testWriteStartState() throws Exception {
    ProcessDefinition processDefinition = new ProcessDefinition();
    processDefinition.setStartState( new StartState() );
    Element element = AbstractXmlTestCase.toXmlAndParse( processDefinition, "/process-definition/start-state[1]" );
    assertNotNull(element);
    assertEquals("start-state", element.getName());
    assertEquals(0, element.attributeCount());
  }
View Full Code Here

Examples of org.jbpm.graph.node.StartState

    assertEquals(0, element.attributeCount());
  }

  public void testWriteStartStateName() throws Exception {
    ProcessDefinition processDefinition = new ProcessDefinition();
    processDefinition.setStartState( new StartState("mystartstate") );
    Element element = AbstractXmlTestCase.toXmlAndParse( processDefinition, "/process-definition/start-state[1]" );
    assertEquals("start-state", element.getName());
    assertEquals(1, element.attributeCount());
    assertEquals("mystartstate", element.attributeValue("name"));
  }
View Full Code Here

Examples of org.jbpm.graph.node.StartState

    assertSupportedEvents(new ProcessState(), new String[] { "node-leave", "node-enter", "after-signal", "before-signal", "subprocess-created",
        "subprocess-end" });
  }

  public void testStartStateEvents() {
    assertSupportedEvents(new StartState(), new String[] { "node-leave", "after-signal" });
  }
View Full Code Here

Examples of org.jbpm.graph.node.StartState

    assertFalse(processDefinition.isTerminationImplicit());
  }

  public void testProcessDefinitionStartState() {
    ProcessDefinition processDefinition = new ProcessDefinition();
    processDefinition.setStartState(new StartState());

    processDefinition = saveAndReload(processDefinition);

    // the start state of a process definition is mapped as a node.
    // therefor the hibernate proxy will be a node
View Full Code Here

Examples of org.jbpm.graph.node.StartState

    assertTrue(StartState.class.isAssignableFrom(session.load(StartState.class, new Long(startState.getId())).getClass()))
  }

  public void testProcessDefinitionNodes() {
    ProcessDefinition processDefinition = new ProcessDefinition();
    processDefinition.setStartState(new StartState("s"));
    processDefinition.addNode(new Node("a"));
    processDefinition.addNode(new Node("b"));
    processDefinition.addNode(new Node("c"));
    processDefinition.addNode(new Node("d"));
View Full Code Here

Examples of org.jbpm.graph.node.StartState

      "</pageflow-definition>"
    );
    PageflowParser pageflowParser = new PageflowParser(stringReader);
    ProcessDefinition processDefinition = pageflowParser.readProcessDefinition();
   
    StartState start = (StartState) processDefinition.getStartState();
    Page confirm = (Page) processDefinition.getNode("confirm");
    Page complete = (Page) processDefinition.getNode("complete");
    Page cont = (Page) processDefinition.getNode("continue");
    assert confirm!=null;
    assert complete!=null;
    assert cont!=null;
   
    ProcessInstance processInstance = new ProcessInstance(processDefinition);
    Token token = processInstance.getRootToken();
    assert start.equals(token.getNode());
   
    processInstance.signal();
  }
View Full Code Here

Examples of org.jbpm.graph.node.StartState

      "    <end-conversation/>" +
      "  </page>" +
      "</pageflow-definition>"
    );
   
    StartState start = (StartState) pageflowDefinition.getStartState();
    Page confirm = (Page) pageflowDefinition.getNode("confirm");
    Page complete = (Page) pageflowDefinition.getNode("complete");
    Page cont = (Page) pageflowDefinition.getNode("continue");
    assert confirm!=null;
    assert complete!=null;
    assert cont!=null;
   
    ProcessInstance pageflowInstance = new ProcessInstance(pageflowDefinition);
    Token token = pageflowInstance.getRootToken();
    assert start.equals(token.getNode());
   
    pageflowInstance.signal();
  }
View Full Code Here

Examples of org.jbpm.ui.common.model.StartState

        }

        NodeList startStates = document.getElementsByTagName(START_STATE_NODE);
        if (startStates.getLength() == 1) {
            Node node = startStates.item(0);
            StartState startState = create(node, definition);
            String swimlaneName = getAttribute(node, SWIMLANE_NODE);
            Swimlane swimlane = definition.getSwimlaneByName(swimlaneName);
            startState.setSwimlane(swimlane);
        }

        NodeList states = document.getElementsByTagName(STATE_NODE);
        for (int i = 0; i < states.getLength(); i++) {
            Node node = states.item(i);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.