Search in sources :

Example 1 with CHARACTER_11

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

the class JdbcEventAnalyticsTableManager method getDimensionColumns.

/**
 * Returns dimensional analytics table columns.
 *
 * @param program the program.
 * @return a list of {@link AnalyticsTableColumn}.
 */
private List<AnalyticsTableColumn> getDimensionColumns(Program program) {
    List<AnalyticsTableColumn> columns = new ArrayList<>();
    if (program.hasNonDefaultCategoryCombo()) {
        List<Category> categories = program.getCategoryCombo().getCategories();
        for (Category category : categories) {
            if (category.isDataDimension()) {
                columns.add(new AnalyticsTableColumn(quote(category.getUid()), CHARACTER_11, "acs." + quote(category.getUid())).withCreated(category.getCreated()));
            }
        }
    }
    columns.addAll(addOrganisationUnitLevels());
    columns.addAll(addOrganisationUnitGroupSets());
    columns.addAll(categoryService.getAttributeCategoryOptionGroupSetsNoAcl().stream().map(l -> toCharColumn(quote(l.getUid()), "acs", l.getCreated())).collect(Collectors.toList()));
    columns.addAll(addPeriodTypeColumns("dps"));
    columns.addAll(program.getAnalyticsDataElements().stream().map(de -> getColumnFromDataElement(de, false)).flatMap(Collection::stream).collect(Collectors.toList()));
    columns.addAll(program.getAnalyticsDataElementsWithLegendSet().stream().map(de -> getColumnFromDataElement(de, true)).flatMap(Collection::stream).collect(Collectors.toList()));
    columns.addAll(program.getNonConfidentialTrackedEntityAttributes().stream().map(tea -> getColumnFromTrackedEntityAttribute(tea, getNumericClause(), getDateClause(), false)).flatMap(Collection::stream).collect(Collectors.toList()));
    columns.addAll(program.getNonConfidentialTrackedEntityAttributesWithLegendSet().stream().map(tea -> getColumnFromTrackedEntityAttribute(tea, getNumericClause(), getDateClause(), true)).flatMap(Collection::stream).collect(Collectors.toList()));
    columns.addAll(getFixedColumns());
    if (program.isRegistration()) {
        columns.add(new AnalyticsTableColumn(quote("tei"), CHARACTER_11, "tei.uid"));
    }
    return filterDimensionColumns(columns);
}
Also used : CategoryService(org.hisp.dhis.category.CategoryService) CHARACTER_11(org.hisp.dhis.analytics.ColumnDataType.CHARACTER_11) ResourceTableService(org.hisp.dhis.resourcetable.ResourceTableService) Date(java.util.Date) ValueType(org.hisp.dhis.common.ValueType) AnalyticsSqlUtils.quote(org.hisp.dhis.analytics.util.AnalyticsSqlUtils.quote) AnalyticsTableUpdateParams(org.hisp.dhis.analytics.AnalyticsTableUpdateParams) OrganisationUnitService(org.hisp.dhis.organisationunit.OrganisationUnitService) GEOMETRY(org.hisp.dhis.analytics.ColumnDataType.GEOMETRY) AnalyticsUtils.getColumnType(org.hisp.dhis.analytics.util.AnalyticsUtils.getColumnType) Calendar(org.hisp.dhis.calendar.Calendar) INTEGER(org.hisp.dhis.analytics.ColumnDataType.INTEGER) NOT_NULL(org.hisp.dhis.analytics.ColumnNotNullConstraint.NOT_NULL) AnalyticsTableType(org.hisp.dhis.analytics.AnalyticsTableType) Collection(java.util.Collection) IndexType(org.hisp.dhis.analytics.IndexType) Category(org.hisp.dhis.category.Category) Collectors(java.util.stream.Collectors) List(java.util.List) Slf4j(lombok.extern.slf4j.Slf4j) VARCHAR_255(org.hisp.dhis.analytics.ColumnDataType.VARCHAR_255) DateUtils.getLongDateString(org.hisp.dhis.util.DateUtils.getLongDateString) TrackedEntityAttribute(org.hisp.dhis.trackedentity.TrackedEntityAttribute) NUMERIC_LENIENT_REGEXP(org.hisp.dhis.system.util.MathUtils.NUMERIC_LENIENT_REGEXP) TIMESTAMP(org.hisp.dhis.analytics.ColumnDataType.TIMESTAMP) DOUBLE(org.hisp.dhis.analytics.ColumnDataType.DOUBLE) AnalyticsTableColumn(org.hisp.dhis.analytics.AnalyticsTableColumn) AnalyticsTable(org.hisp.dhis.analytics.AnalyticsTable) AnalyticsTableHookService(org.hisp.dhis.analytics.AnalyticsTableHookService) PartitionManager(org.hisp.dhis.analytics.partition.PartitionManager) Program(org.hisp.dhis.program.Program) ArrayList(java.util.ArrayList) JdbcTemplate(org.springframework.jdbc.core.JdbcTemplate) DataElement(org.hisp.dhis.dataelement.DataElement) DatabaseInfo(org.hisp.dhis.system.database.DatabaseInfo) Lists(com.google.common.collect.Lists) ImmutableList(com.google.common.collect.ImmutableList) IdentifiableObjectManager(org.hisp.dhis.common.IdentifiableObjectManager) Service(org.springframework.stereotype.Service) SystemSettingManager(org.hisp.dhis.setting.SystemSettingManager) DataApprovalLevelService(org.hisp.dhis.dataapproval.DataApprovalLevelService) AnalyticsSqlUtils.getClosingParentheses(org.hisp.dhis.analytics.util.AnalyticsSqlUtils.getClosingParentheses) AnalyticsTablePartition(org.hisp.dhis.analytics.AnalyticsTablePartition) TEXT(org.hisp.dhis.analytics.ColumnDataType.TEXT) StatementBuilder(org.hisp.dhis.jdbc.StatementBuilder) ColumnDataType(org.hisp.dhis.analytics.ColumnDataType) VARCHAR_50(org.hisp.dhis.analytics.ColumnDataType.VARCHAR_50) PeriodType(org.hisp.dhis.period.PeriodType) SettingKey(org.hisp.dhis.setting.SettingKey) Collections(java.util.Collections) DateUtils(org.hisp.dhis.util.DateUtils) Transactional(org.springframework.transaction.annotation.Transactional) Assert(org.springframework.util.Assert) Category(org.hisp.dhis.category.Category) ArrayList(java.util.ArrayList) Collection(java.util.Collection) AnalyticsTableColumn(org.hisp.dhis.analytics.AnalyticsTableColumn)

