-
Bug
-
Resolution: Won't Do
-
Major
-
None
-
7.22.0.Final
-
None
-
NEW
-
NEW
version : `7.22.0.Final`
- this is my rule:
```
package org.zhangnix.droolsdemo;
import org.zhangnix.droolsdemo.model.DroolsContext;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import java.math.BigDecimal;
import java.util.List;
import java.util.Date;
import java.lang.Boolean;
import java.lang.String;
import java.lang.Integer;
function boolean checkGoodsCount(Integer currentGoodsCount,String jsonString)Unknown macro: { JSONObject context = JSON.parseObject(jsonString); int goodsCount = context.getInteger("goodsCount"); String compareType = context.getString("compareType"); switch (compareType) { case "M": return currentGoodsCount > goodsCount; case "E": return currentGoodsCount == goodsCount; case "EM": return currentGoodsCount >= goodsCount; default: return false; } }
rule "Activity conditions"
when
$droolsContext:DroolsContext();
eval(checkGoodsCount($droolsContext.getCurrentGoodsCount(),'
'));
then
end
```
I use jsonString as the parameter of the function and i get a error:
> Syntax error on tokens, delete these tokens
this is my generate java file:
```
public static boolean eval0( org.zhangnix.droolsdemo.model.DroolsContext $droolsContext
) throws java.lang.Exception {
Boolean $eval$result$ = ( checkGoodsCount($droolsContext.getCurrentGoodsCount(),"
") );
return $eval$result$ == null ? false : $eval$result$.booleanValue();
}
```
When parsing jsonString, there is no backslash (
) before the quotes. Please tell me what should I do to pass jsonString correctly.