Search in sources :

Example 11 with EventVisualization

use of org.hisp.dhis.eventvisualization.EventVisualization in project dhis2-core by dhis2.

the class DashboardServiceTest method createEventVisualization.

private EventVisualization createEventVisualization(String name, Program program) {
    EventVisualization eventVisualization = createEventVisualization('X', program);
    eventVisualization.setName(name);
    return eventVisualization;
}
Also used : EventVisualization(org.hisp.dhis.eventvisualization.EventVisualization)

Example 12 with EventVisualization

use of org.hisp.dhis.eventvisualization.EventVisualization in project dhis2-core by dhis2.

the class DashboardServiceTest method testSearchDashboardWithMaxCount.

@Test
void testSearchDashboardWithMaxCount() {
    Program prA = createProgram('A', null, null);
    objectManager.save(prA);
    IntStream.range(1, 30).forEach(i -> {
        Visualization visualization = createVisualization('A');
        visualization.setName(RandomStringUtils.randomAlphabetic(5));
        visualizationService.save(visualization);
    });
    IntStream.range(1, 30).forEach(i -> {
        EventVisualization eventVisualization = createEventVisualization("A", prA);
        eventVisualization.setName(RandomStringUtils.randomAlphabetic(5));
        eventVisualizationService.save(eventVisualization);
    });
    IntStream.range(1, 30).forEach(i -> eventChartService.saveEventChart(createEventChart(prA)));
    DashboardSearchResult result = dashboardService.search(Sets.newHashSet(DashboardItemType.VISUALIZATION));
    assertThat(result.getVisualizationCount(), is(25));
    assertThat(result.getEventChartCount(), is(6));
    result = dashboardService.search(Sets.newHashSet(DashboardItemType.VISUALIZATION), 3, null);
    assertThat(result.getVisualizationCount(), is(25));
    assertThat(result.getEventChartCount(), is(3));
    result = dashboardService.search(Sets.newHashSet(DashboardItemType.VISUALIZATION), 3, 29);
    assertThat(result.getVisualizationCount(), is(29));
    assertThat(result.getEventChartCount(), is(3));
    result = dashboardService.search(Sets.newHashSet(DashboardItemType.EVENT_VISUALIZATION), 3, 29);
    assertThat(result.getEventVisualizationCount(), is(29));
    assertThat(result.getEventReportCount(), is(0));
    result = dashboardService.search(Sets.newHashSet(DashboardItemType.EVENT_VISUALIZATION), 3, 30);
    assertThat(result.getEventVisualizationCount(), is(30));
    assertThat(result.getEventChartCount(), is(3));
}
Also used : EventVisualization(org.hisp.dhis.eventvisualization.EventVisualization) Visualization(org.hisp.dhis.visualization.Visualization) Program(org.hisp.dhis.program.Program) EventVisualization(org.hisp.dhis.eventvisualization.EventVisualization) Test(org.junit.jupiter.api.Test) DhisSpringTest(org.hisp.dhis.DhisSpringTest)

Example 13 with EventVisualization

use of org.hisp.dhis.eventvisualization.EventVisualization in project dhis2-core by dhis2.

the class DhisConvenienceTest method createEventVisualization.

public static EventVisualization createEventVisualization(char uniqueCharacter, Program program) {
    EventVisualization eventVisualization = new EventVisualization("name-" + uniqueCharacter);
    eventVisualization.setAutoFields();
    eventVisualization.setProgram(program);
    eventVisualization.setName("EventVisualization" + uniqueCharacter);
    eventVisualization.setType(EventVisualizationType.COLUMN);
    return eventVisualization;
}
Also used : EventVisualization(org.hisp.dhis.eventvisualization.EventVisualization)

Example 14 with EventVisualization

use of org.hisp.dhis.eventvisualization.EventVisualization in project dhis2-core by dhis2.

the class EventVisualizationController method deserializeXmlEntity.

@Override
protected EventVisualization deserializeXmlEntity(final HttpServletRequest request) throws IOException {
    final EventVisualization eventVisualization = super.deserializeXmlEntity(request);
    prepare(eventVisualization);
    return eventVisualization;
}
Also used : EventVisualization(org.hisp.dhis.eventvisualization.EventVisualization)

Example 15 with EventVisualization

use of org.hisp.dhis.eventvisualization.EventVisualization in project dhis2-core by dhis2.

the class InterpretationController method writeEventChartInterpretation.

@PostMapping(value = "/eventChart/{uid}", consumes = { "text/html", "text/plain" })
@ResponseBody
@Deprecated
public WebMessage writeEventChartInterpretation(@PathVariable("uid") String uid, @RequestParam(value = "ou", required = false) String orgUnitUid, @CurrentUser User currentUser, @RequestBody String text) throws WebMessageException {
    EventChart eventChart = idObjectManager.get(EventChart.class, uid);
    if (eventChart == null) {
        return conflict("Event chart does not exist or is not accessible: " + uid);
    }
    final EventVisualization eventVisualization = idObjectManager.get(EventVisualization.class, eventChart.getUid());
    OrganisationUnit orgUnit = getUserOrganisationUnit(orgUnitUid, eventChart, currentUser);
    return createInterpretation(new Interpretation(eventVisualization, eventChart, orgUnit, text));
}
Also used : OrganisationUnit(org.hisp.dhis.organisationunit.OrganisationUnit) EventChart(org.hisp.dhis.eventchart.EventChart) Interpretation(org.hisp.dhis.interpretation.Interpretation) EventVisualization(org.hisp.dhis.eventvisualization.EventVisualization) PostMapping(org.springframework.web.bind.annotation.PostMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Aggregations

EventVisualization (org.hisp.dhis.eventvisualization.EventVisualization)31 Test (org.junit.jupiter.api.Test)20 DhisSpringTest (org.hisp.dhis.DhisSpringTest)11 TransactionalIntegrationTest (org.hisp.dhis.TransactionalIntegrationTest)7 BaseDimensionalObject (org.hisp.dhis.common.BaseDimensionalObject)7 User (org.hisp.dhis.user.User)7 OrganisationUnit (org.hisp.dhis.organisationunit.OrganisationUnit)4 Program (org.hisp.dhis.program.Program)4 CriteriaBuilder (javax.persistence.criteria.CriteriaBuilder)3 JpaQueryParameters (org.hisp.dhis.hibernate.JpaQueryParameters)3 Interpretation (org.hisp.dhis.interpretation.Interpretation)3 UserAccess (org.hisp.dhis.user.sharing.UserAccess)3 ArrayList (java.util.ArrayList)2 Function (java.util.function.Function)2 Dashboard (org.hisp.dhis.dashboard.Dashboard)2 DataElement (org.hisp.dhis.dataelement.DataElement)2 EventChart (org.hisp.dhis.eventchart.EventChart)2 EventReport (org.hisp.dhis.eventreport.EventReport)2 UserAuthorityGroup (org.hisp.dhis.user.UserAuthorityGroup)2 PostMapping (org.springframework.web.bind.annotation.PostMapping)2