Search in sources :

Example 1 with DataDimensionItemType

use of org.hisp.dhis.common.DataDimensionItemType in project dhis2-core by dhis2.

the class DataQueryParams method retainDataDimensions.

/**
 * Retains only dimensions of the given data dimension item types.
 *
 * @param itemTypes the array of data dimension item types.
 */
private DataQueryParams retainDataDimensions(DataDimensionItemType... itemTypes) {
    DimensionalObject dimension = getDimensionOrFilter(DATA_X_DIM_ID);
    List<DimensionalItemObject> items = new ArrayList<>();
    for (DataDimensionItemType itemType : itemTypes) {
        items.addAll(AnalyticsUtils.getByDataDimensionItemType(itemType, dimension.getItems()));
    }
    dimension.getItems().clear();
    dimension.getItems().addAll(items);
    return this;
}
Also used : DimensionalItemObject(org.hisp.dhis.common.DimensionalItemObject) DataDimensionItemType(org.hisp.dhis.common.DataDimensionItemType) ArrayList(java.util.ArrayList) DimensionalObject(org.hisp.dhis.common.DimensionalObject) BaseDimensionalObject(org.hisp.dhis.common.BaseDimensionalObject)

Aggregations

ArrayList (java.util.ArrayList)1 BaseDimensionalObject (org.hisp.dhis.common.BaseDimensionalObject)1 DataDimensionItemType (org.hisp.dhis.common.DataDimensionItemType)1 DimensionalItemObject (org.hisp.dhis.common.DimensionalItemObject)1 DimensionalObject (org.hisp.dhis.common.DimensionalObject)1