コード例 #1
0
ファイル: OrderController.java プロジェクト: Qorder/QorderWS
  @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);
  }
コード例 #2
0
ファイル: OrderController.java プロジェクト: Qorder/QorderWS
  @RequestMapping(
      value = "/business/{businessID}",
      method = RequestMethod.GET,
      produces = MediaType.APPLICATION_JSON_VALUE)
  ResponseEntity<Collection<OrderViewDTO>> getOrdersByBusinessId(@PathVariable Long businessID)
      throws ResourceNotFoundException {
    Collection<OrderViewDTO> businessOrders = orderService.fetchOrdersByBusinessID(businessID);
    LOGGER.info("Request for business orders.\nFetchedList size is " + businessOrders.size());

    return new ResponseEntity<>(businessOrders, HttpStatus.OK);
  }
コード例 #3
0
ファイル: OrderController.java プロジェクト: Qorder/QorderWS
  @RequestMapping(
      value = "/{orderID}",
      method = RequestMethod.GET,
      produces = MediaType.APPLICATION_JSON_VALUE)
  ResponseEntity<OrderViewDTO> getOrdersById(@PathVariable Long orderID)
      throws ResourceNotFoundException {
    LOGGER.info("Request for order with id " + orderID);

    OrderViewDTO orderView = orderService.fetchOrderById(orderID);

    return new ResponseEntity<>(orderView, HttpStatus.OK);
  }
コード例 #4
0
ファイル: OrderController.java プロジェクト: Qorder/QorderWS
  @RequestMapping(
      value = "/business/{businessID}",
      method = RequestMethod.POST,
      consumes = MediaType.APPLICATION_JSON_VALUE)
  ResponseEntity<Void> createOrder(@PathVariable Long businessID, @RequestBody OrderDTO orderDTO)
      throws ResourceNotFoundException {
    LOGGER.info("Request for order submit");
    long orderID = orderService.submitOrder(businessID, orderDTO);

    URI location = URI.create(EDomainLinkProvider.INSTANCE.getLocationFor(EEntity.ORDER) + orderID);
    HttpHeaders headers = new HttpHeaders();
    headers.setLocation(location);

    return new ResponseEntity<>(headers, HttpStatus.CREATED);
  }
コード例 #5
0
ファイル: OrderController.java プロジェクト: Qorder/QorderWS
  @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);
  }