org.opengts.db.tables
Class Driver

java.lang.Object
  extended by org.opengts.dbtools.DBRecord<RT>
      extended by org.opengts.db.AccountRecord<Driver>
          extended by org.opengts.db.tables.Driver

public class Driver
extends AccountRecord<Driver>


Nested Class Summary
static class Driver.DutyStatus
           
static class Driver.Key
           
 
Nested classes/interfaces inherited from class org.opengts.db.AccountRecord
AccountRecord.AccountKey<RT extends DBRecord>
 
Nested classes/interfaces inherited from class org.opengts.dbtools.DBRecord
DBRecord.DBChangeListener
 
Field Summary
static java.lang.String _TABLE_NAME
           
static long DutyStatus_DRIVING
           
static long DutyStatus_INVALID
           
static long DutyStatus_OFF_DUTY
           
static long DutyStatus_ON_DUTY
           
static long DutyStatus_SLEEPING
           
static long DutyStatus_UNKNOWN
           
static java.lang.String FLD_address
           
static java.lang.String FLD_badgeID
           
static java.lang.String FLD_birthdate
           
static java.lang.String FLD_contactEmail
           
static java.lang.String FLD_contactPhone
           
static java.lang.String FLD_deviceID
           
static java.lang.String FLD_driverID
           
static java.lang.String FLD_driverStatus
           
static java.lang.String FLD_dutyStatus
           
static java.lang.String FLD_licenseExpire
           
static java.lang.String FLD_licenseNumber
           
static java.lang.String FLD_licenseType
           
 
Fields inherited from class org.opengts.db.AccountRecord
FLD_accountID, FLD_displayName, FLD_isActive, FLD_notes
 
Fields inherited from class org.opengts.dbtools.DBRecord
errorDescription, excludedUpdateFields, FLD_creationMillis, FLD_creationTime, FLD_description, FLD_lastUpdateAccount, FLD_lastUpdateTime, FLD_lastUpdateUser, hasError, ID_SIZE, isValidating, lastSQLException, NOTIFY_GROUP, PSEUDO_FIELD_CHAR, tempProps
 
Constructor Summary
Driver()
           
Driver(Driver.Key key)
           
 
Method Summary
static Driver createNewDriver(Account account, java.lang.String drvID)
           
static void cron(java.lang.String[] args)
           
static boolean exists(java.lang.String acctID, java.lang.String drvID)
          Returns true if the specified driver exists
 java.lang.String getAddress()
          Gets the driver address
 java.lang.String getBadgeID()
          Gets the driver badge ID
 long getBirthdate()
          Gets the driver birthdate as a DayNumber value
 java.lang.String getContactEmail()
           
 java.lang.String getContactPhone()
           
 Device getDevice()
          Returns the Device instance for the defined device-id
 java.lang.String getDeviceDescription()
          Returns the description for the assigned DeviceID
 java.lang.String getDeviceID()
          Gets the driver associated device ID (if available)
static Driver getDriver(Account account, java.lang.String drvID)
          Get Driver record instance for the specified account/driverID
static Driver getDriver(Account account, java.lang.String drvID, boolean create)
           
 java.lang.String getDriverID()
           
static OrderedSet<java.lang.String> getDriverIDsForAccount(java.lang.String acctId)
           
static OrderedSet<java.lang.String> getDriverIDsForAccount(java.lang.String acctId, long limit)
           
 long getDriverStatus()
          Gets the driver/duty status
 long getDutyStatus()
          Gets the duty status
static Driver.DutyStatus getDutyStatus(Driver d)
          Returns the defined DutyStatus for the specified driver.
static Driver.DutyStatus getDutyStatus(long ds)
          Returns the DutyStatus for the specified code.
static java.lang.String getDutyStatusDescription(Driver.DutyStatus ds, java.util.Locale loc)
          Returns the short text description of the specified DutyStatus
