Package org.jbpm.compiler.xml

Examples of org.jbpm.compiler.xml.XmlProcessReader


        System.out.println(xml);
        System.out.println("-------------------");
       
        SemanticModules modules = new SemanticModules();
        modules.addSemanticModule(new ProcessSemanticModule());
        XmlProcessReader reader = new XmlProcessReader(modules, getClass().getClassLoader());
        List<Process> processes = reader.read(new StringReader(xml));
        assertNotNull(processes);
        process = (RuleFlowProcess) processes.get(0);
        if (process == null) {
            throw new IllegalArgumentException("Failed to reload process!");
        }
View Full Code Here


       
        System.out.println(xml);
       
        SemanticModules modules = new SemanticModules();
        modules.addSemanticModule(new ProcessSemanticModule());
        XmlProcessReader reader = new XmlProcessReader(modules, getClass().getClassLoader());
        List<Process> processes = reader.read(new StringReader(xml));
        assertNotNull(processes);
        process = (RuleFlowProcess) processes.get(0);
        if (process == null) {
            throw new IllegalArgumentException("Failed to reload process!");
        }
View Full Code Here

    KnowledgeBuilderConfiguration conf = KnowledgeBuilderFactory.newKnowledgeBuilderConfiguration();
    ((PackageBuilderConfiguration) conf).initSemanticModules();
    ((PackageBuilderConfiguration) conf).addSemanticModule(new BPMNSemanticModule());
    ((PackageBuilderConfiguration) conf).addSemanticModule(new BPMNDISemanticModule());
//    ProcessDialectRegistry.setDialect("XPath", new XPathDialect());
    XmlProcessReader processReader = new XmlProcessReader(
          ((PackageBuilderConfiguration) conf).getSemanticModules(), getClass().getClassLoader());
    KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(conf);
    List<Process> processes = processReader.read(SimpleBPMNProcessTest.class.getResourceAsStream("/" + process));
        for (Process p : processes) {
            RuleFlowProcess ruleFlowProcess = (RuleFlowProcess) p;
            kbuilder.add(ResourceFactory.newReaderResource(
                    new StringReader(XmlBPMNProcessDumper.INSTANCE.dump(ruleFlowProcess))), ResourceType.BPMN2);
        }
