Package org.jbpm.bpmn2.xml

Examples of org.jbpm.bpmn2.xml.BPMNExtensionsSemanticModule


            ((ProcessBuildData) parser.getData()).getMetaData("Messages");
        if (messages == null) {
            messages = new HashMap<String, Message>();
            buildData.setMetaData("Messages", messages);
        }
        Message message = new Message(id);
        message.setType(itemDefinition.getStructureRef());
        messages.put(id, message);
    return message;
  }
View Full Code Here


    Map<String, Message> messages = (Map<String, Message>)
            ((ProcessBuildData) parser.getData()).getMetaData("Messages");
        if (messages == null) {
            throw new IllegalArgumentException("No messages found");
        }
        Message message = messages.get(messageId);
        if (message == null) {
            throw new IllegalArgumentException("Could not find message " + messageId);
        }
        Operation operation = (Operation) parser.getParent();
        operation.setMessage(message);
View Full Code Here

                Map<String, Message> messages = (Map<String, Message>)
                    ((ProcessBuildData) parser.getData()).getMetaData("Messages");
                if (messages == null) {
                    throw new IllegalArgumentException("No messages found");
                }
                Message message = messages.get(messageRef);
                if (message == null) {
                    throw new IllegalArgumentException("Could not find message " + messageRef);
                }
                String variable = (String) endNode.getMetaData("MappingVariable");
                endNode.setMetaData("MessageType", message.getType());
                List<DroolsAction> actions = new ArrayList<DroolsAction>();
               
                actions.add(new DroolsConsequenceAction("java",
                    "org.drools.process.instance.impl.WorkItemImpl workItem = new org.drools.process.instance.impl.WorkItemImpl();" + EOL +
                    "workItem.setName(\"Send Task\");" + EOL +
                    "workItem.setParameter(\"MessageType\", \"" + message.getType() + "\");" + EOL +
                    (variable == null ? "" : "workItem.setParameter(\"Message\", " + variable + ");" + EOL) +
                    "((org.drools.process.instance.WorkItemManager) kcontext.getKnowledgeRuntime().getWorkItemManager()).internalExecuteWorkItem(workItem);"));
                endNode.setActions(EndNode.EVENT_NODE_ENTER, actions);
            }
            xmlNode = xmlNode.getNextSibling();
View Full Code Here

                Map<String, Message> messages = (Map<String, Message>)
                    ((ProcessBuildData) parser.getData()).getMetaData("Messages");
                if (messages == null) {
                    throw new IllegalArgumentException("No messages found");
                }
                Message message = messages.get(messageRef);
                if (message == null) {
                    throw new IllegalArgumentException("Could not find message " + messageRef);
                }
                eventNode.setMetaData("MessageType", message.getType());
                List<EventFilter> eventFilters = new ArrayList<EventFilter>();
                EventTypeFilter eventFilter = new EventTypeFilter();
                eventFilter.setType("Message-" + messageRef);
                eventFilters.add(eventFilter);
                eventNode.setEventFilters(eventFilters);
View Full Code Here

        Map<String, Message> messages = (Map<String, Message>)
            ((ProcessBuildData) parser.getData()).getMetaData("Messages");
        if (messages == null) {
            throw new IllegalArgumentException("No messages found");
        }
        Message message = messages.get(messageRef);
        if (message == null) {
            throw new IllegalArgumentException("Could not find message " + messageRef);
        }
        workItemNode.getWork().setParameter("MessageType", message.getType());
    }
View Full Code Here

      if (connections == null) {
        connections = new ArrayList<SequenceFlow>();
        ((CompositeNode) nodeContainer).setMetaData(ProcessHandler.CONNECTIONS, connections);
      }
    }
    SequenceFlow connection = new SequenceFlow(id, sourceRef, targetRef);
    connection.setBendpoints(bendpoints);
    connection.setName(name);
    if (priority != null) {
      connection.setPriority(Integer.parseInt(priority));
    }
   
    connections.add(connection);

    return connection;
View Full Code Here

  }

  public Object end(final String uri, final String localName,
                final ExtensibleXmlParser parser) throws SAXException {
    final Element element = parser.endElementBuilder();
    SequenceFlow sequenceFlow = (SequenceFlow) parser.getCurrent();
       
    org.w3c.dom.Node xmlNode = element.getFirstChild();
        while (xmlNode != null) {
          String nodeName = xmlNode.getNodeName();
          if ("conditionExpression".equals(nodeName)) {
            String expression = xmlNode.getTextContent();
            org.w3c.dom.Node languageNode = xmlNode.getAttributes().getNamedItem("language");
            if (languageNode != null) {
              String language = languageNode.getNodeValue();
              if (XmlBPMNProcessDumper.JAVA_LANGUAGE.equals(language)) {
                sequenceFlow.setLanguage("java");
              } else if (XmlBPMNProcessDumper.RULE_LANGUAGE.equals(language)) {
                sequenceFlow.setType("rule");
              } else if (XmlBPMNProcessDumper.XPATH_LANGUAGE.equals(language)) {
                        sequenceFlow.setLanguage("XPath");
                    } else {
                  throw new IllegalArgumentException("Unknown language " + language);
              }
            }
            sequenceFlow.setExpression(expression);
          }
          xmlNode = xmlNode.getNextSibling();
        }
        return sequenceFlow;
  }
