@Test public void shouldUpdateShipmentFileTemplate() { EDIFileColumn shipmentFileColumn1 = new EDIFileColumn("name", "Label", false, true, 1, "dd/mm/yy"); EDIFileColumn shipmentFileColumn2 = new EDIFileColumn("name", "Label", false, true, 2, "dd/mm/yy"); EDIFileTemplate shipmentFileTemplate = new EDIFileTemplate( new EDIConfiguration(true), asList(shipmentFileColumn1, shipmentFileColumn2)); ResponseEntity<OpenLmisResponse> response = controller.update(shipmentFileTemplate, httpServletRequest); assertThat(response.getStatusCode(), is(OK)); assertThat(response.getBody().getSuccessMsg(), is("shipment.file.configuration.success")); assertThat(shipmentFileTemplate.getConfiguration().getModifiedBy(), is(userId)); for (EDIFileColumn column : shipmentFileTemplate.getColumns()) { assertThat(column.getModifiedBy(), is(userId)); } verify(shipmentFileTemplateService).update(shipmentFileTemplate); }
@RequestMapping(value = "/shipment-file-template", method = POST, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'SYSTEM_SETTINGS')") public ResponseEntity<OpenLmisResponse> update(@RequestBody EDIFileTemplate shipmentFileTemplate, HttpServletRequest request) { shipmentFileTemplate.validateAndSetModifiedBy(loggedInUserId(request), asList("productCode", "orderId", "quantityShipped")); service.update(shipmentFileTemplate); return success("shipment.file.configuration.success"); }
ShipmentFileTemplateController extends BaseController { @RequestMapping(value = "/shipment-file-template", method = POST, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'SYSTEM_SETTINGS')") public ResponseEntity<OpenLmisResponse> update(@RequestBody EDIFileTemplate shipmentFileTemplate, HttpServletRequest request) { shipmentFileTemplate.validateAndSetModifiedBy(loggedInUserId(request), asList("productCode", "orderId", "quantityShipped")); service.update(shipmentFileTemplate); return success("shipment.file.configuration.success"); } }
ShipmentFileTemplateController extends BaseController { @RequestMapping(value = "/shipment-file-template", method = POST, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'SYSTEM_SETTINGS')") public ResponseEntity<OpenLmisResponse> update(@RequestBody EDIFileTemplate shipmentFileTemplate, HttpServletRequest request) { shipmentFileTemplate.validateAndSetModifiedBy(loggedInUserId(request), asList("productCode", "orderId", "quantityShipped")); service.update(shipmentFileTemplate); return success("shipment.file.configuration.success"); }  }
ShipmentFileTemplateController extends BaseController { @RequestMapping(value = "/shipment-file-template", method = POST, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'SYSTEM_SETTINGS')") public ResponseEntity<OpenLmisResponse> update(@RequestBody EDIFileTemplate shipmentFileTemplate, HttpServletRequest request) { shipmentFileTemplate.validateAndSetModifiedBy(loggedInUserId(request), asList("productCode", "orderId", "quantityShipped")); service.update(shipmentFileTemplate); return success("shipment.file.configuration.success"); }  @RequestMapping(value = "/shipment-file-template", method = GET) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'SYSTEM_SETTINGS')") ResponseEntity<OpenLmisResponse> get(); @RequestMapping(value = "/shipment-file-template", method = POST, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'SYSTEM_SETTINGS')") ResponseEntity<OpenLmisResponse> update(@RequestBody EDIFileTemplate shipmentFileTemplate,
                                                 HttpServletRequest request); }
ShipmentFileTemplateController extends BaseController { @RequestMapping(value = "/shipment-file-template", method = POST, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'SYSTEM_SETTINGS')") public ResponseEntity<OpenLmisResponse> update(@RequestBody EDIFileTemplate shipmentFileTemplate, HttpServletRequest request) { shipmentFileTemplate.validateAndSetModifiedBy(loggedInUserId(request), asList("productCode", "orderId", "quantityShipped")); service.update(shipmentFileTemplate); return success("shipment.file.configuration.success"); }  @RequestMapping(value = "/shipment-file-template", method = GET) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'SYSTEM_SETTINGS')") ResponseEntity<OpenLmisResponse> get(); @RequestMapping(value = "/shipment-file-template", method = POST, headers = ACCEPT_JSON) @PreAuthorize("@permissionEvaluator.hasPermission(principal,'SYSTEM_SETTINGS')") ResponseEntity<OpenLmisResponse> update(@RequestBody EDIFileTemplate shipmentFileTemplate,
                                                 HttpServletRequest request);  }