[rules-users] Need source code for Drools Database Interface

Mauricio Salatino salaboy at gmail.com
Sat Feb 4 11:01:29 EST 2012


You will need to query the text of the rule from the database and then
use the knowledge builder with a ByteArrayResource(rules.getBytes())
Something like this:

KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();



        String rule = "package test;\n"
                + "import
org.drools.mas.kmr2.mygridsharedclasses.MySerializableObject;\n"
                + "rule \"test\"\n"
                + "  when\n"
                + "       $o: MySerializableObject()\n"
                + "  then\n"
                + "      System.out.println(\"Rule Fired! -> Name:
\"+$o.getName() + \"Age: \"+$o.getAge());\n"
                + " end\n";

        kbuilder.add(new ByteArrayResource(rule.getBytes()),
                ResourceType.DRL);


You need to do your homework and then comeback here if you have
questions. Did you read the docs?
Cheers
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users



-- 
 - CTO @ http://www.plugtree.com
 - MyJourney @ http://salaboy.wordpress.com
 - Co-Founder @ http://www.jugargentina.org
 - Co-Founder @ http://www.jbug.com.ar

 - Salatino "Salaboy" Mauricio -




More information about the rules-users mailing list