@Test public void shouldSave() throws Exception { VaccineReport report = new VaccineReport(); doNothing().when(service).save(report, 1L); ResponseEntity<OpenLmisResponse> response = controller.save(report, httpServletRequest); verify(service).save(report, 1L); assertThat(report, is(response.getBody().getData().get("report"))); }
@RequestMapping(value = "save") @PreAuthorize("@permissionEvaluator.hasPermission(principal,'CREATE_IVD')") public ResponseEntity<OpenLmisResponse> save(@RequestBody VaccineReport report, HttpServletRequest request) { service.save(report, loggedInUserId(request)); return OpenLmisResponse.response(REPORT, report); }
VaccineReportController extends BaseController { @RequestMapping(value = "save") @PreAuthorize("@permissionEvaluator.hasPermission(principal,'CREATE_IVD')") public ResponseEntity<OpenLmisResponse> save(@RequestBody VaccineReport report, HttpServletRequest request) { service.save(report, loggedInUserId(request)); return OpenLmisResponse.response(REPORT, report); } }
VaccineReportController extends BaseController { @RequestMapping(value = "save") @PreAuthorize("@permissionEvaluator.hasPermission(principal,'CREATE_IVD')") public ResponseEntity<OpenLmisResponse> save(@RequestBody VaccineReport report, HttpServletRequest request) { service.save(report, loggedInUserId(request)); return OpenLmisResponse.response(REPORT, report); }  }
VaccineReportController extends BaseController { @RequestMapping(value = "save") @PreAuthorize("@permissionEvaluator.hasPermission(principal,'CREATE_IVD')") public ResponseEntity<OpenLmisResponse> save(@RequestBody VaccineReport report, HttpServletRequest request) { service.save(report, loggedInUserId(request)); return OpenLmisResponse.response(REPORT, report); }  @RequestMapping(value = "periods/{facilityId}/{programId}", method = RequestMethod.GET) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'CREATE_IVD')") ResponseEntity<OpenLmisResponse> getPeriods(@PathVariable Long facilityId, @PathVariable Long programId); @RequestMapping(value = "view-periods/{facilityId}/{programId}", method = RequestMethod.GET) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'VIEW_IVD')") ResponseEntity<OpenLmisResponse> getViewPeriods(@PathVariable Long facilityId, @PathVariable Long programId); @RequestMapping(value = "initialize/{facilityId}/{programId}/{periodId}") @PreAuthorize("@permissionEvaluator.hasPermission(principal,'CREATE_IVD')") ResponseEntity<OpenLmisResponse> initialize(
          @PathVariable Long facilityId,
          @PathVariable Long programId,
          @PathVariable Long periodId,
          HttpServletRequest request
  ); @RequestMapping(value = "get/{id}.json", method = RequestMethod.GET) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'CREATE_IVD, VIEW_IVD')") ResponseEntity<OpenLmisResponse> getReport(@PathVariable Long id); @RequestMapping(value = "save") @PreAuthorize("@permissionEvaluator.hasPermission(principal,'CREATE_IVD')") ResponseEntity<OpenLmisResponse> save(@RequestBody VaccineReport report, HttpServletRequest request); @RequestMapping(value = "submit") @PreAuthorize("@permissionEvaluator.hasPermission(principal,'CREATE_IVD')") ResponseEntity<OpenLmisResponse> submit(@RequestBody VaccineReport report, HttpServletRequest request); @RequestMapping(value = "vaccine-monthly-report") @PreAuthorize("@permissionEvaluator.hasPermission(principal,'CREATE_IVD')") ResponseEntity<OpenLmisResponse> getVaccineMonthlyReport(@RequestParam("facility") Long facilityId, @RequestParam("period") Long periodId, @RequestParam("zone") Long zoneId); @RequestMapping(value = "vaccine-usage-trend") ResponseEntity<OpenLmisResponse> vaccineUsageTrend(@RequestParam("facilityCode") String facilityCode, @RequestParam("productCode") String productCode, @RequestParam("period") Long periodId, @RequestParam("zone") Long zoneId); @RequestMapping(value = "/orderRequisition/downloadPDF", method = RequestMethod.GET) ModelAndView downloadPDF(); }
VaccineReportController extends BaseController { @RequestMapping(value = "save") @PreAuthorize("@permissionEvaluator.hasPermission(principal,'CREATE_IVD')") public ResponseEntity<OpenLmisResponse> save(@RequestBody VaccineReport report, HttpServletRequest request) { service.save(report, loggedInUserId(request)); return OpenLmisResponse.response(REPORT, report); }  @RequestMapping(value = "periods/{facilityId}/{programId}", method = RequestMethod.GET) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'CREATE_IVD')") ResponseEntity<OpenLmisResponse> getPeriods(@PathVariable Long facilityId, @PathVariable Long programId); @RequestMapping(value = "view-periods/{facilityId}/{programId}", method = RequestMethod.GET) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'VIEW_IVD')") ResponseEntity<OpenLmisResponse> getViewPeriods(@PathVariable Long facilityId, @PathVariable Long programId); @RequestMapping(value = "initialize/{facilityId}/{programId}/{periodId}") @PreAuthorize("@permissionEvaluator.hasPermission(principal,'CREATE_IVD')") ResponseEntity<OpenLmisResponse> initialize(
          @PathVariable Long facilityId,
          @PathVariable Long programId,
          @PathVariable Long periodId,
          HttpServletRequest request
  ); @RequestMapping(value = "get/{id}.json", method = RequestMethod.GET) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'CREATE_IVD, VIEW_IVD')") ResponseEntity<OpenLmisResponse> getReport(@PathVariable Long id); @RequestMapping(value = "save") @PreAuthorize("@permissionEvaluator.hasPermission(principal,'CREATE_IVD')") ResponseEntity<OpenLmisResponse> save(@RequestBody VaccineReport report, HttpServletRequest request); @RequestMapping(value = "submit") @PreAuthorize("@permissionEvaluator.hasPermission(principal,'CREATE_IVD')") ResponseEntity<OpenLmisResponse> submit(@RequestBody VaccineReport report, HttpServletRequest request); @RequestMapping(value = "vaccine-monthly-report") @PreAuthorize("@permissionEvaluator.hasPermission(principal,'CREATE_IVD')") ResponseEntity<OpenLmisResponse> getVaccineMonthlyReport(@RequestParam("facility") Long facilityId, @RequestParam("period") Long periodId, @RequestParam("zone") Long zoneId); @RequestMapping(value = "vaccine-usage-trend") ResponseEntity<OpenLmisResponse> vaccineUsageTrend(@RequestParam("facilityCode") String facilityCode, @RequestParam("productCode") String productCode, @RequestParam("period") Long periodId, @RequestParam("zone") Long zoneId); @RequestMapping(value = "/orderRequisition/downloadPDF", method = RequestMethod.GET) ModelAndView downloadPDF(); static final String PERIODS; static final String REPORT; }