Thanks your code works well (extract the name of all the rules and name
of the package). I suppose there is nothing we ca do with guvnor. May be
export all in guvnor so we have a 'snapshot' of guvnor when the package
was build and deployed or archive the package.
You mean put a Map as attribute in MapPojo Class (not extending anymore
HashMap) and in the subclass MapTest1, MapTest2... extending MapPojo put
set and get method to access attribute of this map?
Thanks for your help
Le 8/03/2011 23:37, Vincent Legendre a écrit :
> Yes i created rueles with guided editor and it's working with
my
> attribute. is there a way to remove "empty", "entrySet",
"keySet",
> "clone",... herited from Map. So i would have only the attribute i
> have defined?
Don't make the POJO extends Map, but containing a map.
> i have always used drl file instead of package. If i deploy a
> file.pkg, is there a way to know what's in it? If i deploy something,
> i just want to be able later to very that all is well what i think if
> i have a doubt (easy with drl file).
try this (the only trick is to compact the rules that comes from a
decision table into one main log line) :
public static void dumpKbContent(KnowledgeBase knowledgeBase) {
System.out.println("================ " + ruleSet + "
================");
// Dump content
for (KnowledgePackage p : knowledgeBase.getKnowledgePackages()) {
System.out.println("-o0o- Package " + p.getName() + "
-o0o-");
System.out.println("Processes : ");
for (Process flow : p.getProcesses()) {
System.out.println(" - " + flow.getName());
}
System.out.println("Rules : ");
String lastRuleName = "";
for (Rule rule : p.getRules()) {
String ruleName = extractMainTableName(rule.getName());
if (!ruleName.equals(lastRuleName)) {
System.out.println(" - " + ruleName);
lastRuleName = ruleName;
}
}
System.out.println("-o0o- End Package " + p.getName() + "
-o0o-");
}
System.out.println("================ END " + ruleSet + "
================");
}
private static String extractMainTableName(String ruleName) {
// tables
Pattern p = Pattern.compile("(.*)_[0-9]+");
Matcher m = p.matcher(ruleName);
if (m.matches()) {
return m.group(1) + " ... table";
} else {
return ruleName;
}
}
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users