@Test public void shouldRemove() throws Exception { doNothing().when(service).remove(2L); ResponseEntity<OpenLmisResponse> response = controller.remove(2L); assertThat(response.getBody().getSuccessMsg(), is(notNullValue())); }
@RequestMapping(value="remove/{programEquipmentId}") @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_EQUIPMENT_SETTINGS')") public ResponseEntity<OpenLmisResponse> remove(@PathVariable(value = "programEquipmentId") Long programEquipmentId){ ResponseEntity<OpenLmisResponse> successResponse; try{ programEquipmentTypeProductService.remove(programEquipmentId); } catch(DataException e){ return OpenLmisResponse.error(e,HttpStatus.BAD_REQUEST); } successResponse = OpenLmisResponse.success("message.equipment.association.pep.removed"); return successResponse; }
ProgramEquipmentTypeProductController extends BaseController { @RequestMapping(value="remove/{programEquipmentId}") @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_EQUIPMENT_SETTINGS')") public ResponseEntity<OpenLmisResponse> remove(@PathVariable(value = "programEquipmentId") Long programEquipmentId){ ResponseEntity<OpenLmisResponse> successResponse; try{ programEquipmentTypeProductService.remove(programEquipmentId); } catch(DataException e){ return OpenLmisResponse.error(e,HttpStatus.BAD_REQUEST); } successResponse = OpenLmisResponse.success("message.equipment.association.pep.removed"); return successResponse; } }
ProgramEquipmentTypeProductController extends BaseController { @RequestMapping(value="remove/{programEquipmentId}") @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_EQUIPMENT_SETTINGS')") public ResponseEntity<OpenLmisResponse> remove(@PathVariable(value = "programEquipmentId") Long programEquipmentId){ ResponseEntity<OpenLmisResponse> successResponse; try{ programEquipmentTypeProductService.remove(programEquipmentId); } catch(DataException e){ return OpenLmisResponse.error(e,HttpStatus.BAD_REQUEST); } successResponse = OpenLmisResponse.success("message.equipment.association.pep.removed"); return successResponse; }  }
ProgramEquipmentTypeProductController extends BaseController { @RequestMapping(value="remove/{programEquipmentId}") @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_EQUIPMENT_SETTINGS')") public ResponseEntity<OpenLmisResponse> remove(@PathVariable(value = "programEquipmentId") Long programEquipmentId){ ResponseEntity<OpenLmisResponse> successResponse; try{ programEquipmentTypeProductService.remove(programEquipmentId); } catch(DataException e){ return OpenLmisResponse.error(e,HttpStatus.BAD_REQUEST); } successResponse = OpenLmisResponse.success("message.equipment.association.pep.removed"); return successResponse; }  @RequestMapping(value="getByProgramEquipment/{programEquipmentId}",headers = ACCEPT_JSON,method = RequestMethod.GET) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_EQUIPMENT_SETTINGS')") ResponseEntity<OpenLmisResponse> getByProgramEquipmentId(@PathVariable(value="programEquipmentId") Long programEquipmentId); @RequestMapping(value = "save", method = RequestMethod.POST, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_EQUIPMENT_SETTINGS')") ResponseEntity<OpenLmisResponse> save(@RequestBody EquipmentTypeProduct equipmentTypeProduct, HttpServletRequest request); @RequestMapping(value="remove/{programEquipmentId}") @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_EQUIPMENT_SETTINGS')") ResponseEntity<OpenLmisResponse> remove(@PathVariable(value = "programEquipmentId") Long programEquipmentId); @RequestMapping(value="possible-products",headers = ACCEPT_JSON,method = RequestMethod.GET) ResponseEntity<OpenLmisResponse> getProducts(@RequestParam("program") Long programId, @RequestParam(value = "equipment", defaultValue = "0") Long equipmentId ); }
ProgramEquipmentTypeProductController extends BaseController { @RequestMapping(value="remove/{programEquipmentId}") @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_EQUIPMENT_SETTINGS')") public ResponseEntity<OpenLmisResponse> remove(@PathVariable(value = "programEquipmentId") Long programEquipmentId){ ResponseEntity<OpenLmisResponse> successResponse; try{ programEquipmentTypeProductService.remove(programEquipmentId); } catch(DataException e){ return OpenLmisResponse.error(e,HttpStatus.BAD_REQUEST); } successResponse = OpenLmisResponse.success("message.equipment.association.pep.removed"); return successResponse; }  @RequestMapping(value="getByProgramEquipment/{programEquipmentId}",headers = ACCEPT_JSON,method = RequestMethod.GET) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_EQUIPMENT_SETTINGS')") ResponseEntity<OpenLmisResponse> getByProgramEquipmentId(@PathVariable(value="programEquipmentId") Long programEquipmentId); @RequestMapping(value = "save", method = RequestMethod.POST, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_EQUIPMENT_SETTINGS')") ResponseEntity<OpenLmisResponse> save(@RequestBody EquipmentTypeProduct equipmentTypeProduct, HttpServletRequest request); @RequestMapping(value="remove/{programEquipmentId}") @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_EQUIPMENT_SETTINGS')") ResponseEntity<OpenLmisResponse> remove(@PathVariable(value = "programEquipmentId") Long programEquipmentId); @RequestMapping(value="possible-products",headers = ACCEPT_JSON,method = RequestMethod.GET) ResponseEntity<OpenLmisResponse> getProducts(@RequestParam("program") Long programId, @RequestParam(value = "equipment", defaultValue = "0") Long equipmentId ); static final String PROGRAM_EQUIPMENT_PRODUCT; static final String PRODUCTS; }