Package Databases

Class InventoryRequestDatabase

java.lang.Object
Common.Database
Databases.InventoryRequestDatabase

public class InventoryRequestDatabase extends Database
The InventoryRequestDatabase class manages a collection of inventory requests. It extends Database and provides methods for creating, searching, removing, and printing inventory requests.
  • Constructor Details

    • InventoryRequestDatabase

      public InventoryRequestDatabase()
      Constructs an InventoryRequestDatabase with a default CSV path.
    • InventoryRequestDatabase

      public InventoryRequestDatabase(String csvPath)
      Constructs an InventoryRequestDatabase with a specified CSV path.
      Parameters:
      csvPath - the path to the CSV file containing inventory requests
  • Method Details

    • createDatabaseItem

      public DatabaseItems createDatabaseItem(String[] values)
      Creates a new InventoryRequest instance from an array of values.
      Specified by:
      createDatabaseItem in class Database
      Parameters:
      values - an array of strings containing inventory request data
      Returns:
      a new InventoryRequest object
    • printItems

      public void printItems()
      Prints all items in the inventory request database.
      Specified by:
      printItems in class Database
    • searchItem

      public DatabaseItems searchItem(String medicine)
      Searches for an inventory request by medicine name.
      Specified by:
      searchItem in class Database
      Parameters:
      medicine - the name of the medicine to search for
      Returns:
      the found Medicines item; null if not found
    • searchItem

      public DatabaseItems searchItem(String medicine, int request_value)
      Searches for an inventory request by medicine name and request value.
      Parameters:
      medicine - the name of the medicine to search for
      request_value - the requested quantity of the medicine
      Returns:
      the found InventoryRequest item; null if not found
    • searchItems

      public List<InventoryRequest> searchItems(String medicine)
      Searches for all inventory requests associated with a specific medicine.
      Parameters:
      medicine - the name of the medicine to search for
      Returns:
      a list of matching InventoryRequest objects; empty list if none found
    • removeItem

      public boolean removeItem(String medicine)
      Removes an inventory request by medicine name.
      Specified by:
      removeItem in class Database
      Parameters:
      medicine - the name of the medicine to remove from requests
      Returns:
      true if any record was successfully removed; false otherwise
    • removeItem

      public boolean removeItem(String medicine, int request_value)
      Removes an inventory request by medicine name and request value.
      Parameters:
      medicine - the name of the medicine to remove from requests
      request_value - the requested quantity to match for removal
      Returns:
      true if any record was successfully removed; false otherwise