Package org.ofbiz.entity.condition

Examples of org.ofbiz.entity.condition.EntityComparisonOperator


     
      String primaryEntityName = primaryEntity.getUiEntity().getEntityName();
      String searchAttribValue = "";
      String searchEntityName = "";
      String searchAttribName = "";
      EntityComparisonOperator entityOperator = null;
      List relatedSearchClauses = new LinkedList();
      List selectFields = new ArrayList();
      List selectFieldLabels = new ArrayList();
      List sortFields = new ArrayList();
     
      List reportFields = new ArrayList();
      List reportCriteria = new ArrayList();
      List reportOrderBy = new ArrayList();
     
      ModelEntity primaryME = primaryEntity.getUiEntity().getModelEntity();
      List primaryPkFieldNames =primaryEntity.getUiEntity().getPrimaryKeyFieldNames();
     
      queryInfo = new QueryInfo(delegator, primaryEntityName);
     
      HashMap joinedEntities = new HashMap();
         
      joinedEntities.put(primaryEntityName, "Y");
         
      // Find the main entity(ies) by building a WHERE clause using LIKE and AND, with one or more tables in the FROM clause.
      // First join all secondary screen section entities in the WHERE and FROM clauses in case
      // we are going to use query values from them.
      Iterator uiScreenSectionEntityI = uiScreenSectionEntityGVL.iterator();
     
      uiScreenSectionEntityI.next(); // Pass up the primary entity.
     
      while (uiScreenSectionEntityI.hasNext()) {
        GenericValue entityGV = (GenericValue) uiScreenSectionEntityI.next();
        UIScreenSectionEntity uiScreenSectionEntity = new UIScreenSectionEntity(entityGV, delegator, uiCache) ;
        String relationTitle = uiScreenSectionEntity.getRelationTitle();
        String relatedEntityName = uiScreenSectionEntity.getUiEntity().getEntityName();
        String relatedAndFields = uiScreenSectionEntity.getRelationByAndFields();
        boolean isOuterJoin = uiScreenSectionEntity.getIsOuterJoined();
     
        eventProcessor.addOneRelationClause(delegator, relationTitle, relatedAndFields,
          relatedEntityName, primaryEntityName, primaryME, isOuterJoin,
          queryInfo);
             
        joinedEntities.put(relatedEntityName, "Y");
      }
     
      String queryListMaxRows = request.getParameter("queryListMaxRows");
      // if queryListMaxRows is set, then we are using advanced query mode
      if ( (queryListMaxRows != null ) && ( queryListMaxRows.length() > 0) )
      {
        int maxRows = Integer.valueOf(queryListMaxRows).intValue();
        for ( int i=1; i <= maxRows; i++ )
        {
          String qlFieldInfo = request.getParameter("queryListField" + i);
          if ( ( qlFieldInfo != null ) && ( qlFieldInfo.length() > 0 ) )
          {
            StringTokenizer tokSemi = new StringTokenizer(qlFieldInfo,";");
            String qlFieldName = "";
            String qlAttributeId = "";
            String qlDisplayObjectId = "";
            String qlDisplayTypeId = "";
            String qlDisplayLabel = "";
           
            if (tokSemi.countTokens() == 5) {
                qlFieldName = tokSemi.nextToken();
                qlAttributeId = tokSemi.nextToken();
                qlDisplayTypeId = tokSemi.nextToken();
                qlDisplayObjectId = tokSemi.nextToken();
                qlDisplayLabel = tokSemi.nextToken();
            }
            else
            {
              qlFieldName = qlFieldInfo;
            }
     
            String qlOperator  = request.getParameter("queryListOperator" + i);
            String qlValue     = request.getParameter("queryListValue" + i);
           
            reportCriteria.add( new UIReportCriteria(qlAttributeId, qlDisplayTypeId, qlDisplayObjectId, qlOperator,qlValue, qlDisplayLabel) );
           
            if ( qlOperator.equals("like"))
              qlValue =  "%" + qlValue.replace('*','%') + "%";
            else if ( qlOperator.equals("startsWith"))
            {
              qlValue =  qlValue.replace('*','%') + "%";
              qlOperator = "like";
            }
            else if ( qlOperator.equals("endsWith"))
            {
              qlValue =  "%" + qlValue.replace('*','%');
              qlOperator = "like";
            }
     
            searchEntityName = UIWebUtility.getEntityFromParamName(qlFieldName);
     
            String hasJoin = (String) joinedEntities.get(searchEntityName);
           
            if ( ( hasJoin == null ) || ( !hasJoin.equals("Y")) )
            {
              eventProcessor.addOneRelationClause(delegator, "", "", searchEntityName, primaryEntityName, primaryME, false, queryInfo);
     
              joinedEntities.put(searchEntityName, "Y");
            }
           
            if ((searchEntityName == null) ||
                searchEntityName.equals("")) {
              searchEntityName = primaryEntityName;
            }
     
            searchAttribName = UIWebUtility.getAttribFromParamName(qlFieldName);
            entityOperator = EntityOperator.lookupComparison(qlOperator);
            Object searchValue = qlValue;
           

            // If this is a set operator, convert the String param into a comma separated List
            if ( (entityOperator.equals(EntityOperator.IN)) || (entityOperator.equals(EntityOperator.NOT_IN)) || (entityOperator.equals(EntityOperator.BETWEEN)))
            {
              List valueList = new ArrayList();
              StringTokenizer tokComma = new StringTokenizer(qlValue, ",");
     
              while (tokComma.hasMoreTokens()) {
View Full Code Here


                String entityAlias = "GI" + productSearchContext.index;
                String prefix = "gi" + productSearchContext.index;
                productSearchContext.index++;

               
                EntityComparisonOperator operator = EntityOperator.EQUALS;
               
                if (UtilValidate.isNotEmpty(include) && include == Boolean.FALSE) {
                    operator = EntityOperator.NOT_EQUAL;
                }
               
View Full Code Here

TOP

Related Classes of org.ofbiz.entity.condition.EntityComparisonOperator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.