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
-
airline
- The airline providing the flight
-
arriveTime
- The arrival time
-
BUSINESSFLIGHTLEVEL
-
-
departTime
- The departure time
-
dest_airport
- The airport where the flight ends
-
ECONOMYFLIGHTLEVEL
-
-
FIRSTCLASSFLIGHTLEVEL
-
-
flight_id
- A unique id for this flight
-
flyingTime
- The duration of the flight
-
get_airline_pricing_info
-
-
insert_flight_bookings
-
-
mileage
-
-
orig_airport
- The airport where the flight starts
-
segmentNumber
- The segment number of the flight.
-
Flight()
- Basic empty constructor.
-
Flight(String, int, String, Time, String, Time, double, int)
- Constructs a Flight object.
-
checkLevel(short)
-
-
checkSegmentAvailability(Connection, Date, short, int)
- Checks whether the flight is available on the specified
date for the specified number of seat.
-
getAltFlightId()
-
-
getAltSegmentNumber()
-
-
getFlightId()
- Returns the flight_id.
-
getRate(Connection, short)
- Checks the rate of the flight, using information from
the airlines table.
-
getSegmentNumber()
- Returns the flight's segment number.
-
getTotalDuration()
-
-
getType()
-
-
getUniqueId()
-
-
levelToCursor(short)
- Converts a group's level to the kind of seats needed
-
levelToSeats(short)
- Converts a group's level to the kind of seats needed
-
prepareAvailabilityQuery(Connection, short)
- Prepares the query for checking the availability of the segment
-
prepareStatements(Connection)
- Prepares the PreparedStatements for this class.
-
printInfo()
- Prints information about the flight.
-
storeBookingInfoForAirline(Connection, int, Date, int, BigDecimal, short)
- "Books" the flight by extracting the pertinent information
to a separate table (FlightBookings).
-
toString()
- Returns flight information as a string.
flight_id
public String flight_id
- A unique id for this flight
segmentNumber
public int segmentNumber
- The segment number of the flight.
airline
public String airline
- The airline providing the flight
orig_airport
public String orig_airport
- The airport where the flight starts
dest_airport
public String dest_airport
- The airport where the flight ends
departTime
public Time departTime
- The departure time
arriveTime
public Time arriveTime
- The arrival time
flyingTime
public double flyingTime
- The duration of the flight
mileage
public int mileage
insert_flight_bookings
protected transient PreparedStatement insert_flight_bookings
get_airline_pricing_info
protected transient PreparedStatement get_airline_pricing_info
ECONOMYFLIGHTLEVEL
public static final String ECONOMYFLIGHTLEVEL
BUSINESSFLIGHTLEVEL
public static final String BUSINESSFLIGHTLEVEL
FIRSTCLASSFLIGHTLEVEL
public static final String FIRSTCLASSFLIGHTLEVEL
Flight
public Flight()
- Basic empty constructor.
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
toString
public String toString()
- Returns flight information as a string.
- Overrides:
- toString in class Object
printInfo
public void printInfo()
- Prints information about the flight.
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
getSegmentNumber
public int getSegmentNumber()
- Returns the flight's segment number.
getFlightId
public String getFlightId()
- Returns the flight_id.
getAltFlightId
public String getAltFlightId()
getAltSegmentNumber
public int getAltSegmentNumber()
getType
public String getType()
getTotalDuration
public double getTotalDuration()
getUniqueId
public String getUniqueId()
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
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
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
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
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
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
checkLevel
public static String checkLevel(short l)
All Packages Class Hierarchy This Package Previous Next Index