Thanks *Davide and laune* for your all suggestions.Davide u r right all
those are best practices suggested by client :) .Davide can we discuss
below example .how to rewrite this example using best practices (which is
mention by u and laune in your earlier posts)
Consider Bank Class which contains Account details
Acnt_holder_name
account_no
branch_name
we have some PreDefined exceptions in DB with error code
101-"account holder name can not be blank"
102-"account_no can not be null"
103-"account_no can not be blank"
104-"Wrong branch"
Rule "Base-Rule"
Salience 200
lock-on-active true
when
$Customer : Bank($account:account)
then
//Do nothing this is base rule for defining customer
end
rule "madatory-rule-1" extends "Base-Rule"
Salience 190
lock-on-active true
when
Account(Acnt_holder_name.trim =="") from $Customer
then
$Customer.AddNewException(101)
update($Customer);
end
rule "madatory-rule-2" extends "Base-Rule"
Salience 180
lock-on-active true
when
Account(account_no ==null) from $Customer
then
$Customer.AddNewException(102)
update($Customer);
end
rule "madatory-rule-3" extends "Base-Rule"
Salience 170
lock-on-active true
when
Account(account_no.trim=="") from $Customer
then
$Customer.AddNewException(103)
update($Customer);
end
rule "madatory-rule-4" extends "Base-Rule"
Salience 160
lock-on-active true
when
Account(branch_name=="mumbai") from $Customer
then
$Customer.AddNewException(103)
update($Customer);
end
rule "madatory-rule-5"
Salience 150
lock-on-active true
when
$Customer : Bank(exceptionList.size>0)
then
$Customer.setCustomerValidationSuccess(false)
drools.halt();
end
Here I want to avoid salience and update (Like this I am also using lots of
setter methods in my drools project.Now I am trying to use all these setter
methods without using UPDDATE.But in some cases rules are dependent on other
rules so I dnt have any other choice left .In such cases I am using *update*
keyword so other rules can use updated object fom working memory).
--
View this message in context:
http://drools.46999.n3.nabble.com/In-drools-what-is-the-exact-difference-...
Sent from the Drools: User forum mailing list archive at
Nabble.com.