com.faa.flyfaa
Class FlyFAAProjectBean

java.lang.Object
  |
  +--com.faa.flyfaa.FlyFAAProjectBean

public class FlyFAAProjectBean
extends java.lang.Object

JavaBean to hold properties of what in livewire was the project object. Since there was only one project object, there is only one FlyFAAProjectBean. It is attached to the application as the property 'Project'. The FlyFAAProjectBean object is created by usmap.jsp or any of the regional jsp pages (nwmap.jsp, ncmap.jsp, nemap.jsp, swmap.jsp, scmap.jsp, semap.jsp, or fwmap.jsp).

For example,

 <jsp:useBean id="proj" scope="application" class="com.faa.flyfaa.FlyFAAProjectBean" />
 <%
    FlyfaaDbBean db = proj.getDbBean();
    if (db == null) {
       db = new FlyfaaDbBean();
    }
    db.setCache(c_cache);
    try {
       proj.setDbBean(db);
       if (!proj.getPI()) { // if the FlyFAAProjectBean has not been instantiated, then
 	     if (proj.FlyFAAProjectBeanStalk()) { // Performs same job as old setFlyFaaInitData
 	        application.setAttribute("Project", proj);
 	     }
       }
    }
 

Author:
Jeffrey H. Carroll

Field Summary
(package private)  java.util.Map airportsMap
          HashMap for storing Airport objects indexed by the airport ID (for ALL AIRPORTS).
 int alert_layers_end
          This value is used as a parameter to Alert_Airports() by usmap.jsp.
 int alert_layers_start
          The next available lay[] item index after the U.S.
protected  java.util.Map alrtMap
          HashMap for CURRENT ALERTED AIRPORTS: Each item is keyed by the airport id the same way that the airportsMap is, and the value is a Boolean.
protected  java.util.List ClosureA
          Array for Airport Closures; contains Closure objects.
private  FlyfaaDbBean DbAccess
          A reference to the database access bean
(package private)  java.util.Timer dbtimer
          A Timer object with which to schedule the DatabaseUpdater
(package private)  DatabaseUpdater dbu
          A DatabaseUpdater to read Traffic Management Information from the database periodically
protected  java.util.List DelayA
          Array for Delays; contains Delay objects.
protected  boolean FlyLock
          True primarily when delay/GDP/GSTOP/Closure data is being read from the database.
(package private)  java.util.ArrayList fwA
          An array for the Far West Region; contains 3-character FAA airport identifiers
protected  java.util.List GDPA
          Array for most recently retrieved Ground Delay Programs; contains GDP objects.
protected  java.util.List GStopA
          Array for Ground Stops; contains GStop objects.
private  java.util.Map keycenters
          A hashmap for storing the centers associated with the (currently 46) different keywords used by TMSs ('ZNY1', 'NOWEST', '6WEST', etc.)
private  java.lang.String keywordQuery
          String to use for holding a query during object construction...
(package private)  java.lang.String Logf
          String containing the name of the log file.
(package private)  java.util.ArrayList ncA
          An array for the North Central Region; contains 3-character FAA airport identifiers
(package private)  java.util.ArrayList neA
          An array for the Northeast Region; contains 3-character FAA airport identifiers
(package private)  java.util.ArrayList nwA
          An array for the Northwest Region; contains 3-character FAA airport identifiers
(package private)  java.util.Map oldAirportsMap
          HashMap for storing Airport objects indexed by the airport ID (for ALL AIRPORTS).
protected  java.util.List oldClosureA
          Array for saving Closure information while new Closure info is being read.
protected  java.util.List oldDelayA
          Array for saving Delay information while new Delay info is being read.
protected  java.util.List oldGDPA
          Array for saving Ground Delay Program information while new GDP info is being read.
protected  java.util.List oldGStopA
          Array for saving Ground Stop information while new GStop info is being read.
protected  java.util.Map oldMap
          HashMap for PREVIOUSLY ALERTED AIRPORTS (airports which were put into alrtMap during the previous 60-second database refresh).
protected  java.util.List pacingA
          Array for PACING AIRPORTS; indexed by FAA_AIRPORTS.TOOL_ORDER, contains 3-character airport identifiers
protected  boolean PI
          A boolean to ensure that the ProjectBean's initialization only occurs once
private  java.sql.ResultSet rs
          ResultSet for use by multiple database queries
private  java.sql.ResultSet rs2
          ResultSet for use by routines which need two simultaneous queries
(package private)  java.util.ArrayList scA
          An array for the South Central Region; contains 3-character FAA airport identifiers
(package private)  java.util.ArrayList seA
          An array for the Southeast Region; contains 3-character FAA airport identifiers
(package private)  java.util.ArrayList swA
          An array for the Southwest Region; contains 3-character FAA airport identifiers
protected  java.util.Date tmTimeStamp
          Time just after finishing fetching new delay/GDP/GSTOP/Closure data
protected  java.util.Date vd_dbstart
          Time when data starts being fetched (when lock is set).
 
Constructor Summary
FlyFAAProjectBean()
          FlyFAA's ("Project Object") Class constructor.
 
