Two ways you could do it:
List list = workingMemory.getObjects(Target.class);
or use a query:
query "target objects"
QueryResults results = workingMemory.getQueryResults ( "target objects" );
Suppose my client code initially asserts two Facts into WorkingMemory
instance: one Source object and one TargetOne object. As the rules get
applied, some of the rules may assert additional Target facts into WM. How
can I retrieve all of the Target facts (however many were created) from the
WorkingMemory after fireAllRules() method was called (regardless of how many
Target objects were created as a result)?!
I will not know the concrete type of the target object types that were
asserted into WM instance, as they can be as many as 7 class sub-types
(TargetOne, TargetTwo, TargetThree), though they will all share a common
super-class (com.mypackage.Target). Can someone show an example on how to
fetch the resulting Target objects after fireAllRules() is called and filter
out the Target objects?
Thanks in advance -
View this message in context: http://www.nabble.com/Fetching-Facts-from-WM...-tf3550451.html#a9912199
Sent from the drools - user mailing list archive at Nabble.com.
rules-users mailing list