gpt4 book ai didi

org.jbpm.compiler.xml.XmlProcessReader.()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-20 00:03:40 27 4
gpt4 key购买 nike

本文整理了Java中org.jbpm.compiler.xml.XmlProcessReader.<init>()方法的一些代码示例,展示了XmlProcessReader.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XmlProcessReader.<init>()方法的具体详情如下:
包路径:org.jbpm.compiler.xml.XmlProcessReader
类名称:XmlProcessReader
方法名:<init>

XmlProcessReader.<init>介绍

暂无

代码示例

代码示例来源:origin: kiegroup/jbpm

@Override
public Process readProcess(String processXml) {
  KnowledgeBuilderConfigurationImpl configuration = new KnowledgeBuilderConfigurationImpl();
  SemanticModules modules = configuration.getSemanticModules();
  modules.addSemanticModule(new ProcessSemanticModule());
  XmlProcessReader xmlReader = new XmlProcessReader( modules, Thread.currentThread().getContextClassLoader() );
  try {
    List<Process> processes = xmlReader.read(new StringReader(processXml));
    return processes.get(0);
  } catch (Throwable t) {
    t.printStackTrace();
    return null;
  }
}

代码示例来源:origin: kiegroup/jbpm

@Override
  public Process readProcess(String processXml) {
    SemanticModules semanticModules = new SemanticModules();
    semanticModules.addSemanticModule(new BPMNSemanticModule());
    semanticModules.addSemanticModule(new BPMNExtensionsSemanticModule());
    semanticModules.addSemanticModule(new BPMNDISemanticModule());
    XmlProcessReader xmlReader = new XmlProcessReader(semanticModules, Thread.currentThread().getContextClassLoader());
    try {
      List<Process> processes = xmlReader.read(new StringReader(processXml));
      return processes.get(0);
    } catch (Throwable t) {
      t.printStackTrace();
      return null;
    }
  }
}

代码示例来源:origin: kiegroup/jbpm

public List<Process> addProcessFromXml(final Resource resource) throws IOException {
  Reader reader = resource.getReader();
  KnowledgeBuilderConfigurationImpl configuration = knowledgeBuilder.getBuilderConfiguration();
  XmlProcessReader xmlReader = new XmlProcessReader( configuration.getSemanticModules(), knowledgeBuilder.getRootClassLoader() );

代码示例来源:origin: kiegroup/jbpm

@Test
  public void testSimpleXml() throws Exception {
    SemanticModules modules = new SemanticModules();
    modules.addSemanticModule(new ProcessSemanticModule());
    XmlProcessReader reader = new XmlProcessReader(modules, getClass().getClassLoader());
    reader.read(new InputStreamReader(TestXml.class.getResourceAsStream("XmlTest.xml")));
    List<Process> processes = reader.getProcess();
    assertNotNull(processes);
    assertEquals(1, processes.size());
    RuleFlowProcess process = (RuleFlowProcess) processes.get(0);
    assertNotNull(process);

    String output = XmlRuleFlowProcessDumper.INSTANCE.dump(process);
    logger.info(output);
    reader = new XmlProcessReader(new SemanticModules(), getClass().getClassLoader());
    reader.read(new StringReader(output));
  }
}

代码示例来源:origin: kiegroup/jbpm

public void testInvalidXML() throws Exception, SAXException {
  SemanticModules modules = new SemanticModules();
  modules.addSemanticModule(new BPMNSemanticModule());
  modules.addSemanticModule(new BPMNDISemanticModule());
  XmlProcessReader processReader = new XmlProcessReader(modules, getClass().getClassLoader()) {
    @Override
    protected String processParserMessage(LinkedList<Object> parents, org.xml.sax.Attributes attr, String errorMessage) {
      setErrorMessage(super.processParserMessage(parents, attr, errorMessage));
      return errorMessage;
    }
  };
  processReader.read(BPMN2XMLTest.class.getResourceAsStream("/BPMN2-XMLProcessWithError.bpmn2"));
  assertNotNull(getErrorMessage());
  assertThat(getErrorMessage()).contains("Process Info: id:error.process, pkg:org.jbpm, name:errorprocess, version:1.0 \n" +
             "Node Info: id:_F8A89567-7416-4CCA-9CCD-BC1DDE870F1E name: \n" +
             "Parser message: (null: 45, 181): cvc-complex-type.2.4.a: Invalid content was found");
}

代码示例来源:origin: kiegroup/jbpm

