All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class JBMSTours.serializabletypes.Flight

java.lang.Object
   |
   +----JBMSTours.serializabletypes.Flight

public class Flight
extends Object
implements Serializable
Look at the Source.

Flight describes an airline flight segment for the tours database. This is a superclass for one-leg and multi-leg flights. These objects are stored temporarily in the database in the FlightObjects table.

See Also:
OneStopFlight, TransferFlight

Variable Index

 o airline
The airline providing the flight
 o arriveTime
The arrival time
 o BUSINESSFLIGHTLEVEL
 o departTime
The departure time
 o dest_airport
The airport where the flight ends
 o ECONOMYFLIGHTLEVEL
 o FIRSTCLASSFLIGHTLEVEL
 o flight_id
A unique id for this flight
 o flyingTime
The duration of the flight
 o get_airline_pricing_info
 o insert_flight_bookings
 o mileage
 o orig_airport
The airport where the flight starts
 o segmentNumber
The segment number of the flight.

Constructor Index

 o Flight()
Basic empty constructor.
 o Flight(String, int, String, Time, String, Time, double, int)
Constructs a Flight object.

Method Index

 o checkLevel(short)
 o checkSegmentAvailability(Connection, Date, short, int)
Checks whether the flight is available on the specified date for the specified number of seat.
 o getAltFlightId()
 o getAltSegmentNumber()
 o getFlightId()
Returns the flight_id.
 o getRate(Connection, short)
Checks the rate of the flight, using information from the airlines table.
 o getSegmentNumber()
Returns the flight's segment number.
 o getTotalDuration()
 o getType()
 o getUniqueId()
 o levelToCursor(short)
Converts a group's level to the kind of seats needed
 o levelToSeats(short)
Converts a group's level to the kind of seats needed
 o prepareAvailabilityQuery(Connection, short)
Prepares the query for checking the availability of the segment
 o prepareStatements(Connection)
Prepares the PreparedStatements for this class.
 o printInfo()
Prints information about the flight.
 o storeBookingInfoForAirline(Connection, int, Date, int, BigDecimal, short)
"Books" the flight by extracting the pertinent information to a separate table (FlightBookings).
 o toString()
Returns flight information as a string.

Variables

 o flight_id
 public String flight_id
A unique id for this flight

 o segmentNumber
 public int segmentNumber
The segment number of the flight.

 o airline
 public String airline
The airline providing the flight

 o orig_airport
 public String orig_airport
The airport where the flight starts

 o dest_airport
 public String dest_airport
The airport where the flight ends

 o departTime
 public Time departTime
The departure time

 o arriveTime
 public Time arriveTime
The arrival time

 o flyingTime
 public double flyingTime
The duration of the flight

 o mileage
 public int mileage
 o insert_flight_bookings
 protected transient PreparedStatement insert_flight_bookings
 o get_airline_pricing_info
 protected transient PreparedStatement get_airline_pricing_info
 o ECONOMYFLIGHTLEVEL
 public static final String ECONOMYFLIGHTLEVEL
 o BUSINESSFLIGHTLEVEL
 public static final String BUSINESSFLIGHTLEVEL
 o FIRSTCLASSFLIGHTLEVEL
 public static final String FIRSTCLASSFLIGHTLEVEL

Constructors

 o Flight
 public Flight()
Basic empty constructor.

 o Flight
 public Flight(String flightId,
               int segment_number,
               String origAirport,
               Time depart_time,
               String destAirport,
               Time arrive_time,
               double flytime,
               int miles)
Constructs a Flight object. This is a non-stop flight.

Parameters:
flightID - flight number
segment_number - flight segment number
origAirport - airport of departure
depart_time - time the flight departs
dest_airport - airport of arrival
arrive_time - time of arrival
flytime - flying time of flight
miles - number of miles in flight

Methods

 o toString
 public String toString()
Returns flight information as a string.

Overrides:
toString in class Object
 o printInfo
 public void printInfo()
Prints information about the flight.

 o getRate
 public BigDecimal getRate(Connection conn,
                           short level) throws SQLException
Checks the rate of the flight, using information from the airlines table. Algorithm for generating the rate is imaginary only. It probably does not resemble the actual way airlines price flights.

Parameters:
conn - database connection to use
The - level of the tour. See the static variables in Tour.java.
Throws: SQLException
returned on errors in database access
 o getSegmentNumber
 public int getSegmentNumber()
Returns the flight's segment number.

 o getFlightId
 public String getFlightId()
Returns the flight_id.

 o getAltFlightId
 public String getAltFlightId()
 o getAltSegmentNumber
 public int getAltSegmentNumber()
 o getType
 public String getType()
 o getTotalDuration
 public double getTotalDuration()
 o getUniqueId
 public String getUniqueId()
 o storeBookingInfoForAirline
 public int storeBookingInfoForAirline(Connection conn,
                                       int gid,
                                       Date travelDate,
                                       int numberSeats,
                                       BigDecimal fixedRate,
                                       short level) throws SQLException
"Books" the flight by extracting the pertinent information to a separate table (FlightBookings). This is the information that eventually goes to the airline.

Parameters:
conn - Database connection
gid - The group_id
travelDate - Date that travel begins.
numberSeats - number of seats reserved
fixedRate - the rate for those seats
The - level of the tour. See the static variables in Tour.java.
Returns:
> 0 if FlightBookings table successfully updated.
Throws: SQLException
in case anything goes wrong during a SQL operation
 o checkSegmentAvailability
 public boolean checkSegmentAvailability(Connection conn,
                                         Date travel,
                                         short kindOfSeats,
                                         int numberOfSeatsNeeded) throws SQLException
Checks whether the flight is available on the specified date for the specified number of seat. Called by CustomerFlight.checkAvailability.

Parameters:
conn - Connection
travel - The date flying.
seatsInBlock - The number of seats the airline reserves for JBMSTours on the flight
kindOfSeats - the name of the column in FlightAvailability to select from
numberSeatsNeeded - number of seats needed
Returns:
true, if the flight is available
Throws: SQLException
in case anything goes wrong during a SQL operation
 o prepareAvailabilityQuery
 protected PreparedStatement prepareAvailabilityQuery(Connection conn,
                                                      short kindOfSeats) throws SQLException
Prepares the query for checking the availability of the segment

Parameters:
conn - Connection
kindOfSeats - the name of the column in
Returns:
the prepared statement
Throws: SQLException
in case anything goes wrong during a SQL operation
 o levelToSeats
 public static String levelToSeats(short l)
Converts a group's level to the kind of seats needed

Parameters:
The - level of the tour. See the static variables in Tour.java.
Returns:
the appropriate column name for the kind of airline seats
 o levelToCursor
 public static String levelToCursor(short l)
Converts a group's level to the kind of seats needed

Parameters:
The - level of the tour. See the static variables in Tour.java.
Returns:
the appropriate column name for the kind of airline seats
 o prepareStatements
 public boolean prepareStatements(Connection conn) throws SQLException
Prepares the PreparedStatements for this class.

Returns:
boolean if statements are prepared without error
Throws: SQLException
If there is a SQL error
 o checkLevel
 public static String checkLevel(short l)

All Packages  Class Hierarchy  This Package  Previous  Next  Index