@RequestMapping(value = "/{orderId}/order", params = "status", method = RequestMethod.POST) ResponseEntity<Void> changeOrderStatus(@PathVariable Long orderId, @RequestParam String status) throws ResourceNotFoundException, IllegalArgumentException { LOGGER.info("Request to change status if order with id " + orderId); EOrderStatus orderStatus = EOrderStatus.valueOf(status); orderService.changeOrderStatus(orderId, orderStatus); return new ResponseEntity<>(HttpStatus.ACCEPTED); }
@RequestMapping( value = "/business/{businessID}/order", params = "status", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) ResponseEntity<Collection<OrderViewDTO>> getOrdersByStatus( @PathVariable Long businessID, @RequestParam String status) throws ResourceNotFoundException, IllegalArgumentException { EOrderStatus orderStatus = EOrderStatus.valueOf(status); Collection<OrderViewDTO> businessOrders = orderService.fetchOrdersByStatus(businessID, orderStatus); LOGGER.info( "Request for business orders with status query.\nFetchedList size is " + businessOrders.size()); return new ResponseEntity<>(businessOrders, HttpStatus.OK); }