public void testInvalidXMLInCompositeNode() throws Exception, SAXException {
  SemanticModules modules = new SemanticModules();
  modules.addSemanticModule(new BPMNSemanticModule());
  modules.addSemanticModule(new BPMNDISemanticModule());
  XmlProcessReader processReader = new XmlProcessReader(modules, getClass().getClassLoader()) {
    @Override
    protected String processParserMessage(LinkedList<Object> parents, org.xml.sax.Attributes attr, String errorMessage) {
      setErrorMessage(super.processParserMessage(parents, attr, errorMessage));
      return errorMessage;
    }
  };
  processReader.read(BPMN2XMLTest.class.getResourceAsStream("/BPMN2-XMLProcessWithErrorInCompositeNode.bpmn2"));
  assertNotNull(getErrorMessage());
  assertThat(getErrorMessage()).contains("Process Info: id:abc.abc, pkg:org.drools.bpmn2, name:abc, version:1.0 \n" +
             "Node Info: id:_47489F3D-FEBD-4452-B62E-B04EF191C6C3 name: \n" +
             "Parser message: (null: 24, 185): cvc-complex-type.2.4.a: Invalid content was found");
}

代码示例来源:origin: kiegroup/jbpm

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));

代码示例来源:origin: kiegroup/jbpm

protected List<Resource> buildAndDumpBPMN2Process(String process) throws SAXException, IOException { 
  KnowledgeBuilderConfiguration conf = KnowledgeBuilderFactory.newKnowledgeBuilderConfiguration();
  ((KnowledgeBuilderConfigurationImpl) conf).initSemanticModules();
  ((KnowledgeBuilderConfigurationImpl) conf).addSemanticModule(new BPMNSemanticModule());
  ((KnowledgeBuilderConfigurationImpl) conf).addSemanticModule(new BPMNDISemanticModule());
  ((KnowledgeBuilderConfigurationImpl) conf).addSemanticModule(new BPMNExtensionsSemanticModule());
  
  Resource classpathResource = ResourceFactory.newClassPathResource(process);
  // Dump and reread
  XmlProcessReader processReader 
    = new XmlProcessReader(((KnowledgeBuilderConfigurationImpl) conf).getSemanticModules(), getClass().getClassLoader());
  List<Process> processes = processReader.read(this.getClass().getResourceAsStream("/" + process));
  List<Resource> resources = new ArrayList<Resource>();
  for (Process p : processes) {
    RuleFlowProcess ruleFlowProcess = (RuleFlowProcess) p;
    String dumpedString = XmlBPMNProcessDumper.INSTANCE.dump(ruleFlowProcess);
    Resource resource = ResourceFactory.newReaderResource(new StringReader(dumpedString));
    resource.setSourcePath(classpathResource.getSourcePath());
    resource.setTargetPath(classpathResource.getTargetPath());
    resources.add(resource);
  }
  return resources;
}

代码示例来源:origin: kiegroup/jbpm

XmlProcessReader reader = new XmlProcessReader(modules, getClass().getClassLoader());
List<Process> processes = reader.read(new StringReader(xml));
assertNotNull(processes);

代码示例来源:origin: kiegroup/jbpm

XmlProcessReader reader = new XmlProcessReader(modules, getClass().getClassLoader());
List<Process> processes = reader.read(new StringReader(xml));
assertNotNull(processes);

代码示例来源:origin: org.kie.workbench.stunner/kie-wb-common-stunner-bpmn-backend

private List<Process> parseProcess(String serializedProcess) throws SAXException, IOException {
  return new XmlProcessReader(modules, getClass().getClassLoader()).read(new StringReader(serializedProcess));
}

代码示例来源:origin: org.jbpm/jbpm-flow-builder

@Override
public Process readProcess(String processXml) {
  KnowledgeBuilderConfigurationImpl configuration = new KnowledgeBuilderConfigurationImpl();
  SemanticModules modules = configuration.getSemanticModules();
  modules.addSemanticModule(new ProcessSemanticModule());
  XmlProcessReader xmlReader = new XmlProcessReader( modules, Thread.currentThread().getContextClassLoader() );
  try {
    List<Process> processes = xmlReader.read(new StringReader(processXml));
    return processes.get(0);
  } catch (Throwable t) {
    t.printStackTrace();
    return null;
  }
}

代码示例来源:origin: org.jbpm/jbpm-bpmn2

@Override
  public Process readProcess(String processXml) {
    SemanticModules semanticModules = new SemanticModules();
    semanticModules.addSemanticModule(new BPMNSemanticModule());
    semanticModules.addSemanticModule(new BPMNExtensionsSemanticModule());
    semanticModules.addSemanticModule(new BPMNDISemanticModule());
    XmlProcessReader xmlReader = new XmlProcessReader(semanticModules, Thread.currentThread().getContextClassLoader());
    try {
      List<Process> processes = xmlReader.read(new StringReader(processXml));
      return processes.get(0);
    } catch (Throwable t) {
      t.printStackTrace();
      return null;
    }
  }
}

代码示例来源:origin: org.jbpm/jbpm-flow-builder

