private void addHelloWorldRule() throws Exception { RuleManager ruleManager = getOsgiService(RuleManager.class); ruleManager.addImport("org.openengsb.domain.example.ExampleDomain"); ruleManager.addGlobal("org.openengsb.domain.example.ExampleDomain", "example"); RuleBaseElementId id = new RuleBaseElementId(RuleBaseElementType.Rule, "hello1"); String rule = readRule(); ruleManager.add(id, rule); }
protected void addWorkflow(String workflow) throws IOException, RuleBaseException { if (ruleManager.get(new RuleBaseElementId(RuleBaseElementType.Process, workflow)) == null) { InputStream is = getClass() .getClassLoader() .getResourceAsStream("rulebase/org/openengsb/" + workflow + ".rf"); String testWorkflow = IOUtils.toString(is); RuleBaseElementId id = new RuleBaseElementId(RuleBaseElementType.Process, workflow); ruleManager.add(id, testWorkflow); IOUtils.closeQuietly(is); } }