コード例 #1
0
 @RequestMapping(
     value = "/removeLine/{id}",
     method = RequestMethod.PUT,
     consumes = {"application/json", "application/xml"},
     produces = {"application/json", "application/xml"})
 public RestResponse removeLine(
     @PathVariable("id") Long id,
     @RequestBody RestRequestObject<Inventory> requestObject,
     HttpServletRequest request,
     HttpServletResponse response) {
   String permission = "deliveryNote.update";
   if (!ndovuSecurity.grant(requestObject, permission).isAuthorized()) {
     return ndovuSecurity.grant(requestObject, permission);
   }
   this.errors =
       deliveryNoteLineValidator.validateRemoveLine(
           tokenManager.getUserId(requestObject.getToken()), id, requestObject.getObject());
   if (errors.hasErrors()) {
     return responsePayload.expectationFailed(errors);
   }
   return responsePayload.created(
       inventoryManager.removeLine(
           deliveryNoteLine,
           tokenManager.getUserId(requestObject.getToken()),
           id,
           requestObject.getObject()));
 }
コード例 #2
0
 @RequestMapping(
     value = "deliveryNote/{id}",
     method = RequestMethod.POST,
     consumes = {"application/json"},
     produces = {"application/json"})
 @ResponseStatus(HttpStatus.OK)
 public RestResponse getByGoodsReceipt(
     @PathVariable("id") Long id,
     @RequestBody RestRequestObject<RestPageRequest> requestObject,
     HttpServletRequest request,
     HttpServletResponse response) {
   String permission = "deliveryNote.view";
   if (!ndovuSecurity.grant(requestObject, permission).isAuthorized()) {
     return ndovuSecurity.grant(requestObject, permission);
   }
   return responsePayload.fetched(
       inventoryManager.findAll(
           deliveryNoteLine,
           tokenManager.getUserId(requestObject.getToken()),
           DocumentType.DELIVERY_NOTE,
           id,
           requestObject.getObject()));
 }