Search in sources :

Example 1 with DimensionResponse

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

the class ProgramStageDataElementMapper method map.

@Override
public DimensionResponse map(BaseIdentifiableObject dimension, String prefix) {
    ProgramStageDataElement programStageDataElement = (ProgramStageDataElement) dimension;
    final DimensionResponse mapped = super.map(programStageDataElement.getDataElement(), prefix).withValueType(programStageDataElement.getDataElement().getValueType().name()).withId(getProgramStageDataElementUid(programStageDataElement));
    return Optional.of(programStageDataElement).map(ProgramStageDataElement::getDataElement).map(DataElement::getOptionSet).map(BaseIdentifiableObject::getUid).map(mapped::withOptionSet).orElse(mapped);
}
Also used : ProgramStageDataElement(org.hisp.dhis.program.ProgramStageDataElement) BaseIdentifiableObject(org.hisp.dhis.common.BaseIdentifiableObject) DimensionResponse(org.hisp.dhis.analytics.dimension.DimensionResponse)

Example 2 with DimensionResponse

use of org.hisp.dhis.analytics.dimension.DimensionResponse 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)

Example 3 with DimensionResponse

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

the class DataElementMapper method map.

@Override
public DimensionResponse map(BaseIdentifiableObject dimension, String prefix) {
    DataElement dataElement = (DataElement) dimension;
    final DimensionResponse mapped = super.map(dataElement, prefix).withValueType(dataElement.getValueType().name()).withId(String.join(".", prefix, dataElement.getUid()));
    return Optional.of(dataElement).map(DataElement::getOptionSet).map(BaseIdentifiableObject::getUid).map(mapped::withOptionSet).orElse(mapped);
}
Also used : DataElement(org.hisp.dhis.dataelement.DataElement) BaseIdentifiableObject(org.hisp.dhis.common.BaseIdentifiableObject) DimensionResponse(org.hisp.dhis.analytics.dimension.DimensionResponse)

Aggregations

DimensionResponse (org.hisp.dhis.analytics.dimension.DimensionResponse)3 BaseIdentifiableObject (org.hisp.dhis.common.BaseIdentifiableObject)2 BaseDimensionalItemObject (org.hisp.dhis.common.BaseDimensionalItemObject)1 ValueTypedDimensionalItemObject (org.hisp.dhis.common.ValueTypedDimensionalItemObject)1 DataElement (org.hisp.dhis.dataelement.DataElement)1 ProgramStageDataElement (org.hisp.dhis.program.ProgramStageDataElement)1