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;
}
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));
}
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;
}
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;
}
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));
}
Aggregations