[rules-users] Accessing globals after FireAllRules

sdinoo sdinoo at gmail.com
Thu May 26 11:33:49 EDT 2011


I have a rule flow that has two tasks that insert global value called ndc11


In the ProcessTest.java (using the sample program) I am trying this code
			ksession.startProcess("com.drughistory");
			ksession.fireAllRules();
			NdcMaster myNdc = (NdcMaster)ksession.getGlobal("ndc11");
			System.out.println(">>>>>>" + myNdc.getNdc11()); //THIS IS LINE 53

CONSOLE OUTPUT
Inserted drug with ABCDEFGH
Found Global ABCDEFGH
java.lang.NullPointerException
	at rules.tester.ProcessTest.main(ProcessTest.java:53)

All I want to do is access the inserted object and use the same - Can
someone please help?


DROOLS FILE 
rule "getDrugMaster" ruleflow-group "DUR" dialect "java" salience 100 
	when
	dc: DurClaim(  )
	then
	ndc11 = ClaimsHistoryHelper.getClaimDrugRecord(dc.getProductSvcID());
	insert(ndc11);
	System.out.println("Inserted drug with " + ndc11.getNdc11());
	
end

rule "Get History Claims" ruleflow-group "getClaimHistory" dialect "java"
salience 99
	when
	n: NdcMaster( ndc11 == "ABCDEFGH" )
	then
	insert(ndc11);
	System.out.println("Found Global " + n.getNdc11());
end



--
View this message in context: http://drools.46999.n3.nabble.com/Accessing-globals-after-FireAllRules-tp2989144p2989144.html
Sent from the Drools: User forum mailing list archive at Nabble.com.



More information about the rules-users mailing list