[rules-users] Update function usage for java objects to be retrieved for database update
dbfree75
wbismuth at yahoo.fr
Tue May 24 19:55:45 EDT 2011
I'm still using such solution .
Here an example of rule where I nees to set the
originalPropertyValuationLoan :
rule "OriginalPropertyValuationLoan - NbSecuredGaranteeUnderLoan >= 1 -
garantee H - postCode equivalent - initialValue equivalent"
no-loop
salience 970
dialect "mvel"
when
$controlFact : ControlFact(phase == "INITIAL")
$loanEvaluated : loanEvaluated(nbSecuredGaranteeUnderLoan >= 1,
originalPropertyValuationLoan == null)
$loan : loan() from $loanEvaluated.loan
$garantee : garantee(typegarantee.code == "H" , initialValue != null) from
$loan.garantees
$postCodes : Set(size == 1)
from accumulate(
garantee(typegarantee.code == "H", $n :
postCodeInGarantee) from $loan.garantees,
collectSet($n)
)
$garantees : Set(size == 1)
from accumulate(
garantee(typegarantee.code == "H" ||
typegarantee.code == "O", $n : typegarantee.code) from $loan.garantees,
collectSet($n)
)
$initialValue : Set(size == 1)
from accumulate(
garantee(typegarantee.code == "H", $n : initialValue ) from $loan.garantees,
collectSet($n)
)
then
$loanEvaluated.originalPropertyValuationLoan = $garantee.initialValue
update($loanEvaluated)
#System.out.println("OriginalPropertyValuationLoan -
NbSecuredGaranteeUnderLoan > 1 : " +
$loan.loanEvaluated.originalPropertyValuationLoan);
end
In case this rule isn't fired because any of these conditions isn't set, on
update after any other property has been set this rule will be fired again
--
View this message in context: http://drools.46999.n3.nabble.com/Update-function-usage-for-java-objects-to-be-retrieved-for-database-update-tp2981879p2982338.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
More information about the rules-users
mailing list