Search in sources :

Example 11 with TrackedEntityAttributeDimension

use of org.hisp.dhis.trackedentity.TrackedEntityAttributeDimension in project dhis2-core by dhis2.

the class EventDataQueryServiceTest method testGetFromAnalyticalObjectA.

@Test
void testGetFromAnalyticalObjectA() {
    EventChart eventChart = new EventChart();
    eventChart.setAutoFields();
    eventChart.setProgram(prA);
    eventChart.getColumnDimensions().add(atA.getUid());
    eventChart.getRowDimensions().add(DimensionalObject.ORGUNIT_DIM_ID);
    eventChart.getFilterDimensions().add(DimensionalObject.PERIOD_DIM_ID);
    eventChart.getAttributeDimensions().add(new TrackedEntityAttributeDimension(atA, null, "LE:5"));
    eventChart.getPeriods().add(peA);
    eventChart.getPeriods().add(peB);
    eventChart.getOrganisationUnits().add(ouA);
    eventChart.getOrganisationUnits().add(ouB);
    EventQueryParams params = dataQueryService.getFromAnalyticalObject(eventChart);
    assertNotNull(params);
    assertEquals(1, params.getItems().size());
    assertEquals(2, params.getOrganisationUnits().size());
    assertEquals(2, params.getFilterPeriods().size());
}
Also used : TrackedEntityAttributeDimension(org.hisp.dhis.trackedentity.TrackedEntityAttributeDimension) EventQueryParams(org.hisp.dhis.analytics.event.EventQueryParams) EventChart(org.hisp.dhis.eventchart.EventChart) Test(org.junit.jupiter.api.Test) DhisSpringTest(org.hisp.dhis.DhisSpringTest)

Example 12 with TrackedEntityAttributeDimension

use of org.hisp.dhis.trackedentity.TrackedEntityAttributeDimension in project dhis2-core by dhis2.

the class EventDataQueryServiceTest method testGetFromAnalyticalObjectC.

@Test
void testGetFromAnalyticalObjectC() {
    EventChart eventChart = new EventChart();
    eventChart.setAutoFields();
    eventChart.setProgram(prA);
    eventChart.getColumnDimensions().add(deA.getUid());
    eventChart.getColumnDimensions().add(atA.getUid());
    eventChart.getRowDimensions().add(DimensionalObject.ORGUNIT_DIM_ID);
    eventChart.getFilterDimensions().add(DimensionalObject.PERIOD_DIM_ID);
    eventChart.getDataElementDimensions().add(new TrackedEntityDataElementDimension(deA, null, null, "GT:2000"));
    eventChart.getAttributeDimensions().add(new TrackedEntityAttributeDimension(atA, null, "LE:5"));
    eventChart.getPeriods().add(peA);
    eventChart.getPeriods().add(peB);
    eventChart.getOrganisationUnits().add(ouA);
    EventQueryParams params = dataQueryService.getFromAnalyticalObject(eventChart);
    assertNotNull(params);
    assertEquals(2, params.getItems().size());
    assertEquals(1, params.getOrganisationUnits().size());
    assertEquals(2, params.getFilterPeriods().size());
}
Also used : TrackedEntityAttributeDimension(org.hisp.dhis.trackedentity.TrackedEntityAttributeDimension) EventQueryParams(org.hisp.dhis.analytics.event.EventQueryParams) EventChart(org.hisp.dhis.eventchart.EventChart) TrackedEntityDataElementDimension(org.hisp.dhis.trackedentity.TrackedEntityDataElementDimension) Test(org.junit.jupiter.api.Test) DhisSpringTest(org.hisp.dhis.DhisSpringTest)

Aggregations

TrackedEntityAttributeDimension (org.hisp.dhis.trackedentity.TrackedEntityAttributeDimension)12 EventChart (org.hisp.dhis.eventchart.EventChart)6 TrackedEntityDataElementDimension (org.hisp.dhis.trackedentity.TrackedEntityDataElementDimension)6 Test (org.junit.jupiter.api.Test)6 DhisSpringTest (org.hisp.dhis.DhisSpringTest)4 TrackedEntityProgramIndicatorDimension (org.hisp.dhis.trackedentity.TrackedEntityProgramIndicatorDimension)4 EventQueryParams (org.hisp.dhis.analytics.event.EventQueryParams)3 DimensionalObject (org.hisp.dhis.common.DimensionalObject)3 TrackedEntityAttribute (org.hisp.dhis.trackedentity.TrackedEntityAttribute)3 ArrayList (java.util.ArrayList)2 CategoryDimension (org.hisp.dhis.category.CategoryDimension)2 DataDimensionItem (org.hisp.dhis.common.DataDimensionItem)2 DimensionalItemObject (org.hisp.dhis.common.DimensionalItemObject)2 LegendSet (org.hisp.dhis.legend.LegendSet)2 OptionSet (org.hisp.dhis.option.OptionSet)2 List (java.util.List)1 CategoryOptionGroup (org.hisp.dhis.category.CategoryOptionGroup)1 CategoryOptionGroupSet (org.hisp.dhis.category.CategoryOptionGroupSet)1 CategoryOptionGroupSetDimension (org.hisp.dhis.category.CategoryOptionGroupSetDimension)1 AnalyticalObject (org.hisp.dhis.common.AnalyticalObject)1