When I tried this code snippet in a similar case
it gives me org.drools.rule.InvalidRulePackage: unknown:yy:xx Unexpected token 'loanBO'

this is my Bean Classes

class LoabBO {
    private Money loanAmount;
    public Money getLoanAmount() {
        return loanAmount;
    }

    void setLoanAmount(Money loanAmount) {
        this.loanAmount = loanAmount;
    }
}

class Money {
    private final BigDecimal amount;
    public double getAmountDoubleValue() {
        return amount.doubleValue();
    }
}

and this is my drl code

rule "test"
when
    loanBO : LoanBO()
    money : Money( amountDoubleValue > 980.0) from loanBO.getLoanAmount()
then
    // anything
end

On 11/10/06, Edson Tirelli <[EMAIL PROTECTED] > wrote:
   Using 3.0.x version, Steven's suggestion is probably the best. Using
the new version, you can use "from" as Geoffrey suggested. Something
like that:

when
   $p: Party()
   $c: Contact() from p.getContacts()
   $t : ContactType( name == "mobile" ) from $c.getContactType()
then
   //
end

Geoffrey Wiseman wrote:

> This is also a textbook case of where 'from' should work, from what
> I've seen - although I don't think that's been released yet.  Someone
> else could tell you more.
>
> On 11/10/06, * Steven Williams* <[EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED] >> wrote:
>
>     Hi Weily,
>
>     one way I think would work is
>
>     //explode party contracts
>     when
>         p : Party(c : contracts)
>     then
>         for(Iterator it = c.iterator();it.hasNext();) {
>             assert(it.next());
>         }
>     end
>
>     when
>         c : Contract(ct : contractType -> (ct.getName ().equals("mobile")))
>         p : Party(contracts contains c)
>     then
>         ....
>
>
>     On 11/10/06, * weily li* <[EMAIL PROTECTED]
>     <mailto:[EMAIL PROTECTED]>> wrote:
>
>         Here is such scenario.
>         First I create a party instance, which has a Set attribute.
>         The set contains all avariable contact mechnism for the party.
>         Here is the Bean class:
>
>         public class Party{
>          private Set contracts;
>         }
>
>         public   class Contact {
>          private ContactType contactType;
>          private String contactValue;
>
>         }
>
>         public   class ContactType {
>          private String name;
>          private String comments;
>         }
>
>
>         Now at rule, I want to select these Parties whose contact type
>         support mobile phone..
>         Could you share such a sample ?
>
>         Thanks
>         Best Regards
>         Weily
>
>
>
>
>
>     --
>     Steven Williams
>
>     Supervising Consultant
>
>     Object Consulting
>     Office: 8615 4500 Mob: 0439 898 668 Fax: 8615 4501
>     [EMAIL PROTECTED]
>     <mailto:[EMAIL PROTECTED]>
>     www.objectconsulting.com.au < http://www.objectconsulting.com.au>
>
>     consulting | development | training | support
>     our experience makes the difference
>
>
>
>
> --
> Geoffrey Wiseman



--
  ---
  Edson Tirelli
  Software Engineer - JBoss Rules Core Developer
  Office: +55 11 3124-6000
  Mobile: +55 11 9218-4151
  JBoss, a division of Red Hat @ www.jboss.com

  IT executives: Red Hat still #1 for value
  http://www.redhat.com/promo/vendor/


---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email




--
Ali Abdel-Aziz
http://www.aliabdelaziz.com
http://aabdelaziz.blogspot.com

Reply via email to