Method Summary
(package private)  void Alert_Airport(Airport a, int x, int y, int r, int Regx, int Regy, java.lang.String Color)
          Modifies an existing airport object (in airportsMap) to store the alerted airport information, including X-coordinate on map, Y-coordinate on map, radius of hotspot, X- and Y- coordinate on the regional map (for pacing airports), and color to be displayed.
 java.lang.String Alert_Airports(int first_layer, int last_layer)
          Method to write the 'dolayers' client-side javascript function into the document.
 java.lang.String alert_layers(int firstielayer)
          Generates javascript code to mark the alerted airports (layers) so that they are displayed in the browser.
 java.lang.String alert_regional_layers(int firstlayer, int firstielayer, java.lang.String region, java.util.ArrayList airports)
          Generates javascript code to mark the alerted airports (layers) in a given region so that they are displayed in the browser.
 java.lang.String convertGMTtoLocal(int month, int day_of_month, double hhmm, double offsetHours, boolean bUseDayLight)
          Converts a GMT time string from OIS into a local time string.
 java.lang.String deleteSpaces(java.lang.String base)
          Parses a given String, deleting spaces wherever they may be found.
 java.lang.String Disclaimer(java.lang.String type)
          Returns a disclaimer in an HTML <TR> tag.
 java.lang.String DisplayAllInitiatives(java.util.List a, boolean useOldArray)
          Returns a String of HTML representing a given set of Traffic Management Initiatives in plain text based on the supplied ArrayList.
 java.lang.String DisplayDelayInfo(java.lang.String DelayedAirport, boolean dynamic, int delayx, boolean plain)
          Generates HTML code to represent the airport delay and closure information.
 java.lang.String[] DisplayDelayObjRecords(java.lang.String strARPT, boolean bGdelayGstop, boolean isdynamic, int specificDelay)
          Generates a string of HTML code to summarize the general Arrival and Departure delay information for a given airport.
 java.lang.String DisplayPlainTextDelayInfo()
          Returns a String containing the HTML representing the plain text content for the upper frame.
(package private)  void FillARPTData(java.sql.Connection conn)
          Using the database's AIRPORTS, CITIES, STATES and CENTERS tables, this routine fills the airportsMap with airport information, fills the pacingA array if the airport is a pacing airport, and fills up the regional arrays depending on which state the airport is in.
 java.lang.String FillDelayData(FlyfaaDbBean dbb)
          Reads from the database a list of Ground Delay Programs, Ground Stops, Delay Information and Airport Closure information.
 boolean FlyFAAProjectBeanStalk()
          FlyFAA's ("Project Object") Class construction completion method.
 Airport getAirport(java.lang.String airport_id, boolean useOldOne)
          Gets an Airport object from the AirportsMap based on a given airport_id if the useOldOne flag is not set, or from the oldAirportsMap if the useOldOne flag is set (which means that the DatabaseUpdater Thread is running).
 java.lang.String GetClosureInfoByARPT(java.lang.String airport, java.lang.String longname)
          Generates HTML code to describe airport closure information.
 FlyfaaDbBean getDbBean()
          Getter method to return the FlyfaaDbBean property.
 java.util.Date getDbStartTime()
          Gets the date/timestamp when new Traffic Management Initiative data starts being read from the database.
 java.lang.String GetFacilities(java.lang.String facs)
          Parses the list of included facilities for a Ground Delay Program or Ground Stop (which may include keywords) and returns a string of ARTCC names.
 java.lang.String[] GetGDelayInfoByARPT(java.lang.String strFacility, java.lang.String strARPT)
          Generates an array of Strings containing HTML representing a summary of delay information affecting a given airport caused by Ground Delay Programs.
 java.lang.String GetGStopGDelayInfoByARPT(java.lang.String strARPT, java.lang.String strARPTLongName, java.lang.String strARPTCity, java.lang.String strARPTState)
          Generates HTML code to summarize the general status of Ground Stops and Ground Delay Programs which may be affecting a given airport.
 java.lang.String[] GetGStopInfoByARPT(java.lang.String strFacility, java.lang.String strARPT, Airport requestARPTObj)
          Generates an array of Strings containing HTML representing a summary of delay information affecting a given airport caused by Ground Stops.
 Airport getKnownAirport(java.lang.String airport_id, boolean useOldOne)
          Gets an Airport object from the AirportsMap based on a given airport_id if the useOldOne flag is not set, or from the oldAirportsMap if the useOldOne flag is set (which means that the DatabaseUpdater Thread is running).
 java.lang.String[] GetOtherClosureInfo(java.lang.String airp)
          Returns a string with information about closed airports other than the one the user selected.
 boolean getPI()
          Getter method to return the flag indicating whether the FlyFAAProjectBean has been created yet.
 java.util.ArrayList getRegionalArray(char ns, char wce)
          Returns one of the regional ArrayLists.
 java.util.Date getTmTimeStamp()
          Getter method to return the date/timestamp representing the date/time just after the most recent time when delay/GDP/GSTOP/Closure information was read from the database.
