Search in sources :

Example 6 with BPMNDISemanticModule

use of io.automatiko.engine.workflow.bpmn2.xml.BPMNDISemanticModule in project jbpm by kiegroup.

the class JbpmBpmn2TestCase method buildAndDumpBPMN2Process.

// Important to test this since persistence relies on this
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;
}
Also used : RuleFlowProcess(org.jbpm.ruleflow.core.RuleFlowProcess) KnowledgeBuilderConfigurationImpl(org.drools.compiler.builder.impl.KnowledgeBuilderConfigurationImpl) XmlProcessReader(org.jbpm.compiler.xml.XmlProcessReader) Resource(org.kie.api.io.Resource) ArrayList(java.util.ArrayList) Process(org.kie.api.definition.process.Process) RuleFlowProcess(org.jbpm.ruleflow.core.RuleFlowProcess) BPMNExtensionsSemanticModule(org.jbpm.bpmn2.xml.BPMNExtensionsSemanticModule) BPMNDISemanticModule(org.jbpm.bpmn2.xml.BPMNDISemanticModule) BPMNSemanticModule(org.jbpm.bpmn2.xml.BPMNSemanticModule) StringReader(java.io.StringReader) KnowledgeBuilderConfiguration(org.kie.internal.builder.KnowledgeBuilderConfiguration)

Example 7 with BPMNDISemanticModule

use of io.automatiko.engine.workflow.bpmn2.xml.BPMNDISemanticModule in project kogito-runtimes by kiegroup.

the class BPMN2ProcessProviderImpl method configurePackageBuilder.

public void configurePackageBuilder(KnowledgeBuilder knowledgeBuilder) {
    KnowledgeBuilderConfigurationImpl conf = ((KnowledgeBuilderImpl) knowledgeBuilder).getBuilderConfiguration();
    if (conf.getSemanticModules().getSemanticModule(BPMNSemanticModule.BPMN2_URI) == null) {
        conf.addSemanticModule(new BPMNSemanticModule());
        conf.addSemanticModule(new BPMNDISemanticModule());
        conf.addSemanticModule(new BPMNExtensionsSemanticModule());
    }
}
Also used : BPMNExtensionsSemanticModule(org.jbpm.bpmn2.xml.BPMNExtensionsSemanticModule) BPMNDISemanticModule(org.jbpm.bpmn2.xml.BPMNDISemanticModule) KnowledgeBuilderConfigurationImpl(org.drools.compiler.builder.impl.KnowledgeBuilderConfigurationImpl) KnowledgeBuilderImpl(org.drools.compiler.builder.impl.KnowledgeBuilderImpl) BPMNSemanticModule(org.jbpm.bpmn2.xml.BPMNSemanticModule)

Aggregations

BPMNDISemanticModule (org.jbpm.bpmn2.xml.BPMNDISemanticModule)7 BPMNSemanticModule (org.jbpm.bpmn2.xml.BPMNSemanticModule)7 SemanticModules (org.drools.core.xml.SemanticModules)4 XmlProcessReader (org.jbpm.compiler.xml.XmlProcessReader)4 KnowledgeBuilderConfigurationImpl (org.drools.compiler.builder.impl.KnowledgeBuilderConfigurationImpl)3 BPMNExtensionsSemanticModule (org.jbpm.bpmn2.xml.BPMNExtensionsSemanticModule)3 Collection (java.util.Collection)2 KnowledgeBuilderImpl (org.drools.compiler.builder.impl.KnowledgeBuilderImpl)2 RuleFlowProcess (org.jbpm.ruleflow.core.RuleFlowProcess)2 Process (org.kie.api.definition.process.Process)2 StringReader (java.io.StringReader)1 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 PostConstruct (javax.annotation.PostConstruct)1 Diff (org.custommonkey.xmlunit.Diff)1 Difference (org.custommonkey.xmlunit.Difference)1 DifferenceListener (org.custommonkey.xmlunit.DifferenceListener)1 ElementNameAndAttributeQualifier (org.custommonkey.xmlunit.ElementNameAndAttributeQualifier)1 Resource (org.kie.api.io.Resource)1 KnowledgeBuilderConfiguration (org.kie.internal.builder.KnowledgeBuilderConfiguration)1