Search in sources :

Example 16 with AnalyticsTableColumn

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

the class AbstractEventJdbcTableManager method createTable.

@Override
public void createTable(AnalyticsTable table) {
    final String tableName = table.getTempTableName();
    final String sqlDrop = "drop table " + tableName;
    executeSilently(sqlDrop);
    String sqlCreate = "create table " + tableName + " (";
    List<AnalyticsTableColumn> columns = getDimensionColumns(table);
    validateDimensionColumns(columns);
    for (AnalyticsTableColumn col : columns) {
        sqlCreate += col.getName() + " " + col.getDataType() + ",";
    }
    sqlCreate = removeLast(sqlCreate, 1) + ")";
    log.info("Creating table: " + tableName + ", columns: " + columns.size());
    log.debug("Create SQL: " + sqlCreate);
    jdbcTemplate.execute(sqlCreate);
}
Also used : AnalyticsTableColumn(org.hisp.dhis.analytics.AnalyticsTableColumn)

Aggregations

AnalyticsTableColumn (org.hisp.dhis.analytics.AnalyticsTableColumn)16 OrganisationUnitLevel (org.hisp.dhis.organisationunit.OrganisationUnitLevel)5 UniqueArrayList (org.hisp.dhis.commons.collection.UniqueArrayList)4 OrganisationUnitGroupSet (org.hisp.dhis.organisationunit.OrganisationUnitGroupSet)4 CategoryOptionGroupSet (org.hisp.dhis.dataelement.CategoryOptionGroupSet)3 DataElementCategory (org.hisp.dhis.dataelement.DataElementCategory)3 PeriodType (org.hisp.dhis.period.PeriodType)3 ArrayList (java.util.ArrayList)2 AnalyticsTable (org.hisp.dhis.analytics.AnalyticsTable)2 ValueType (org.hisp.dhis.common.ValueType)2 DataElement (org.hisp.dhis.dataelement.DataElement)2 Program (org.hisp.dhis.program.Program)2 TrackedEntityAttribute (org.hisp.dhis.trackedentity.TrackedEntityAttribute)2 Calendar (org.hisp.dhis.calendar.Calendar)1 LegendSet (org.hisp.dhis.legend.LegendSet)1 Period (org.hisp.dhis.period.Period)1 ProgramStage (org.hisp.dhis.program.ProgramStage)1 ProgramStageDataElement (org.hisp.dhis.program.ProgramStageDataElement)1 Transactional (org.springframework.transaction.annotation.Transactional)1