(package private)  void Init_Alerted_Airport_Data(java.sql.Connection conn)
          Query the database to find alerted airports.
 boolean isDST(java.util.Calendar date_of_interest, double offsetHours)
          Determines if the input date (in GMT time) would equate to a daylight savings time in the U.S.
 boolean isFlyLocked()
          Returns the value of the FlyLock, a boolean intended to limit to one user at a time access to critical sections of code.
 java.lang.String LastUpdatedTime()
          Displays the last updated time in HTML text and a link to the Glossary of Terms.
 boolean lockFly()
          Locks the FlyLock and returns true if the FlyLock was unlocked.
 java.lang.String MakeAlertDivs(boolean useOldMap)
          Generates and returns a String of HTML code to represent the circular hotspots on the map for the alerted airports.
 java.lang.String MakeRegionalAlertDivs(char abbreviation1, char abbreviation2, int topv, int leftv, int width, int height, boolean useOldMap)
          Make Alert DIVs for the a given region of the U.S.
 java.lang.String MakeRegionalToolTips(java.lang.String region, FlyFAAProjectBean project, boolean useOldMap)
          Generates HTML code to represent the pop-up tooltips for airport mouseovers.
 java.lang.String MakeToolTips(FlyFAAProjectBean project, boolean useOldMap)
          Generates HTML code to represent the pop-up tooltips for airport mouseovers.
 void setClosureObjRecords(java.sql.Connection conn, java.lang.String strSQL)
          Sets up the Array of Airport Closure Objects based on querying the ois_airport_closures table.
 void setDbBean(FlyfaaDbBean fdb)
          Sets the FlyfaaDbBean property of the project.
 void setDbStartTime()
          Sets the date/timestamp when new delay data starts being read from the database to the current time.
 void setDelayObjRecords(java.sql.Connection conn, java.lang.String strSQL)
          Sets up the Array of Delay Objects based on querying the ois_delay table.
 void setGDelayObjRecords(java.sql.Connection conn, java.lang.String strSQL)
          Sets up the Array of Ground Delay Objects based on querying the ois_program table.
 void setGStopObjRecords(java.sql.Connection conn, java.lang.String strSQL)
          Sets up the Array of Ground Stop Objects based on querying the ois_gstop table.
 void setPI(boolean init_value)
          Sets the flag which indicates that the FlyFAAProjectBean has been instantiated yet to the given argument.
 void setTmTimeStamp()
          Sets the date/timestamp when data was last read from the database to a Date representing the current time.
 void setTmTimeStamp(long date)
          Overloaded method to set the date/timestamp when data was last read from the database to a given date/time.
(package private)  java.lang.String setToolTips(java.sql.Connection c, java.lang.String SQL)
          Method to set the Tooltip property in the Airport objects contained in the arptMap.
 java.lang.String TickerUpdatedTime(java.util.Date whichTime, java.lang.String tag)
          Returns the time of a given date, optionally enclosed within a given HTML tag supplied as input.
 boolean unlockFly()
          Unlocks the FlyLock, notifies all threads waiting on it and returns true, unless the FlyLock is not currently set, in which case this method returns false.
(package private)  java.lang.String Update_Airport_Project_Data(java.sql.Connection conn, java.lang.String TTQuery)
          Query database to find alerted airports.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

Logf

java.lang.String Logf
String containing the name of the log file. Set to FlyLog.LogFile

keywordQuery

private java.lang.String keywordQuery
String to use for holding a query during object construction...

rs

private java.sql.ResultSet rs
ResultSet for use by multiple database queries

rs2

private java.sql.ResultSet rs2
ResultSet for use by routines which need two simultaneous queries

tmTimeStamp

protected java.util.Date tmTimeStamp
Time just after finishing fetching new delay/GDP/GSTOP/Closure data

vd_dbstart

protected java.util.Date vd_dbstart
Time when data starts being fetched (when lock is set).

FlyLock

protected boolean FlyLock
True primarily when delay/GDP/GSTOP/Closure data is being read from the database. See the checkFAAData method.

GDPA

protected java.util.List GDPA
Array for most recently retrieved Ground Delay Programs; contains GDP objects. Read from this Array if FlyLock is not set.

oldGDPA

protected java.util.List oldGDPA
Array for saving Ground Delay Program information while new GDP info is being read. This Array will be used if the FlyLock is set when the page is accessed, meaning that the DatabaseUpdater Thread is running.

GStopA

protected java.util.List GStopA
Array for Ground Stops; contains GStop objects.

oldGStopA

protected java.util.List oldGStopA
Array for saving Ground Stop information while new GStop info is being read. This Array will be used if the FlyLock is set when the page is accessed, meaning that the DatabaseUpdater Thread is running.

DelayA

protected java.util.List DelayA
Array for Delays; contains Delay objects.

oldDelayA

protected java.util.List oldDelayA
Array for saving Delay information while new Delay info is being read. This Array will be used if the FlyLock is set when the page is accessed, meaning that the DatabaseUpdater Thread is running.

ClosureA

protected java.util.List ClosureA
Array for Airport Closures; contains Closure objects.

oldClosureA

protected java.util.List oldClosureA
Array for saving Closure information while new Closure info is being read. This Array will be used if the FlyLock is set when the page is accessed, meaning that the DatabaseUpdater Thread is running.

alrtMap

protected java.util.Map alrtMap
HashMap for CURRENT ALERTED AIRPORTS: Each item is keyed by the airport id the same way that the airportsMap is, and the value is a Boolean. True if the airport is alerted, false otherwise.

oldMap

protected java.util.Map oldMap
HashMap for PREVIOUSLY ALERTED AIRPORTS (airports which were put into alrtMap during the previous 60-second database refresh).

pacingA

protected java.util.List pacingA
Array for PACING AIRPORTS; indexed by FAA_AIRPORTS.TOOL_ORDER, contains 3-character airport identifiers

airportsMap

java.util.Map airportsMap
HashMap for storing Airport objects indexed by the airport ID (for ALL AIRPORTS). This is a synchronizedMap. The values in the map are Airport objects.

oldAirportsMap

java.util.Map oldAirportsMap
HashMap for storing Airport objects indexed by the airport ID (for ALL AIRPORTS). This is a synchronizedMap. The values in the map are Airport objects. This map becomes a copy of airportsMap when the DatabaseUpdater Thread starts. Airport info should be read from this map while the DatabaseUpdater Thread is running, which is when the FlyLock is set.

