@Test public void shouldGetUnapprovedProgramProducts() { Long facilityTypeId = 1L; Long programId = 2L; when(service.getUnapprovedProgramProducts(facilityTypeId, programId)).thenReturn(expectedProgramProductList); List<ProgramProduct> unapprovedProgramProducts = controller.getUnapprovedProgramProducts(facilityTypeId, programId); assertThat(unapprovedProgramProducts, is(expectedProgramProductList)); verify(service).getUnapprovedProgramProducts(facilityTypeId, programId); }
@RequestMapping(value = "/filter/programId/{programId}/facilityTypeId/{facilityTypeId}", method = GET, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_FACILITY_APPROVED_PRODUCT')") public List<ProgramProduct> getUnapprovedProgramProducts(@PathVariable(value = "facilityTypeId") Long facilityTypeId, @PathVariable(value = "programId") Long programId) { return service.getUnapprovedProgramProducts(facilityTypeId, programId); }
ProgramProductController extends BaseController { @RequestMapping(value = "/filter/programId/{programId}/facilityTypeId/{facilityTypeId}", method = GET, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_FACILITY_APPROVED_PRODUCT')") public List<ProgramProduct> getUnapprovedProgramProducts(@PathVariable(value = "facilityTypeId") Long facilityTypeId, @PathVariable(value = "programId") Long programId) { return service.getUnapprovedProgramProducts(facilityTypeId, programId); } }
ProgramProductController extends BaseController { @RequestMapping(value = "/filter/programId/{programId}/facilityTypeId/{facilityTypeId}", method = GET, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_FACILITY_APPROVED_PRODUCT')") public List<ProgramProduct> getUnapprovedProgramProducts(@PathVariable(value = "facilityTypeId") Long facilityTypeId, @PathVariable(value = "programId") Long programId) { return service.getUnapprovedProgramProducts(facilityTypeId, programId); }  }
ProgramProductController extends BaseController { @RequestMapping(value = "/filter/programId/{programId}/facilityTypeId/{facilityTypeId}", method = GET, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_FACILITY_APPROVED_PRODUCT')") public List<ProgramProduct> getUnapprovedProgramProducts(@PathVariable(value = "facilityTypeId") Long facilityTypeId, @PathVariable(value = "programId") Long programId) { return service.getUnapprovedProgramProducts(facilityTypeId, programId); }  @RequestMapping(value = "/programId/{programId}", method = GET, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_PROGRAM_PRODUCT')") ResponseEntity<OpenLmisResponse> getProgramProductsByProgram(@PathVariable Long programId); @RequestMapping(value = "/filter/programId/{programId}/facilityTypeId/{facilityTypeId}", method = GET, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_FACILITY_APPROVED_PRODUCT')") List<ProgramProduct> getUnapprovedProgramProducts(@PathVariable(value = "facilityTypeId") Long facilityTypeId,
                                                           @PathVariable(value = "programId") Long programId); @RequestMapping(value = "/search", method = GET, headers = ACCEPT_JSON) ResponseEntity<OpenLmisResponse> getByProgram(@RequestParam(value = "page", defaultValue = "1") Integer page,
                                                       @RequestParam(value = "searchParam", required = true) String searchParam,
                                                       @RequestParam(value = "column", required = true, defaultValue = "product") String column,
                                                       @Value("${search.page.size}") String limit); @RequestMapping(value = "/{programProductId}/isa", method = POST, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_PROGRAM_PRODUCT')") void insertIsa(@PathVariable Long programProductId,
                        @RequestBody ProgramProductISA programProductISA,
                        HttpServletRequest request); @RequestMapping(value = "/{programProductId}/isa/{isaId}", method = PUT, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_PROGRAM_PRODUCT')") void updateIsa(@PathVariable Long isaId,
            @PathVariable Long programProductId,
            @RequestBody ProgramProductISA programProductISA,
            HttpServletRequest request); }
ProgramProductController extends BaseController { @RequestMapping(value = "/filter/programId/{programId}/facilityTypeId/{facilityTypeId}", method = GET, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_FACILITY_APPROVED_PRODUCT')") public List<ProgramProduct> getUnapprovedProgramProducts(@PathVariable(value = "facilityTypeId") Long facilityTypeId, @PathVariable(value = "programId") Long programId) { return service.getUnapprovedProgramProducts(facilityTypeId, programId); }  @RequestMapping(value = "/programId/{programId}", method = GET, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_PROGRAM_PRODUCT')") ResponseEntity<OpenLmisResponse> getProgramProductsByProgram(@PathVariable Long programId); @RequestMapping(value = "/filter/programId/{programId}/facilityTypeId/{facilityTypeId}", method = GET, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_FACILITY_APPROVED_PRODUCT')") List<ProgramProduct> getUnapprovedProgramProducts(@PathVariable(value = "facilityTypeId") Long facilityTypeId,
                                                           @PathVariable(value = "programId") Long programId); @RequestMapping(value = "/search", method = GET, headers = ACCEPT_JSON) ResponseEntity<OpenLmisResponse> getByProgram(@RequestParam(value = "page", defaultValue = "1") Integer page,
                                                       @RequestParam(value = "searchParam", required = true) String searchParam,
                                                       @RequestParam(value = "column", required = true, defaultValue = "product") String column,
                                                       @Value("${search.page.size}") String limit); @RequestMapping(value = "/{programProductId}/isa", method = POST, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_PROGRAM_PRODUCT')") void insertIsa(@PathVariable Long programProductId,
                        @RequestBody ProgramProductISA programProductISA,
                        HttpServletRequest request); @RequestMapping(value = "/{programProductId}/isa/{isaId}", method = PUT, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_PROGRAM_PRODUCT')") void updateIsa(@PathVariable Long isaId,
            @PathVariable Long programProductId,
            @RequestBody ProgramProductISA programProductISA,
            HttpServletRequest request);  }