j-easy / easy-rules

The simple, stupid rules engine for Java
https://github.com/j-easy/easy-rules/wiki
MIT License
4.86k stars 1.05k forks source link

how to use java library in rule yml file #349

Open SUSHIL161 opened 3 years ago

SUSHIL161 commented 3 years ago

i have to compare two list in return true if both are equals regardless of order. one list i will get from facts and one i need to keep in yaml file.

eg name: "datalake rule" description: "check whether target are covid or not" priority: 1 condition: "list.equals(Arrays.asList(\"A\"))." actions:

but getting below error [Error: unresolvable property or identifier: Arrays]

daidai21 commented 3 years ago

https://github.com/j-easy/easy-rules/blob/d4450831533e47a5c0cb361edb80dad43db228a4/easy-rules-mvel/src/test/java/org/jeasy/rules/mvel/MVELActionTest.java#L84-L87

https://github.com/j-easy/easy-rules/blob/d4450831533e47a5c0cb361edb80dad43db228a4/easy-rules-mvel/src/main/java/org/jeasy/rules/mvel/MVELCondition.java#L52-L60

You need to customize the initialization Parameter parserContext of class MVELAction.

SUSHIL161 commented 3 years ago

hi @daidai21 Thanks for reply but i need in yml file . eg "Arrays.asList(\"X\", \"Y\", \"Z\", \"A\").equals(target) "

i am getting below error [Error: unresolvable property or identifier: Arrays]

huangzhendong commented 1 year ago

So, how is everything going? Is there any progress about this issue :)