View Full Code Here

    }

    public List<DroolsError> addProcessFromXml(final Resource resource) throws IOException {
      Reader reader = resource.getReader();
        PackageBuilderConfiguration configuration = packageBuilder.getPackageBuilderConfiguration();
        XmlProcessReader xmlReader = new XmlProcessReader( configuration.getSemanticModules(), packageBuilder.getRootClassLoader() );
       
        final ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
        final ClassLoader newLoader = this.getClass().getClassLoader();
        try {
            Thread.currentThread().setContextClassLoader( newLoader );
            String portRuleFlow = System.getProperty( "drools.ruleflow.port", "false" );
            Reader portedReader = null;
            if ( portRuleFlow.equalsIgnoreCase( "true" ) ) {
                portedReader = portToCurrentVersion( reader );
            } else {
                portedReader = reader;
            }
            List<Process> processes = xmlReader.read(portedReader);
            if (processes != null) {
                // it is possible an xml file could not be parsed, so we need to
                // stop null pointers
                for (Process process : processes) {
                    buildProcess(process, resource);
View Full Code Here

 
  public void testXML() throws IOException, SAXException {
    SemanticModules modules = new SemanticModules();
    modules.addSemanticModule(new BPMNSemanticModule());
    modules.addSemanticModule(new BPMNDISemanticModule());
        XmlProcessReader processReader = new XmlProcessReader(modules, getClass().getClassLoader());
        for (String processName: processes) {
      String original = slurp(BPMN2XMLTest.class.getResourceAsStream("/" + processName));
      List<Process> processes = processReader.read(BPMN2XMLTest.class.getResourceAsStream("/" + processName));
            assertNotNull(processes);
            assertEquals(1, processes.size());
            RuleFlowProcess p = (RuleFlowProcess) processes.get(0);
      String result = XmlBPMNProcessDumper.INSTANCE.dump(p, XmlBPMNProcessDumper.META_DATA_USING_DI);
      System.out.println(original);
View Full Code Here

    KnowledgeBuilderConfiguration conf = KnowledgeBuilderFactory.newKnowledgeBuilderConfiguration();
    ((PackageBuilderConfiguration) conf).initSemanticModules();
    ((PackageBuilderConfiguration) conf).addSemanticModule(new BPMNSemanticModule());
    ((PackageBuilderConfiguration) conf).addSemanticModule(new BPMNDISemanticModule());
//        ProcessDialectRegistry.setDialect("XPath", new XPathDialect());
    XmlProcessReader processReader = new XmlProcessReader(
            ((PackageBuilderConfiguration) conf).getSemanticModules(), getClass().getClassLoader());
    List<Process> processes = processReader.read(SimpleBPMNProcessTest.class.getResourceAsStream("/BPMN2-RuleTask.bpmn2"));
    assertNotNull(processes);
    assertEquals(1, processes.size());
    RuleFlowProcess p = (RuleFlowProcess) processes.get(0);
    assertNotNull(p);
    KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(conf);
View Full Code Here

    KnowledgeBuilderConfiguration conf = KnowledgeBuilderFactory.newKnowledgeBuilderConfiguration();
    ((PackageBuilderConfiguration) conf).initSemanticModules();
    ((PackageBuilderConfiguration) conf).addSemanticModule(new BPMNSemanticModule());
    ((PackageBuilderConfiguration) conf).addSemanticModule(new BPMNDISemanticModule());
//        ProcessDialectRegistry.setDialect("XPath", new XPathDialect());
    XmlProcessReader processReader = new XmlProcessReader(
            ((PackageBuilderConfiguration) conf).getSemanticModules(), getClass().getClassLoader());
    List<Process> processes = processReader.read(SimpleBPMNProcessTest.class.getResourceAsStream("/BPMN2-AdHocSubProcess.bpmn2"));
    assertNotNull(processes);
    assertEquals(1, processes.size());
    RuleFlowProcess p = (RuleFlowProcess) processes.get(0);
    assertNotNull(p);
    KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(conf);
View Full Code Here

    KnowledgeBuilderConfiguration conf = KnowledgeBuilderFactory.newKnowledgeBuilderConfiguration();
    ((PackageBuilderConfiguration) conf).initSemanticModules();
    ((PackageBuilderConfiguration) conf).addSemanticModule(new BPMNSemanticModule());
    ((PackageBuilderConfiguration) conf).addSemanticModule(new BPMNDISemanticModule());
//      ProcessDialectRegistry.setDialect("XPath", new XPathDialect());
    XmlProcessReader processReader = new XmlProcessReader(
          ((PackageBuilderConfiguration) conf).getSemanticModules(), getClass().getClassLoader());
    List<Process> processes = processReader.read(SimpleBPMNProcessTest.class.getResourceAsStream("/BPMN2-AdHocSubProcessAutoComplete.bpmn2"));
        assertNotNull(processes);
        assertEquals(1, processes.size());
        RuleFlowProcess p = (RuleFlowProcess) processes.get(0);
    KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(conf);
//    System.out.println(XmlBPMNProcessDumper.INSTANCE.dump(p));
View Full Code Here

    ((PackageBuilderConfiguration) conf).initSemanticModules();
    ((PackageBuilderConfiguration) conf).addSemanticModule(new BPMNSemanticModule());
    ((PackageBuilderConfiguration) conf).addSemanticModule(new BPMNDISemanticModule());
    ((PackageBuilderConfiguration) conf).addSemanticModule(new BPMNExtensionsSemanticModule());
//    ProcessDialectRegistry.setDialect("XPath", new XPathDialect());
    XmlProcessReader processReader = new XmlProcessReader(
          ((PackageBuilderConfiguration) conf).getSemanticModules(), getClass().getClassLoader());
    KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(conf);
    List<Process> processes = processReader.read(SimpleBPMNProcessTest.class.getResourceAsStream("/" + process));
    for (Process p : processes) {
        RuleFlowProcess ruleFlowProcess = (RuleFlowProcess)p;
      System.out.println(XmlBPMNProcessDumper.INSTANCE.dump(ruleFlowProcess));
      kbuilder.add(ResourceFactory.newReaderResource(
                                         new StringReader(XmlBPMNProcessDumper.INSTANCE.dump(ruleFlowProcess))), ResourceType.BPMN2);
View Full Code Here

        ((PackageBuilderConfiguration) conf).initSemanticModules();
        ((PackageBuilderConfiguration) conf).addSemanticModule(new BPMNSemanticModule());
        ((PackageBuilderConfiguration) conf).addSemanticModule(new BPMNDISemanticModule());
        ((PackageBuilderConfiguration) conf).addSemanticModule(new BPMNExtensionsSemanticModule());
//      ProcessDialectRegistry.setDialect("XPath", new XPathDialect());
        XmlProcessReader processReader = new XmlProcessReader(
            ((PackageBuilderConfiguration) conf).getSemanticModules(), getClass().getClassLoader());
        KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(conf);
        kbuilder.add(ResourceFactory.newReaderResource(new InputStreamReader(SimpleBPMNProcessTest.class.getResourceAsStream("/" + process))), ResourceType.BPMN2);
        if (!kbuilder.getErrors().isEmpty()) {
            for (KnowledgeBuilderError error: kbuilder.getErrors()) {
View Full Code Here

TOP

Related Classes of org.jbpm.compiler.xml.XmlProcessReader

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.