[rules-users] Evaluating an attribute of an object in Arraylist

Chris Woodrow woodrow.chris at gmail.com
Wed Sep 26 07:48:31 EDT 2007


Hi,
Doesn't (client == $motorista.nome) work?

2007/9/26, Rafael Alcemar <rafael.alcemar at gmail.com>:
>
>  Hello guys, i'm trying to seek an object in an ArrayList, but I don't
> know how I do it. I'm inserting this list as a global variable into drools,
> but I'd like to check if there is an ojbect in this list with a specific
> name. Could Anybody help me? The code is below:
>
> global java.util.List locacoes
>
> rule "Cliente pode alugar"
>     when
>         $motorista : umMotorista()
> //        $list : ArrayList() from collect( umLocacaoImediata( cliente ==
> $motorista(nome) ) )
>     then
>         $motorista.setPodeAlugar(false);
>         System.out.println($motorista.getNome() + " já possui uma
> alocacao");
>         update($motorista);
> end
>
> I'm trying to compare the attribute cliente from umLocacaoImediata with
> the attribute nome from motorista. How do I do it?
>
> If anybody can help me with the right way to do it, answer this mail,
> please.
>
> Rafael Alcemar
>
> _______________________________________________
> 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/20070926/99341522/attachment.html 


More information about the rules-users mailing list