Package org.jbpm.bpmn2.xml

Examples of org.jbpm.bpmn2.xml.EventBasedGatewayHandler


  }

  public Object end(final String uri, final String localName,
                final ExtensibleXmlParser parser) throws SAXException {
    final Element element = parser.endElementBuilder();
    Definitions definitions = (Definitions) parser.getCurrent();
        String namespace = element.getAttribute("targetNamespace");
        List<Process> processes = ((ProcessBuildData) parser.getData()).getProcesses();
        for (Process process : processes) {
            RuleFlowProcess ruleFlowProcess = (RuleFlowProcess)process;
            ruleFlowProcess.setMetaData("TargetNamespace", namespace);
        }
        definitions.setTargetNamespace(namespace);
        return definitions;
  }
View Full Code Here


     
      visitEscalations(process.getNodes(), xmlDump, new ArrayList<String>());
      visitErrors(process.getNodes(), xmlDump, new ArrayList<String>());
        
      //data stores
      Definitions def = (Definitions) process.getMetaData().get("Definitions");
      if (def != null && def.getDataStores() != null) {
        for (DataStore dataStore : def.getDataStores()) {
          visitDataStore(dataStore, xmlDump);
        }
      }
     
      // the process itself
    xmlDump.append("  <process processType=\"Private\" isExecutable=\"true\" ");
        if (process.getId() != null) {
            xmlDump.append("id=\"" + XmlBPMNProcessDumper.replaceIllegalCharsAttribute(process.getId()) + "\" ");
        }
        if (process.getName() != null) {
            xmlDump.append("name=\"" + XmlBPMNProcessDumper.replaceIllegalCharsAttribute(process.getName()) + "\" ");
        }
        String packageName = process.getPackageName();
        if (packageName != null && !"org.drools.bpmn2".equals(packageName)) {
            xmlDump.append("tns:packageName=\"" + XmlBPMNProcessDumper.replaceIllegalCharsAttribute(packageName) + "\" ");
        }
        if (((org.jbpm.workflow.core.WorkflowProcess) process).isDynamic()) {
          xmlDump.append("tns:adHoc=\"true\" ");
        }
        String version = process.getVersion();
        if (version != null && !"".equals(version)) {
            xmlDump.append("tns:version=\"" + XmlBPMNProcessDumper.replaceIllegalCharsAttribute(version) + "\" ");
        }
        // TODO: package, version
        xmlDump.append(">" + EOL + EOL);
        visitHeader(process, xmlDump, metaDataType);
        visitNodes(process, xmlDump, metaDataType);
        visitConnections(process.getNodes(), xmlDump, metaDataType);
        if (def != null && def.getAssociations() != null) {
          for (Association association : def.getAssociations()) {
            visitAssociation(association, xmlDump);
          }
        }
        xmlDump.append("  </process>" + EOL + EOL);
        if (metaDataType == META_DATA_USING_DI) {
View Full Code Here

        dataType = new ObjectDataType(itemDefinition.getStructureRef());
      }
    }
    store.setType(dataType);
   
    Definitions parent = (Definitions) parser.getParent();
    List<DataStore> dataStores = parent.getDataStores();
    if (dataStores == null) {
      dataStores = new ArrayList<DataStore>();
      parent.setDataStores(dataStores);
    }
    dataStores.add(store);
    return store;
  }
View Full Code Here

    public void testDataStore() throws Exception {
        KnowledgeBase kbase = createKnowledgeBase("BPMN2-DataStore.xml");
    StatefulKnowledgeSession ksession = createKnowledgeSession(kbase);
        ProcessInstance processInstance = ksession.startProcess("Evaluation");
        Definitions def = (Definitions) processInstance.getProcess().getMetaData().get("Definitions");
        assertNotNull(def.getDataStores());
        assertTrue(def.getDataStores().size() == 1);
        DataStore dataStore = def.getDataStores().get(0);
        assertEquals("employee", dataStore.getId());
        assertEquals("employeeStore", dataStore.getName());
        assertEquals(String.class.getCanonicalName(), ((ObjectDataType) dataStore.getType()).getClassName());
    }
View Full Code Here

    public void testAssociation() throws Exception {
      KnowledgeBase kbase = createKnowledgeBase("BPMN2-Association.xml");
    StatefulKnowledgeSession ksession = createKnowledgeSession(kbase);
        ProcessInstance processInstance = ksession.startProcess("Evaluation");
        Definitions def = (Definitions) processInstance.getProcess().getMetaData().get("Definitions");
        assertNotNull(def.getAssociations());
        assertTrue(def.getAssociations().size() == 1);
        Association assoc = def.getAssociations().get(0);
        assertEquals("_1234", assoc.getId());
        assertEquals("_1", assoc.getSourceRef());
        assertEquals("_2", assoc.getTargetRef());
    }
View Full Code Here

    association.setId(attrs.getValue("id"));
    association.setSourceRef(attrs.getValue("sourceRef"));
    association.setTargetRef(attrs.getValue("targetRef"));
   
    Process parent = (Process) parser.getParent();
    Definitions definitions = (Definitions)
      parent.getMetaData().get("Definitions");
   
    // FIXME for now associations are stored under the definitions node
    // we will move them under process and subprocesses when it becomes possible ?
    List<Association> associations = definitions.getAssociations();
    if (associations == null) {
      associations = new ArrayList<Association>();
      definitions.setAssociations(associations);
    }
    associations.add(association);
   
    return association;
  }
View Full Code Here

                  Map<String, Error> errors = (Map<String, Error>)
                    ((ProcessBuildData) parser.getData()).getMetaData("Errors");
                if (errors == null) {
                    throw new IllegalArgumentException("No errors found");
                }
                Error error = errors.get(errorRef);
                if (error == null) {
                    throw new IllegalArgumentException("Could not find error " + errorRef);
                }
                String type = error.getErrorCode();
                    List<EventFilter> eventFilters = new ArrayList<EventFilter>();
                    EventTypeFilter eventFilter = new EventTypeFilter();
                    eventFilter.setType("Error-" + attachedTo + "-" + type);
                    eventFilters.add(eventFilter);
                    eventNode.setEventFilters(eventFilters);
View Full Code Here

    Map<String, Error> errors = (Map<String, Error>) buildData.getMetaData("Errors");
        if (errors == null) {
          errors = new HashMap<String, Error>();
            buildData.setMetaData("Errors", errors);
        }
        Error e = new Error(id, errorCode);
        errors.put(id, e);
    return e;
  }
View Full Code Here

                    Map<String, Error> errors = (Map<String, Error>)
                    ((ProcessBuildData) parser.getData()).getMetaData("Errors");
                if (errors == null) {
                    throw new IllegalArgumentException("No errors found");
                }
                Error error = errors.get(errorRef);
                if (error == null) {
                    throw new IllegalArgumentException("Could not find error " + errorRef);
                }
                faultNode.setFaultName(error.getErrorCode());
                  faultNode.setTerminateParent(true);
                }
            }
            xmlNode = xmlNode.getNextSibling();
        }
View Full Code Here

    Map<String, Escalation> escalations = (Map<String, Escalation>) buildData.getMetaData("Escalations");
        if (escalations == null) {
          escalations = new HashMap<String, Escalation>();
            buildData.setMetaData("Escalations", escalations);
        }
        Escalation e = new Escalation(id, escalationCode);
        escalations.put(id, e);
    return e;
  }
View Full Code Here

TOP

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

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.