[rules-users] Validation flow - defer expression evaluation

zstlaw zstlawre at akamai.com
Mon Oct 24 10:59:09 EDT 2011


There are a couple different options available.

I haven't tried it but some of what you are trying to do sounds suspiciously
like what you are trying to do is a workfow process or rules plan.  Which
might mean you want to look at planner or consider how you are approaching
the problem.

If they were in the same group I know you can literally do what you want by
adding the salience keyword to one of your rules. example - 

rule "print mail messages"
salience -100 // run this after other rules have finished
dialect "mvel"
    when
        $m : Message( )
    then
        System.out.println( "Message was "+$m );
end

I am not sure if it works between groups though I thought there were ways to
state order of group activation but that has never been part of the
documentation I use so I can't help you much there.  But as a third option I
would suggest if you are using mvel you just use the feature of the language
to do null checks in the business logic if that is feasible for you. 
Example 

$var: user.?manager.name
    is supposedly functionally equivalent to writing:
if (user.manager != null) { $var=user.manager.name; } else { $var=null; }

So you might just be able to test the data more elegantly inline.  But it
really depends on what you are trying to do and why.

Hope this helped!  If not I expect someone more familiar with the planning
or enterprise tools may speak up.
Zachary

--
View this message in context: http://drools.46999.n3.nabble.com/Validation-flow-defer-expression-evaluation-tp3447883p3448375.html
Sent from the Drools: User forum mailing list archive at Nabble.com.



More information about the rules-users mailing list