@Override public DataQueryParams withTableNameAndPartitions( DataQueryParams params, QueryPlannerParams plannerParams ) { Partitions partitions = params.hasStartEndDate() ? PartitionUtils.getPartitions( params.getStartDate(), params.getEndDate() ) : PartitionUtils.getPartitions( params.getAllPeriods() ); return DataQueryParams.newBuilder( params ) .withTableName( plannerParams.getTableName() ) .withPartitions( partitions ) .build(); }
/** * Adds raw data to the grid for the given data query parameters. * * @param params the {@link DataQueryParams}. * @param grid the grid. */ private void addRawData( DataQueryParams params, Grid grid ) { if ( !params.isSkipData() ) { QueryPlannerParams plannerParams = QueryPlannerParams.newBuilder() .withTableName( AnalyticsTableType.DATA_VALUE.getTableName() ).build(); params = queryPlanner.withTableNameAndPartitions( params, plannerParams ); rawAnalyticsManager.getRawDataValues( params, grid ); } }
@Override public AnalyticsTableType getAnalyticsTableType() { return tableManager.getAnalyticsTableType(); }
/** * Retrieves the dimension or filter with the given dimension identifier. * Returns null if the dimension or filter is not present. */ public DimensionalObject getDimensionOrFilter( String dimension ) { DimensionalObject dim = getDimension( dimension ); return dim != null ? dim : getFilter( dimension ); }
/** * Removes the dimension or filter with the given identifier. */ protected DataQueryParams removeDimensionOrFilter( String dimension ) { removeDimension( dimension ); removeFilter( dimension ); return this; }
/** * Sets the {@code startDate} property to the earliest start date, and the * {@code endDate} property to the latest end date based on periods. */ private void setEarliestStartDateLatestEndDate() { this.startDate = getEarliestStartDate(); this.endDate = getLatestEndDate(); }
@Override public List<AnalyticsTableHook> getByPhase( AnalyticsTablePhase phase ) { return analyticsTableHookStore.getByPhase( phase ); }
@Override public List<AnalyticsTableHook> getByPhaseAndResourceTableType( AnalyticsTablePhase phase, ResourceTableType resourceTableType ) { return analyticsTableHookStore.getByPhaseAndResourceTableType( phase, resourceTableType ); }
/** * Indicates whether the current number of queries in this group is optimal. * Uses the given optimal query number compared to the size of the largest * query group to determine the outcome. * * @return true if the current number of queries in this group is optimal. */ public boolean isOptimal( int optimalQueries ) { return getLargestGroupSize() >= optimalQueries; }
/** * Indicates whether this query has the given aggregation type. */ public boolean isAggregationType( AggregationType type ) { return aggregationType != null && aggregationType.isAggregationType( type ); }
/** * Returns the organisation unit field if specified; if not * returns the default field which is {@link DataQueryParams#DEFAULT_ORG_UNIT_FIELD}. */ public String getOrgUnitFieldFallback() { return hasOrgUnitField() ? orgUnitField : DEFAULT_ORG_UNIT_FIELD; }
/** * Adds the given filters to the filters of this query. */ private void addFilters( List<DimensionalObject> filters ) { for ( DimensionalObject filter : filters ) { addFilter( filter ); } }
@Override public String toString() { return "[Table name: " + getTableName() + ", partitions: " + partitionTables + "]"; } }
@Override public void execute( JobConfiguration jobConfiguration ) { analyticsTableGenerator.generateResourceTables( jobConfiguration ); } }
@Override public void dropTables() { for ( AnalyticsTableService service : analyticsTableServices ) { service.dropTables(); } }
/** * Creates a new Builder for DataQueryParams. * * @return a Builder for DataQueryParams. */ public static Builder newBuilder() { return new DataQueryParams.Builder(); }
/** * Returns all data element groups part of dimensions and filters of type * data element group set. */ public List<DimensionalItemObject> getAllDataElementGroups() { return getDimensionalItemObjects( DimensionType.DATA_ELEMENT_GROUP_SET ); }
public Builder addOrSetDimensionOptions( String dimension, DimensionType type, String dimensionName, List<DimensionalItemObject> options ) { this.params.setDimensionOptions( dimension, type, dimensionName, options ); return this; }
/** * Indicates whether the aggregation type is of type disaggregation. */ public boolean isDisaggregation() { return aggregationType != null && aggregationType.isDisaggregation(); }