Search in sources :

Example 1 with ValueTypedDimensionalItemObject

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

the class DefaultEventAnalyticsService method addEventDataObjects.

/**
 * Puts elements into the mapping table. The elements are fetched from the
 * query parameters.
 *
 * @param grid the {@link Grid}.
 * @param params the {@link EventQueryParams}.
 * @param table the map to add elements to.
 * @param dimension the dimension identifier.
 */
private void addEventDataObjects(Grid grid, EventQueryParams params, Map<String, List<EventAnalyticsDimensionalItem>> table, String dimension) {
    List<EventAnalyticsDimensionalItem> objects = params.getEventReportDimensionalItemArrayExploded(dimension);
    if (objects.isEmpty()) {
        ValueTypedDimensionalItemObject eventDimensionalItemObject = dataElementService.getDataElement(dimension);
        if (eventDimensionalItemObject == null) {
            eventDimensionalItemObject = trackedEntityAttributeService.getTrackedEntityAttribute(dimension);
        }
        addEventReportDimensionalItems(eventDimensionalItemObject, objects, grid, dimension);
        table.put(eventDimensionalItemObject.getDisplayProperty(params.getDisplayProperty()), objects);
    } else {
        table.put(dimension, objects);
    }
}
Also used : EventAnalyticsDimensionalItem(org.hisp.dhis.analytics.EventAnalyticsDimensionalItem) ValueTypedDimensionalItemObject(org.hisp.dhis.common.ValueTypedDimensionalItemObject)

Example 2 with ValueTypedDimensionalItemObject

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

the class BaseDimensionalItemObjectMapper method map.

@Override
public DimensionResponse map(BaseIdentifiableObject dimension, String prefix) {
    BaseDimensionalItemObject baseDimensionalItemObject = (BaseDimensionalItemObject) dimension;
    DimensionResponse responseWithDimensionType = super.map(dimension, prefix).withDimensionType(baseDimensionalItemObject.getDimensionItemType().name());
    if (dimension instanceof ValueTypedDimensionalItemObject) {
        ValueTypedDimensionalItemObject valueTypedDimensionalItemObject = (ValueTypedDimensionalItemObject) dimension;
        return responseWithDimensionType.withValueType(valueTypedDimensionalItemObject.getValueType().name());
    }
    return responseWithDimensionType;
}
Also used : ValueTypedDimensionalItemObject(org.hisp.dhis.common.ValueTypedDimensionalItemObject) BaseDimensionalItemObject(org.hisp.dhis.common.BaseDimensionalItemObject) DimensionResponse(org.hisp.dhis.analytics.dimension.DimensionResponse)

Aggregations

ValueTypedDimensionalItemObject (org.hisp.dhis.common.ValueTypedDimensionalItemObject)2 EventAnalyticsDimensionalItem (org.hisp.dhis.analytics.EventAnalyticsDimensionalItem)1 DimensionResponse (org.hisp.dhis.analytics.dimension.DimensionResponse)1 BaseDimensionalItemObject (org.hisp.dhis.common.BaseDimensionalItemObject)1