nwA

java.util.ArrayList nwA
An array for the Northwest Region; contains 3-character FAA airport identifiers

ncA

java.util.ArrayList ncA
An array for the North Central Region; contains 3-character FAA airport identifiers

neA

java.util.ArrayList neA
An array for the Northeast Region; contains 3-character FAA airport identifiers

swA

java.util.ArrayList swA
An array for the Southwest Region; contains 3-character FAA airport identifiers

scA

java.util.ArrayList scA
An array for the South Central Region; contains 3-character FAA airport identifiers

seA

java.util.ArrayList seA
An array for the Southeast Region; contains 3-character FAA airport identifiers

fwA

java.util.ArrayList fwA
An array for the Far West Region; contains 3-character FAA airport identifiers

alert_layers_start

public final int alert_layers_start
The next available lay[] item index after the U.S. map (see usmap.jsp)

alert_layers_end

public final int alert_layers_end
This value is used as a parameter to Alert_Airports() by usmap.jsp. The other regions (nemap.jsp, etc.) also call Alert_Airports and pass a value equivalent to alert_layers_start+neA.size() (for example).

keycenters

private java.util.Map keycenters
A hashmap for storing the centers associated with the (currently 46) different keywords used by TMSs ('ZNY1', 'NOWEST', '6WEST', etc.)

DbAccess

private FlyfaaDbBean DbAccess
A reference to the database access bean

PI

protected boolean PI
A boolean to ensure that the ProjectBean's initialization only occurs once

dbu

DatabaseUpdater dbu
A DatabaseUpdater to read Traffic Management Information from the database periodically

dbtimer

java.util.Timer dbtimer
A Timer object with which to schedule the DatabaseUpdater
Constructor Detail

FlyFAAProjectBean

public FlyFAAProjectBean()
FlyFAA's ("Project Object") Class constructor. References the package private FlyLog.LogFile property to set up a pointer to the logfile.
Method Detail

FlyFAAProjectBeanStalk

public boolean FlyFAAProjectBeanStalk()
                               throws java.sql.SQLException,
                                      java.io.IOException
FlyFAA's ("Project Object") Class construction completion method. Call this method after you have set the OracleConnectionCacheImpl property of the DbAccess.
Returns:
false if FlyFAAProjectBean has already been constructed, otherwise true
Throws:
java.sql.SQLException - if a database access error occurs
java.io.IOException - if a database connection cannot be obtained within 5 seconds

getPI

public boolean getPI()
Getter method to return the flag indicating whether the FlyFAAProjectBean has been created yet.

Returns:
true if FlyFAAProjectBean has been instantiated, otherwise false

setPI

public void setPI(boolean init_value)
Sets the flag which indicates that the FlyFAAProjectBean has been instantiated yet to the given argument.
Parameters:
init_value - true if the FlyFAAProjectBean has just been instantiated

getRegionalArray

public java.util.ArrayList getRegionalArray(char ns,
                                            char wce)
                                     throws java.lang.IllegalArgumentException
Returns one of the regional ArrayLists.
Parameters:
ns - char representing the first character of the region ('f', 'n' or 's')
wce - char representing the second character of the region ('w', 'c' or 'e'). Note: the far west region is distinguished solely based upon the value of the first char
Returns:
ArrayList one of the regional ArrayLists (nwA, ncA, neA, swA, scA, seA, or fwA)
Throws:
java.lang.IllegalArgumentException - if an invalid region is given

getTmTimeStamp

public java.util.Date getTmTimeStamp()
Getter method to return the date/timestamp representing the date/time just after the most recent time when delay/GDP/GSTOP/Closure information was read from the database.

Returns:
java.util.Date - Date/timestamp just after reading delay data

setTmTimeStamp

public void setTmTimeStamp()
Sets the date/timestamp when data was last read from the database to a Date representing the current time.

getDbBean

public FlyfaaDbBean getDbBean()
Getter method to return the FlyfaaDbBean property.

Returns:
FlyfaaDbBean - Reference to the Database accessor bean

setDbBean

public void setDbBean(FlyfaaDbBean fdb)
Sets the FlyfaaDbBean property of the project.
Parameters:
fdb - FlyfaaDbBean to be assigned as the project object's database accessor bean

setTmTimeStamp

public void setTmTimeStamp(long date)
Overloaded method to set the date/timestamp when data was last read from the database to a given date/time.

Parameters:
date - long date in milliseconds since January 1, 1970, 00:00:00 GMT

getDbStartTime

public java.util.Date getDbStartTime()
Gets the date/timestamp when new Traffic Management Initiative data starts being read from the database.

Returns:
java.util.Date just before starting database access.
See Also:
DatabaseUpdater.checkFAAData()

setDbStartTime

public void setDbStartTime()
Sets the date/timestamp when new delay data starts being read from the database to the current time.

isFlyLocked

public boolean isFlyLocked()
Returns the value of the FlyLock, a boolean intended to limit to one user at a time access to critical sections of code.

Returns:
The current state of the FlyLock flag.

unlockFly

public boolean unlockFly()
Unlocks the FlyLock, notifies all threads waiting on it and returns true, unless the FlyLock is not currently set, in which case this method returns false.

Returns:
indication of whether the FlyLock was unlocked (true if it was, false if not)

lockFly

public boolean lockFly()
Locks the FlyLock and returns true if the FlyLock was unlocked. Otherwise, does nothing and returns false.

