コード例 #1
0
  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);
  }
コード例 #2
0
 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);
   }
 }