[rules-users] how to check if a global has been declared in a rule
gs76pl
gstasica at pacemetrics.com
Wed Feb 9 10:24:35 EST 2011
hi,
is it possible to check if a rule has been defined with a global as below?
global MyObject obj;
rule
when
then
Basically, i'm running below code:
ksession = kbase.newStatefulKnowledgeSession();
ksession.setGlobal("obj", new MyObject());
but if a rule doesn't have global definition my code throws an exception.
What i'd like to do is something like
ksession.getGlobal('"obj") or ksession.checkGlobalExist('"obj").
Unfortunately the first method doesn't work as it doesn't check if a global
has been declared in a rule
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/how-to-check-if-a-global-has-been-declared-in-a-rule-tp2459143p2459143.html
Sent from the Drools - User mailing list archive at Nabble.com.
More information about the rules-users
mailing list