Returns:
true if the FlyLock was locked, otherwise false

deleteSpaces

public java.lang.String deleteSpaces(java.lang.String base)
Parses a given String, deleting spaces wherever they may be found.
Parameters:
base - String from which spaces are to be deleted
Returns:
String - the input string with all spaces removed

GetFacilities

public java.lang.String GetFacilities(java.lang.String facs)
Parses the list of included facilities for a Ground Delay Program or Ground Stop (which may include keywords) and returns a string of ARTCC names.
Parameters:
facs - String containing the list of included facilities (may include keywords)
Returns:
String of ARTCC names

FillDelayData

public java.lang.String FillDelayData(FlyfaaDbBean dbb)
                               throws java.sql.SQLException,
                                      java.io.IOException
Reads from the database a list of Ground Delay Programs, Ground Stops, Delay Information and Airport Closure information. Basic Tooltip information is also generated. The ArrayLists defined in this FlyFAAProjectBean are then populated with the data from the database.

Returns:
String HTML produced by Update_Airport_Project_Data
Throws:
java.sql.SQLException - if a database access error occurs
java.io.IOException - if a database connection cannot be obtained within 5 seconds
See Also:
checkFAAData

setDelayObjRecords

public void setDelayObjRecords(java.sql.Connection conn,
                               java.lang.String strSQL)
                        throws java.sql.SQLException
Sets up the Array of Delay Objects based on querying the ois_delay table.

Parameters:
conn - handle to a database connection
strSQL - String containing the SQL query to be executed
Throws:
java.sql.SQLException - if a database access error occurs

setGDelayObjRecords

public void setGDelayObjRecords(java.sql.Connection conn,
                                java.lang.String strSQL)
                         throws java.sql.SQLException
Sets up the Array of Ground Delay Objects based on querying the ois_program table.

Parameters:
conn - handle to a database connection
strSQL - String containing the SQL query to be executed
Throws:
java.sql.SQLException - if a database access error occurs

setGStopObjRecords

public void setGStopObjRecords(java.sql.Connection conn,
                               java.lang.String strSQL)
                        throws java.sql.SQLException
Sets up the Array of Ground Stop Objects based on querying the ois_gstop table.

Parameters:
conn - handle to a database connection
strSQL - String containing the SQL query to be executed
Throws:
java.sql.SQLException - if a database access error occurs

setClosureObjRecords

public void setClosureObjRecords(java.sql.Connection conn,
                                 java.lang.String strSQL)
                          throws java.sql.SQLException
Sets up the Array of Airport Closure Objects based on querying the ois_airport_closures table.

Parameters:
conn - handle to a database connection
strSQL - String containing the SQL query to be executed
Throws:
java.sql.SQLException - if a database access error occurs

FillARPTData

void FillARPTData(java.sql.Connection conn)
            throws java.sql.SQLException
Using the database's AIRPORTS, CITIES, STATES and CENTERS tables, this routine fills the airportsMap with airport information, fills the pacingA array if the airport is a pacing airport, and fills up the regional arrays depending on which state the airport is in.
Parameters:
conn - Handle to a database connection
Throws:
java.sql.SQLException - if a database access error occurs

getAirport

public Airport getAirport(java.lang.String airport_id,
                          boolean useOldOne)
Gets an Airport object from the AirportsMap based on a given airport_id if the useOldOne flag is not set, or from the oldAirportsMap if the useOldOne flag is set (which means that the DatabaseUpdater Thread is running). This method will generate an Airport object if the given airport_id does not exist in whichever hashmap is searched first.
Parameters:
airport_id - String containing the airport ID of the airport of interest.
useOldOne - false to get airport from the airportsMap, true meaning to get the airport info from the oldAirportsMap
Returns:
Airport object for the requested airport. If no airport object exists for the requested airport, a new Airport object is created using the one-argument Airport constructor which is then stored in both the airportsMap and the oldAirportsMap.
See Also:
getKnownAirport

getKnownAirport

public Airport getKnownAirport(java.lang.String airport_id,
                               boolean useOldOne)
Gets an Airport object from the AirportsMap based on a given airport_id if the useOldOne flag is not set, or from the oldAirportsMap if the useOldOne flag is set (which means that the DatabaseUpdater Thread is running). This method will return null if the given airport_id does not exist in whichever hashmap is searched first. This method is used by the DisplayDelayInfo method to prevent hackers from causing too many Airport objects to be created by overutilizing the flyfaaindex.jsp with a possible 17,576 different combinations of the ARPT parameter.
Parameters:
airport_id - String containing the airport ID of the airport of interest.
useOldOne - false to get airport from the airportsMap, true meaning to get the airport info from the oldAirportsMap
Returns:
Airport object for the requested airport. If no airport object exists for the requested airport, this method returns null.
See Also:
getAirport

Init_Alerted_Airport_Data

void Init_Alerted_Airport_Data(java.sql.Connection conn)
                         throws java.sql.SQLException
Query the database to find alerted airports. Initialize the airportsMap with the information. Call Alert_Airport for each alerted airport. This function is currently the last function called by FlyFAAProjectBeanStalk() at application initialization time.
Parameters:
conn - handle to a database connection
Throws:
java.sql.SQLException - if a database access error occurs

Alert_Airport

void Alert_Airport(Airport a,
                   int x,
                   int y,
                   int r,
                   int Regx,
                   int Regy,
                   java.lang.String Color)
