@Test public void shouldUpdateBudgetFileTemplate() { EDIFileColumn ediFileColumn1 = new EDIFileColumn("name", "Label", false, true, 1, "dd/mm/yy"); EDIFileColumn ediFileColumn2 = new EDIFileColumn("name", "Label", false, true, 2, "dd/mm/yy"); EDIFileTemplate budgetFileTemplate = new EDIFileTemplate( new EDIConfiguration(true), asList(ediFileColumn1, ediFileColumn2)); ResponseEntity<OpenLmisResponse> response = controller.update(budgetFileTemplate, httpServletRequest); assertThat(response.getStatusCode(), is(OK)); assertThat(response.getBody().getSuccessMsg(), is("budget.file.configuration.success")); assertThat(budgetFileTemplate.getConfiguration().getModifiedBy(), is(userId)); for (EDIFileColumn column : budgetFileTemplate.getColumns()) { assertThat(column.getModifiedBy(), is(userId)); } verify(budgetFileTemplateService).update(budgetFileTemplate); }
@RequestMapping(value = "/budget-file-template", method = POST, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'SYSTEM_SETTINGS')") public ResponseEntity<OpenLmisResponse> update(@RequestBody EDIFileTemplate ediFileTemplate, HttpServletRequest request) { ediFileTemplate.validateAndSetModifiedBy(loggedInUserId(request), asList("facilityCode", "programCode", "periodStartDate", "allocatedBudget")); service.update(ediFileTemplate); return success("budget.file.configuration.success"); }
BudgetFileTemplateController extends BaseController { @RequestMapping(value = "/budget-file-template", method = POST, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'SYSTEM_SETTINGS')") public ResponseEntity<OpenLmisResponse> update(@RequestBody EDIFileTemplate ediFileTemplate, HttpServletRequest request) { ediFileTemplate.validateAndSetModifiedBy(loggedInUserId(request), asList("facilityCode", "programCode", "periodStartDate", "allocatedBudget")); service.update(ediFileTemplate); return success("budget.file.configuration.success"); } }
BudgetFileTemplateController extends BaseController { @RequestMapping(value = "/budget-file-template", method = POST, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'SYSTEM_SETTINGS')") public ResponseEntity<OpenLmisResponse> update(@RequestBody EDIFileTemplate ediFileTemplate, HttpServletRequest request) { ediFileTemplate.validateAndSetModifiedBy(loggedInUserId(request), asList("facilityCode", "programCode", "periodStartDate", "allocatedBudget")); service.update(ediFileTemplate); return success("budget.file.configuration.success"); }  }
BudgetFileTemplateController extends BaseController { @RequestMapping(value = "/budget-file-template", method = POST, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'SYSTEM_SETTINGS')") public ResponseEntity<OpenLmisResponse> update(@RequestBody EDIFileTemplate ediFileTemplate, HttpServletRequest request) { ediFileTemplate.validateAndSetModifiedBy(loggedInUserId(request), asList("facilityCode", "programCode", "periodStartDate", "allocatedBudget")); service.update(ediFileTemplate); return success("budget.file.configuration.success"); }  @RequestMapping(value = "/budget-file-template", method = GET) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'SYSTEM_SETTINGS')") ResponseEntity<OpenLmisResponse> get(); @RequestMapping(value = "/budget-file-template", method = POST, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'SYSTEM_SETTINGS')") ResponseEntity<OpenLmisResponse> update(@RequestBody EDIFileTemplate ediFileTemplate,
                                                 HttpServletRequest request); }
BudgetFileTemplateController extends BaseController { @RequestMapping(value = "/budget-file-template", method = POST, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'SYSTEM_SETTINGS')") public ResponseEntity<OpenLmisResponse> update(@RequestBody EDIFileTemplate ediFileTemplate, HttpServletRequest request) { ediFileTemplate.validateAndSetModifiedBy(loggedInUserId(request), asList("facilityCode", "programCode", "periodStartDate", "allocatedBudget")); service.update(ediFileTemplate); return success("budget.file.configuration.success"); }  @RequestMapping(value = "/budget-file-template", method = GET) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'SYSTEM_SETTINGS')") ResponseEntity<OpenLmisResponse> get(); @RequestMapping(value = "/budget-file-template", method = POST, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'SYSTEM_SETTINGS')") ResponseEntity<OpenLmisResponse> update(@RequestBody EDIFileTemplate ediFileTemplate,
                                                 HttpServletRequest request);  }