Package org.jbpm.bpmn2.core

Examples of org.jbpm.bpmn2.core.Escalation


 
  public Object start(final String uri, final String localName,
      final Attributes attrs, final ExtensibleXmlParser parser)
      throws SAXException {
    parser.startElementBuilder(localName, attrs);
    Association association = new Association();
    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");
   
View Full Code Here


 
  public Object start(final String uri, final String localName,
      final Attributes attrs, final ExtensibleXmlParser parser)
      throws SAXException {
    parser.startElementBuilder(localName, attrs);
    DataStore store = new DataStore();
    store.setId(attrs.getValue("id"));
    store.setName(attrs.getValue("name"));
    final String itemSubjectRef = attrs.getValue("itemSubjectRef");
    store.setItemSubjectRef(itemSubjectRef);
    Map<String, ItemDefinition> itemDefinitions = (Map<String, ItemDefinition>)
      ((ProcessBuildData) parser.getData()).getMetaData("ItemDefinitions");
    // retrieve type from item definition
    //FIXME we bypass namespace resolving here. That's not a good idea
    // when we start having several documents, with imports.
    String localItemSubjectRef = itemSubjectRef.substring(
        itemSubjectRef.indexOf(":") +1);
    DataType dataType = new ObjectDataType();
    if (itemDefinitions != null) {
      ItemDefinition itemDefinition = itemDefinitions.get(localItemSubjectRef);
      if (itemDefinition != null) {
        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>();
View Full Code Here

    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 Object start(final String uri, final String localName,
                  final Attributes attrs, final ExtensibleXmlParser parser)
      throws SAXException {
    parser.startElementBuilder(localName, attrs);
    return new Definitions();
  }
View Full Code Here

  }

  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

TOP

Related Classes of org.jbpm.bpmn2.core.Escalation

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.