Modifies an existing airport object (in airportsMap) to store the alerted airport information, including X-coordinate on map, Y-coordinate on map, radius of hotspot, X- and Y- coordinate on the regional map (for pacing airports), and color to be displayed.
Parameters:
a - Airport object to be alerted
x - int X coordinate on U.S. map
y - int Y coordinate on U.S. map
r - int radius of hotspot where airport's colored circle appears
Regx - int X coordinate of airport on regional map
Regy - int Y coordinate of airport on regional map
Color - String containing the color to be displayed for this airport

Update_Airport_Project_Data

java.lang.String Update_Airport_Project_Data(java.sql.Connection conn,
                                             java.lang.String TTQuery)
                                       throws java.sql.SQLException,
                                              java.io.IOException
Query database to find alerted airports. Update project.airports array with the new information. Called by FillDelayData

Parameters:
conn - handle to a database connection
TTQuery - String containing the ToolTip SQL query to be executed
Returns:
String of HTML actually created by setToolTips
Throws:
java.sql.SQLException - if a database access error occurs

setToolTips

java.lang.String setToolTips(java.sql.Connection c,
                             java.lang.String SQL)
                       throws java.sql.SQLException,
                              java.io.IOException
Method to set the Tooltip property in the Airport objects contained in the arptMap. SQL restricts airports to those whose alert status has changed in the most recent database refresh.

Parameters:
c - handle to a database connection
SQL - String containing the ToolTip SQL query to be executed
Returns:
String of HTML actually produced by DisplayDelayInfo
Throws:
java.sql.SQLException - if a database access error occurs
See Also:
Update_Airport_Project_Data

Alert_Airports

public java.lang.String Alert_Airports(int first_layer,
                                       int last_layer)
Method to write the 'dolayers' client-side javascript function into the document. Reference the project object to flag alerted airports. Since a variable number of airports can be alerted now, not just the pacing airports, parameter last_layer was added. last_layer = (next lay[] item number after the map) + project.[region].length (example for the northeast region: 73+project.ne.length [73+62=135]). By the way, the length of project.ne can be determined by querying as follows:
   SELECT COUNT(B.ARPT)
   FROM FAA_STATES A, FAA_AIRPORTS B, FAA_CITIES C
   WHERE (A.ST IN ('VA','WV','MD','DE','PA','NJ','NY','CT','RI','VT','NH','ME','DC','MA')
   AND (B.CITY_ID=C.CITY_ID AND C.STATE_ID=A.STATE_ID))
 
The test is for less than, so the last layer in the northeast will be 134.

Parameters:
first_layer - number of the first lay[] array item after the map
last_layer - number of the next lay[] array item after the map + the number of airports in this region
Returns:
String Javascript code

alert_regional_layers

public java.lang.String alert_regional_layers(int firstlayer,
                                              int firstielayer,
                                              java.lang.String region,
                                              java.util.ArrayList airports)
Generates javascript code to mark the alerted airports (layers) in a given region so that they are displayed in the browser.
Parameters:
firstlayer - value of next available lay array item index after the map
firstielayer - value of next available ielayer array item index after the map
region - String representing the region (one of 'nw','nc','ne','sw','sc','se','fw')
airports - pointer to one of the ArrayLists containing the airports belonging to this region defined in FlyFAAProjectBean (nwA, ncA, and so on)
Returns:
String Javascript code

alert_layers

public java.lang.String alert_layers(int firstielayer)
Generates javascript code to mark the alerted airports (layers) so that they are displayed in the browser.
Parameters:
firstielayer - value of next available ielayer array item index
Returns:
String Javascript code

MakeToolTips

public java.lang.String MakeToolTips(FlyFAAProjectBean project,
                                     boolean useOldMap)
                              throws java.sql.SQLException,
                                     java.io.IOException
Generates HTML code to represent the pop-up tooltips for airport mouseovers. The code consists of
tags containing the tooltips generated by setToolTips(conn, TTQuery+TT_query_where) (called by Update_Airport_Project_Data from FillDelayData(), which is called by FlyfaaDbBean.checkFAAData() when more than 60 seconds have elapsed since the database has been checked). Called by usmap.jsp.
Parameters:
project - FlyFAAProjectBean reference
useOldMap - true if the DatabaseUpdater Thread is running, meaning that the ArrayLists containing GDPs, GStops, Delays, and Closures (GDPA, GStopA, DelayA, ClosureA) as well as airportsMap for the airport colors, are being updated, meaning that the backup copies of this data, oldGDPA, oldGStopA, oldDelayA, and oldAirportsMap, should be used instead. The jsp page passes in the state of the FlyLock as it was when the page starts, and uses that same value later on when MakeAlertDivs() is called. If this value is false, the DatabaseUpdater Thread is sleeping, therefore it has been decreed to be safe to use the new ArrayLists.
Returns:
String HTML code containing <DIV> tags for airport tooltips
Throws:
java.sql.SQLException - if a database access error occurs
java.io.IOException - if a database connection cannot be obtained within 5 seconds

MakeRegionalToolTips

public java.lang.String MakeRegionalToolTips(java.lang.String region,
                                             FlyFAAProjectBean project,
                                             boolean useOldMap)
                                      throws java.sql.SQLException,
                                             java.io.IOException
