@Test public void shouldInsertFacilityProgramProductISA() { ProgramProductISA programProductISA = new ProgramProductISA(); Long programProductId = 1L; Long facilityId = 2L; String username = "Foo"; session.setAttribute(UserAuthenticationSuccessHandler.USER, username); controller.insertIsa(facilityId, programProductId, programProductISA, httpServletRequest); verify(service).insertISA(facilityId, programProductISA); assertThat(programProductISA.getProgramProductId(), is(1l)); }
@RequestMapping(value = "/facility/{facilityId}/programProducts/{programProductId}/isa", method = POST, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_PROGRAM_PRODUCT')") public void insertIsa(@PathVariable Long facilityId, @PathVariable Long programProductId, @RequestBody ProgramProductISA programProductISA, HttpServletRequest request) { programProductISA.setCreatedBy(loggedInUserId(request)); programProductISA.setModifiedBy(loggedInUserId(request)); programProductISA.setProgramProductId(programProductId); service.insertISA(facilityId, programProductISA); }
FacilityProgramProductController extends BaseController { @RequestMapping(value = "/facility/{facilityId}/programProducts/{programProductId}/isa", method = POST, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_PROGRAM_PRODUCT')") public void insertIsa(@PathVariable Long facilityId, @PathVariable Long programProductId, @RequestBody ProgramProductISA programProductISA, HttpServletRequest request) { programProductISA.setCreatedBy(loggedInUserId(request)); programProductISA.setModifiedBy(loggedInUserId(request)); programProductISA.setProgramProductId(programProductId); service.insertISA(facilityId, programProductISA); } }
FacilityProgramProductController extends BaseController { @RequestMapping(value = "/facility/{facilityId}/programProducts/{programProductId}/isa", method = POST, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_PROGRAM_PRODUCT')") public void insertIsa(@PathVariable Long facilityId, @PathVariable Long programProductId, @RequestBody ProgramProductISA programProductISA, HttpServletRequest request) { programProductISA.setCreatedBy(loggedInUserId(request)); programProductISA.setModifiedBy(loggedInUserId(request)); programProductISA.setProgramProductId(programProductId); service.insertISA(facilityId, programProductISA); }  }
FacilityProgramProductController extends BaseController { @RequestMapping(value = "/facility/{facilityId}/programProducts/{programProductId}/isa", method = POST, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_PROGRAM_PRODUCT')") public void insertIsa(@PathVariable Long facilityId, @PathVariable Long programProductId, @RequestBody ProgramProductISA programProductISA, HttpServletRequest request) { programProductISA.setCreatedBy(loggedInUserId(request)); programProductISA.setModifiedBy(loggedInUserId(request)); programProductISA.setProgramProductId(programProductId); service.insertISA(facilityId, programProductISA); }  @RequestMapping(value = "/facility/{facilityId}/program/{programId}", method = GET, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_PROGRAM_PRODUCT')") ResponseEntity<OpenLmisResponse> getProgramProductsByProgramAndFacility(@PathVariable Long programId,
                                                                                 @PathVariable Long facilityId); @RequestMapping(value = "/facility/{facilityId}/program/{programId}", method = PUT, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_FACILITY')") void saveFacilityProgramProducts(@PathVariable Long facilityId, @RequestBody List<FacilityProgramProduct> products); @RequestMapping(value = "/facility/{facilityId}/programProducts/{programProductId}/isa", method = POST, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_PROGRAM_PRODUCT')") void insertIsa(@PathVariable Long facilityId,
                        @PathVariable Long programProductId,
                        @RequestBody ProgramProductISA programProductISA,
                        HttpServletRequest request); @RequestMapping(value = "/facility/{facilityId}/programProducts/{programProductId}/isa", method = DELETE, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_PROGRAM_PRODUCT')") void deleteIsa(@PathVariable Long facilityId, @PathVariable Long programProductId, HttpServletRequest request); }
FacilityProgramProductController extends BaseController { @RequestMapping(value = "/facility/{facilityId}/programProducts/{programProductId}/isa", method = POST, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_PROGRAM_PRODUCT')") public void insertIsa(@PathVariable Long facilityId, @PathVariable Long programProductId, @RequestBody ProgramProductISA programProductISA, HttpServletRequest request) { programProductISA.setCreatedBy(loggedInUserId(request)); programProductISA.setModifiedBy(loggedInUserId(request)); programProductISA.setProgramProductId(programProductId); service.insertISA(facilityId, programProductISA); }  @RequestMapping(value = "/facility/{facilityId}/program/{programId}", method = GET, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_PROGRAM_PRODUCT')") ResponseEntity<OpenLmisResponse> getProgramProductsByProgramAndFacility(@PathVariable Long programId,
                                                                                 @PathVariable Long facilityId); @RequestMapping(value = "/facility/{facilityId}/program/{programId}", method = PUT, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_FACILITY')") void saveFacilityProgramProducts(@PathVariable Long facilityId, @RequestBody List<FacilityProgramProduct> products); @RequestMapping(value = "/facility/{facilityId}/programProducts/{programProductId}/isa", method = POST, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_PROGRAM_PRODUCT')") void insertIsa(@PathVariable Long facilityId,
                        @PathVariable Long programProductId,
                        @RequestBody ProgramProductISA programProductISA,
                        HttpServletRequest request); @RequestMapping(value = "/facility/{facilityId}/programProducts/{programProductId}/isa", method = DELETE, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'MANAGE_PROGRAM_PRODUCT')") void deleteIsa(@PathVariable Long facilityId, @PathVariable Long programProductId, HttpServletRequest request); static final String PROGRAM_PRODUCT_LIST; }