Examples of WhereField


Examples of it.eng.qbe.query.WhereField

  private void updatePromptableFiltersValue(Query query) {
    logger.debug("IN");
    List whereFields = query.getWhereFields();
    Iterator whereFieldsIt = whereFields.iterator();
    while (whereFieldsIt.hasNext()) {
      WhereField whereField = (WhereField) whereFieldsIt.next();
      if (whereField.isPromptable()) {
        // getting filter value on request
        String promptValue = this.getAttributeAsString(whereField.getName());
        logger.debug("Read prompt value [" + promptValue + "] for promptable filter [" + whereField.getName() + "].");
        if (promptValue != null) {
          whereField.getRightOperand().lastValues = new String[] {promptValue}; // TODO how to manage multi-values prompts?;
        }
      }
    }
    List havingFields = query.getHavingFields();
    Iterator havingFieldsIt = havingFields.iterator();
View Full Code Here

Examples of it.eng.qbe.query.WhereField

        String operator = "NOT EQUALS TO";
        if(valuesArray.length()>0){
          operator="IN";
        }

        whereFields.add(new WhereField("OptionalFilter"+i, "OptionalFilter"+i, false, leftOperand, operator, rightOperand, "AND"));
      }
    }
    return whereFields;
  }
View Full Code Here

Examples of it.eng.qbe.query.WhereField

  public static void updatePromptableFiltersValue(Query query, AbstractQbeEngineAction action) {
    logger.debug("IN");
    List whereFields = query.getWhereFields();
    Iterator whereFieldsIt = whereFields.iterator();
    while (whereFieldsIt.hasNext()) {
      WhereField whereField = (WhereField) whereFieldsIt.next();
      if (whereField.isPromptable()) {
        // getting filter value on request
        List promptValuesList = action.getAttributeAsList(whereField.getName());
        if (promptValuesList != null) {
          String[] promptValues = (String[]) promptValuesList.toArray(new String[] {});
          logger.debug("Read prompts " + promptValues + " for promptable filter " + whereField.getName() + ".");
          whereField.getRightOperand().lastValues = promptValues;
        }
      }
    }
    List havingFields = query.getHavingFields();
    Iterator havingFieldsIt = havingFields.iterator();
View Full Code Here

Examples of it.eng.qbe.query.WhereField

  private void updatePromptableFiltersValue(Query query) {
    logger.debug("IN");
    List whereFields = query.getWhereFields();
    Iterator whereFieldsIt = whereFields.iterator();
    while (whereFieldsIt.hasNext()) {
      WhereField whereField = (WhereField) whereFieldsIt.next();
      if (whereField.isPromptable()) {
        // getting filter value on request
        String promptValue = this.getAttributeAsString(whereField.getName());
        logger.debug("Read prompt value [" + promptValue + "] for promptable filter [" + whereField.getName() + "].");
        if (promptValue != null) {
          whereField.getRightOperand().lastValues = new String[] {promptValue}; // TODO how to manage multi-values prompts?;
        }
      }
    }
    List havingFields = query.getHavingFields();
    Iterator havingFieldsIt = havingFields.iterator();
View Full Code Here

Examples of it.eng.qbe.query.WhereField

   */
  private JSONArray serializeFilters(Query query, IDataSource dataSource, Locale locale) throws SerializationException {
    JSONArray filtersJOSN = new JSONArray();
   
    List filters;
    WhereField filter;
    WhereField.Operand operand;
    JSONObject filterJSON;
    IModelField datamartFilter;
    String fieldUniqueName;
    Iterator it;
    IModelProperties datamartLabels;
    IModelField datamartField;
   
    filters = query.getWhereFields();
    Assert.assertNotNull(filters, "Filters cannot be null");
   
    datamartLabels = null;
    if(locale != null) {
      //datamartLabels =  QbeCacheManager.getInstance().getLabels( dataSource , locale );
      datamartLabels = dataSource.getModelI18NProperties(locale);
    }
   
    it = filters.iterator();
    while( it.hasNext() ) {
      filter = (WhereField)it.next();
     
      filterJSON = new JSONObject();
      try {
        filterJSON.put(QuerySerializationConstants.FILTER_ID, filter.getName());
        filterJSON.put(QuerySerializationConstants.FILTER_DESCRIPTION, filter.getDescription());
        filterJSON.put(QuerySerializationConstants.FILTER_PROMPTABLE, filter.isPromptable());
       
        operand = filter.getLeftOperand();
        filterJSON.put(QuerySerializationConstants.FILTER_LO_VALUE, operand.values[0]);
        if(operand.type.equalsIgnoreCase("Field Content")) {
          if(operand.values[0].contains("\"expression\":\"")){
            filterJSON.put(QuerySerializationConstants.FILTER_LO_DESCRIPTION, operand.description );
            String description = operand.values[0].substring(operand.values[0].indexOf("\"expression\":\"")+14);
            description.substring(0, description.indexOf("\""));
            filterJSON.put(QuerySerializationConstants.FILTER_LO_LONG_DESCRIPTION, description);           
          }else{
            datamartField = dataSource.getModelStructure().getField( operand.values[0] );
           
            String labelF, labelE;
            labelE = null;
            if(datamartLabels != null) {
              labelE = datamartLabels.getProperty(datamartField.getParent(), "label");
            }
            labelE = StringUtilities.isEmpty(labelE)? datamartField.getParent().getName(): labelE;
           
           
            labelF = null;
            if(datamartLabels != null) {
              labelF = datamartLabels.getProperty(datamartField, "label");
            }
            labelF = StringUtilities.isEmpty(labelF)? datamartField.getName(): labelF;
           
            filterJSON.put(QuerySerializationConstants.FILTER_LO_DESCRIPTION, labelE  + " : " + labelF );
           
            String loLongDescription = getFieldLongDescription(datamartField, datamartLabels);
            filterJSON.put(QuerySerializationConstants.FILTER_LO_LONG_DESCRIPTION, loLongDescription);
          }
        } else if(operand.type.equalsIgnoreCase("Subquery")) {
          String loLongDescription = "Subquery " + operand.description;
          filterJSON.put(QuerySerializationConstants.FILTER_LO_LONG_DESCRIPTION, loLongDescription);
         
          filterJSON.put(QuerySerializationConstants.FILTER_LO_DESCRIPTION, operand.description);
        } else if(operand.type.equalsIgnoreCase("Parent Field Content")) {
          String[] chunks = operand.values[0].split(" ");
          String parentQueryId = chunks[0];
          String fieldName = chunks[1];
          datamartField = dataSource.getModelStructure().getField( fieldName );
          String datamartFieldLongDescription = getFieldLongDescription(datamartField, datamartLabels);
          String loLongDescription = "Query " + parentQueryId + ", " + datamartFieldLongDescription;
          filterJSON.put(QuerySerializationConstants.FILTER_LO_LONG_DESCRIPTION, loLongDescription);
         
          filterJSON.put(QuerySerializationConstants.FILTER_LO_DESCRIPTION, operand.description);
        } else {
          filterJSON.put(QuerySerializationConstants.FILTER_LO_DESCRIPTION, operand.description);
        }
       
       
       
        filterJSON.put(QuerySerializationConstants.FILTER_LO_TYPE, operand.type);
        filterJSON.put(QuerySerializationConstants.FILTER_LO_DEFAULT_VALUE, operand.defaulttValues[0]);
        filterJSON.put(QuerySerializationConstants.FILTER_LO_LAST_VALUE, operand.lastValues[0]);
       
        filterJSON.put(QuerySerializationConstants.FILTER_OPERATOR, filter.getOperator());
       
        operand = filter.getRightOperand();
        filterJSON.put(QuerySerializationConstants.FILTER_RO_VALUE, JSONUtils.asJSONArray(operand.values));
        if(operand.type.equalsIgnoreCase("Field Content")) {
          datamartField = dataSource.getModelStructure().getField( operand.values[0] );
         
          String labelF, labelE;
          labelE = null;
          if(datamartLabels != null) {
            labelE = datamartLabels.getProperty(datamartField.getParent(), "label");
          }
          labelE = StringUtilities.isEmpty(labelE)? datamartField.getParent().getName(): labelE;
         
         
          labelF = null;
          if(datamartLabels != null) {
            labelF = datamartLabels.getProperty(datamartField, "label");
          }
          labelF = StringUtilities.isEmpty(labelF)? datamartField.getName(): labelF;
         
          filterJSON.put(QuerySerializationConstants.FILTER_RO_DESCRIPTION, labelE  + " : " + labelF );
         
          String roLongDescription = getFieldLongDescription(datamartField, datamartLabels);
          filterJSON.put(QuerySerializationConstants.FILTER_RO_LONG_DESCRIPTION, roLongDescription);
        } else if(operand.type.equalsIgnoreCase("Subquery")) {
          String roLongDescription = "Subquery " + operand.description;
          filterJSON.put(QuerySerializationConstants.FILTER_RO_LONG_DESCRIPTION, roLongDescription);
         
          filterJSON.put(QuerySerializationConstants.FILTER_RO_DESCRIPTION, operand.description);
        } else if(operand.type.equalsIgnoreCase("Parent Field Content")) {
          String[] chunks = operand.values[0].split(" ");
          String parentQueryId = chunks[0];
          String fieldName = chunks[1];
          datamartField = dataSource.getModelStructure().getField( fieldName );
          String datamartFieldLongDescription = getFieldLongDescription(datamartField, datamartLabels);
          String loLongDescription = "Query " + parentQueryId + ", " + datamartFieldLongDescription;
          filterJSON.put(QuerySerializationConstants.FILTER_RO_LONG_DESCRIPTION, loLongDescription);
         
          filterJSON.put(QuerySerializationConstants.FILTER_RO_DESCRIPTION, operand.description);
        } else {
          filterJSON.put(QuerySerializationConstants.FILTER_RO_DESCRIPTION, operand.description);
        }
        filterJSON.put(QuerySerializationConstants.FILTER_RO_TYPE, operand.type);
        filterJSON.put(QuerySerializationConstants.FILTER_RO_DEFAULT_VALUE, JSONUtils.asJSONArray(operand.defaulttValues));
        filterJSON.put(QuerySerializationConstants.FILTER_RO_LAST_VALUE, JSONUtils.asJSONArray(operand.lastValues));
       
        filterJSON.put(QuerySerializationConstants.FILTER_BOOLEAN_CONNETOR, filter.getBooleanConnector());
       
      } catch(JSONException e) {
        throw new SerializationException("An error occurred while serializing filter: " + filter.getName(), e);
      }
      filtersJOSN.put(filterJSON);
    }
   
    return filtersJOSN;
View Full Code Here

Examples of it.eng.qbe.query.WhereField

        }
        str += (i==0?"": " " + filterExp.getValue());
        str += " " + childStr;
      }
    } else {
      WhereField whereField = query.getWhereFieldByName( filterExp.getValue() );
      str += buildUserProvidedWhereField(whereField, query, entityAliasesMaps);
    }
   
    return str;
  }