Generates HTML code to represent the pop-up tooltips for airport mouseovers. The code consists of
tags containing the tooltips generated by setToolTips(conn, TTQuery+TT_query_where) (called by Update_Airport_Project_Data from FillDelayData(), which is called by FlyfaaDbBean.checkFAAData() when more than 60 seconds have elapsed since the database has been checked). Called by nwmap.jsp, ncmap.jsp, nemap.jsp, and so on. Sample code:
 <DIV ID="PDXLayer" CLASS="tooltip">
 <TABLE BORDER="1" CELLSPACING="0" BGCOLOR="#FFFFCC"><TR><td CLASS="tip">
 <center><b>Portland International</b></center>
 </TD></TR></TABLE>
 </DIV>
 

Parameters:
region - String identifying the region of interest: 'nw','nc','ne','sw','sc','se','fw'
project - FlyFAAProjectBean reference
useOldMap - true if the DatabaseUpdater Thread is running, meaning that the ArrayLists containing GDPs, GStops, Delays, and Closures (GDPA, GStopA, DelayA, ClosureA) as well as airportsMap for the airport colors, are being updated, meaning that the backup copies of this data, oldGDPA, oldGStopA, oldDelayA, and oldAirportsMap, should be used instead. The jsp page passes in the state of the FlyLock as it was when the page starts, and uses that same value later on when MakeAlertDivs() is called. If this value is false, the DatabaseUpdater Thread is sleeping, therefore it has been decreed to be safe to use the new ArrayLists.
Returns:
String HTML code containing <DIV> tags for airport tooltips
Throws:
java.sql.SQLException - if a database access error occurs
java.io.IOException - if a database connection cannot be obtained within 5 seconds

MakeRegionalAlertDivs

public java.lang.String MakeRegionalAlertDivs(char abbreviation1,
                                              char abbreviation2,
                                              int topv,
                                              int leftv,
                                              int width,
                                              int height,
                                              boolean useOldMap)
Make Alert DIVs for the a given region of the U.S.
Parameters:
abbreviation1 - char indicating the first character of the regional abbreviation: 'f' for far west, 'n' for north, or 's' for south
abbreviation2 - char indicating the second character of the regional abbreeviation: 'w' for west, 'c' for central, or 'e' for east. Note: far west region is identified based solely on abbreviation1.
topv - int provides the top style position of the map for this region
leftv - int provides the left style position of the map for this region
width - int provides the width of the map for this region
height - int provides the height of the map for this region
useOldMap - boolean indicating state of DatabaseUpdater. If true, DatabaseUpdater is running; in this case, the getAirport function will read airport info from a backup copy of the airportsMap.
Returns:
String containing <LAYER> tags for all airports in the given region.

MakeAlertDivs

public java.lang.String MakeAlertDivs(boolean useOldMap)
Generates and returns a String of HTML code to represent the circular hotspots on the map for the alerted airports. Mouseovers display the airport's long name in the status window.
Parameters:
useOldMap - true if oldAirportsMap should be used (i.e., if the FlyLock was set when the jsp page initiated the call to this method), otherwise false
Returns:
String of <DIV> tags for alerted layers

DisplayDelayInfo

public java.lang.String DisplayDelayInfo(java.lang.String DelayedAirport,
                                         boolean dynamic,
                                         int delayx,
                                         boolean plain)