public List<Process> addProcessFromXml(final Resource resource) throws IOException {
  Reader reader = resource.getReader();
  KnowledgeBuilderConfigurationImpl configuration = knowledgeBuilder.getBuilderConfiguration();
  XmlProcessReader xmlReader = new XmlProcessReader( configuration.getSemanticModules(), knowledgeBuilder.getRootClassLoader() );

代码示例来源:origin: org.kie.workbench.stunner/kie-wb-common-stunner-bpmn-backend

XmlProcessReader processReader = new XmlProcessReader(modules,
                           moduleClassLoader);
List<Process> processes = Collections.emptyList();

代码示例来源:origin: org.jbpm/org.jbpm.eclipse

modules.addSemanticModule(new BPMNDISemanticModule());
modules.addSemanticModule(new BPMNExtensionsSemanticModule());
XmlProcessReader xmlReader = new XmlProcessReader( modules, Thread.currentThread().getContextClassLoader() );
String xml = RuleFlowMigrator.convertReaderToString(isr);
Reader reader = new StringReader(xml);

代码示例来源:origin: org.jbpm/jbpm-bpmn2

public void testInvalidXML() throws Exception, SAXException {
  SemanticModules modules = new SemanticModules();
  modules.addSemanticModule(new BPMNSemanticModule());
  modules.addSemanticModule(new BPMNDISemanticModule());
  XmlProcessReader processReader = new XmlProcessReader(modules, getClass().getClassLoader()) {
    @Override
    protected String processParserMessage(LinkedList<Object> parents, org.xml.sax.Attributes attr, String errorMessage) {
      setErrorMessage(super.processParserMessage(parents, attr, errorMessage));
      return errorMessage;
    }
  };
  processReader.read(BPMN2XMLTest.class.getResourceAsStream("/BPMN2-XMLProcessWithError.bpmn2"));
  assertNotNull(getErrorMessage());
  assertThat(getErrorMessage()).contains("Process Info: id:error.process, pkg:org.jbpm, name:errorprocess, version:1.0 \n" +
             "Node Info: id:_F8A89567-7416-4CCA-9CCD-BC1DDE870F1E name: \n" +
             "Parser message: (null: 45, 181): cvc-complex-type.2.4.a: Invalid content was found");
}

代码示例来源:origin: org.jbpm/jbpm-bpmn2

public void testInvalidXMLInCompositeNode() throws Exception, SAXException {
  SemanticModules modules = new SemanticModules();
  modules.addSemanticModule(new BPMNSemanticModule());
  modules.addSemanticModule(new BPMNDISemanticModule());
  XmlProcessReader processReader = new XmlProcessReader(modules, getClass().getClassLoader()) {
    @Override
    protected String processParserMessage(LinkedList<Object> parents, org.xml.sax.Attributes attr, String errorMessage) {
      setErrorMessage(super.processParserMessage(parents, attr, errorMessage));
      return errorMessage;
    }
  };
  processReader.read(BPMN2XMLTest.class.getResourceAsStream("/BPMN2-XMLProcessWithErrorInCompositeNode.bpmn2"));
  assertNotNull(getErrorMessage());
  assertThat(getErrorMessage()).contains("Process Info: id:abc.abc, pkg:org.drools.bpmn2, name:abc, version:1.0 \n" +
             "Node Info: id:_47489F3D-FEBD-4452-B62E-B04EF191C6C3 name: \n" +
             "Parser message: (null: 24, 185): cvc-complex-type.2.4.a: Invalid content was found");
}

代码示例来源:origin: org.jbpm/jbpm-bpmn2

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));

代码示例来源:origin: org.jbpm/jbpm-bpmn2

protected List<Resource> buildAndDumpBPMN2Process(String process) throws SAXException, IOException { 
  KnowledgeBuilderConfiguration conf = KnowledgeBuilderFactory.newKnowledgeBuilderConfiguration();
  ((KnowledgeBuilderConfigurationImpl) conf).initSemanticModules();
  ((KnowledgeBuilderConfigurationImpl) conf).addSemanticModule(new BPMNSemanticModule());
  ((KnowledgeBuilderConfigurationImpl) conf).addSemanticModule(new BPMNDISemanticModule());
  ((KnowledgeBuilderConfigurationImpl) conf).addSemanticModule(new BPMNExtensionsSemanticModule());
  
  Resource classpathResource = ResourceFactory.newClassPathResource(process);
  // Dump and reread
  XmlProcessReader processReader 
    = new XmlProcessReader(((KnowledgeBuilderConfigurationImpl) conf).getSemanticModules(), getClass().getClassLoader());
  List<Process> processes = processReader.read(this.getClass().getResourceAsStream("/" + process));
  List<Resource> resources = new ArrayList<Resource>();
  for (Process p : processes) {
    RuleFlowProcess ruleFlowProcess = (RuleFlowProcess) p;
    String dumpedString = XmlBPMNProcessDumper.INSTANCE.dump(ruleFlowProcess);
    Resource resource = ResourceFactory.newReaderResource(new StringReader(dumpedString));
    resource.setSourcePath(classpathResource.getSourcePath());
    resource.setTargetPath(classpathResource.getTargetPath());
    resources.add(resource);
  }
  return resources;
}

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com