[rules-users] Fwd: Double Handling

Wolfgang Laun wolfgang.laun at gmail.com
Fri Apr 16 06:13:42 EDT 2010


Well, I already suggested to you that the Drools Engine must be
*informed*about changes to facts if these changes should trigger any
rules.

In rule "Preset" you have

   $d.preset($i);

but this must be written as

   modify( $d ){
      preset( $i );
   }

-W

2010/4/16 Ade Timi <adeyinka.timi at nathean.com>

>  Changing the method name solved the build error problem.
>
> But now I’m having my initial number comparison problem. I am using a rule
> flow that runs preset 1st and then customer details. It is acting weird in
> that it never runs customer details with the cpointer == 2 condition. It
> only runs it when I change the condition to cpointer <= 2 and then its print
> statement returns the value 2! What am I doing wrong?
>
>
>
> *rule* "Joint App"
>
>       *ruleflow-group* "customer_details"
>
>       *when*
>
>             $d : IndividualDecision(cpointer == 2)
>
>       *then*
>
>             $d.setWfResult("Yes");
>
>             $d.setJointApp(*true*);
>
>             System.out.println("Customer pointer " + $d.getCpointer());
>
>             System.out.println("Customer Details(Joint App)? " +
> $d.getWfResult());
>
> *end*
>
>
>
> *rule* "Preset"
>
>       *ruleflow-group* "preset"
>
>       *when*
>
>             $d : IndividualDecision()
>
>             $i : Individual()
>
>       *then*
>
>             $d.preset($i);
>
>             System.out.println("Custpointer: " + $d.getCpointer());
>
>             System.out.println("Preset..........");
>
> *End*
>
> * *
>
> *public class IndividualDecision {*
>
> *      . . .*
>
> *      private int cpointer;*
>
> *      */**
>
>        * *@param* customerPointer the customerPointer to set
>
>        */
>
>       *public* *void* setCpointer(*int* cpointer) {
>
>             *this*.cpointer = cpointer;
>
>       }
>
>       /**
>
>        * *@return* the customerPointer
>
>        */
>
>       *public* *int* getCpointer() {
>
>             *return* cpointer;
>
>       }
>
>       /**
>
>        * *@param* ind.
>
>        * Preset for Calculator
>
>        */
>
>       *public* *void* preset(Individual ind) {
>
>             *this*.setDecision("Error");
>
>             *this*.setCpointer(2);
>
>             *this*.setDepositPercentage((ind.getDepositLomabard() /
> ind.getAmountFinanced()) * 100);
>
>             *this*.setAssetAgeInYears(ind.getAssetAgeYears()/12);
>
>       }**
>
> }
>
>
>
>
>  ------------------------------
>
> *From:* rules-users-bounces at lists.jboss.org [mailto:
> rules-users-bounces at lists.jboss.org] *On Behalf Of *Edson Tirelli
> *Sent:* 15 April 2010 14:59
> *To:* Rules Users List
> *Subject:* [rules-users] Fwd: Double Handling
>
>
>
>
>      Sorry, I meant to send this to the list.
>
>      Ade, let us know if that solves the problem.
>
>      Edson
>
> ---------- Forwarded message ----------
> From: *Edson Tirelli* <tirelli at post.com>
> Date: 2010/4/15
> Subject: Re: [rules-users] Double Handling
> To: Ade Timi <adeyinka.timi at nathean.com>
>
>
>
>    Ade,
>
>    There you go:
>
> https://jira.jboss.org/jira/browse/JBRULES-2424
>
>    You have:
>
>    public String setErrorMessage() {
>
>
>    This problem was fixed in M2 (trunk). Meanwhile, you can rename your
> method or use a trunk snapshot.
>
>
>
>     Edson
>
>
>
>
>
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20100416/3b076661/attachment.html 


More information about the rules-users mailing list