Generates HTML code to represent the airport delay and closure information. The code consists of
tags containing the tooltips generated by setToolTips(conn, TTQuery+TT_query_where) (called by Update_Airport_Project_Data from FillDelayData(), which is called by DatabaseUpdater.checkFAAData() when it has been determined that there have been updates or deletions in the OIS data. Called by usmap.jsp.
Parameters:
DelayedAirport - The airport for which delays are being reported
dynamic - Used by the MakeToolTips method. If true, only the DelayInfo array will be returned (as the 'get_tip_local' stored procedure would if it was smart enough to do all of the fancy conversion of minutes to hours and minutes, which it's not. Also, if dynamic is true, delayx will be passed with the DelayA index.
delayx - DelayA index; used if dynamic is true
plain - true if this information is for a plain text page
Returns:
String HTML code containing delay and closure information.

GetClosureInfoByARPT

public java.lang.String GetClosureInfoByARPT(java.lang.String airport,
                                             java.lang.String longname)
Generates HTML code to describe airport closure information.
Parameters:
airport - The airport ID
longname - The airport long name
Returns:
String HTML code containing airport closure information.

Disclaimer

public java.lang.String Disclaimer(java.lang.String type)
Returns a disclaimer in an HTML <TR> tag.
Parameters:
type - String indicating if this disclaimer is "special". If the value of this parameter is 'spec', it means to use Javascript HREF for link to airlines' websites, which will close this window and open the link to the airlines' websites in the opener's window.
Returns:
String HTML code containing disclaimer text in a <TH> of class "footer"

GetOtherClosureInfo

public java.lang.String[] GetOtherClosureInfo(java.lang.String airp)
Returns a string with information about closed airports other than the one the user selected. The closure time and reopening time, if available, are returned in local time.
Parameters:
airp - String identifying the airport that the user selected
Returns:
String[] HTML code containing information about closed airports

GetGStopInfoByARPT

public java.lang.String[] GetGStopInfoByARPT(java.lang.String strFacility,
                                             java.lang.String strARPT,
                                             Airport requestARPTObj)
                                      throws java.lang.Exception
Generates an array of Strings containing HTML representing a summary of delay information affecting a given airport caused by Ground Stops.
Parameters:
strFacility - ARTCC within which the airport of interest lies
strARPT - the name of the airport for which Ground Stop information is to be generated
requestARPTObj - pointer to the airport object for which Ground Stop information is to be generated
Returns:
String[] Array of Strings containing a summary of how GStops are affecting the given airport.
Throws:
java.lang.Exception - if an exception occurred while iterating through the GStops.

convertGMTtoLocal

public java.lang.String convertGMTtoLocal(int month,
                                          int day_of_month,
                                          double hhmm,
                                          double offsetHours,
                                          boolean bUseDayLight)
Converts a GMT time string from OIS into a local time string.
Parameters:
month - month of the GMT time to be converted (if the current month [of time NOW] is November or December, and this parameter represents January or February, the year is assumed to be next year).
day_of_month - the day of the month (also known as the date) of the time to be converted
hhmm - double value representing the hours and minutes of the time to be converted
offsetHours - double value representing the timezone offset for the location
bUseDayLight - boolean value indicating whether the Daylight Savings Time is used at the location
Returns:
String String containing the input GMT time converted to local time

isDST

public boolean isDST(java.util.Calendar date_of_interest,
                     double offsetHours)
Determines if the input date (in GMT time) would equate to a daylight savings time in the U.S. It uses the offset from Eastern Standard time (offsetHours).
Parameters:
date_of_interest - Calendar representing the date/time (in GMT) of the time for which the determination of whether it is DST or not is to be made.
offsetHours - number of hours that the timezone of the location to which the given date/time applies differs from GMT
Returns:
true if the input date/time would be in Daylight Savings Time, false otherwise.

GetGDelayInfoByARPT

public java.lang.String[] GetGDelayInfoByARPT(java.lang.String strFacility,
                                              java.lang.String strARPT)
                                       throws java.lang.Exception
Generates an array of Strings containing HTML representing a summary of delay information affecting a given airport caused by Ground Delay Programs.
Parameters:
strFacility - ARTCC within which the airport of interest lies
strARPT - the airport for which Ground Delay information is to be generated
Returns:
String[] Array of Strings containing a summary of how GDPs are affecting the given airport.
Throws:
java.lang.Exception - if an exception occurred while iterating through the GDPs

GetGStopGDelayInfoByARPT

public java.lang.String GetGStopGDelayInfoByARPT(java.lang.String strARPT,
                                                 java.lang.String strARPTLongName,
                                                 java.lang.String strARPTCity,
                                                 java.lang.String strARPTState)
Generates HTML code to summarize the general status of Ground Stops and Ground Delay Programs which may be affecting a given airport.
Parameters:
strARPT - Airport of interest; that is, how are the GStops and GDPs affecting this airport
strARPTLongName - The long name of the airport of interest
strARPTCity - The city served by the airport of interest
strARPTState - The state occupied by the airport of interest
Returns:
String HTML code containing a summary of how all of the Ground Stops and Ground Delay Programs in effect are impacting the airport of interest or an empty string if there are none.

DisplayDelayObjRecords

public java.lang.String[] DisplayDelayObjRecords(java.lang.String strARPT,
                                                 boolean bGdelayGstop,
                                                 boolean isdynamic,
                                                 int specificDelay)
Generates a string of HTML code to summarize the general Arrival and Departure delay information for a given airport.
Parameters:
strARPT - String identifying the airport of interest; that is, what sort of general arrival and departure delays are being experienced at this airport
bGdelayGstop - boolean indicating if a GDP or GStop is affecting the airport
isdynamic - boolean flag used to avoid returning the "Less than 15-minute delay" message
specificDelay - int identifying the DelayA arrayList item index for a dynamic delay
Returns:
String[] HTML code containing a summary of the general arrival and departure delays impacting the airport of interest or an empty string if there are none. Item 0 contains Departure Delay info; item 1 contains Arrival Delay info. Item 2 is a boolean which is set to true if isdynamic is set and the amount of Departure Delays are greater than zero; this means that the item 0 data can be used by the dynamic tooltip. Item 3 is a boolean which is used in the same manner for the Arrival Delay info.

LastUpdatedTime

public java.lang.String LastUpdatedTime()
Displays the last updated time in HTML text and a link to the Glossary of Terms. Calls TickerUpdatedTime to retrieve the current time.
Returns:
String HTML containing the last updated time and a link to the Glossary of Terms

TickerUpdatedTime

public java.lang.String TickerUpdatedTime(java.util.Date whichTime,
                                          java.lang.String tag)
Returns the time of a given date, optionally enclosed within a given HTML tag supplied as input.
Parameters:
whichTime - java.util.Date representing the time to be displayed.
tag - HTML tag within which should surround the time, but not the 'EST' or 'EDT'. For example, 'B' or 'I'.
Returns:
String HTML containing the last updated time.

DisplayPlainTextDelayInfo

public java.lang.String DisplayPlainTextDelayInfo()
                                           throws java.lang.Exception
Returns a String containing the HTML representing the plain text content for the upper frame.
Returns:
String of HTML representing the plain text content for the upper frame.
Throws:
java.lang.Exception - if DisplayAllInitiatives threw an exception

DisplayAllInitiatives

public java.lang.String DisplayAllInitiatives(java.util.List a,
                                              boolean useOldArray)
                                       throws java.lang.Exception
Returns a String of HTML representing a given set of Traffic Management Initiatives in plain text based on the supplied ArrayList.
Parameters:
a - ArrayList representing the array of Traffic Management Initiatives to list.
useOldArray - boolean indicating if the old arrays should be used
Returns:
String Airport closures or Ground Stops or Ground Delay Programs or General Arrival/Departure Delay information in plain text. Returns an empty string if no Initiatives exist in the given List.
Throws:
java.lang.Exception - if something bad happened while accessing the data.