@Test public void shouldGetByProgramEquipmentId() throws Exception { List<EquipmentTypeProduct> list = new ArrayList<>(); when(service.getByProgramEquipmentId(2L)).thenReturn(list); ResponseEntity<OpenLmisResponse> response = controller.getByProgramEquipmentId(2L); assertThat(list,is(response.getBody().getData().get("programEquipmentProducts"))); }
@RequestMapping(value="getByProgramEquipment/{programEquipmentId}",headers = ACCEPT_JSON,method = RequestMethod.GET) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_EQUIPMENT_SETTINGS')") public ResponseEntity<OpenLmisResponse> getByProgramEquipmentId(@PathVariable(value="programEquipmentId") Long programEquipmentId){ return OpenLmisResponse.response("programEquipmentProducts", programEquipmentTypeProductService.getByProgramEquipmentId(programEquipmentId)); }
ProgramEquipmentTypeProductController extends BaseController { @RequestMapping(value="getByProgramEquipment/{programEquipmentId}",headers = ACCEPT_JSON,method = RequestMethod.GET) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_EQUIPMENT_SETTINGS')") public ResponseEntity<OpenLmisResponse> getByProgramEquipmentId(@PathVariable(value="programEquipmentId") Long programEquipmentId){ return OpenLmisResponse.response("programEquipmentProducts", programEquipmentTypeProductService.getByProgramEquipmentId(programEquipmentId)); } }
ProgramEquipmentTypeProductController extends BaseController { @RequestMapping(value="getByProgramEquipment/{programEquipmentId}",headers = ACCEPT_JSON,method = RequestMethod.GET) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_EQUIPMENT_SETTINGS')") public ResponseEntity<OpenLmisResponse> getByProgramEquipmentId(@PathVariable(value="programEquipmentId") Long programEquipmentId){ return OpenLmisResponse.response("programEquipmentProducts", programEquipmentTypeProductService.getByProgramEquipmentId(programEquipmentId)); }  }
ProgramEquipmentTypeProductController extends BaseController { @RequestMapping(value="getByProgramEquipment/{programEquipmentId}",headers = ACCEPT_JSON,method = RequestMethod.GET) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_EQUIPMENT_SETTINGS')") public ResponseEntity<OpenLmisResponse> getByProgramEquipmentId(@PathVariable(value="programEquipmentId") Long programEquipmentId){ return OpenLmisResponse.response("programEquipmentProducts", programEquipmentTypeProductService.getByProgramEquipmentId(programEquipmentId)); }  @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="getByProgramEquipment/{programEquipmentId}",headers = ACCEPT_JSON,method = RequestMethod.GET) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_EQUIPMENT_SETTINGS')") public ResponseEntity<OpenLmisResponse> getByProgramEquipmentId(@PathVariable(value="programEquipmentId") Long programEquipmentId){ return OpenLmisResponse.response("programEquipmentProducts", programEquipmentTypeProductService.getByProgramEquipmentId(programEquipmentId)); }  @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; }