use of org.jbpm.bpmn2.xml.BPMNExtensionsSemanticModule in project jbpm 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());
}
}
use of org.jbpm.bpmn2.xml.BPMNExtensionsSemanticModule 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;
}
Aggregations