View Full Code Here

  public void testEventBasedSplit5() throws Exception {
    KnowledgeBase kbase = createKnowledgeBase("BPMN2-EventBasedSplit5.bpmn2");
    StatefulKnowledgeSession ksession = createKnowledgeSession(kbase);
    ksession.getWorkItemManager().registerWorkItemHandler("Email1", new SystemOutWorkItemHandler());
    ksession.getWorkItemManager().registerWorkItemHandler("Email2", new SystemOutWorkItemHandler());
        ReceiveTaskHandler receiveTaskHandler = new ReceiveTaskHandler(ksession);
        ksession.getWorkItemManager().registerWorkItemHandler("Receive Task", receiveTaskHandler);
    // Yes
    ProcessInstance processInstance = ksession.startProcess("com.sample.test");
    assertTrue(processInstance.getState() == ProcessInstance.STATE_ACTIVE);
    ksession = restoreSession(ksession, true);
    ksession.getWorkItemManager().registerWorkItemHandler("Email1", new SystemOutWorkItemHandler());
    ksession.getWorkItemManager().registerWorkItemHandler("Email2", new SystemOutWorkItemHandler());
    receiveTaskHandler.setKnowledgeRuntime(ksession);
    ksession.getWorkItemManager().registerWorkItemHandler("Receive Task", receiveTaskHandler);
        receiveTaskHandler.messageReceived("YesMessage", "YesValue");
    assertProcessInstanceCompleted(processInstance.getId(), ksession);
        receiveTaskHandler.messageReceived("NoMessage", "NoValue");
    ksession = restoreSession(ksession, true);
    ksession.getWorkItemManager().registerWorkItemHandler("Email1", new SystemOutWorkItemHandler());
    ksession.getWorkItemManager().registerWorkItemHandler("Email2", new SystemOutWorkItemHandler());
    receiveTaskHandler.setKnowledgeRuntime(ksession);
        ksession.getWorkItemManager().registerWorkItemHandler("Receive Task", receiveTaskHandler);
    // No
    processInstance = ksession.startProcess("com.sample.test");
    receiveTaskHandler.messageReceived("NoMessage", "NoValue");
    assertProcessInstanceCompleted(processInstance.getId(), ksession);
    receiveTaskHandler.messageReceived("YesMessage", "YesValue");
  }
View Full Code Here

    }

    public void testReceiveTask() throws Exception {
        KnowledgeBase kbase = createKnowledgeBase("BPMN2-ReceiveTask.bpmn2");
    StatefulKnowledgeSession ksession = createKnowledgeSession(kbase);
        ReceiveTaskHandler receiveTaskHandler = new ReceiveTaskHandler(ksession);
        ksession.getWorkItemManager().registerWorkItemHandler("Receive Task", receiveTaskHandler);
        WorkflowProcessInstance processInstance = (WorkflowProcessInstance)
            ksession.startProcess("ReceiveTask");
        assertEquals(ProcessInstance.STATE_ACTIVE, processInstance.getState());
        ksession = restoreSession(ksession, true);
        receiveTaskHandler.messageReceived("HelloMessage", "Hello john!");
    assertProcessInstanceCompleted(processInstance.getId(), ksession);
    }
View Full Code Here

  public void testEventBasedSplit5() throws Exception {
    KnowledgeBase kbase = createKnowledgeBase("BPMN2-EventBasedSplit5.bpmn2");
    StatefulKnowledgeSession ksession = createKnowledgeSession(kbase);
    ksession.getWorkItemManager().registerWorkItemHandler("Email1", new SystemOutWorkItemHandler());
    ksession.getWorkItemManager().registerWorkItemHandler("Email2", new SystemOutWorkItemHandler());
        ReceiveTaskHandler receiveTaskHandler = new ReceiveTaskHandler(ksession);
        ksession.getWorkItemManager().registerWorkItemHandler("Receive Task", receiveTaskHandler);
    // Yes
    ProcessInstance processInstance = ksession.startProcess("com.sample.test");
    assertTrue(processInstance.getState() == ProcessInstance.STATE_ACTIVE);
    ksession = restoreSession(ksession, true);
    ksession.getWorkItemManager().registerWorkItemHandler("Email1", new SystemOutWorkItemHandler());
    ksession.getWorkItemManager().registerWorkItemHandler("Email2", new SystemOutWorkItemHandler());
    receiveTaskHandler.setKnowledgeRuntime(ksession);
    ksession.getWorkItemManager().registerWorkItemHandler("Receive Task", receiveTaskHandler);
        receiveTaskHandler.messageReceived("YesMessage", "YesValue");
    assertProcessInstanceCompleted(processInstance.getId(), ksession);
        receiveTaskHandler.messageReceived("NoMessage", "NoValue");
    ksession = restoreSession(ksession, true);
    ksession.getWorkItemManager().registerWorkItemHandler("Email1", new SystemOutWorkItemHandler());
    ksession.getWorkItemManager().registerWorkItemHandler("Email2", new SystemOutWorkItemHandler());
    receiveTaskHandler.setKnowledgeRuntime(ksession);
        ksession.getWorkItemManager().registerWorkItemHandler("Receive Task", receiveTaskHandler);
    // No
    processInstance = ksession.startProcess("com.sample.test");
    receiveTaskHandler.messageReceived("NoMessage", "NoValue");
    assertProcessInstanceCompleted(processInstance.getId(), ksession);
    receiveTaskHandler.messageReceived("YesMessage", "YesValue");
  }
View Full Code Here

TOP

Related Classes of org.jbpm.bpmn2.xml.BPMNExtensionsSemanticModule

Copyright © 2018 www.massapicom. 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.