Class ListCustomer

java.lang.Object
bcu.cmp5332.bookingsystem.commands.ListCustomer
All Implemented Interfaces:
Command

public class ListCustomer extends Object implements Command
The ListCustomer class represents a command to list all customers in the flight booking system. It implements the Command interface, allowing it to be executed within the context of a FlightBookingSystem instance.

Upon execution, the command retrieves a list of all customers from the FlightBookingSystem instance. It then iterates through the list and prints the short details (using getDetailsShort()) of each customer to the console, excluding any customers marked as deleted.

After listing all customers, it prints the total number of customers retrieved.

Example usage:


 // Create a new ListCustomer command instance
 Command listCustomerCommand = new ListCustomer();
 
 // Execute the command within a FlightBookingSystem instance
 listCustomerCommand.execute(flightBookingSystem);
 
See Also:
  • Constructor Details

    • ListCustomer

      public ListCustomer()
  • Method Details

    • execute

      public void execute(FlightBookingSystem flightBookingSystem) throws FlightBookingSystemException
      Executes the list customer command within the provided FlightBookingSystem instance. Retrieves a list of all customers and prints their short details to the console. Excludes customers marked as deleted.
      Specified by:
      execute in interface Command
      Parameters:
      flightBookingSystem - The FlightBookingSystem instance on which the command is executed
      Throws:
      FlightBookingSystemException - If there is an error while accessing or processing flight booking system data