Ejemplo n.º 1
0
 /**
  * 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);
   }
 }
Ejemplo n.º 2
0
 /**
  * Adds main protocol object (CS/CP) to the query clone if its not present.
  *
  * @param queryDetailsObj queryDetailsObj
  * @param mapEntity mapEntity
  * @param dagPanel dagPanel
  * @return queryClone Modified query
  */
 private static IQuery addMainProtocolObjInQuery(
     QueryDetails queryDetailsObj, EntityInterface mapEntity, DAGPanel dagPanel) {
   IQuery queryClone = new DyExtnObjectCloner().clone(queryDetailsObj.getQuery());
   queryDetailsObj.setQuery(queryClone);
   String mainEntityId = "";
   boolean isMainObjPresent = false;
   IQuery originalQuery = queryDetailsObj.getQuery();
   IConstraints constraints = originalQuery.getConstraints();
   Set<IQueryEntity> queryEntities = constraints.getQueryEntities();
   EntityInterface mainEntity = null;
   for (IQueryEntity queryEntity : queryEntities) {
     if (queryEntity.getDynamicExtensionsEntity().getName().equals(Variables.mainProtocolObject)) {
       mainEntity = queryEntity.getDynamicExtensionsEntity();
       mainEntityId = mainEntity.getId().toString();
       isMainObjPresent = true;
       break;
     }
   }
   if (isMainObjPresent && queryDetailsObj.getSessionData().isSecurityRequired()) {
     StringBuffer strToCreateObject = new StringBuffer();
     Map<RelationalOperator, List<String>> oprVsLstOfVals =
         new HashMap<RelationalOperator, List<String>>();
     callModifyRule(mainEntityId, strToCreateObject, constraints, oprVsLstOfVals);
     dagPanel.createQueryObject(
         strToCreateObject.toString(),
         mainEntity.getId().toString(),
         AQConstants.EDIT,
         queryDetailsObj,
         oprVsLstOfVals);
   } else {
     dagPanel.createQueryObject(
         null, mapEntity.getId().toString(), AQConstants.ADD, queryDetailsObj, null);
   }
   queryClone = queryDetailsObj.getQuery();
   queryDetailsObj.setQuery(originalQuery);
   return queryClone;
 }