Package it.eng.spagobi.tools.dataset.common.query

Examples of it.eng.spagobi.tools.dataset.common.query.IAggregationFunction


   
    // appends measures
    Iterator<CrosstabDefinition.Measure> measuresIt = measures.iterator();
    while (measuresIt.hasNext()) {
      CrosstabDefinition.Measure aMeasure = measuresIt.next();
      IAggregationFunction function = aMeasure.getAggregationFunction();
      String alias = getSQLAlias(aMeasure.getAlias(), baseQuery, baseQuerySelectedFields);
      if (alias == null) {
        // when defining a crosstab inside the SmartFilter document, an additional COUNT field with id QBE_SMARTFILTER_COUNT
        // is automatically added inside query fields, therefore the alias is not found on base query selected fields
        if (aMeasure.getEntityId().equals(QBE_SMARTFILTER_COUNT)) {
          toReturn.append(AggregationFunctions.COUNT_FUNCTION.apply("*"));
        } else {
          logger.error("Alias " + aMeasure.getAlias() + " not found on the base query!!!!");
          throw new RuntimeException("Alias " + aMeasure.getAlias() + " not found on the base query!!!!");
        }
      } else {
        if (function != AggregationFunctions.NONE_FUNCTION) {
          toReturn.append(function.apply(alias));
        } else {
          toReturn.append(alias);
        }
      }
      if (measuresIt.hasNext()) {
View Full Code Here


      Iterator it = dataMartSelectFields.iterator();
      while (it.hasNext()) {
        DataMartSelectField field = (DataMartSelectField) it.next();
        int fieldIndex = query.getSelectFieldIndex(field.getUniqueName());       
        String[] f = (String[])selectFields.get(fieldIndex);
        IAggregationFunction aggregationFunction = field.getFunction();
        if (aggregationFunction != null && aggregationFunction != AggregationFunctions.NONE_FUNCTION) {
          transformer.addAggregateColumn(f[1]!=null? f[1]:f[0], aggregationFunction.getName(), field.getAlias());
        }
      }
     
      sqlQuery = (String)transformer.transformQuery(sqlQuery);
     
View Full Code Here

    JSONArray operandLastValuesJSONArray;
    HavingField.Operand leftOperand;
    HavingField.Operand rightOperand;
    String operator;
    String booleanConnector;
    IAggregationFunction function;
   
    logger.debug("IN");
   
    try {
   
View Full Code Here

      rootEntityAlias = (String)targetQueryEntityAliasesMap.get( rootEntity.getUniqueName() );
      logger.debug("where field root entity alias [" + rootEntityAlias + "]");
     
      if (operand instanceof HavingField.Operand) {
        HavingField.Operand havingFieldOperand = (HavingField.Operand) operand;
        IAggregationFunction function = havingFieldOperand.function;
        operandElement = function.apply(rootEntityAlias + "." + queryName);
      } else {
        operandElement = rootEntityAlias + "." + queryName;
      }
      logger.debug("where element operand value [" + operandElement + "]");
    } finally {
View Full Code Here

      rootEntityAlias = (String)targetQueryEntityAliasesMap.get( rootEntity.getUniqueName() );
      logger.debug("where field root entity alias [" + rootEntityAlias + "]");
     
      if (operand instanceof HavingField.Operand) {
        HavingField.Operand havingFieldOperand = (HavingField.Operand) operand;
        IAggregationFunction function = havingFieldOperand.function;
        operandElement = function.apply(rootEntityAlias + "." + queryName);
      } else {
        operandElement = rootEntityAlias + "." + queryName;
      }
      logger.debug("where element operand value [" + operandElement + "]");
    } finally {
View Full Code Here

TOP

Related Classes of it.eng.spagobi.tools.dataset.common.query.IAggregationFunction

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.