Class ProductOnOrderController
- java.lang.Object
-
- edu.cnm.deepdive.albuquirky.controller.ProductOnOrderController
-
@RestController @RequestMapping("/products-on-order") @ExposesResourceFor(ProductOnOrder.class) public class ProductOnOrderController extends ObjectThe ProductOnOrderController class is the @RestController that maps the endpoints of "/products-on-order" for communication between the server-side and client-side forProductOnOrder.
-
-
Constructor Summary
Constructors Constructor Description ProductOnOrderController(OrderService orderService)Constructs the instance of OrderService object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<ProductOnOrder>getProductsOnOrder(long orderId)The Get method which returns allProductOnOrderentities for a particularOrder.ProductOnOrderpost(ProductOnOrder productOnOrder, Order order)The Post method to save aProductOnOrderin the database.
-
-
-
Constructor Detail
-
ProductOnOrderController
public ProductOnOrderController(OrderService orderService)
Constructs the instance of OrderService object.- Parameters:
orderService- The instance ofOrderServiceto initialize.
-
-
Method Detail
-
getProductsOnOrder
@GetMapping(value="/{orderId:\\d+}", produces="application/json") public List<ProductOnOrder> getProductsOnOrder(@PathVariable long orderId)The Get method which returns allProductOnOrderentities for a particularOrder.- Parameters:
orderId- The ID of theOrder.- Returns:
- A
ListofProductOnOrderobjects on theOrder.
-
post
@PostMapping(consumes="application/json", produces={"application/json","text/plain"}) public ProductOnOrder post(@RequestBody ProductOnOrder productOnOrder, Order order)The Post method to save aProductOnOrderin the database.- Parameters:
productOnOrder- TheProductOnOrderto save.order- TheOrderto link theProductOnOrderto.- Returns:
- The
ProductOnOrdersaved.
-
-