static DBFactory<Driver> getFactory()
           
 long getLicenseExpire()
          Gets the license expiration date as a DayNumber value
 java.lang.String getLicenseNumber()
           
 java.lang.String getLicenseType()
           
static void getRecordCallback(Account account, DBRecordHandler<Driver> rcdHandler)
          Callback for returning all drivers for an Account
static java.lang.String getTableDescription(java.util.Locale loc)
           
 boolean hasDriverStatus()
          Returns true if this driver has a defined driver-status (value > 0)
 boolean hasDutyStatus()
          Returns true if this driver has a defined duty-status (value > 0)
 boolean isLicenseExpired(DayNumber asof)
          Returns true if the license is expired as-of the specified date
 boolean isLicenseExpired(long asofDay)
          Returns true if the license is expired as-of the specified date
static void main(java.lang.String[] args)
           
 void setAddress(java.lang.String v)
          Sets the driver address
 void setBadgeID(java.lang.String v)
          Sets the driver badge ID
 void setBirthdate(DayNumber dn)
          Sets the driver birthdate as a DayNumber instance
 void setBirthdate(int year, int month1, int day)
          Sets the driver birthdate
 void setBirthdate(long v)
          Sets the driver birthdate as a DayNumber value
 void setContactEmail(java.lang.String v)
           
 void setContactPhone(java.lang.String v)
           
 void setCreationDefaultValues()
          Override to set default values
 void setDeviceID(java.lang.String v)
          Sets the driver associated device ID
 void setDriverID(java.lang.String v)
           
 void setDriverStatus(long v)
          Sets the driver/duty status
 void setDutyStatus(long v)
          Sets the duty status
 void setLicenseExpire(DayNumber dn)
          Sets the license expiration date as a DayNumber instance
 void setLicenseExpire(int year, int month1, int day)
          Sets the license expiration date
 void setLicenseExpire(long v)
          Sets the license expiration date as a DayNumber value
 void setLicenseNumber(java.lang.String v)
           
 void setLicenseType(java.lang.String v)
           
static java.lang.String TABLE_NAME()
           
static boolean updateDriverStatus(Account acct, java.lang.String drvID, long status)
          Sets/Updates the driver-status for the specified DriverID
static boolean updateDutyStatus(Account acct, java.lang.String drvID, long status)
          Sets/Updates the duty-status for the specified DriverID
 
Methods inherited from class org.opengts.db.AccountRecord
createSystemAdminAccount, getAccount, getAccountDescription, getAccountID, getDisplayName, getFilteredID, getFilteredID, getIsActive, getNotes, GetSimpleLocalString, getSystemAdminAccount, getSystemAdminAccountID, hasAccount, hasSystemAdminAccountID, isAccountManager, isActive, isSystemAdmin, isSystemAdmin, isSystemAdminAccountID, isValidID, newField_accountID, newField_accountID, newField_displayName, newField_displayName, newField_isActive, newField_isActive, newField_notes, newField_notes, setAccount, setDisplayName, setIsActive, setNotes, setRuntimeDefaultValues
 
