Search in sources :

Example 16 with EmptyNullException

use of com.duangframework.core.exceptions.EmptyNullException in project duangframework by tcrct.

the class AutoCreateDrlFile method createRuleWhen.

private static String createRuleWhen(List<ParamItem> paramItemList) {
    if (ToolsKit.isEmpty(paramItemList)) {
        throw new EmptyNullException("paramItemList is null");
    }
    StringBuilder paramItemString = new StringBuilder();
    int size = paramItemList.size();
    for (int i = 0; i < size; i++) {
        ParamItem paramItem = paramItemList.get(i);
        paramItemString.append("$ruleMap_").append(paramItem.getKey()).append(" : Map(this[\"").append(paramItem.getKey()).append("\"]");
        paramItemString.append(" " + paramItem.getOperatorEnum().getValue() + " ");
        Object valueObj = paramItem.getValue();
        if (valueObj instanceof String) {
            paramItemString.append("\"").append(valueObj).append("\"");
        } else {
            paramItemString.append(valueObj);
        }
        paramItemString.append(");");
        if (i < (size - 1)) {
            paramItemString.append(ENTER_FIELD).append(TAB_FIELD).append(TAB_FIELD);
        }
    }
    return paramItemString.toString();
}
Also used : ParamItem(com.duangframework.rule.entity.ParamItem) EmptyNullException(com.duangframework.core.exceptions.EmptyNullException)

Aggregations

EmptyNullException (com.duangframework.core.exceptions.EmptyNullException)16 IOException (java.io.IOException)2 Method (java.lang.reflect.Method)2 Document (org.bson.Document)2 Bson (org.bson.conversions.Bson)2 Mapping (com.duangframework.core.annotation.mvc.Mapping)1 Service (com.duangframework.core.annotation.mvc.Service)1 Rpc (com.duangframework.core.annotation.rpc.Rpc)1 AsyncContext (com.duangframework.core.common.dto.http.request.AsyncContext)1 HttpRequest (com.duangframework.core.common.dto.http.request.HttpRequest)1 HttpResponse (com.duangframework.core.common.dto.http.response.HttpResponse)1 RpcException (com.duangframework.core.exceptions.RpcException)1 ServiceException (com.duangframework.core.exceptions.ServiceException)1 Action (com.duangframework.mvc.core.Action)1 RpcAction (com.duangframework.rpc.common.RpcAction)1 ParamItem (com.duangframework.rule.entity.ParamItem)1 RuleParam (com.duangframework.rule.entity.RuleParam)1 RuleResult (com.duangframework.rule.entity.RuleResult)1 RuleInfoModel (com.duangframework.rule.entity.generate.RuleInfoModel)1 BasicDBObject (com.mongodb.BasicDBObject)1