use of org.hisp.dhis.analytics.AnalyticsTable in project dhis2-core by dhis2.
the class AnalyticsTableTest method testGetTableName.
@Test
public void testGetTableName() {
Program program = new Program("ProgramA", "DescriptionA");
program.setUid("UIDA");
Period period = new YearlyPeriodType().createPeriod(new DateTime(2014, 1, 1, 0, 0).toDate());
AnalyticsTable tableA = new AnalyticsTable("analytics_event", null, period, program);
assertEquals("analytics_event_2014_uida", tableA.getTableName());
}
use of org.hisp.dhis.analytics.AnalyticsTable in project dhis2-core by dhis2.
the class AnalyticsTableTest method testEquals.
@Test
public void testEquals() {
Period periodA = new YearlyPeriodType().createPeriod(new DateTime(2014, 1, 1, 0, 0).toDate());
Period periodB = new YearlyPeriodType().createPeriod(new DateTime(2015, 1, 1, 0, 0).toDate());
AnalyticsTable tableA = new AnalyticsTable("analytics", null, periodA);
AnalyticsTable tableB = new AnalyticsTable("analytics", null, periodA);
AnalyticsTable tableC = new AnalyticsTable("analytics", null, periodB);
List<AnalyticsTable> uniqueList = new UniqueArrayList<>();
uniqueList.add(tableA);
uniqueList.add(tableB);
uniqueList.add(tableC);
assertEquals(2, uniqueList.size());
}
use of org.hisp.dhis.analytics.AnalyticsTable in project dhis2-core by dhis2.
the class JdbcEventAnalyticsTableManager method getTables.
@Override
@Transactional
public List<AnalyticsTable> getTables(Date earliest) {
log.info(String.format("Get tables using earliest: %s, spatial support: %b", earliest, databaseInfo.isSpatialSupport()));
List<AnalyticsTable> tables = new UniqueArrayList<>();
Calendar calendar = PeriodType.getCalendar();
String baseName = getTableName();
List<Program> programs = idObjectManager.getAllNoAcl(Program.class);
for (Program program : programs) {
List<Integer> dataYears = getDataYears(program, earliest);
Collections.sort(dataYears);
for (Integer year : dataYears) {
Period period = PartitionUtils.getPeriod(calendar, year);
AnalyticsTable table = new AnalyticsTable(baseName, null, period, program);
List<AnalyticsTableColumn> dimensionColumns = getDimensionColumns(table);
table.setDimensionColumns(dimensionColumns);
tables.add(table);
}
}
return tables;
}
use of org.hisp.dhis.analytics.AnalyticsTable in project dhis2-core by dhis2.
the class JdbcOrgUnitTargetTableManager method getTables.
@Override
@Transactional
public List<AnalyticsTable> getTables(Date earliest) {
List<AnalyticsTable> tables = new ArrayList<>();
tables.add(new AnalyticsTable(getTableName(), getDimensionColumns(null)));
return tables;
}
use of org.hisp.dhis.analytics.AnalyticsTable in project dhis2-core by dhis2.
the class JdbcCompletenessTargetTableManager method getTables.
@Override
@Transactional
public List<AnalyticsTable> getTables(Date earliest) {
List<AnalyticsTable> tables = new ArrayList<>();
tables.add(new AnalyticsTable(getTableName(), getDimensionColumns(null)));
return tables;
}
Aggregations