Search in sources :

Example 6 with AnalyticsTable

use of org.hisp.dhis.analytics.AnalyticsTable in project dhis2-core by dhis2.

the class JdbcEnrollmentAnalyticsTableManager method getTables.

private List<AnalyticsTable> getTables() {
    List<AnalyticsTable> tables = new UniqueArrayList<>();
    List<Program> programs = idObjectManager.getAllNoAcl(Program.class);
    String baseName = getTableName();
    for (Program program : programs) {
        AnalyticsTable table = new AnalyticsTable(baseName, null, null, program);
        List<AnalyticsTableColumn> dimensionColumns = getDimensionColumns(table);
        table.setDimensionColumns(dimensionColumns);
        tables.add(table);
    }
    return tables;
}
Also used : Program(org.hisp.dhis.program.Program) AnalyticsTable(org.hisp.dhis.analytics.AnalyticsTable) UniqueArrayList(org.hisp.dhis.commons.collection.UniqueArrayList) AnalyticsTableColumn(org.hisp.dhis.analytics.AnalyticsTableColumn)

Example 7 with AnalyticsTable

use of org.hisp.dhis.analytics.AnalyticsTable in project dhis2-core by dhis2.

the class AbstractJdbcTableManager method getTables.

/**
     * Generates a list of {@link AnalyticsTable} based on a list of years with data.
     * 
     * @param dataYears the list of years of data.
     */
protected List<AnalyticsTable> getTables(List<Integer> dataYears) {
    List<AnalyticsTable> tables = new UniqueArrayList<>();
    Calendar calendar = PeriodType.getCalendar();
    Collections.sort(dataYears);
    String baseName = getAnalyticsTableType().getTableName();
    for (Integer year : dataYears) {
        Period period = PartitionUtils.getPeriod(calendar, year);
        AnalyticsTable table = new AnalyticsTable(baseName, getDimensionColumns(null), period);
        tables.add(table);
    }
    return tables;
}
Also used : AnalyticsTable(org.hisp.dhis.analytics.AnalyticsTable) Calendar(org.hisp.dhis.calendar.Calendar) Period(org.hisp.dhis.period.Period) UniqueArrayList(org.hisp.dhis.commons.collection.UniqueArrayList)

Aggregations

AnalyticsTable (org.hisp.dhis.analytics.AnalyticsTable)7 UniqueArrayList (org.hisp.dhis.commons.collection.UniqueArrayList)4 Period (org.hisp.dhis.period.Period)4 Program (org.hisp.dhis.program.Program)3 Transactional (org.springframework.transaction.annotation.Transactional)3 ArrayList (java.util.ArrayList)2 AnalyticsTableColumn (org.hisp.dhis.analytics.AnalyticsTableColumn)2 Calendar (org.hisp.dhis.calendar.Calendar)2 YearlyPeriodType (org.hisp.dhis.period.YearlyPeriodType)2 DateTime (org.joda.time.DateTime)2 Test (org.junit.Test)2