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

dsykes derek.sykes at gmail.com
Wed May 16 09:34:51 EDT 2012


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.


More information about the rules-users mailing list