Methods inherited from class org.opengts.dbtools.DBRecord
_getFactory, _reload, addChangedNotification, addExcludedUpdateFields, adjustStringLength_1, adjustStringLength, appendFieldValues, clearChanged, clearError, clearExcludedUpdateFields, clearLastCaughtSQLException, equals, excludeFieldFromUpdate, excludeFieldFromUpdate, fireChangeNotification, geKeyValue, getCreationDateTime, getCreationMillis, getCreationTime, GetCurrentAccount, GetCurrentUser, getDefaultFieldValueKey, getDescription, getErrorDescription, getFactory, getFactory, getField, getFieldBoolean, getFieldDateTime, getFieldDouble, getFieldFloat, getFieldInt, getFieldLong, getFieldName, getFieldString, getFieldValue, getFieldValue, getFieldValue, getFieldValue, getFieldValue, getFieldValue, getFieldValue, getFieldValue, getFieldValue, getKeyValue, getLastCaughtSQLException, getLastUpdateAccount, getLastUpdateTime, getLastUpdateTime, getLastUpdateUser, getNextGroup, getOptionalFieldValue, getOptionalFieldValue, getOptionalFieldValue, getOptionalFieldValue, getOptionalFieldValue, getOptionalFieldValue, getOptionalFieldValue, getOptionalFieldValue, getOptionalFieldValue, getRecordCount, getRecordCount, getRecordCount, getRecordCount, getRecordCount, getRecordKey, getRecords, getRecords, getTemporaryProperties, getValue, getVirtual, hasChanged, hasError, hasField, hasFieldValue, hasOptionalFieldValue, hasTemporaryProperties, insert, isFieldUnsigned, isLastCaughtSQLExceptionErrorCode, isOkToReload, isOkToSave, isValidating, isVirtual, lock, lockRead, lockWrite, newField_creationMillis, newField_creationTime, newField_creationTime, newField_description, newField_description, newField_lastUpdateAccount, newField_lastUpdateAccount, newField_lastUpdateTime, newField_lastUpdateUser, newField_lastUpdateUser, printXML, printXML, printXML, printXML, printXML, printXML, recordDidInsert, recordDidUpdate, recordWillInsert, recordWillUpdate, reload, reload, removeChangedNotification, save, select, select, select, setAllFieldValues, setAllFieldValues, setAllFieldValues, setAllFieldValues, setChanged, setChanged, setCreationMillis, setCreationTime, SetCurrentAccount, SetCurrentUser, setDescription, setError, setError, setFieldValue, setFieldValue, setFieldValue, setFieldValue, setFieldValue, setFieldValue, setFieldValue, setIgnoreInvalidFields, setKeyValue, setLastCaughtSQLException, setLastUpdateAccount, setLastUpdateTime, setLastUpdateUser, setOptionalFieldValue, setOptionalFieldValue, setOptionalFieldValue, setOptionalFieldValue, setOptionalFieldValue, setOptionalFieldValue, setOptionalFieldValue, setOptionalFieldValue, setValidating, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setVirtual, toString, toXML, toXML, toXML, toXML, toXML, unlock, update, update, update
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DutyStatus_INVALID

public static final long DutyStatus_INVALID
See Also:
Constant Field Values

DutyStatus_UNKNOWN

public static final long DutyStatus_UNKNOWN
See Also:
Constant Field Values

DutyStatus_OFF_DUTY

public static final long DutyStatus_OFF_DUTY
See Also:
Constant Field Values

DutyStatus_SLEEPING

public static final long DutyStatus_SLEEPING
See Also:
Constant Field Values

DutyStatus_DRIVING

public static final long DutyStatus_DRIVING
See Also:
Constant Field Values

DutyStatus_ON_DUTY

public static final long DutyStatus_ON_DUTY
See Also:
Constant Field Values

_TABLE_NAME

public static final java.lang.String _TABLE_NAME
See Also:
Constant Field Values

FLD_driverID

public static final java.lang.String FLD_driverID
See Also:
Constant Field Values

FLD_contactPhone

public static final java.lang.String FLD_contactPhone
See Also:
Constant Field Values

FLD_contactEmail

public static final java.lang.String FLD_contactEmail
See Also:
Constant Field Values

FLD_licenseType

public static final java.lang.String FLD_licenseType
See Also:
Constant Field Values

FLD_licenseNumber

public static final java.lang.String FLD_licenseNumber
See Also:
Constant Field Values

FLD_licenseExpire

public static final java.lang.String FLD_licenseExpire
See Also:
Constant Field Values

FLD_badgeID

public static final java.lang.String FLD_badgeID
See Also:
Constant Field Values

FLD_address

public static final java.lang.String FLD_address
See Also:
Constant Field Values

FLD_birthdate

public static final java.lang.String FLD_birthdate
See Also:
Constant Field Values

FLD_deviceID