Aggregations

ImmutableList (com.google.common.collect.ImmutableList)1 Lists (com.google.common.collect.Lists)1 ArrayList (java.util.ArrayList)1 Collection (java.util.Collection)1 Collections (java.util.Collections)1 Date (java.util.Date)1 List (java.util.List)1 Collectors (java.util.stream.Collectors)1 Slf4j (lombok.extern.slf4j.Slf4j)1 AnalyticsTable (org.hisp.dhis.analytics.AnalyticsTable)1 AnalyticsTableColumn (org.hisp.dhis.analytics.AnalyticsTableColumn)1 AnalyticsTableHookService (org.hisp.dhis.analytics.AnalyticsTableHookService)1 AnalyticsTablePartition (org.hisp.dhis.analytics.AnalyticsTablePartition)1 AnalyticsTableType (org.hisp.dhis.analytics.AnalyticsTableType)1 AnalyticsTableUpdateParams (org.hisp.dhis.analytics.AnalyticsTableUpdateParams)1 ColumnDataType (org.hisp.dhis.analytics.ColumnDataType)1 CHARACTER_11 (org.hisp.dhis.analytics.ColumnDataType.CHARACTER_11)1 DOUBLE (org.hisp.dhis.analytics.ColumnDataType.DOUBLE)1 GEOMETRY (org.hisp.dhis.analytics.ColumnDataType.GEOMETRY)1 INTEGER (org.hisp.dhis.analytics.ColumnDataType.INTEGER)1