Search in sources :

Example 1 with TrackerBundleReportMode

use of org.hisp.dhis.tracker.TrackerBundleReportMode in project dhis2-core by dhis2.

the class TrackerImportController method getJobReport.

@GetMapping(value = "/jobs/{uid}/report", produces = APPLICATION_JSON_VALUE)
public TrackerImportReport getJobReport(@PathVariable String uid, @RequestParam(defaultValue = "errors", required = false) String reportMode, HttpServletResponse response) throws HttpStatusCodeException, NotFoundException {
    TrackerBundleReportMode trackerBundleReportMode = TrackerBundleReportMode.getTrackerBundleReportMode(reportMode);
    setNoStore(response);
    return Optional.ofNullable(notifier.getJobSummaryByJobId(JobType.TRACKER_IMPORT_JOB, uid)).map(report -> trackerImportService.buildImportReport((TrackerImportReport) report, trackerBundleReportMode)).orElseThrow(() -> NotFoundException.notFoundUid(uid));
}
Also used : DhisApiVersion(org.hisp.dhis.common.DhisApiVersion) PathVariable(org.springframework.web.bind.annotation.PathVariable) ContextUtils.setNoStore(org.hisp.dhis.webapi.utils.ContextUtils.setNoStore) RequestParam(org.springframework.web.bind.annotation.RequestParam) HttpStatusCodeException(org.springframework.web.client.HttpStatusCodeException) RequiredArgsConstructor(lombok.RequiredArgsConstructor) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) TrackerImportService(org.hisp.dhis.tracker.TrackerImportService) Deque(java.util.Deque) StreamUtils(org.hisp.dhis.commons.util.StreamUtils) ApiVersion(org.hisp.dhis.webapi.mvc.annotation.ApiVersion) CurrentUser(org.hisp.dhis.user.CurrentUser) Notifier(org.hisp.dhis.system.notification.Notifier) RequestBody(org.springframework.web.bind.annotation.RequestBody) WebMessageUtils.ok(org.hisp.dhis.dxf2.webmessage.WebMessageUtils.ok) HttpServletRequest(javax.servlet.http.HttpServletRequest) TrackerStatus(org.hisp.dhis.tracker.report.TrackerStatus) TrackerImportReportRequest(org.hisp.dhis.webapi.controller.tracker.TrackerImportReportRequest) TrackerJobWebMessageResponse(org.hisp.dhis.tracker.job.TrackerJobWebMessageResponse) JobType(org.hisp.dhis.scheduling.JobType) User(org.hisp.dhis.user.User) GetMapping(org.springframework.web.bind.annotation.GetMapping) SecurityContextHolder(org.springframework.security.core.context.SecurityContextHolder) TrackerBundleParams(org.hisp.dhis.webapi.controller.tracker.TrackerBundleParams) Event(org.hisp.dhis.tracker.domain.Event) ContextUtils(org.hisp.dhis.webapi.utils.ContextUtils) PostMapping(org.springframework.web.bind.annotation.PostMapping) NotFoundException(org.hisp.dhis.webapi.controller.exception.NotFoundException) ContextService(org.hisp.dhis.webapi.service.ContextService) CsvEventService(org.hisp.dhis.dxf2.events.event.csv.CsvEventService) Notification(org.hisp.dhis.system.notification.Notification) TrackerImportStrategyHandler(org.hisp.dhis.webapi.strategy.tracker.imports.TrackerImportStrategyHandler) HttpServletResponse(javax.servlet.http.HttpServletResponse) TrackerImportReport(org.hisp.dhis.tracker.report.TrackerImportReport) IOException(java.io.IOException) APPLICATION_JSON_VALUE(org.springframework.http.MediaType.APPLICATION_JSON_VALUE) ResponseBody(org.springframework.web.bind.annotation.ResponseBody) RestController(org.springframework.web.bind.annotation.RestController) HttpStatus(org.springframework.http.HttpStatus) List(java.util.List) TrackerBundleReportMode(org.hisp.dhis.tracker.TrackerBundleReportMode) ParseException(org.locationtech.jts.io.ParseException) Optional(java.util.Optional) RESOURCE_PATH(org.hisp.dhis.webapi.controller.tracker.TrackerControllerSupport.RESOURCE_PATH) CodeGenerator(org.hisp.dhis.common.CodeGenerator) ResponseEntity(org.springframework.http.ResponseEntity) WebMessage(org.hisp.dhis.dxf2.webmessage.WebMessage) InputStream(java.io.InputStream) TrackerBundleReportMode(org.hisp.dhis.tracker.TrackerBundleReportMode) GetMapping(org.springframework.web.bind.annotation.GetMapping)

Aggregations

IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 Deque (java.util.Deque)1 List (java.util.List)1 Optional (java.util.Optional)1 HttpServletRequest (javax.servlet.http.HttpServletRequest)1 HttpServletResponse (javax.servlet.http.HttpServletResponse)1 RequiredArgsConstructor (lombok.RequiredArgsConstructor)1 CodeGenerator (org.hisp.dhis.common.CodeGenerator)1 DhisApiVersion (org.hisp.dhis.common.DhisApiVersion)1 StreamUtils (org.hisp.dhis.commons.util.StreamUtils)1 CsvEventService (org.hisp.dhis.dxf2.events.event.csv.CsvEventService)1 WebMessage (org.hisp.dhis.dxf2.webmessage.WebMessage)1 WebMessageUtils.ok (org.hisp.dhis.dxf2.webmessage.WebMessageUtils.ok)1 JobType (org.hisp.dhis.scheduling.JobType)1 Notification (org.hisp.dhis.system.notification.Notification)1 Notifier (org.hisp.dhis.system.notification.Notifier)1 TrackerBundleReportMode (org.hisp.dhis.tracker.TrackerBundleReportMode)1 TrackerImportService (org.hisp.dhis.tracker.TrackerImportService)1 Event (org.hisp.dhis.tracker.domain.Event)1