@Test public void shouldDeleteFacilityApprovedProduct() { FacilityTypeApprovedProduct facilityTypeApprovedProduct = new FacilityTypeApprovedProduct(); facilityTypeApprovedProduct.setId(3L); doNothing().when(service).delete(3L); ResponseEntity<OpenLmisResponse> response = controller.delete(3L); assertThat(response.getBody().getSuccessMsg(), is("message.facility.approved.product.deleted.success")); verify(service).delete(3L); }
@RequestMapping(value = "/{id}", method = DELETE, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_FACILITY_APPROVED_PRODUCT')") public ResponseEntity<OpenLmisResponse> delete(@PathVariable("id") Long id) { service.delete(id); return OpenLmisResponse.success("message.facility.approved.product.deleted.success"); }
FacilityApprovedProductController extends BaseController { @RequestMapping(value = "/{id}", method = DELETE, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_FACILITY_APPROVED_PRODUCT')") public ResponseEntity<OpenLmisResponse> delete(@PathVariable("id") Long id) { service.delete(id); return OpenLmisResponse.success("message.facility.approved.product.deleted.success"); } }
FacilityApprovedProductController extends BaseController { @RequestMapping(value = "/{id}", method = DELETE, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_FACILITY_APPROVED_PRODUCT')") public ResponseEntity<OpenLmisResponse> delete(@PathVariable("id") Long id) { service.delete(id); return OpenLmisResponse.success("message.facility.approved.product.deleted.success"); }  }
FacilityApprovedProductController extends BaseController { @RequestMapping(value = "/{id}", method = DELETE, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_FACILITY_APPROVED_PRODUCT')") public ResponseEntity<OpenLmisResponse> delete(@PathVariable("id") Long id) { service.delete(id); return OpenLmisResponse.success("message.facility.approved.product.deleted.success"); }  @RequestMapping(value = "/facility/{facilityId}/program/{programId}/nonFullSupply", method = GET, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'CREATE_REQUISITION, AUTHORIZE_REQUISITION')") ResponseEntity<OpenLmisResponse> getAllNonFullSupplyProductsByFacilityAndProgram(@PathVariable("facilityId") Long facilityId,
                                                                                          @PathVariable("programId") Long programId); @RequestMapping(method = GET, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_FACILITY_APPROVED_PRODUCT')") ResponseEntity<OpenLmisResponse> getAllBy(@RequestParam("facilityTypeId") Long facilityTypeId,
                                                   @RequestParam("programId") Long programId,
                                                   @RequestParam(value = "searchParam", defaultValue = "", required = false) String searchParam,
                                                   @RequestParam(value = "page", defaultValue = "1") Integer page,
                                                   @Value("${search.page.size}") String limit); @RequestMapping(method = POST, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_FACILITY_APPROVED_PRODUCT')") ResponseEntity<OpenLmisResponse> insert(@RequestBody FacilityTypeApprovedProductList facilityTypeApprovedProducts,
                                                 HttpServletRequest request); @RequestMapping(value = "/{id}", method = PUT, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_FACILITY_APPROVED_PRODUCT')") ResponseEntity<OpenLmisResponse> update(@PathVariable("id") Long id,
                                                 @RequestBody FacilityTypeApprovedProduct facilityTypeApprovedProduct,
                                                 HttpServletRequest request); @RequestMapping(value = "/{id}", method = DELETE, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_FACILITY_APPROVED_PRODUCT')") ResponseEntity<OpenLmisResponse> delete(@PathVariable("id") Long id); }
FacilityApprovedProductController extends BaseController { @RequestMapping(value = "/{id}", method = DELETE, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_FACILITY_APPROVED_PRODUCT')") public ResponseEntity<OpenLmisResponse> delete(@PathVariable("id") Long id) { service.delete(id); return OpenLmisResponse.success("message.facility.approved.product.deleted.success"); }  @RequestMapping(value = "/facility/{facilityId}/program/{programId}/nonFullSupply", method = GET, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'CREATE_REQUISITION, AUTHORIZE_REQUISITION')") ResponseEntity<OpenLmisResponse> getAllNonFullSupplyProductsByFacilityAndProgram(@PathVariable("facilityId") Long facilityId,
                                                                                          @PathVariable("programId") Long programId); @RequestMapping(method = GET, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_FACILITY_APPROVED_PRODUCT')") ResponseEntity<OpenLmisResponse> getAllBy(@RequestParam("facilityTypeId") Long facilityTypeId,
                                                   @RequestParam("programId") Long programId,
                                                   @RequestParam(value = "searchParam", defaultValue = "", required = false) String searchParam,
                                                   @RequestParam(value = "page", defaultValue = "1") Integer page,
                                                   @Value("${search.page.size}") String limit); @RequestMapping(method = POST, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_FACILITY_APPROVED_PRODUCT')") ResponseEntity<OpenLmisResponse> insert(@RequestBody FacilityTypeApprovedProductList facilityTypeApprovedProducts,
                                                 HttpServletRequest request); @RequestMapping(value = "/{id}", method = PUT, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_FACILITY_APPROVED_PRODUCT')") ResponseEntity<OpenLmisResponse> update(@PathVariable("id") Long id,
                                                 @RequestBody FacilityTypeApprovedProduct facilityTypeApprovedProduct,
                                                 HttpServletRequest request); @RequestMapping(value = "/{id}", method = DELETE, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_FACILITY_APPROVED_PRODUCT')") ResponseEntity<OpenLmisResponse> delete(@PathVariable("id") Long id); static final String NON_FULL_SUPPLY_PRODUCTS; static final String FACILITY_APPROVED_PRODUCTS; static final String PAGINATION; static final String FACILITY_TYPE_APPROVED_PRODUCT; }