Class ShopQueueController
java.lang.Object
com.iu.javadatastructureslab.controller.ShopQueueController
Handles order queue simulation endpoints for the shop demo.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdds a new order to the queue.cancelOrder(int orderId) Cancels an order by id.completeOrder(int orderId) Completes an order by id.Peeks at the next order in the queue without removal.Processes the next order in the queue.shopQueue(org.springframework.ui.Model model) Renders the shop queue view and exposes queue metrics.
-
Constructor Details
-
ShopQueueController
public ShopQueueController()
-
-
Method Details
-
shopQueue
Renders the shop queue view and exposes queue metrics.- Parameters:
model- model used to expose view attributes- Returns:
- the shop queue view name
-
addOrder
@PostMapping("/shopqueue/add") public String addOrder(@RequestParam String customerName, @RequestParam String productName, @RequestParam String priority, @RequestParam int orderValue) Adds a new order to the queue.- Parameters:
customerName- customer nameproductName- product namepriority- priority level textorderValue- order total value- Returns:
- redirect to the shop queue view
-
processNextOrder
Processes the next order in the queue.- Returns:
- redirect to the shop queue view
-
peekNextOrder
Peeks at the next order in the queue without removal.- Returns:
- redirect to the shop queue view
-
cancelOrder
Cancels an order by id.- Parameters:
orderId- order identifier- Returns:
- redirect to the shop queue view
-
completeOrder
Completes an order by id.- Parameters:
orderId- order identifier- Returns:
- redirect to the shop queue view
-