All Packages Class Hierarchy This Package Previous Next Index
Class JBMSTours.serializabletypes.CustomerFlight
java.lang.Object
|
+----JBMSTours.serializabletypes.CustomerFlight
- public class CustomerFlight
- extends Object
- implements Serializable
Look at the Source.
A CustomerFlight is A FlightObject wrapped in specific
date, booking, and customer information.
It contains a Flight object as a field (which can be Flight,
OneStopFlight, or TransferFlight).
-
arriveCity
-
-
arriveCity_id
-
-
departCity
-
-
departCity_id
-
-
fixedRate
-
-
level
-
-
numberSeats
-
-
totalCost
-
-
CustomerFlight(Date, City, City, int, short, int)
- Constructs a customer flight object.
-
bookFlight(Connection, int)
- Books the flight.
-
checkRate(Connection)
- Checks the rate of the currently proposed flight.
-
checkTotalCost(Connection)
- Checks the total of the currently proposed flight (rate * number of
seats).
-
equals(Object)
- Returns true if the two objects are equal.
-
getArrivalDate(Connection)
-
Date customers actually arrive in city (for long flights).
-
getArriveCity(Connection)
-
Getter for the city where the flight arrives.
-
getDepartCity(Connection)
-
Getter for the city where the flight departs from.
-
getFlight()
- Gets the Flight ID of the Flight.
-
getFlightObject()
- Gets the Flight object (a field).
-
getInfo(Connection)
-
Prints detailed information about the CustomerFlight.
-
getTravelDate()
- Gets the date of travel for the flight (date of departure).
-
prepareStatements(Connection)
- Prepares all the PreparedStatements for this class.
-
proposeFlight(Connection, BigDecimal)
- Proposes a flight for the group.
-
proposeFlight(Connection, BigDecimal, short)
- Proposes a flight for the group.
-
toString()
-
Returns a string value for the CustomerFlight.
-
toString(Connection)
-
Returns a string value for the CustomerFlight.
departCity
public transient City departCity
departCity_id
public int departCity_id
arriveCity
public transient City arriveCity
arriveCity_id
public int arriveCity_id
numberSeats
public int numberSeats
fixedRate
public BigDecimal fixedRate
totalCost
public BigDecimal totalCost
level
public short level
CustomerFlight
public CustomerFlight(Date travel,
City city1,
City city2,
int num,
short alevel,
int gid)
- Constructs a customer flight object. Initializes the date of
travel, the city of origin, the destination city, the number
of seats needed, and the level of travel. To add the actual
Flight object to CustomerFlight, use the proposeFlight method.
The bookFlight method adds the rate information.
- Parameters:
- travel - Date of travel
- city1 - City of origin
- city2 - City of destination
- num - Number of seats needed
- The - level of the tour. See the static variables in Tour.java.
checkRate
public BigDecimal checkRate(Connection conn) throws SQLException
- Checks the rate of the currently proposed flight. Does not fix the rate.
If rate is already fixed, returns that value.
- Parameters:
- conn - Connection to the database.
- Throws: SQLException
- Thrown if there is a SQL error.
checkTotalCost
public BigDecimal checkTotalCost(Connection conn) throws SQLException
- Checks the total of the currently proposed flight (rate * number of
seats). Does not fix the rate. If rate is already fixed, returns that value.
- Parameters:
- conn - Connection to the database.
- Throws: SQLException
- Thrown if there is a SQL error.
proposeFlight
public BigDecimal proposeFlight(Connection conn,
BigDecimal availableFunds) throws SQLException, AvailabilityException, BudgetException
- Proposes a flight for the group.
Returns true if successfully proposed a flight.
- Parameters:
- conn - Connection to db.
- availableFunds - the amount of money the group has left to spend
- Returns:
- true if successfully proposed flight.
- Throws: SQLException
- Thrown if there is a SQL error.
- Throws: BudgetException
- Thrown if the flight is out of the customer's budget.
- Throws: AvailabilityException
- Thrown if the flight is not available.
proposeFlight
public BigDecimal proposeFlight(Connection conn,
BigDecimal availableFunds,
short templevel) throws SQLException, AvailabilityException, BudgetException
- Proposes a flight for the group.
Returns true if successfully proposed a flight. Allows you to override level.
- Parameters:
- conn - Connection to db.
- availableFunds - the amount of money the group has left to spend
- Returns:
- true if successfully proposed flight.
- Throws: SQLException
- Thrown if there is a SQL error.
- Throws: BudgetException
- Thrown if the flight is out of the customer's budget.
- Throws: AvailabilityException
- Thrown if the flight is not available.
bookFlight
public BigDecimal bookFlight(Connection conn,
int gid) throws SQLException
- Books the flight. --Updates the FlightBookings and the FlightAvailability tables.
- Parameters:
- conn - Connection to db.
- gid - group_id.
- Returns:
- the total cost of the flights for the group
- Throws: SQLException
- Thrown if there is a SQL error.
getFlight
public String getFlight()
- Gets the Flight ID of the Flight.
- Returns:
- String The flight_id
getFlightObject
public Flight getFlightObject()
- Gets the Flight object (a field).
- Returns:
- The flight (a Flight object)
- See Also:
- Flight, OneStopFlight, TransferFlight
getTravelDate
public Date getTravelDate()
- Gets the date of travel for the flight (date of departure).
- Returns:
- Date Date flight departs.
getArrivalDate
public Date getArrivalDate(Connection conn) throws SQLException
- Date customers actually arrive in city (for long flights).
If the flight arrives after 4 a.m., no hotel stay needed
until date of actual arrival, so therefore this method
returns the actual date that they arrive. But if the flight arrives
before 4 a.m, return the date before the actual arrival date
because they will need a hotel stay for the remainder of the
"night".
Used by HotelStay.
- Parameters:
- conn - A connection to the database.
- Throws: SQLException
- thrown on database access failure
- See Also:
- HotelStay
toString
public String toString(Connection conn) throws SQLException
- Returns a string value for the CustomerFlight.
- Parameters:
- conn - Conenction to the database.
- Returns:
- String A string value for the CustomerFlight.
- Throws: SQLException
- In case of a database error.
toString
public String toString()
- Returns a string value for the CustomerFlight.
- Returns:
- String A string value for the CustomerFlight.
- Overrides:
- toString in class Object
getInfo
public String getInfo(Connection conn) throws SQLException
- Prints detailed information about the CustomerFlight.
- Parameters:
- conn - A connection to the database.
- Returns:
- String object information about the CustomerFlight
- Throws: SQLException
- in case of a database error.
getArriveCity
public City getArriveCity(Connection conn) throws SQLException
- Getter for the city where the flight arrives.
- Parameters:
- conn - A connection to the database.
- Returns:
- City City where the flight arrives.
- Throws: SQLException
- in case of a database error
getDepartCity
public City getDepartCity(Connection conn) throws SQLException
- Getter for the city where the flight departs from.
- Parameters:
- conn - A connection to the database.
- Returns:
- City City where the flight departs from.
- Throws: SQLException
- in case of a database error
prepareStatements
public boolean prepareStatements(Connection conn) throws SQLException
- Prepares all the PreparedStatements for this class.
- Parameters:
- conn - a connection to the database.
- Returns:
- boolean if statements are prepared without error
- Throws: SQLException
- If there is an SQL error
equals
public boolean equals(Object o)
- Returns true if the two objects are equal.
- Overrides:
- equals in class Object
All Packages Class Hierarchy This Package Previous Next Index