[rules-users] Events - Determining the Fact Pattern

David Boaz davidb at dbmotion.com
Sun Mar 8 08:41:55 EDT 2009


Hi all,

Is it possible to determine the Pattern that ‘produced’ a given Fact? For
example, assuming we have the following rule and event handler:

rule r1
	when 
		p1:Person(...)
		p2:Person(...)
	then
	...
end

protected class MyAgendaEventHandler extends
	    DefaultAgendaEventListener {

	@Override
	public void
afterActivationFired(org.drools.event.rule.AfterActivationFiredEvent event)
{
		String ruleName = event.getActivation().getRule().getName();
		KnowledgeRuntime knowledgeRuntime = event.getKnowledgeRuntime();
		for (FactHandle factHandle : event.getActivation().getFactHandles()) {
			Object fact = knowledgeRuntime.getObject(factHandle);
			Pattern pattern= ?;
		}
	}
}

Is it possible to determine the Pattern that originate a Person object? If
yes, how the pattern is identified?

Thanks, David
-- 
View this message in context: http://www.nabble.com/Events---Determining-the-Fact-Pattern-tp22397570p22397570.html
Sent from the drools - user mailing list archive at Nabble.com.





More information about the rules-users mailing list