View Full Code Here

Examples of it.eng.qbe.query.WhereField

  public void updateParameters(Query query, Map parameters) {
    logger.debug("IN");
    List whereFields = query.getWhereFields();
    Iterator whereFieldsIt = whereFields.iterator();
    while (whereFieldsIt.hasNext()) {
      WhereField whereField = (WhereField) whereFieldsIt.next();
      if (whereField.isPromptable()) {
        String key = getParameterKey(whereField.getRightOperand().values[0]);
        if (key != null) {
          String parameterValues = (String) parameters.get(key);
          if (parameterValues != null) {
            String[] promptValues = new String[] {parameterValues}; // TODO how to manage multi-values prompts?
            logger.debug("Read prompts " + promptValues + " for promptable filter " + whereField.getName() + ".");
            whereField.getRightOperand().lastValues = promptValues;
          }
        }
      }
    }
    List havingFields = query.getHavingFields();
View Full Code Here

Examples of it.eng.qbe.query.WhereField

  public void updateParameters(it.eng.qbe.query.Query query, Map parameters) {
    logger.debug("IN");
    List whereFields = query.getWhereFields();
    Iterator whereFieldsIt = whereFields.iterator();
    while (whereFieldsIt.hasNext()) {
      WhereField whereField = (WhereField) whereFieldsIt.next();
      if (whereField.isPromptable()) {
        String key = getParameterKey(whereField.getRightOperand().values[0]);
        if (key != null) {
          String parameterValues = (String) parameters.get(key);
          if (parameterValues != null) {
            String[] promptValues = new String[] {parameterValues}; // TODO how to manage multi-values prompts?
            logger.debug("Read prompts " + promptValues + " for promptable filter " + whereField.getName() + ".");
            whereField.getRightOperand().lastValues = promptValues;
          }
        }
      }
    }
    List havingFields = query.getHavingFields();
View Full Code Here

Examples of it.eng.qbe.query.WhereField

   
    //Get the where fields
    List<WhereField> whereFields = query.getWhereFields();
    if(whereFields!=null){
      for(int i=0; i<whereFields.size(); i++){
        WhereField whereField = whereFields.get(i);
        Operand leftOperand = whereField.getLeftOperand();
        if(statement.OPERAND_TYPE_FIELD.equalsIgnoreCase(leftOperand.type)){
          datamartField = statement.getDataSource().getModelStructure().getField( leftOperand.values[0] );
          concernedEntities.add(datamartField.getPathParent());
        }
        Operand rightOperand = whereField.getLeftOperand();
        if(statement.OPERAND_TYPE_FIELD.equalsIgnoreCase(rightOperand.type)){
          datamartField = statement.getDataSource().getModelStructure().getField( rightOperand.values[0] );
          concernedEntities.add(datamartField.getPathParent());
        }
      }
View Full Code Here

Examples of it.eng.qbe.query.WhereField

        }
        str += (i==0?"": " " + filterExp.getValue());
        str += " " + childStr;
      }
    } else {
      WhereField whereField = query.getWhereFieldByName( filterExp.getValue() );
      str += buildUserProvidedWhereField(whereField, query, entityAliasesMaps);
    }
   
    return str;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.