[rules-users] Hide a Rule that has fired

Wolfgang Laun wolfgang.laun at gmail.com
Mon Feb 10 23:20:17 EST 2014


Normally people don't worry about such a "one shot" rule co-existing
with application specific logic. Job is retracted and the rule remains
but inactive. If you really want to separate the "up front" logic from
the business logic you can use two rule bases and two connected
sessions. The second session object must be made available as a
"global" to the first session and the insert simply uses that. (What
you have with the JobMapRule and whatever rules come later is the
simplest case of a "staging" design pattern.)

global KieSession nextSession

rule  "JobMapRule"
...
    nextSession.insert(incomingData);
...
end

-W

On 11/02/2014, mvanders <mark.vandersteen at servicestream.com.au> wrote:
> Hi all,
>
> This is more visual aid when reviewing Test Scenarios than a must have but,
> is it possible to "hide" a rule that has fired from the list of fired
> rules.
>
> If you look at the below Rule "JobMapRule", once it has fired and populated
> the incomnigData Map it is no longer necessary to know if the rule fired or
> not. Its purely a rule to setup up Fact details.
>
> The below rule will appear in every Test Scenario but it is not necessary
> to
> be seen, is there a way to "remove" it from the "fired rules" list that
> appears. Just trying to make this as simple as possible for the business
> user so they don't see things that they don't need to worry about when
> creating to Test Scenarios
>
> rule "JobMapRule"
>     dialect "mvel"
>     when
>         job : Job( )
>     then
>         Map incomingData = new HashMap();
>
>         incomingData.put('workType', job.workType);
>         incomingData.put('status', job.status);
>
>         insert(incomingData)
>         retract(job)
> end
>
> Cheers
> Mark
>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Hide-a-Rule-that-has-fired-tp4028051.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>


More information about the rules-users mailing list