use of org.jbpm.compiler.xml.core.SemanticModules in project kogito-runtimes by kiegroup.
the class SemanticKnowledgeBuilderConfigurationImpl method initSemanticModules.
public void initSemanticModules() {
this.semanticModules = new SemanticModules();
RulesSemanticModule ruleModule = new RulesSemanticModule("http://ddefault");
this.semanticModules.addSemanticModule(new WrapperSemanticModule("http://drools.org/drools-5.0", ruleModule));
this.semanticModules.addSemanticModule(new WrapperSemanticModule("http://drools.org/drools-5.2", ruleModule));
// split on each space
String[] locations = getChainedProperties().getProperty("semanticModules", "").split("\\s");
// load each SemanticModule
for (String moduleLocation : locations) {
// trim leading/trailing spaces and quotes
moduleLocation = moduleLocation.trim();
if (moduleLocation.startsWith("\"")) {
moduleLocation = moduleLocation.substring(1);
}
if (moduleLocation.endsWith("\"")) {
moduleLocation = moduleLocation.substring(0, moduleLocation.length() - 1);
}
if (!moduleLocation.equals("")) {
loadSemanticModule(moduleLocation);
}
}
}
use of org.jbpm.compiler.xml.core.SemanticModules in project kogito-runtimes by kiegroup.
the class TestXml method testSimpleXml.
@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));
}
use of org.jbpm.compiler.xml.core.SemanticModules in project kogito-runtimes by kiegroup.
the class XmlRuleFlowProcessDumper method readProcess.
@Override
public Process readProcess(String processXml) {
SemanticKnowledgeBuilderConfigurationImpl configuration = new SemanticKnowledgeBuilderConfigurationImpl();
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;
}
}
use of org.jbpm.compiler.xml.core.SemanticModules in project kogito-runtimes by kiegroup.
the class XmlBPMNProcessDumper method readProcess.
@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;
}
}
Aggregations