Sorry, the actual error in my logic was
totally unrelated to the fragment below.
The problem was that the DQAttribute that should have matched
below was inserted by another rule, but the insertion was done at
a time when the checkViolations collection was still emtpy. And I
had forgotten the modify() after filling the checkViolations
collection.
So the rule "saw" an empty collection and that last condition did
not trigger. Once I corrected that, things started working :-)
On 08/03/2013 10:59 PM, Joe Ammann wrote:
Here's what I currently have (Drools 5.5.0 btw):
rule "R2030: UpdateDQAttribute"
dialect "mvel"
agenda-group "PROCESS_CHECKRESULTS"
when
pv : PriceViolation ( p : changedPrice.price, dqc :
check )
ps : PriceSeries ( id == p.seriesId )
i : Instrument ( id == ps.instrument.id )
dqa : DQAttribute ( rootId == i.id, objectId == p.id )
not dqcv : DQCheckViolation ( check.id == dqc.id ) from
dqa.checkViolations
then
# debug
for (DQCheckViolation dqcv : dqa.checkViolations) {
logger.debug("dqc: {}, dqcv: {}", dqc.id,
dqcv.check.id);
}
end
The rule fires and the log statement produces
PriceCheck: dqc:
6fc6636b-9b7c-4302-bce7-1680eec57830, dqcv:
6fc6636b-9b7c-4302-bce7-1680eec57830
The ids are the same, so I would have expected that last LHS
condition to avoid that the rule fires.
--
CU, Joe