public static final java.lang.String FLD_deviceID
See Also:
Constant Field Values

FLD_driverStatus

public static final java.lang.String FLD_driverStatus
See Also:
Constant Field Values

FLD_dutyStatus

public static final java.lang.String FLD_dutyStatus
See Also:
Constant Field Values
Constructor Detail

Driver

public Driver()

Driver

public Driver(Driver.Key key)
Method Detail

getDutyStatus

public static Driver.DutyStatus getDutyStatus(long ds)
Returns the DutyStatus for the specified code.

Parameters:
ds - The duty code
Returns:
The DutyStatus

getDutyStatus

public static Driver.DutyStatus getDutyStatus(Driver d)
Returns the defined DutyStatus for the specified driver.

Parameters:
d - The driver from which the DutyStatus will be obtained. If null, the default DutyStatus will be returned.
Returns:
The DutyStatus

getDutyStatusDescription

public static java.lang.String getDutyStatusDescription(Driver.DutyStatus ds,
                                                        java.util.Locale loc)
Returns the short text description of the specified DutyStatus

Parameters:
ds - The DutyStatus
loc - The desired Locale
Returns:
The short text description for the specified DutyStatus

TABLE_NAME

public static java.lang.String TABLE_NAME()

getFactory

public static DBFactory<Driver> getFactory()

getTableDescription

public static java.lang.String getTableDescription(java.util.Locale loc)

getDriverID

public java.lang.String getDriverID()

setDriverID

public void setDriverID(java.lang.String v)

hasDriverStatus

public boolean hasDriverStatus()
Returns true if this driver has a defined driver-status (value > 0)

Returns:
True if this driver has a defined driver-status

getDriverStatus

public long getDriverStatus()
Gets the driver/duty status

Returns:
The driver/duty status

setDriverStatus

public void setDriverStatus(long v)
Sets the driver/duty status

Parameters:
v - The driver/duty status

updateDriverStatus

public static boolean updateDriverStatus(Account acct,
                                         java.lang.String drvID,
                                         long status)
                                  throws DBException
Sets/Updates the driver-status for the specified DriverID

Parameters:
acct - The Account
drvID - The driver-id
status - The driver status
Throws:
DBException

hasDutyStatus

public boolean hasDutyStatus()
Returns true if this driver has a defined duty-status (value > 0)

Returns:
True if this driver has a defined duty-status

getDutyStatus

public long getDutyStatus()
Gets the duty status

Returns:
The duty status

setDutyStatus

public void setDutyStatus(long v)
Sets the duty status

Parameters:
v - The duty status

updateDutyStatus

public static boolean updateDutyStatus(Account acct,
                                       java.lang.String drvID,
                                       long status)
                                throws DBException
Sets/Updates the duty-status for the specified DriverID

Parameters:
acct - The Account
drvID - The driver-id
status - The duty status
Throws:
DBException

getContactPhone

public java.lang.String getContactPhone()

setContactPhone

public void setContactPhone(java.lang.String v)

getContactEmail

public java.lang.String getContactEmail()

setContactEmail

public void setContactEmail(java.lang.String v)

getLicenseType

public java.lang.String getLicenseType()

setLicenseType

public void setLicenseType(java.lang.String v)

getLicenseNumber

public java.lang.String getLicenseNumber()

setLicenseNumber

public void setLicenseNumber(java.lang.String v)

getLicenseExpire

public long getLicenseExpire()
Gets the license expiration date as a DayNumber value

Returns:
The license expiration date as a DayNumber value

setLicenseExpire

public void setLicenseExpire(long v)
Sets the license expiration date as a DayNumber value

Parameters:
v - The license expiration date as a DayNumber value

setLicenseExpire

public void setLicenseExpire(int year,
                             int month1,
                             int day)
Sets the license expiration date

Parameters:
year - The expiration year
month1 - The expiration month
day - The expiration day

setLicenseExpire

public void setLicenseExpire(DayNumber dn)
Sets the license expiration date as a DayNumber instance

