Class PilotReadDAO
java.lang.Object
org.deltava.dao.DAO
org.deltava.dao.PilotReadDAO
- Direct Known Subclasses:
GetInactivity,GetPilot,GetPilotOnline
A DAO to support reading Pilot object(s) from the database. This class contains methods to read an individual Pilot
from the database; implementing subclasses typically add methods to retrieve Lists of pilots based on particular criteria.
- Since:
- 1.0
- Version:
- 12.0
- Author:
- Luke
-
Field Summary
FieldsFields inherited from class org.deltava.dao.DAO
_queryMax, _queryStart, _queryTimeout, WGS84_SRID -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCreates the DAO from a JDBC connection. -
Method Summary
Modifier and TypeMethodDescriptionQuery pilot objects from the database, assuming a pre-prepared statement.final Pilotget(int id) Gets a pilot object based on a database ID.Returns a Pilot object which may be in another Airline's database.get(UserDataMap udm) Returns Pilot objects which may be in another Airline's database.getByID(Collection<?> ids, String tableName) Returns a Map of pilots based on a Set of pilot IDs.Returns a Pilot based on a given full name.protected final voidloadAccomplishments(Map<Integer, Pilot> pilots, String dbName) Load the accomplishment IDs for a group of Pilots.protected final voidloadChildRows(Pilot p, String dbName) Load the ratings, roles and accomplishment IDs for a Pilot.protected final voidloadIMAddrs(Map<Integer, Pilot> pilots, String dbName) Load social media addresses for a group of Pilots.protected final voidloadPushEndpoints(Map<Integer, Pilot> pilots, String dbName) Loads push notification endpoints for a group of Pilots.protected final voidloadRatings(Map<Integer, Pilot> pilots, String dbName) Load the equipment ratings for a group of Pilots.protected final voidLoad the security roles for a group of Pilots.protected static final voidupdatePilotCodes(Collection<Pilot> pilots, String dbName) Updates the Pilot codes when loading Pilots from different databases.Methods inherited from class org.deltava.dao.DAO
commitTransaction, createTimestamp, executeIDs, executeUpdate, executeUpdate, expandDate, formatDBName, formatLocation, getNewID, getQueryCount, prepare, prepareWithoutLimits, rollbackTransaction, setQueryMax, setQueryStart, setQueryTimeout, startTransaction, toID, toID, toInstant
-
Field Details
-
_cache
-
-
Constructor Details
-
PilotReadDAO
Creates the DAO from a JDBC connection.- Parameters:
c- the JDBC connection to use
-
-
Method Details
-
get
Gets a pilot object based on a database ID. This uses a cached query, and populates ratings and roles.- Parameters:
id- the database ID of the Pilot object- Returns:
- the Pilot object, or null if the ID was not found
- Throws:
DAOException- if a JDBC error occured
-
getByName
Returns a Pilot based on a given full name. This method does not use first/last name splitting since this can be unpredictable.- Parameters:
fullName- the Full Name of the PilotdbName- the database name to search- Returns:
- a Collection of Pilot beans
- Throws:
DAOException- if a JDBC error occurs
-
get
Returns a Pilot object which may be in another Airline's database.- Parameters:
ud- the UserData bean containg the Pilot location- Returns:
- the Pilot bean, or null if not found
- Throws:
DAOException- if a JDBC error occurs
-
get
Returns Pilot objects which may be in another Airline's database.- Parameters:
udm- the UserDataMap bean containg the Pilot locations- Returns:
- a Map of Pilots indexed by database ID
- Throws:
DAOException- if a JDBC error occurs
-
getByID
Returns a Map of pilots based on a Set of pilot IDs. This is typically called by a Water Cooler thread/channel list command.- Parameters:
ids- a Collection of pilot IDs. This can either be a Collection of Integers, a Collection ofDatabaseBeanbeanstableName- the table to read from, in DATABASE.TABLE format for a remote database, or TABLE for a table in the current airline's database.- Returns:
- a Map of Pilots, indexed by the pilot code
- Throws:
DAOException- if a JDBC error occurs
-
execute
Query pilot objects from the database, assuming a pre-prepared statement.- Parameters:
ps- a PreparedStatement- Returns:
- a List of Pilot objects
- Throws:
SQLException- if a JDBC error occurs
-
loadChildRows
Load the ratings, roles and accomplishment IDs for a Pilot.- Parameters:
p- the Pilot beandbName- the database Name- Throws:
SQLException- if a JDBC error occurs
-
loadAccomplishments
protected final void loadAccomplishments(Map<Integer, Pilot> pilots, String dbName) throws SQLExceptionLoad the accomplishment IDs for a group of Pilots.- Parameters:
pilots- the Map of Pilots, indexed by database IDdbName- the database Name- Throws:
SQLException- if a JDBC error occurs
-
loadRoles
Load the security roles for a group of Pilots.- Parameters:
pilots- the Map of Pilots, indexed by database ID- Throws:
SQLException- if a JDBC error occurs
-
loadIMAddrs
Load social media addresses for a group of Pilots.- Parameters:
pilots- the Map of Pilots, indexed by database IDdbName- the database name- Throws:
SQLException- if a JDBC error occurs
-
loadPushEndpoints
protected final void loadPushEndpoints(Map<Integer, Pilot> pilots, String dbName) throws SQLExceptionLoads push notification endpoints for a group of Pilots.- Parameters:
pilots- a Map of Pilots, indexed by database IDdbName- the database name- Throws:
SQLException- if a JDBC error occurs
-
loadRatings
Load the equipment ratings for a group of Pilots.- Parameters:
pilots- the Map of Pilots, indexed by database IDdbName- the database name- Throws:
SQLException- if a JDBC error occurs
-
updatePilotCodes
Updates the Pilot codes when loading Pilots from different databases.- Parameters:
pilots- a Collection of Pilot beans to updatedbName- the database name
-