/** * Modify the rule by adding/deleting the conditions. * * @param mainEntityId mainEntityId * @param strToCreateObject strToCreateObject * @param oprVsLstOfVals operatorAndLstOfValues * @param expression expression */ private static void modifyRule( String mainEntityId, StringBuffer strToCreateObject, Map<RelationalOperator, List<String>> oprVsLstOfVals, IExpression expression) { IQueryEntity queryEntity = expression.getQueryEntity(); EntityInterface deEntity = queryEntity.getDynamicExtensionsEntity(); Long deEntityId = deEntity.getId(); if (String.valueOf(deEntityId).equals(mainEntityId) && expression.numberOfOperands() != 0 && expression.getOperand(0) instanceof Rule) { processRules(strToCreateObject, oprVsLstOfVals, expression); } }
/** * @param strToCreateObject strToCreateObject * @param oprVsLstOfVals Map * @param expression expression */ private static void processRules( StringBuffer strToCreateObject, Map<RelationalOperator, List<String>> oprVsLstOfVals, IExpression expression) { ICondition idCondition = null; Rule rule = ((Rule) (expression.getOperand(0))); for (ICondition condition : rule) { AttributeInterface conditionAttr = condition.getAttribute(); String attrName = conditionAttr.getName(); if (attrName.equalsIgnoreCase("id")) { idCondition = processRuleForId(oprVsLstOfVals, condition); } else { processRuleForOtherAttributes(strToCreateObject, condition, conditionAttr, attrName); } } // rule.removeCondition(idCondition); }