/** * 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); }
public int compare(IExpression o1, IExpression o2) { Integer i1 = o1.getExpressionId(); Integer i2 = o2.getExpressionId(); return i1.compareTo(i2); }