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

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


       
       
        // ==============================================================
        // STEP3: join the two query generated at setp 1 & 2
        // --------------------------------------------------------------
        JoinQueryTransformer joinQueryTransformer;
       
        joinQueryTransformer = new JoinQueryTransformer();
       
        // select the column associated to the selected level into the selected hierarchy
        String aggColumnName = datamartProvider.getSelectedLevel().getColumnId();       
        joinQueryTransformer.addSelectColumn(aggColumnName);
       
        // select all columns defined as measure in the metadata configuration block
        it = measureColumnNames.iterator();
        while(it.hasNext()) {
          String measureColumnName= (String)it.next();
          joinQueryTransformer.addSelectColumn( measureColumnName);
        }
       
        //  set as joining query the one generated during step 2       
        joinQueryTransformer.setStatmentToJoin( dimGeoQuery );
       
        // define the join condition
        joinQueryTransformer.setJoinCondition(
            datamartProvider.getMetaData().getGeoIdColumnName( datamartProvider.getSelectedHierarchy().getName() ),
            baseLevel.getColumnId()
        );
       
        //joinedQuery = joinQueryTransformer.transformStatment( normalizedSubQuery );
        // ==========================================================
       
       
        // ==============================================================
        // STEP4:
        // --------------------------------------------------------------
        GroupByQueryTransformer normalizeJoinedQueryTransformer;
       
        normalizeJoinedQueryTransformer = new GroupByQueryTransformer();
       
        normalizeJoinedQueryTransformer.addGrouByColumn( datamartProvider.getSelectedLevel().getColumnId() );
       
        // aggregate on the column defined as measure in the metadata configuration block
        it = measureColumnNames.iterator();
        while(it.hasNext()) {
          String measureColumnName= (String)it.next();
          String aggregationFunction = null;
         
          aggregationFunction = datamartProvider.getMetaData().getAggregationFunction(measureColumnName);
          if( StringUtilities.isEmpty(aggregationFunction) ) {
            aggregationFunction = "SUM";
          }
         
          normalizeJoinedQueryTransformer.addAggregateColumn(measureColumnName, aggregationFunction);
        }
       
        //aggragateQuery = (String)normalizeJoinedQueryTransformer.transformStatment(joinedQuery);
        // ==========================================================    
       
        normalizeJoinedQueryTransformer.setPreviousTransformer(joinQueryTransformer);
        joinQueryTransformer.setPreviousTransformer(normalizationQueryTransformer);
        normalizationQueryTransformer.setPreviousTransformer( this.getPreviousTransformer() );
         
          queryDrillTransformer = normalizeJoinedQueryTransformer;
      }    
     
View Full Code Here

TOP

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

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.