Package Controllers
Class InventoryRequestManager
java.lang.Object
Controllers.InventoryRequestManager
The
InventoryRequestManager
class manages inventory requests.
It allows adding new requests, approving existing requests, and displaying all requests.-
Constructor Summary
ConstructorsConstructorDescriptionInventoryRequestManager
(InventoryRequestDatabase inventoryRequestDatabase) Constructs anInventoryRequestManager
for handling requests only.InventoryRequestManager
(InventoryRequestDatabase inventoryRequestDatabase, InventoryManager inventoryManager) Constructs anInventoryRequestManager
for handling both requests and approvals. -
Method Summary
Modifier and TypeMethodDescriptionboolean
addRequest
(String medicine, int value) Adds a new inventory request.boolean
approveRequest
(String medicine, int value) Approves an existing inventory request and updates the stock accordingly.void
Displays all current inventory requests.
-
Constructor Details
-
InventoryRequestManager
Constructs anInventoryRequestManager
for handling requests only.- Parameters:
inventoryRequestDatabase
- theInventoryRequestDatabase
used to manage inventory requests
-
InventoryRequestManager
public InventoryRequestManager(InventoryRequestDatabase inventoryRequestDatabase, InventoryManager inventoryManager) Constructs anInventoryRequestManager
for handling both requests and approvals.- Parameters:
inventoryRequestDatabase
- theInventoryRequestDatabase
used to manage inventory requestsinventoryManager
- theInventoryManager
used to manage inventory stock
-
-
Method Details
-
addRequest
Adds a new inventory request.- Parameters:
medicine
- the name of the medicine requestedvalue
- the quantity of the medicine requested- Returns:
- true if the request was added successfully; false if the value is less than or equal to zero
-
approveRequest
Approves an existing inventory request and updates the stock accordingly.- Parameters:
medicine
- the name of the medicine to approvevalue
- the quantity of the medicine to approve- Returns:
- true if the request was approved successfully; false if not found
-
displayAllRequests
public void displayAllRequests()Displays all current inventory requests.
-