Parameters:
dn - The license expiration date as a DayNumber instance

isLicenseExpired

public boolean isLicenseExpired(long asofDay)
Returns true if the license is expired as-of the specified date

Parameters:
asofDay - The as-of expiration test DayNumber

isLicenseExpired

public boolean isLicenseExpired(DayNumber asof)
Returns true if the license is expired as-of the specified date

Parameters:
asof - The as-of expiration test DayNumber

getBadgeID

public java.lang.String getBadgeID()
Gets the driver badge ID

Returns:
The driver badge ID

setBadgeID

public void setBadgeID(java.lang.String v)
Sets the driver badge ID

Parameters:
v - The driver badge ID

getAddress

public java.lang.String getAddress()
Gets the driver address

Returns:
The driver address

setAddress

public void setAddress(java.lang.String v)
Sets the driver address

Parameters:
v - The driver address

getBirthdate

public long getBirthdate()
Gets the driver birthdate as a DayNumber value

Returns:
The driver birthdate as a DayNumber value

setBirthdate

public void setBirthdate(long v)
Sets the driver birthdate as a DayNumber value

Parameters:
v - The driver birthdate as a DayNumber value

setBirthdate

public void setBirthdate(int year,
                         int month1,
                         int day)
Sets the driver birthdate

Parameters:
year - The driver birthdate year
month1 - The driver birthdate month
day - The driver birthdate day

setBirthdate

public void setBirthdate(DayNumber dn)
Sets the driver birthdate as a DayNumber instance

Parameters:
dn - The driver birthdate as a DayNumber instance

getDeviceID

public java.lang.String getDeviceID()
Gets the driver associated device ID (if available)

Returns:
The driver associated device ID, or blank if not available.

setDeviceID

public void setDeviceID(java.lang.String v)
Sets the driver associated device ID

Parameters:
v - The driver associated device ID

getDevice

public Device getDevice()
Returns the Device instance for the defined device-id

Returns:
The Device instance

getDeviceDescription

public java.lang.String getDeviceDescription()
Returns the description for the assigned DeviceID

Returns:
The device description, or null if no deviceID is defined

setCreationDefaultValues

public void setCreationDefaultValues()
Description copied from class: DBRecord
Override to set default values

Overrides:
setCreationDefaultValues in class DBRecord<Driver>

exists

public static boolean exists(java.lang.String acctID,
                             java.lang.String drvID)
                      throws DBException
Returns true if the specified driver exists

Parameters:
acctID - The Account ID
drvID - The driver ID
Returns:
True if the specified driver exists
Throws:
DBException

getDriver

public static Driver getDriver(Account account,
                               java.lang.String drvID)
                        throws DBException
Get Driver record instance for the specified account/driverID

Parameters:
account - The Account instance
drvID - The driver ID
Returns:
The Driver record instance, or null if non-existent
Throws:
DBException

getDriver

public static Driver getDriver(Account account,
                               java.lang.String drvID,
                               boolean create)
                        throws DBException
Throws:
DBException

createNewDriver

public static Driver createNewDriver(Account account,
                                     java.lang.String drvID)
                              throws DBException
Throws:
DBException

getDriverIDsForAccount

public static OrderedSet<java.lang.String> getDriverIDsForAccount(java.lang.String acctId)
                                                           throws DBException
Throws:
DBException

getDriverIDsForAccount

public static OrderedSet<java.lang.String> getDriverIDsForAccount(java.lang.String acctId,
                                                                  long limit)
                                                           throws DBException
Throws:
DBException

getRecordCallback

public static void getRecordCallback(Account account,
                                     DBRecordHandler<Driver> rcdHandler)
                              throws DBException
Callback for returning all drivers for an Account

Parameters:
account - The account
rcdHandler - The DBRecordHandler
Throws:
DBException

cron

public static void cron(java.lang.String[] args)

main

public static void main(java.lang.String[] args)