[rules-users] use of enum with "in" on LHS

Wolfgang Laun wolfgang.laun at gmail.com
Wed May 16 10:26:19 EDT 2012


Regrettably, this is just a string substitution, not caring what it
is, or what comes before or after.
-W

On 16/05/2012, dsykes <derek.sykes at gmail.com> wrote:
> Hi there,
>
> I have a rule where I would like human-readable rule to have a comma
> separated list of enum constants in it, however I can't find a way to get
> this working.
>
> DSLR file:
>
> import com.test.Report;
> import com.test.RulesResult;
> import com.test.State;
>
> rule "Test rule"
>     when
>         the received object
>         - state is NEW, MODIFY
>     then
>         #unimportant
> end
>
> DSL file:
>
> [*][when]the received object=result : RulesResult();$stm : Report()
> [*][when]- state is {stateList}=state in (State.{stateList})
>
> Class Report has a property called state which is an enum of type State
> which has a number of constants including NEW and MODIFY.
>
> When I run this I get:
>
> org.drools.RuntimeDroolsException: Exception executing predicate ( state ==
> State.NEW || state == MODIFY)
>
> As you can see only the first constant is being qualified with the enum
> class.  Can anyone help me with how to do this properly?
>
> Thanks,
> Derek
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/use-of-enum-with-in-on-LHS-tp3997081.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