Class ListCustomer
java.lang.Object
bcu.cmp5332.bookingsystem.commands.ListCustomer
- All Implemented Interfaces:
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:
-
Field Summary
Fields inherited from interface bcu.cmp5332.bookingsystem.commands.Command
HELP_MESSAGE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
execute
(FlightBookingSystem flightBookingSystem) Executes the list customer command within the provided FlightBookingSystem instance.
-
Constructor Details
-
ListCustomer
public ListCustomer()
-
-
Method Details
-
execute
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 interfaceCommand
- 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
-