org.opengts.dbtools
Class DBRecord<gDBR extends DBRecord>

java.lang.Object
  extended by org.opengts.dbtools.DBRecord<gDBR>
Direct Known Subclasses:
AccountRecord, ReportDeviceList, SystemProps, UnassignedDevices, UniqueXID

public abstract class DBRecord<gDBR extends DBRecord>
extends java.lang.Object


Nested Class Summary
static interface DBRecord.DBChangeListener
          The change listener interface
 
Field Summary
protected  java.lang.String errorDescription
           
protected  java.util.Set<java.lang.String> excludedUpdateFields
           
static java.lang.String FLD_creationMillis
           
static java.lang.String FLD_creationTime
           
static java.lang.String FLD_description
           
static java.lang.String FLD_lastUpdateAccount
           
static java.lang.String FLD_lastUpdateTime
           
static java.lang.String FLD_lastUpdateUser
           
protected  boolean hasError
           
static int ID_SIZE
           
protected  boolean isValidating
           
protected  java.sql.SQLException lastSQLException
           
static int NOTIFY_GROUP
           
static java.lang.String PSEUDO_FIELD_CHAR
           
protected  RTProperties tempProps
           
 
Constructor Summary
  DBRecord()
          Default Constructor
protected DBRecord(DBRecordKey<gDBR> key)
          Constructor specifying the DBRecord Key
 
Method Summary
protected  DBFactory<gDBR> _getFactory()
          Gets the DBFactory for this DBRecord
 gDBR _reload(java.lang.String... fldNames)
          Reload the contents of this record from the DB
 void addChangedNotification(DBRecord.DBChangeListener cl)
          Adds a change notification listener to this record
 void addExcludedUpdateFields(java.lang.String... fldNames)
          Adds excluded field to list
static java.lang.String adjustStringLength_1(java.lang.String v, int maxLen)
          Trims and adjusts the length of the specified value to the maximum specified length-1 (ignored if maximum length is '0').
static java.lang.String adjustStringLength(java.lang.String v, int maxLen)
          Trims and adjusts the length of the specified value to the maximum specified length (ignored if maximum length is '0').
 void appendFieldValues(java.util.Map<java.lang.String,java.lang.String> valMap)
          Appends the field values for this DBRecord from the specified Map.
Field values are converted to their proper type from the specified Map values.
Similar to "setAllFieldValues", however the current field values are not cleared.
 void clearChanged()
          Clears the changed state for this record.
 void clearError()
          Clears the error state
 void clearExcludedUpdateFields()
          Clear excluded fields
 void clearLastCaughtSQLException()
          Clears the last caught SQLException
 boolean equals(java.lang.Object obj)
          Returns true if the specified DBRecord key is equivalent to this record key
 boolean excludeFieldFromUpdate(DBField fld)
          Returns true if the specified field should be excluded from the next update.
 boolean excludeFieldFromUpdate(java.lang.String fldName)
          Returns true if the specified field should be excluded from the next update.
 void fireChangeNotification(java.lang.String fieldName)
          Fires a change notification
 java.lang.Object geKeyValue(java.lang.String fldName, java.lang.Object dft)
          Gets the value for the specified key.
Note: This function bypasses the normal 'getter' methods for the specific DBRecord subclass, and thus may not perform some of the bounds checking for the specific field.
 java.lang.String getCreationDateTime(java.util.TimeZone tz, java.lang.String fmt)
          Gets the formatted creation date/time of this record
 long getCreationMillis()
          Gets the millisecond creation time of this record
 long getCreationTime()
          Gets the creation time of this record
static java.lang.String GetCurrentAccount()
          Gets the current account
static java.lang.String GetCurrentUser()
          Gets the current user
 java.lang.String[] getDefaultFieldValueKey(java.lang.String fieldName)
          Gets the default value keys for current table
 java.lang.String getDescription()
          Gets the description field value
 java.lang.String getErrorDescription()
          Gets the error state
 DBFactory<gDBR> getFactory(boolean required)
          Gets the DBFactory instance for this DBRecord
static
<T extends DBRecord>
DBFactory<T>
getFactory(DBRecord<T> dbr)
          Returns the DBFactory instance for the specified DBRecord
 DBField getField(java.lang.String fldName)
          Gets the DBField with the specified name, or null if the specified field name does not exist.
 boolean getFieldBoolean(java.lang.String fldName)
          Gets the boolean value for the specified field.
Note: This function bypasses the normal 'getter' methods for the specific DBRecord subclass, and thus may not perform some of the bounds checking for the specific field.
 DateTime getFieldDateTime(java.lang.String fldName)
          Gets the DateTime value for the specified field.
Note: This function bypasses the normal 'getter' methods for the specific DBRecord subclass, and thus may not perform some of the bounds checking for the specific field.
 double getFieldDouble(java.lang.String fldName)
          Gets the double value for the specified field.
Note: This function bypasses the normal 'getter' methods for the specific DBRecord subclass, and thus may not perform some of the bounds checking for the specific field.
 float getFieldFloat(java.lang.String fldName)
          Gets the float value for the specified field.
Note: This function bypasses the normal 'getter' methods for the specific DBRecord subclass, and thus may not perform some of the bounds checking for the specific field.
 int getFieldInt(java.lang.String fldName)
          Gets the int value for the specified field.
Note: This function bypasses the normal 'getter' methods for the specific DBRecord subclass, and thus may not perform some of the bounds checking for the specific field.
 long getFieldLong(java.lang.String fldName)
          Gets the long value for the specified field.
Note: This function bypasses the normal 'getter' methods for the specific DBRecord subclass, and thus may not perform some of the bounds checking for the specific field.
 java.lang.String getFieldName(java.lang.String fldName)
          Returns a case sensitive field name for the specified case insensitive field name.
 java.lang.String getFieldString(java.lang.String fldName)
          Gets the String value for the specified field.
Note: This function bypasses the normal 'getter' methods for the specific DBRecord subclass, and thus may not perform some of the bounds checking for the specific field.
 java.lang.Object getFieldValue(java.lang.String fldName)
          Gets the value for the specified field.
Note: This function bypasses the normal 'getter' methods for the specific DBRecord subclass, and thus may not perform some of the bounds checking for the specific field.
 boolean getFieldValue(java.lang.String fldName, boolean dft)
          Gets the value for the specified field.
Note: This function bypasses the normal 'getter' methods for the specific DBRecord subclass, and thus may not perform some of the bounds checking for the specific field.
 DateTime getFieldValue(java.lang.String fldName, DateTime dft)
          Gets the value for the specified field.
Note: This function bypasses the normal 'getter' methods for the specific DBRecord subclass, and thus may not perform some of the bounds checking for the specific field.
 double getFieldValue(java.lang.String fldName, double dft)
          Gets the value for the specified field.
Note: This function bypasses the normal 'getter' methods for the specific DBRecord subclass, and thus may not perform some of the bounds checking for the specific field.
 float getFieldValue(java.lang.String fldName, float dft)
          Gets the value for the specified field.
Note: This function bypasses the normal 'getter' methods for the specific DBRecord subclass, and thus may not perform some of the bounds checking for the specific field.
 int getFieldValue(java.lang.String fldName, int dft)
          Gets the value for the specified field.
Note: This function bypasses the normal 'getter' methods for the specific DBRecord subclass, and thus may not perform some of the bounds checking for the specific field.
 long getFieldValue(java.lang.String fldName, long dft)
          Gets the value for the specified field.
Note: This function bypasses the normal 'getter' methods for the specific DBRecord subclass, and thus may not perform some of the bounds checking for the specific field.
 java.lang.Object getFieldValue(java.lang.String fldName, java.lang.Object dft)
          Gets the value for the specified field.
Note: This function bypasses the normal 'getter' methods for the specific DBRecord subclass, and thus may not perform some of the bounds checking for the specific field.
 java.lang.String getFieldValue(java.lang.String fldName, java.lang.String dft)
          Gets the value for the specified field.
Note: This function bypasses the normal 'getter' methods for the specific DBRecord subclass, and thus may not perform some of the bounds checking for the specific field.
 java.lang.Object getKeyValue(java.lang.String fldName)
          Gets the value for the specified key.
Note: This function bypasses the normal 'getter' methods for the specific DBRecord subclass, and thus may not perform some of the bounds checking for the specific field.
 java.sql.SQLException getLastCaughtSQLException()
          Gets the last caught SQLException
 java.lang.String getLastUpdateAccount()
          Returns the last update account, if the 'lastUpdateAccount' field has been defined for this DBRecord, otherwise this method will return null.
 long getLastUpdateTime()
          Gets the last update time
static
<T extends DBRecord>
long
getLastUpdateTime(DBFactory<T> factory)
          Gets the most recent update time for a specified table
 java.lang.String getLastUpdateUser()
          Returns the last update user, if the 'lastUpdateUser' field has been defined for this DBRecord, otherwise this method will return null.
static
<T extends DBRecord>
T[]
getNextGroup(DBFactory<T> fact, java.sql.ResultSet rs, int max)
          This method returns the next 'max' DBRecords from the specified ResultSet
 java.lang.Object getOptionalFieldValue(java.lang.String fldName)
          Gets the value for the specified optional field name.
Note: This function bypasses the normal 'getter' methods for the specific DBRecord subclass, and thus may not perform some of the bounds checking for the specific field.
 boolean getOptionalFieldValue(java.lang.String fldName, boolean dft)
          Gets the value for the specified optional field.
Note: This function bypasses the normal 'getter' methods for the specific DBRecord subclass, and thus may not perform some of the bounds checking for the specific field.
 DateTime getOptionalFieldValue(java.lang.String fldName, DateTime dft)
          Gets the value for the specified optional field.
Note: This function bypasses the normal 'getter' methods for the specific DBRecord subclass, and thus may not perform some of the bounds checking for the specific field.
 double getOptionalFieldValue(java.lang.String fldName, double dft)
          Gets the value for the specified optional field.
Note: This function bypasses the normal 'getter' methods for the specific DBRecord subclass, and thus may not perform some of the bounds checking for the specific field.
 float getOptionalFieldValue(java.lang.String fldName, float dft)
          Gets the value for the specified optional field.
Note: This function bypasses the normal 'getter' methods for the specific DBRecord subclass, and thus may not perform some of the bounds checking for the specific field.
 int getOptionalFieldValue(java.lang.String fldName, int dft)
          Gets the value for the specified optional field.
Note: This function bypasses the normal 'getter' methods for the specific DBRecord subclass, and thus may not perform some of the bounds checking for the specific field.
 long getOptionalFieldValue(java.lang.String fldName, long dft)
          Gets the value for the specified optional field.
Note: This function bypasses the normal 'getter' methods for the specific DBRecord subclass, and thus may not perform some of the bounds checking for the specific field.
 java.lang.Object getOptionalFieldValue(java.lang.String fldName, java.lang.Object dft)
          Gets the value for the specified optional field name.
Note: This function bypasses the normal 'getter' methods for the specific DBRecord subclass, and thus may not perform some of the bounds checking for the specific field.
 java.lang.String getOptionalFieldValue(java.lang.String fldName, java.lang.String dft)
          Gets the value for the specified optional field.
Note: This function bypasses the normal 'getter' methods for the specific DBRecord subclass, and thus may not perform some of the bounds checking for the specific field.
static
<T extends DBRecord>
long
getRecordCount(DBFactory<T> fact)
          Returns the number of records contained in the table represented by the specified DBFactory.
NOTE: Recommended for MyISAM tables only.
static
<T extends DBRecord>
long
getRecordCount(DBFactory<T> fact, DBWhere where)
          Returns the number of records contained in the table represented by the specified DBFactory and based on the specified 'where' clause.
NOTE: Recommended for MyISAM tables only.
static
<T extends DBRecord>
long
getRecordCount(DBFactory<T> fact, java.lang.String where)
          Returns the number of records contained in the table represented by the specified DBFactory and based on the specified 'where' clause.
NOTE: Recommended for MyISAM tables only.
static
<T extends DBRecord>
long
getRecordCount(DBFactory<T> fact, java.lang.StringBuffer where)
          Returns the number of records contained in the table represented by the specified DBFactory and based on the specified 'where' clause.
NOTE: Recommended for MyISAM tables only.
static
<T extends DBRecord>
long
getRecordCount(DBSelect<T> dsel)
          Returns the number of records contained in the table represented by the specified DBSelect (which specifies a DBFactory).
NOTE: Recommended for MyISAM tables only.
 DBRecordKey<gDBR> getRecordKey()
          Return the DBRecordKey instance for this record
static
<T extends DBRecord>
T[]
getRecords(DBFactory<T> fact, java.lang.String where, java.lang.String[] orderBy, boolean ascending)
          Gets an array of DBRecords based on the specified 'where' clause
static
<T extends DBRecord>
T[]
getRecords(DBFactory<T> fact, java.lang.String where, java.lang.String addtnlSel, java.lang.String[] orderBy, boolean ascending, long limit, long offset)
          Gets an array of DBRecords based on the specified 'where' clause
static java.lang.String getTableDescription(java.util.Locale loc)
          Return the table description
 RTProperties getTemporaryProperties()
          Gets a temporary properties instance for this DBRecord
 java.lang.Object getValue(java.lang.String fldName)
          Gets the value for the specified field.
 boolean getVirtual()
          Gets the "virtual" state
 boolean hasChanged()
          Returns true if this record has changed
 boolean hasError()
          Returns true if this record has encountered an error
 boolean hasField(java.lang.String fldName)
          Returns true if a defined field with the specified name exists for this DBRecord
 boolean hasFieldValue(java.lang.String fldName)
          Returns true if the specified field name has a defined value
 boolean hasOptionalFieldValue(java.lang.String fldName)
          Returns true if the specified field name has a defined value.
Returns null if the column does not exist, or if it does exist, but contains a 'NULL' value.
 boolean hasTemporaryProperties()
          Returns true if this DBRecord has a temporary properties instance defined
 void insert()
          Insert this DBRecord in the database.
An exception will be throw if the record already exists
 boolean isFieldUnsigned(java.lang.String fldName)
          Returns true if the specified field is an unsigned integer.
 boolean isLastCaughtSQLExceptionErrorCode(int code)
          Returns true if the specified code matches the error code of the last caught SQLException
 boolean isOkToReload()
          Returns true if this DBRecord is ok to reload
 boolean isOkToSave()
          Returns true if this DBRecord is ok to save
protected  boolean isValidating()
          Returns true if this record is validating
 boolean isVirtual()
          Gets the "virtual" state
 boolean lock(java.lang.String[] writeTables, java.lang.String[] readTables)
          Lock specified tables for write/read
 boolean lockRead()
          Lock table associated with this DBRecord for reading
 boolean lockWrite()
          Lock table associated with this DBRecord for writing
static DBField newField_creationMillis(java.lang.String xAttr)
          Returns a new millisecond creation time field
static DBField newField_creationTime()
          Returns a new creation time field
static DBField newField_creationTime(boolean isAltKey)
          Returns a new creation time field
protected static DBField newField_description()
          Creates a new "description" key field definition
protected static DBField newField_description(java.lang.String xAttr)
          Creates a new "description" key field definition
static DBField newField_lastUpdateAccount()
          Creates a new DBField instance for adding a 'lastUpdateAccount' field to the DBFactory instance at startup initialization time.
static DBField newField_lastUpdateAccount(boolean checkRTP)
          Creates a new DBField instance for adding a 'lastUpdateAccount' field to the DBFactory instance at startup initialization time.
static DBField newField_lastUpdateTime()
          Returns a new last update time field
static DBField newField_lastUpdateUser()
          Creates a new DBField instance for adding a 'lastUpdateUser' field to the DBFactory instance at startup initialization time.
static DBField newField_lastUpdateUser(boolean checkRTP)
          Creates a new DBField instance for adding a 'lastUpdateUser' field to the DBFactory instance at startup initialization time.
static void printXML(java.io.PrintWriter out, DBRecord<?>... dbr)
          Encodes all field of the specified DBRecords into XML and writes it to a specified PrintWriter
 void printXML(java.io.PrintWriter out, int indent, java.util.Set<java.lang.String> fldNames)
          Encodes this DBRecord into XML and writes it to a specified PrintWriter
 void printXML(java.io.PrintWriter out, int indent, java.util.Set<java.lang.String> fldNames, boolean soapXml)
          Contains boolean value used to encode xml that will be embedded within a SOAP envelope.
static void printXML(java.io.PrintWriter out, int indent, java.util.Set<java.lang.String> fldNames, DBRecord<?>... dbr)
          Encodes the specified DBRecords into XML and writes it to a specified PrintWriter
 void printXML(java.io.PrintWriter out, int indent, java.util.Set<java.lang.String> fldNames, int sequence)
          Encodes this DBRecord into XML and writes it to a specified PrintWriter
 void printXML(java.io.PrintWriter out, int indent, java.util.Set<java.lang.String> fldNames, int sequence, boolean soapXML)
          Encodes this DBRecord into XML and writes it to a specified PrintWriter
protected  void recordDidInsert()
          Callback after record has been be inserted into the table
protected  void recordDidUpdate()
          Callback after record has been be updated in the table
protected  void recordWillInsert()
          Callback when record is about to be inserted into the table
protected  void recordWillUpdate()
          Callback when record is about to be updated in the table
 gDBR reload()
          Reload the contents of this record from the DB
 gDBR reload(java.lang.String... fldNames)
          Reload the contents of this record from the DB
 void removeChangedNotification(DBRecord.DBChangeListener cl)
          Removes a change notification listener from this record
 void save()
          Saves (ie.
protected static
<T extends DBRecord>
T[]
select(DBFactory<T> fact, java.lang.String where, java.lang.String addtnlSel, java.lang.String[] orderBy, boolean ascending, long limit, long offset, DBRecordHandler<T> rcdHandler)
          Gets an array of DBRecords based on the specified 'where' clause
protected static
<T extends DBRecord>
T[]
select(DBSelect<T> dsel)
          Gets an array of DBRecords based on the specified 'where' clause
protected static
<T extends DBRecord>
T[]
select(DBSelect<T> dsel, DBRecordHandler<T> rcdHandler)
          Gets an array of DBRecords based on the specified 'where' clause
 void setAllFieldValues(DBRecord<gDBR> rcd)
          Sets the field values for this DBRecord from the specified DBRecord
(primary keys are not copied)
 void setAllFieldValues(java.util.Map<java.lang.String,java.lang.String> valMap)
          Sets the field values for this DBRecord from the specified Map.
Field values are converted to their proper type from the specified Map values.
All current field values are cleared (except primary key values).
 void setAllFieldValues(java.sql.ResultSet rs)
          Sets the field values for this DBRecord from the specified SQL ResultSet
(primary keys are not copied)
 void setAllFieldValues(java.sql.ResultSet rs, java.lang.String... fldNames)
          Sets the field values for this DBRecord from the specified SQL ResultSet
(primary keys are not copied)
 void setChanged(java.lang.String fieldName)
          Sets the 'changed' state of this record, and sends a change notification to any registered listeners.
 void setChanged(java.lang.String fieldName, java.lang.Object oldVal, java.lang.Object newVal)
          Sets the 'changed' state of this record, and sends a change notification to any registered listeners.
 void setCreationDefaultValues()
          Override to set default values
protected  boolean setCreationMillis(long millis)
          Sets the millisecond creation time of this record
protected  boolean setCreationTime(long time)
          Sets the creation time of this record
static void SetCurrentAccount(java.lang.String acct)
          Sets the current account
static void SetCurrentUser(java.lang.String user)
          Sets the current user
 void setDescription(java.lang.String v)
          Sets the description field value
 void setError()
          Sets the error state
 void setError(java.lang.String desc)
          Sets the error state with a description
 void setFieldValue(java.lang.String fldName, boolean value)
          Sets the boolean value for the specified field.
Note: This function bypasses the normal 'setter' methods for the specific DBRecord subclass, and thus may not perform some of the bounds checking for the specific field.
 void setFieldValue(java.lang.String fldName, double value)
          Sets the double value for the specified field.
Note: This function bypasses the normal 'setter' methods for the specific DBRecord subclass, and thus may not perform some of the bounds checking for the specific field.
 void setFieldValue(java.lang.String fldName, float value)
          Sets the float value for the specified field.
Note: This function bypasses the normal 'setter' methods for the specific DBRecord subclass, and thus may not perform some of the bounds checking for the specific field.
 void setFieldValue(java.lang.String fldName, int value)
          Sets the int value for the specified field.
Note: This function bypasses the normal 'setter' methods for the specific DBRecord subclass, and thus may not perform some of the bounds checking for the specific field.
 void setFieldValue(java.lang.String fldName, long value)
          Sets the long value for the specified field.
Note: This function bypasses the normal 'setter' methods for the specific DBRecord subclass, and thus may not perform some of the bounds checking for the specific field.
 boolean setFieldValue(java.lang.String fldName, java.lang.Object value)
          Sets the value for the specified field.
Note: This function bypasses the normal 'setter' methods for the specific DBRecord subclass, and thus may not perform some of the bounds checking for the specific field.
 void setFieldValue(java.lang.String fldName, java.lang.String value)
          Sets the String value for the specified field.
Note: This function bypasses the normal 'setter' methods for the specific DBRecord subclass, and thus may not perform some of the bounds checking for the specific field.
 void setIgnoreInvalidFields(boolean state)
          Sets the state for ignoring invalid field names.
 boolean setKeyValue(java.lang.String fldName, java.lang.Object value)
          Sets the value for the specified key.
Note: This function bypasses the normal 'setter' methods for the specific DBRecord subclass, and thus may not perform some of the bounds checking for the specific field.
protected  void setLastCaughtSQLException(java.sql.SQLException sqe)
          Sets the last caught SQLException
 boolean setLastUpdateAccount(java.lang.String acct, boolean allowBlank)
          Sets the last update account if the 'lastUpdateAccount' field has been defined for this DBRecord, otherwise this method will have no effect.
protected  boolean setLastUpdateTime(long time)
          Sets the last update time of this record
 boolean setLastUpdateUser(java.lang.String user, boolean allowBlank)
          Sets the last update user if the 'lastUpdateUser' field has been defined for this DBRecord, otherwise this method will have no effect.
 void setOptionalFieldValue(java.lang.String fldName, boolean value)
          Sets the boolean value for the specified optional field.
Note: This function bypasses the normal 'setter' methods for the specific DBRecord subclass, and thus may not perform some of the bounds checking for the specific field.
 void setOptionalFieldValue(java.lang.String fldName, DateTime value)
          Sets the DateTime value for the specified optional field.
Note: This function bypasses the normal 'setter' methods for the specific DBRecord subclass, and thus may not perform some of the bounds checking for the specific field.
 void setOptionalFieldValue(java.lang.String fldName, double value)
          Sets the double value for the specified optional field.
Note: This function bypasses the normal 'setter' methods for the specific DBRecord subclass, and thus may not perform some of the bounds checking for the specific field.
 void setOptionalFieldValue(java.lang.String fldName, float value)
          Sets the float value for the specified optional field.
Note: This function bypasses the normal 'setter' methods for the specific DBRecord subclass, and thus may not perform some of the bounds checking for the specific field.
 void setOptionalFieldValue(java.lang.String fldName, int value)
          Sets the int value for the specified optional field.
Note: This function bypasses the normal 'setter' methods for the specific DBRecord subclass, and thus may not perform some of the bounds checking for the specific field.
 void setOptionalFieldValue(java.lang.String fldName, long value)
          Sets the long value for the specified optional field.
Note: This function bypasses the normal 'setter' methods for the specific DBRecord subclass, and thus may not perform some of the bounds checking for the specific field.
 void setOptionalFieldValue(java.lang.String fldName, java.lang.Object value)
          Sets the value for the specified optional field name.
Note: This function bypasses the normal 'setter' methods for the specific DBRecord subclass, and thus may not perform some of the bounds checking for the specific field.
 void setOptionalFieldValue(java.lang.String fldName, java.lang.String value)
          Sets the String value for the specified optional field.
Note: This function bypasses the normal 'setter' methods for the specific DBRecord subclass, and thus may not perform some of the bounds checking for the specific field.
 void setRuntimeDefaultValues()
          Override to set default values
protected  void setValidating(boolean validate)
          Sets if this record id validating [CHECK]
 void setValue(java.lang.String fldName, boolean value)
          Sets the value for the specified field.
This method attempts to use the field 'setter' method for setting the field value.
 void setValue(java.lang.String fldName, double value)
          Sets the value for the specified field.
This method attempts to use the field 'setter' method for setting the field value.
 void setValue(java.lang.String fldName, float value)
          Sets the value for the specified field.
This method attempts to use the field 'setter' method for setting the field value.
 void setValue(java.lang.String fldName, int value)
          Sets the value for the specified field.
This method attempts to use the field 'setter' method for setting the field value.
 void setValue(java.lang.String fldName, long value)
          Sets the value for the specified field.
This method attempts to use the field 'setter' method for setting the field value.
 void setValue(java.lang.String fldName, java.lang.Object value)
          Sets the value for the specified field.
This method attempts to use the field 'setter' method for setting the field value.
 void setValue(java.lang.String fldName, java.lang.String value)
          Sets the String value for the specified field.
This method attempts to use the field 'setter' method for setting the field value.
 void setVirtual(boolean isVirtual)
          Sets the "virtual" state
 java.lang.String toString()
          Returns a String representation of the DBRecordKey for this DBRecord
 java.lang.StringBuffer toXML(java.lang.StringBuffer sb, int indent, java.util.Set<java.lang.String> fldNames)
          Encodes this DBRecord into XML
 java.lang.StringBuffer toXML(java.lang.StringBuffer sb, int indent, java.util.Set<java.lang.String> fldNames, boolean soapXML)
          Encodes this DBRecord into XML
 java.lang.StringBuffer toXML(java.lang.StringBuffer sb, int indent, java.util.Set<java.lang.String> fldNames, int sequence)
          Encodes this DBRecord into XML
 java.lang.StringBuffer toXML(java.lang.StringBuffer sb, int indent, java.util.Set<java.lang.String> fldNames, int sequence, boolean soapXML)
          Encodes this DBRecord into XML
 java.lang.StringBuffer toXML(java.lang.StringBuffer sb, int indent, java.util.Set<java.lang.String> fldNames, int sequence, boolean inclBlank, boolean soapXML)
          Encodes this DBRecord into XML
 boolean unlock()
          Unlock locked tables
 void update()
          Updates all the fields in this DBRecord.
 void update(java.util.Set<java.lang.String> updFldSet)
          Updates the specified fields in this DBRecord.
 void update(java.lang.String... updFldArray)
          Updates the specified fields in this DBRecord.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NOTIFY_GROUP

public static final int NOTIFY_GROUP
See Also:
Constant Field Values

ID_SIZE

public static final int ID_SIZE
See Also:
Constant Field Values

PSEUDO_FIELD_CHAR

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

FLD_description

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

FLD_creationTime

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

FLD_creationMillis

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

FLD_lastUpdateTime

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

FLD_lastUpdateAccount

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

FLD_lastUpdateUser

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

isValidating

protected boolean isValidating

lastSQLException

protected java.sql.SQLException lastSQLException

hasError

protected boolean hasError

errorDescription

protected java.lang.String errorDescription

excludedUpdateFields

protected java.util.Set<java.lang.String> excludedUpdateFields

tempProps

protected RTProperties tempProps
Constructor Detail

DBRecord

public DBRecord()
Default Constructor


DBRecord

protected DBRecord(DBRecordKey<gDBR> key)
Constructor specifying the DBRecord Key

Parameters:
key - The DBRecordKey for this DBRecord
Method Detail

getTableDescription

public static java.lang.String getTableDescription(java.util.Locale loc)
Return the table description

Parameters:
loc - The Locale
Returns:
The table description

adjustStringLength

public static java.lang.String adjustStringLength(java.lang.String v,
                                                  int maxLen)
Trims and adjusts the length of the specified value to the maximum specified length (ignored if maximum length is '0').

Parameters:
v - The String value
maxLen - The maximum length
Returns:
The adjusted String (does not return null)

adjustStringLength_1

public static java.lang.String adjustStringLength_1(java.lang.String v,
                                                    int maxLen)
Trims and adjusts the length of the specified value to the maximum specified length-1 (ignored if maximum length is '0').

Parameters:
v - The String value
maxLen - The maximum length
Returns:
The adjusted String

getRecordCount

public static <T extends DBRecord> long getRecordCount(DBFactory<T> fact)
                           throws DBException
Returns the number of records contained in the table represented by the specified DBFactory.
NOTE: Recommended for MyISAM tables only. For InnoDB tables, the completion time is a function of the number of records that are present in the table.

Parameters:
fact - The DBFactory instance
Returns:
The number of records contained in the SQL table
Throws:
DBException - If a general DB error occurs

getRecordCount

public static <T extends DBRecord> long getRecordCount(DBFactory<T> fact,
                                                       java.lang.StringBuffer where)
                           throws DBException
Returns the number of records contained in the table represented by the specified DBFactory and based on the specified 'where' clause.
NOTE: Recommended for MyISAM tables only. For InnoDB tables, the completion time is a function of the number of records that are present in the table.

Parameters:
fact - The DBFactory instance
where - The 'where' selection clause
Returns:
The number of records contained in the SQL table
Throws:
DBException - If a general DB error occurs

getRecordCount

public static <T extends DBRecord> long getRecordCount(DBFactory<T> fact,
                                                       java.lang.String where)
                           throws DBException
Returns the number of records contained in the table represented by the specified DBFactory and based on the specified 'where' clause.
NOTE: Recommended for MyISAM tables only. For InnoDB tables, the completion time is a function of the number of records that are present in the table.

Parameters:
fact - The DBFactory instance
where - The 'where' selection clause
Returns:
The number of records contained in the SQL table
Throws:
DBException - If a general DB error occurs

getRecordCount

public static <T extends DBRecord> long getRecordCount(DBFactory<T> fact,
                                                       DBWhere where)
                           throws DBException
Returns the number of records contained in the table represented by the specified DBFactory and based on the specified 'where' clause.
NOTE: Recommended for MyISAM tables only. For InnoDB tables, the completion time is a function of the number of records that are present in the table.

Parameters:
fact - The DBFactory instance
where - The 'where' selection clause
Returns:
The number of records contained in the SQL table
Throws:
DBException - If a general DB error occurs

getRecordCount

public static <T extends DBRecord> long getRecordCount(DBSelect<T> dsel)
                           throws DBException
Returns the number of records contained in the table represented by the specified DBSelect (which specifies a DBFactory).
NOTE: Recommended for MyISAM tables only. For InnoDB tables, the completion time is a function of the number of records that are present in the table.

Parameters:
dsel - The DBSelect instance.
Returns:
The number of records contained in the SQL table
Throws:
DBException - If a general DB error occurs

GetCurrentAccount

public static java.lang.String GetCurrentAccount()
Gets the current account

Returns:
The current account

SetCurrentAccount

public static void SetCurrentAccount(java.lang.String acct)
Sets the current account

Parameters:
acct - The current account

GetCurrentUser

public static java.lang.String GetCurrentUser()
Gets the current user

Returns:
The current user

SetCurrentUser

public static void SetCurrentUser(java.lang.String user)
Sets the current user

Parameters:
user - The current user

getRecordKey

public DBRecordKey<gDBR> getRecordKey()
Return the DBRecordKey instance for this record

Returns:
THe DBRecordKey instance

getFactory

public static <T extends DBRecord> DBFactory<T> getFactory(DBRecord<T> dbr)
Returns the DBFactory instance for the specified DBRecord

Parameters:
dbr - The DBRecord instance
Returns:
The DBFactory for the specified DBRecord

getFactory

public DBFactory<gDBR> getFactory(boolean required)
                                            throws DBException
Gets the DBFactory instance for this DBRecord

Parameters:
required - True if the DBFactory is required to be defined, in which case this method will throw a DBException if the DBFactory is null.
Returns:
The DBFactory for this DBRecord
Throws:
DBException - if 'required' is true and the DBFactory isn't defined

_getFactory

protected DBFactory<gDBR> _getFactory()
Gets the DBFactory for this DBRecord

Returns:
The DBFactory for this DBRecord

getNextGroup

public static <T extends DBRecord> T[] getNextGroup(DBFactory<T> fact,
                                                    java.sql.ResultSet rs,
                                                    int max)
                                         throws DBException
This method returns the next 'max' DBRecords from the specified ResultSet

Parameters:
fact - The DBFactory
rs - The ResultSet
max - The number of DBRecords to return
Returns:
An array of DBRecord instances
Throws:
DBException - If a database error occurs

getRecords

public static <T extends DBRecord> T[] getRecords(DBFactory<T> fact,
                                                  java.lang.String where,
                                                  java.lang.String[] orderBy,
                                                  boolean ascending)
                                       throws DBException
Gets an array of DBRecords based on the specified 'where' clause

Parameters:
fact - The DBFactory
where - The Where clause
orderBy - The select 'Order By' statement
ascending - True to return the records in ascending order
Throws:
DBException - If a DB access error occurs

getRecords

public static <T extends DBRecord> T[] getRecords(DBFactory<T> fact,
                                                  java.lang.String where,
                                                  java.lang.String addtnlSel,
                                                  java.lang.String[] orderBy,
                                                  boolean ascending,
                                                  long limit,
                                                  long offset)
                                       throws DBException
Gets an array of DBRecords based on the specified 'where' clause

Parameters:
fact - The DBFactory
where - The Where clause
addtnlSel - Additional selection criteria
orderBy - The select 'Order By' statement
ascending - True to return the records in ascending order
limit - The maximum number of records to return
offset - The the offset within the selected DB records
Returns:
The returned array of DBRecords
Throws:
DBException - If a DB access error occurs

select

protected static <T extends DBRecord> T[] select(DBFactory<T> fact,
                                                 java.lang.String where,
                                                 java.lang.String addtnlSel,
                                                 java.lang.String[] orderBy,
                                                 boolean ascending,
                                                 long limit,
                                                 long offset,
                                                 DBRecordHandler<T> rcdHandler)
                                      throws DBException
Gets an array of DBRecords based on the specified 'where' clause

Parameters:
fact - The DBFactory
where - The Where clause
addtnlSel - Additional selection criteria
orderBy - The select 'Order By' statement
ascending - True to return the records in ascending order
limit - The maximum number of records to return
offset - The the offset within the selected DB records
rcdHandler - The optional DBRecordHandler
Returns:
The returned array of DBRecords
Throws:
DBException - If a DB access error occurs

select

protected static <T extends DBRecord> T[] select(DBSelect<T> dsel)
                                      throws DBException
Gets an array of DBRecords based on the specified 'where' clause

Parameters:
dsel - The DBSelect selection criteria
Returns:
The returned array of DBRecords
Throws:
DBException - If a DB access error occurs

select

protected static <T extends DBRecord> T[] select(DBSelect<T> dsel,
                                                 DBRecordHandler<T> rcdHandler)
                                      throws DBException
Gets an array of DBRecords based on the specified 'where' clause

Parameters:
dsel - The DBSelect selection criteria
rcdHandler - The optional DBRecordHandler
Returns:
The returned array of DBRecords
Throws:
DBException - If a DB access error occurs

hasChanged

public boolean hasChanged()
Returns true if this record has changed

Returns:
True if this record has changed

setChanged

public void setChanged(java.lang.String fieldName)
Sets the 'changed' state of this record, and sends a change notification to any registered listeners.

Parameters:
fieldName - The changed field

setChanged

public void setChanged(java.lang.String fieldName,
                       java.lang.Object oldVal,
                       java.lang.Object newVal)
Sets the 'changed' state of this record, and sends a change notification to any registered listeners.

Parameters:
fieldName - The changed field
oldVal - The previous value of the field
newVal - The new value of the field

clearChanged

public void clearChanged()
Clears the changed state for this record.


addChangedNotification

public void addChangedNotification(DBRecord.DBChangeListener cl)
Adds a change notification listener to this record

Parameters:
cl - The change notification listener to add

removeChangedNotification

public void removeChangedNotification(DBRecord.DBChangeListener cl)
Removes a change notification listener from this record

Parameters:
cl - The change notification listener to remove

fireChangeNotification

public void fireChangeNotification(java.lang.String fieldName)
Fires a change notification

Parameters:
fieldName - The changed field

hasError

public boolean hasError()
Returns true if this record has encountered an error

Returns:
True if thid record has encountered an error

clearError

public void clearError()
Clears the error state


setError

public void setError()
Sets the error state


setError

public void setError(java.lang.String desc)
Sets the error state with a description

Parameters:
desc - The description of the error

getErrorDescription

public java.lang.String getErrorDescription()
Gets the error state

Returns:
The error state

reload

public gDBR reload()
Reload the contents of this record from the DB

Returns:
The DBRecord

reload

public gDBR reload(java.lang.String... fldNames)
Reload the contents of this record from the DB

Parameters:
fldNames - The list of field names to reload (null for all fields)
Returns:
The DBRecord

_reload

public gDBR _reload(java.lang.String... fldNames)
                              throws DBException
Reload the contents of this record from the DB

Returns:
The DBRecord
Throws:
DBException - If a general DB error occurs

setCreationDefaultValues

public void setCreationDefaultValues()
Override to set default values


getDefaultFieldValueKey

public java.lang.String[] getDefaultFieldValueKey(java.lang.String fieldName)
Gets the default value keys for current table

Parameters:
fieldName - The field name
Returns:
The default keys

setRuntimeDefaultValues

public void setRuntimeDefaultValues()
Override to set default values


getLastUpdateTime

public static <T extends DBRecord> long getLastUpdateTime(DBFactory<T> factory)
                              throws DBException
Gets the most recent update time for a specified table

Parameters:
factory - The DBFactory to get the upate time of
Returns:
The field update time, or -1
Throws:
DBException - If a general DB error occurs

newField_description

protected static DBField newField_description()
Creates a new "description" key field definition

Returns:
The "description key field definition

newField_description

protected static DBField newField_description(java.lang.String xAttr)
Creates a new "description" key field definition

Returns:
The "description key field definition

getDescription

public java.lang.String getDescription()
Gets the description field value

Returns:
The record description

setDescription

public void setDescription(java.lang.String v)
Sets the description field value

Parameters:
v - The record description

newField_creationTime

public static DBField newField_creationTime(boolean isAltKey)
Returns a new creation time field

Returns:
The new creation time field

newField_creationTime

public static DBField newField_creationTime()
Returns a new creation time field

Returns:
The new creation time field

getCreationDateTime

public java.lang.String getCreationDateTime(java.util.TimeZone tz,
                                            java.lang.String fmt)
Gets the formatted creation date/time of this record

Returns:
The formatted creation date/time of this record

getCreationTime

public long getCreationTime()
Gets the creation time of this record

Returns:
The creation time of this record

setCreationTime

protected boolean setCreationTime(long time)
Sets the creation time of this record

Parameters:
time - The creation time
Returns:
True if this record contained a creaton time field to set

newField_creationMillis

public static DBField newField_creationMillis(java.lang.String xAttr)
Returns a new millisecond creation time field

Returns:
The new creation time field

getCreationMillis

public long getCreationMillis()
Gets the millisecond creation time of this record

Returns:
The millisecond creation time of this record

setCreationMillis

protected boolean setCreationMillis(long millis)
Sets the millisecond creation time of this record

Parameters:
millis - The millisecond creation time
Returns:
True if this record contained a creaton time field to set

newField_lastUpdateTime

public static DBField newField_lastUpdateTime()
Returns a new last update time field

Returns:
The last update time field

getLastUpdateTime

public long getLastUpdateTime()
Gets the last update time

Returns:
The last update time

setLastUpdateTime

protected boolean setLastUpdateTime(long time)
Sets the last update time of this record

Parameters:
time - The last update time
Returns:
True if this record contained a last update time field to set

newField_lastUpdateAccount

public static DBField newField_lastUpdateAccount(boolean checkRTP)
Creates a new DBField instance for adding a 'lastUpdateAccount' field to the DBFactory instance at startup initialization time.

Parameters:
checkRTP - Check runtime property for inclusion
Returns:
The DBField instance representing a 'lastUpdateAccount' field.

newField_lastUpdateAccount

public static DBField newField_lastUpdateAccount()
Creates a new DBField instance for adding a 'lastUpdateAccount' field to the DBFactory instance at startup initialization time.

Returns:
The DBField instance representing a 'lastUpdateAccount' field.

getLastUpdateAccount

public java.lang.String getLastUpdateAccount()
Returns the last update account, if the 'lastUpdateAccount' field has been defined for this DBRecord, otherwise this method will return null.

Returns:
The last update account, or null if the 'lastUpdateAccount' field has not been defined for this DBRecord.

setLastUpdateAccount

public boolean setLastUpdateAccount(java.lang.String acct,
                                    boolean allowBlank)
Sets the last update account if the 'lastUpdateAccount' field has been defined for this DBRecord, otherwise this method will have no effect.

Parameters:
acct - The last update account
allowBlank - True to allow a blank account-id

newField_lastUpdateUser

public static DBField newField_lastUpdateUser(boolean checkRTP)
Creates a new DBField instance for adding a 'lastUpdateUser' field to the DBFactory instance at startup initialization time.

Parameters:
checkRTP - Check runtime property for inclusion
Returns:
The DBField instance representing a 'lastUpdateUser' field.

newField_lastUpdateUser

public static DBField newField_lastUpdateUser()
Creates a new DBField instance for adding a 'lastUpdateUser' field to the DBFactory instance at startup initialization time.

Returns:
The DBField instance representing a 'lastUpdateUser' field.

getLastUpdateUser

public java.lang.String getLastUpdateUser()
Returns the last update user, if the 'lastUpdateUser' field has been defined for this DBRecord, otherwise this method will return null.

Returns:
The last update user, or null if the 'lastUpdateUser' field has not been defined for this DBRecord.

setLastUpdateUser

public boolean setLastUpdateUser(java.lang.String user,
                                 boolean allowBlank)
Sets the last update user if the 'lastUpdateUser' field has been defined for this DBRecord, otherwise this method will have no effect.

Parameters:
user - The last update user

insert

public void insert()
            throws DBException
Insert this DBRecord in the database.
An exception will be throw if the record already exists

Throws:
DBException - if a database error occurs.

update

public void update()
            throws DBException
Updates all the fields in this DBRecord.

Throws:
DBException - if a database error occurs.

update

public void update(java.lang.String... updFldArray)
            throws DBException
Updates the specified fields in this DBRecord.

Parameters:
updFldArray - An array of fields to update.
Throws:
DBException - if a database error occurs.

update

public void update(java.util.Set<java.lang.String> updFldSet)
            throws DBException
Updates the specified fields in this DBRecord.

Parameters:
updFldSet - A Set of fields to update.
Throws:
DBException - if a database error occurs.

clearExcludedUpdateFields

public void clearExcludedUpdateFields()
Clear excluded fields


addExcludedUpdateFields

public void addExcludedUpdateFields(java.lang.String... fldNames)
Adds excluded field to list

Parameters:
fldNames - The field names which are to be excluded on the next update

excludeFieldFromUpdate

public boolean excludeFieldFromUpdate(DBField fld)
Returns true if the specified field should be excluded from the next update.

Parameters:
fld - The Field to check
Returns:
True to exclude, False to not-exclude

excludeFieldFromUpdate

public boolean excludeFieldFromUpdate(java.lang.String fldName)
Returns true if the specified field should be excluded from the next update.

Parameters:
fldName - The Field to check
Returns:
True to exclude, False to not-exclude

setVirtual

public void setVirtual(boolean isVirtual)
Sets the "virtual" state


getVirtual

public boolean getVirtual()
Gets the "virtual" state


isVirtual

public boolean isVirtual()
Gets the "virtual" state


isOkToSave

public boolean isOkToSave()
Returns true if this DBRecord is ok to save


isOkToReload

public boolean isOkToReload()
Returns true if this DBRecord is ok to reload


save

public void save()
          throws DBException
Saves (ie. update an existing record, or inserts a new record) all fields in this DBRecord

Throws:
DBException - If a database error occurs

lockWrite

public boolean lockWrite()
                  throws DBException
Lock table associated with this DBRecord for writing

Returns:
True if the query was successful
Throws:
DBException - If a database error occurs
See Also:
DBProvider.lockTables(java.lang.String[], java.lang.String[])

lockRead

public boolean lockRead()
                 throws DBException
Lock table associated with this DBRecord for reading

Returns:
True if the query was successful
Throws:
DBException - If a database error occurs
See Also:
DBProvider.lockTables(java.lang.String[], java.lang.String[])

lock

public boolean lock(java.lang.String[] writeTables,
                    java.lang.String[] readTables)
             throws DBException
Lock specified tables for write/read

Parameters:
writeTables - The array of tables to lock for writing. If null, defaults to the table assocated with this DBRecord
readTables - The array of tables to lock for reading
Returns:
True if the query was successful
Throws:
DBException - If a database error occurs
See Also:
DBProvider.lockTables(java.lang.String[], java.lang.String[])

unlock

public boolean unlock()
               throws DBException
Unlock locked tables

Returns:
True if the query was successful
Throws:
DBException - If a database error occurs
See Also:
DBProvider.unlockTables()

getFieldName

public java.lang.String getFieldName(java.lang.String fldName)
Returns a case sensitive field name for the specified case insensitive field name.

Parameters:
fldName - A case-insensitive field name
Returns:
A case sensitive field name

setIgnoreInvalidFields

public void setIgnoreInvalidFields(boolean state)
Sets the state for ignoring invalid field names. True to ignore errors when setting/getting a field name that does not exist, False to emit any invalid field errors.

Parameters:
state - True to ignore invalid field names, false to emit errors.

getField

public DBField getField(java.lang.String fldName)
Gets the DBField with the specified name, or null if the specified field name does not exist.

Parameters:
fldName - The field name
Returns:
The DBField.

hasField

public boolean hasField(java.lang.String fldName)
Returns true if a defined field with the specified name exists for this DBRecord

Returns:
True if a defined field with the specified name exists, false otherwise.

hasFieldValue

public boolean hasFieldValue(java.lang.String fldName)
Returns true if the specified field name has a defined value

Returns:
True if the specified field name has a defined value.

isFieldUnsigned

public boolean isFieldUnsigned(java.lang.String fldName)
Returns true if the specified field is an unsigned integer.

Returns:
True if the specified field is an unsigned integer.

hasOptionalFieldValue

public boolean hasOptionalFieldValue(java.lang.String fldName)
Returns true if the specified field name has a defined value.
Returns null if the column does not exist, or if it does exist, but contains a 'NULL' value.

Parameters:
fldName - The field name to retrieve
Returns:
True if the specified field name has a defined value.

getOptionalFieldValue

public java.lang.Object getOptionalFieldValue(java.lang.String fldName)
Gets the value for the specified optional field name.
Note: This function bypasses the normal 'getter' methods for the specific DBRecord subclass, and thus may not perform some of the bounds checking for the specific field.

Parameters:
fldName - The field name to retrieve
Returns:
The field value

getOptionalFieldValue

public java.lang.Object getOptionalFieldValue(java.lang.String fldName,
                                              java.lang.Object dft)
Gets the value for the specified optional field name.
Note: This function bypasses the normal 'getter' methods for the specific DBRecord subclass, and thus may not perform some of the bounds checking for the specific field.

Parameters:
fldName - The field name to retrieve
Returns:
The field value

setOptionalFieldValue

public void setOptionalFieldValue(java.lang.String fldName,
                                  java.lang.Object value)
Sets the value for the specified optional field name.
Note: This function bypasses the normal 'setter' methods for the specific DBRecord subclass, and thus may not perform some of the bounds checking for the specific field.

Parameters:
fldName - The field name to set
value - The value to set.

getKeyValue

public java.lang.Object getKeyValue(java.lang.String fldName)
Gets the value for the specified key.
Note: This function bypasses the normal 'getter' methods for the specific DBRecord subclass, and thus may not perform some of the bounds checking for the specific field.

Parameters:
fldName - The key name to retrieve
Returns:
The field value

geKeyValue

public java.lang.Object geKeyValue(java.lang.String fldName,
                                   java.lang.Object dft)
Gets the value for the specified key.
Note: This function bypasses the normal 'getter' methods for the specific DBRecord subclass, and thus may not perform some of the bounds checking for the specific field.

Parameters:
fldName - The key name to retrieve
dft - The default value returned if the key does not exist, or has not been initialized.
Returns:
The field value

setKeyValue

public boolean setKeyValue(java.lang.String fldName,
                           java.lang.Object value)
Sets the value for the specified key.
Note: This function bypasses the normal 'setter' methods for the specific DBRecord subclass, and thus may not perform some of the bounds checking for the specific field.

Parameters:
fldName - The key name to set
value - The value to set.
Returns:
True if the field exists and was successfully set.

getFieldValue

public java.lang.Object getFieldValue(java.lang.String fldName)
Gets the value for the specified field.
Note: This function bypasses the normal 'getter' methods for the specific DBRecord subclass, and thus may not perform some of the bounds checking for the specific field.

Parameters:
fldName - The field name to retrieve
Returns:
The field value

getFieldValue

public java.lang.Object getFieldValue(java.lang.String fldName,
                                      java.lang.Object dft)
Gets the value for the specified field.
Note: This function bypasses the normal 'getter' methods for the specific DBRecord subclass, and thus may not perform some of the bounds checking for the specific field.

Parameters:
fldName - The field name to retrieve
dft - The default value returned if the field does not exist, or has not been initialized.
Returns:
The field value

setFieldValue

public boolean setFieldValue(java.lang.String fldName,
                             java.lang.Object value)
Sets the value for the specified field.
Note: This function bypasses the normal 'setter' methods for the specific DBRecord subclass, and thus may not perform some of the bounds checking for the specific field.

Parameters:
fldName - The field name to set
value - The value to set.
Returns:
True if the field exists and was successfully set.

getValue

public java.lang.Object getValue(java.lang.String fldName)
Gets the value for the specified field.

Parameters:
fldName - The field name to retrieve
Returns:
The field value

setValue

public void setValue(java.lang.String fldName,
                     java.lang.Object value)
Sets the value for the specified field.
This method attempts to use the field 'setter' method for setting the field value. If the field 'setter' method does not exist, then the generic 'setFieldValue' method will be used.

Parameters:
fldName - The field name to set
value - The value to set.

getOptionalFieldValue

public java.lang.String getOptionalFieldValue(java.lang.String fldName,
                                              java.lang.String dft)
Gets the value for the specified optional field.
Note: This function bypasses the normal 'getter' methods for the specific DBRecord subclass, and thus may not perform some of the bounds checking for the specific field.

Parameters:
fldName - The field name to retrieve
dft - The default value returned if the field does not exist, or has not been initialized.
Returns:
The field value

getFieldValue

public java.lang.String getFieldValue(java.lang.String fldName,
                                      java.lang.String dft)
Gets the value for the specified field.
Note: This function bypasses the normal 'getter' methods for the specific DBRecord subclass, and thus may not perform some of the bounds checking for the specific field.

Parameters:
fldName - The field name to retrieve
dft - The default value returned if the field does not exist, or has not been initialized.
Returns:
The field value

getFieldString

public java.lang.String getFieldString(java.lang.String fldName)
Gets the String value for the specified field.
Note: This function bypasses the normal 'getter' methods for the specific DBRecord subclass, and thus may not perform some of the bounds checking for the specific field.

Parameters:
fldName - The field name to retrieve
Returns:
The String field value

setOptionalFieldValue

public void setOptionalFieldValue(java.lang.String fldName,
                                  java.lang.String value)
Sets the String value for the specified optional field.
Note: This function bypasses the normal 'setter' methods for the specific DBRecord subclass, and thus may not perform some of the bounds checking for the specific field.

Parameters:
fldName - The field name to set
value - The value to set

setFieldValue

public void setFieldValue(java.lang.String fldName,
                          java.lang.String value)
Sets the String value for the specified field.
Note: This function bypasses the normal 'setter' methods for the specific DBRecord subclass, and thus may not perform some of the bounds checking for the specific field.

Parameters:
fldName - The field name to set
value - The value to set

setValue

public void setValue(java.lang.String fldName,
                     java.lang.String value)
Sets the String value for the specified field.
This method attempts to use the field 'setter' method for setting the field value. If the field 'setter' method does not exist, then the generic 'setFieldValue' method will be used.

Parameters:
fldName - The field name to set
value - The value to set.

getOptionalFieldValue

public boolean getOptionalFieldValue(java.lang.String fldName,
                                     boolean dft)
Gets the value for the specified optional field.
Note: This function bypasses the normal 'getter' methods for the specific DBRecord subclass, and thus may not perform some of the bounds checking for the specific field.

Parameters:
fldName - The field name to retrieve
dft - The default value returned if the field does not exist, or has not been initialized.
Returns:
The field value

getFieldValue

public boolean getFieldValue(java.lang.String fldName,
                             boolean dft)
Gets the value for the specified field.
Note: This function bypasses the normal 'getter' methods for the specific DBRecord subclass, and thus may not perform some of the bounds checking for the specific field.

Parameters:
fldName - The field name to retrieve
dft - The default value returned if the field does not exist, or has not been initialized.
Returns:
The field value

getFieldBoolean

public boolean getFieldBoolean(java.lang.String fldName)
Gets the boolean value for the specified field.
Note: This function bypasses the normal 'getter' methods for the specific DBRecord subclass, and thus may not perform some of the bounds checking for the specific field.

Parameters:
fldName - The field name to retrieve
Returns:
The boolean field value

setOptionalFieldValue

public void setOptionalFieldValue(java.lang.String fldName,
                                  boolean value)
Sets the boolean value for the specified optional field.
Note: This function bypasses the normal 'setter' methods for the specific DBRecord subclass, and thus may not perform some of the bounds checking for the specific field.

Parameters:
fldName - The field name to set
value - The value to set

setFieldValue

public void setFieldValue(java.lang.String fldName,
                          boolean value)
Sets the boolean value for the specified field.
Note: This function bypasses the normal 'setter' methods for the specific DBRecord subclass, and thus may not perform some of the bounds checking for the specific field.

Parameters:
fldName - The field name to set
value - The value to set

setValue

public void setValue(java.lang.String fldName,
                     boolean value)
Sets the value for the specified field.
This method attempts to use the field 'setter' method for setting the field value. If the field 'setter' method does not exist, then the generic 'setFieldValue' method will be used.

Parameters:
fldName - The field name to set
value - The value to set.

getOptionalFieldValue

public int getOptionalFieldValue(java.lang.String fldName,
                                 int dft)
Gets the value for the specified optional field.
Note: This function bypasses the normal 'getter' methods for the specific DBRecord subclass, and thus may not perform some of the bounds checking for the specific field.

Parameters:
fldName - The field name to retrieve
dft - The default value returned if the field does not exist, or has not been initialized.
Returns:
The field value

getFieldValue

public int getFieldValue(java.lang.String fldName,
                         int dft)
Gets the value for the specified field.
Note: This function bypasses the normal 'getter' methods for the specific DBRecord subclass, and thus may not perform some of the bounds checking for the specific field.

Parameters:
fldName - The field name to retrieve
dft - The default value returned if the field does not exist, or has not been initialized.
Returns:
The field value

getFieldInt

public int getFieldInt(java.lang.String fldName)
Gets the int value for the specified field.
Note: This function bypasses the normal 'getter' methods for the specific DBRecord subclass, and thus may not perform some of the bounds checking for the specific field.

Parameters:
fldName - The field name to retrieve
Returns:
The int field value

setOptionalFieldValue

public void setOptionalFieldValue(java.lang.String fldName,
                                  int value)
Sets the int value for the specified optional field.
Note: This function bypasses the normal 'setter' methods for the specific DBRecord subclass, and thus may not perform some of the bounds checking for the specific field.

Parameters:
fldName - The field name to set
value - The value to set

setFieldValue

public void setFieldValue(java.lang.String fldName,
                          int value)
Sets the int value for the specified field.
Note: This function bypasses the normal 'setter' methods for the specific DBRecord subclass, and thus may not perform some of the bounds checking for the specific field.

Parameters:
fldName - The field name to set
value - The value to set

setValue

public void setValue(java.lang.String fldName,
                     int value)
Sets the value for the specified field.
This method attempts to use the field 'setter' method for setting the field value. If the field 'setter' method does not exist, then the generic 'setFieldValue' method will be used.

Parameters:
fldName - The field name to set
value - The value to set.

getOptionalFieldValue

public long getOptionalFieldValue(java.lang.String fldName,
                                  long dft)
Gets the value for the specified optional field.
Note: This function bypasses the normal 'getter' methods for the specific DBRecord subclass, and thus may not perform some of the bounds checking for the specific field.

Parameters:
fldName - The field name to retrieve
dft - The default value returned if the field does not exist, or has not been initialized.
Returns:
The field value

getFieldValue

public long getFieldValue(java.lang.String fldName,
                          long dft)
Gets the value for the specified field.
Note: This function bypasses the normal 'getter' methods for the specific DBRecord subclass, and thus may not perform some of the bounds checking for the specific field.

Parameters:
fldName - The field name to retrieve
dft - The default value returned if the field does not exist, or has not been initialized.
Returns:
The field value

getFieldLong

public long getFieldLong(java.lang.String fldName)
Gets the long value for the specified field.
Note: This function bypasses the normal 'getter' methods for the specific DBRecord subclass, and thus may not perform some of the bounds checking for the specific field.

Parameters:
fldName - The field name to retrieve
Returns:
The long field value

setOptionalFieldValue

public void setOptionalFieldValue(java.lang.String fldName,
                                  long value)
Sets the long value for the specified optional field.
Note: This function bypasses the normal 'setter' methods for the specific DBRecord subclass, and thus may not perform some of the bounds checking for the specific field.

Parameters:
fldName - The field name to set
value - The value to set

setFieldValue

public void setFieldValue(java.lang.String fldName,
                          long value)
Sets the long value for the specified field.
Note: This function bypasses the normal 'setter' methods for the specific DBRecord subclass, and thus may not perform some of the bounds checking for the specific field.

Parameters:
fldName - The field name to set
value - The value to set

setValue

public void setValue(java.lang.String fldName,
                     long value)
Sets the value for the specified field.
This method attempts to use the field 'setter' method for setting the field value. If the field 'setter' method does not exist, then the generic 'setFieldValue' method will be used.

Parameters:
fldName - The field name to set
value - The value to set.

getOptionalFieldValue

public float getOptionalFieldValue(java.lang.String fldName,
                                   float dft)
Gets the value for the specified optional field.
Note: This function bypasses the normal 'getter' methods for the specific DBRecord subclass, and thus may not perform some of the bounds checking for the specific field.

Parameters:
fldName - The field name to retrieve
dft - The default value returned if the field does not exist, or has not been initialized.
Returns:
The field value

getFieldValue

public float getFieldValue(java.lang.String fldName,
                           float dft)
Gets the value for the specified field.
Note: This function bypasses the normal 'getter' methods for the specific DBRecord subclass, and thus may not perform some of the bounds checking for the specific field.

Parameters:
fldName - The field name to retrieve
dft - The default value returned if the field does not exist, or has not been initialized.
Returns:
The field value

getFieldFloat

public float getFieldFloat(java.lang.String fldName)
Gets the float value for the specified field.
Note: This function bypasses the normal 'getter' methods for the specific DBRecord subclass, and thus may not perform some of the bounds checking for the specific field.

Parameters:
fldName - The field name to retrieve
Returns:
The float field value

setOptionalFieldValue

public void setOptionalFieldValue(java.lang.String fldName,
                                  float value)
Sets the float value for the specified optional field.
Note: This function bypasses the normal 'setter' methods for the specific DBRecord subclass, and thus may not perform some of the bounds checking for the specific field.

Parameters:
fldName - The field name to set
value - The value to set

setFieldValue

public void setFieldValue(java.lang.String fldName,
                          float value)
Sets the float value for the specified field.
Note: This function bypasses the normal 'setter' methods for the specific DBRecord subclass, and thus may not perform some of the bounds checking for the specific field.

Parameters:
fldName - The field name to set
value - The value to set

setValue

public void setValue(java.lang.String fldName,
                     float value)
Sets the value for the specified field.
This method attempts to use the field 'setter' method for setting the field value. If the field 'setter' method does not exist, then the generic 'setFieldValue' method will be used.

Parameters:
fldName - The field name to set
value - The value to set.

getOptionalFieldValue

public double getOptionalFieldValue(java.lang.String fldName,
                                    double dft)
Gets the value for the specified optional field.
Note: This function bypasses the normal 'getter' methods for the specific DBRecord subclass, and thus may not perform some of the bounds checking for the specific field.

Parameters:
fldName - The field name to retrieve
dft - The default value returned if the field does not exist, or has not been initialized.
Returns:
The field value

getFieldValue

public double getFieldValue(java.lang.String fldName,
                            double dft)
Gets the value for the specified field.
Note: This function bypasses the normal 'getter' methods for the specific DBRecord subclass, and thus may not perform some of the bounds checking for the specific field.

Parameters:
fldName - The field name to retrieve
dft - The default value returned if the field does not exist, or has not been initialized.
Returns:
The field value

getFieldDouble

public double getFieldDouble(java.lang.String fldName)
Gets the double value for the specified field.
Note: This function bypasses the normal 'getter' methods for the specific DBRecord subclass, and thus may not perform some of the bounds checking for the specific field.

Parameters:
fldName - The field name to retrieve
Returns:
The double field value

setOptionalFieldValue

public void setOptionalFieldValue(java.lang.String fldName,
                                  double value)
Sets the double value for the specified optional field.
Note: This function bypasses the normal 'setter' methods for the specific DBRecord subclass, and thus may not perform some of the bounds checking for the specific field.

Parameters:
fldName - The field name to set
value - The value to set

setFieldValue

public void setFieldValue(java.lang.String fldName,
                          double value)
Sets the double value for the specified field.
Note: This function bypasses the normal 'setter' methods for the specific DBRecord subclass, and thus may not perform some of the bounds checking for the specific field.

Parameters:
fldName - The field name to set
value - The value to set

setValue

public void setValue(java.lang.String fldName,
                     double value)
Sets the value for the specified field.
This method attempts to use the field 'setter' method for setting the field value. If the field 'setter' method does not exist, then the generic 'setFieldValue' method will be used.

Parameters:
fldName - The field name to set
value - The value to set.

getOptionalFieldValue

public DateTime getOptionalFieldValue(java.lang.String fldName,
                                      DateTime dft)
Gets the value for the specified optional field.
Note: This function bypasses the normal 'getter' methods for the specific DBRecord subclass, and thus may not perform some of the bounds checking for the specific field.

Parameters:
fldName - The field name to retrieve
dft - The default value returned if the field does not exist, or has not been initialized.
Returns:
The field value

getFieldValue

public DateTime getFieldValue(java.lang.String fldName,
                              DateTime dft)
Gets the value for the specified field.
Note: This function bypasses the normal 'getter' methods for the specific DBRecord subclass, and thus may not perform some of the bounds checking for the specific field.

Parameters:
fldName - The field name to retrieve
dft - The default value returned if the field does not exist, or has not been initialized.
Returns:
The field value

getFieldDateTime

public DateTime getFieldDateTime(java.lang.String fldName)
Gets the DateTime value for the specified field.
Note: This function bypasses the normal 'getter' methods for the specific DBRecord subclass, and thus may not perform some of the bounds checking for the specific field.

Parameters:
fldName - The field name to retrieve
Returns:
The DateTime field value

setOptionalFieldValue

public void setOptionalFieldValue(java.lang.String fldName,
                                  DateTime value)
Sets the DateTime value for the specified optional field.
Note: This function bypasses the normal 'setter' methods for the specific DBRecord subclass, and thus may not perform some of the bounds checking for the specific field.

Parameters:
fldName - The field name to set
value - The value to set

setAllFieldValues

public void setAllFieldValues(DBRecord<gDBR> rcd)
                       throws DBException
Sets the field values for this DBRecord from the specified DBRecord
(primary keys are not copied)

Parameters:
rcd - The other DBRecord instance from which field values are copied
Throws:
DBException - If a database error occurs

setAllFieldValues

public void setAllFieldValues(java.sql.ResultSet rs)
                       throws DBException
Sets the field values for this DBRecord from the specified SQL ResultSet
(primary keys are not copied)

Parameters:
rs - The SQL ResultSet
Throws:
DBException - If a database error occurs

setAllFieldValues

public void setAllFieldValues(java.sql.ResultSet rs,
                              java.lang.String... fldNames)
                       throws DBException
Sets the field values for this DBRecord from the specified SQL ResultSet
(primary keys are not copied)

Parameters:
rs - The SQL ResultSet
fldNames - The list of field names to set (null for all fields)
Throws:
DBException - If a database error occurs

setAllFieldValues

public void setAllFieldValues(java.util.Map<java.lang.String,java.lang.String> valMap)
                       throws DBException
Sets the field values for this DBRecord from the specified Map.
Field values are converted to their proper type from the specified Map values.
All current field values are cleared (except primary key values).

Parameters:
valMap - The Field==>Value map
Throws:
DBException - If a database error occurs

appendFieldValues

public void appendFieldValues(java.util.Map<java.lang.String,java.lang.String> valMap)
                       throws DBException
Appends the field values for this DBRecord from the specified Map.
Field values are converted to their proper type from the specified Map values.
Similar to "setAllFieldValues", however the current field values are not cleared.

Parameters:
valMap - The Field==>Value map
Throws:
DBException - If a database error occurs

setLastCaughtSQLException

protected void setLastCaughtSQLException(java.sql.SQLException sqe)
Sets the last caught SQLException

Parameters:
sqe - The last caught SQL Exception

clearLastCaughtSQLException

public void clearLastCaughtSQLException()
Clears the last caught SQLException


getLastCaughtSQLException

public java.sql.SQLException getLastCaughtSQLException()
Gets the last caught SQLException

Returns:
The last caught SQLException

isLastCaughtSQLExceptionErrorCode

public boolean isLastCaughtSQLExceptionErrorCode(int code)
Returns true if the specified code matches the error code of the last caught SQLException

Parameters:
code - The code to compare with the last SQLException error code
Returns:
True if code matches the error code of the last caught SQLException

setValidating

protected void setValidating(boolean validate)
Sets if this record id validating [CHECK]

Parameters:
validate - If this record is validating

isValidating

protected boolean isValidating()
Returns true if this record is validating

Returns:
True if this record is validating

equals

public boolean equals(java.lang.Object obj)
Returns true if the specified DBRecord key is equivalent to this record key

Overrides:
equals in class java.lang.Object
Parameters:
obj - The specified DBRecord key
Returns:
True if obj is equivilent to this record key

toString

public java.lang.String toString()
Returns a String representation of the DBRecordKey for this DBRecord

Overrides:
toString in class java.lang.Object
Returns:
A String representation of the DBRecordKey for this DBRecord

printXML

public static void printXML(java.io.PrintWriter out,
                            DBRecord<?>... dbr)
Encodes all field of the specified DBRecords into XML and writes it to a specified PrintWriter

Parameters:
out - The PrintWriter
dbr - The list of DBRecords

printXML

public static void printXML(java.io.PrintWriter out,
                            int indent,
                            java.util.Set<java.lang.String> fldNames,
                            DBRecord<?>... dbr)
Encodes the specified DBRecords into XML and writes it to a specified PrintWriter

Parameters:
out - The PrintWriter
indent - The number of spaces to indent
fldNames - The set of field names to include
dbr - The list of DBRecords

printXML

public void printXML(java.io.PrintWriter out,
                     int indent,
                     java.util.Set<java.lang.String> fldNames)
Encodes this DBRecord into XML and writes it to a specified PrintWriter

Parameters:
out - The PrintWriter
indent - The number of spaces to indent
fldNames - The set of field names to include

printXML

public void printXML(java.io.PrintWriter out,
                     int indent,
                     java.util.Set<java.lang.String> fldNames,
                     boolean soapXml)
Contains boolean value used to encode xml that will be embedded within a SOAP envelope.

Parameters:
out -
indent -
fldNames -
soapXml -

printXML

public void printXML(java.io.PrintWriter out,
                     int indent,
                     java.util.Set<java.lang.String> fldNames,
                     int sequence)
Encodes this DBRecord into XML and writes it to a specified PrintWriter

Parameters:
out - The PrintWriter
indent - The number of spaces to indent
fldNames - The set of field names to include
sequence - Optional sequence value

printXML

public void printXML(java.io.PrintWriter out,
                     int indent,
                     java.util.Set<java.lang.String> fldNames,
                     int sequence,
                     boolean soapXML)
Encodes this DBRecord into XML and writes it to a specified PrintWriter

Parameters:
out - The PrintWriter
indent - The number of spaces to indent
fldNames - The set of field names to include
sequence - Optional sequence value
soapXML - True is SOAP XML

toXML

public java.lang.StringBuffer toXML(java.lang.StringBuffer sb,
                                    int indent,
                                    java.util.Set<java.lang.String> fldNames)
Encodes this DBRecord into XML

Parameters:
sb - The StringBuffer to write the DBRecord XML to
indent - The number of spaces to indent
fldNames - The set of field names to include
Returns:
The StringBuffer

toXML

public java.lang.StringBuffer toXML(java.lang.StringBuffer sb,
                                    int indent,
                                    java.util.Set<java.lang.String> fldNames,
                                    boolean soapXML)
Encodes this DBRecord into XML

Parameters:
sb - The StringBuffer to write the DBRecord XML to
indent - The number of spaces to indent
fldNames - The set of field names to include
soapXML - True if SOAP XML
Returns:
The StringBuffer containing the XML

toXML

public java.lang.StringBuffer toXML(java.lang.StringBuffer sb,
                                    int indent,
                                    java.util.Set<java.lang.String> fldNames,
                                    int sequence)
Encodes this DBRecord into XML

Parameters:
sb - The StringBuffer to write the DBRecord XML to
indent - The number of spaces to indent
fldNames - The set of field names to include
sequence - Optional sequence value
Returns:
The StringBuffer containing the XML

toXML

public java.lang.StringBuffer toXML(java.lang.StringBuffer sb,
                                    int indent,
                                    java.util.Set<java.lang.String> fldNames,
                                    int sequence,
                                    boolean soapXML)
Encodes this DBRecord into XML

Parameters:
sb - The StringBuffer to write the DBRecord XML to
indent - The number of spaces to indent
fldNames - The set of field names to include
sequence - Optional sequence value
soapXML - True if SOAP XML
Returns:
The StringBuffer containing the XML

toXML

public java.lang.StringBuffer toXML(java.lang.StringBuffer sb,
                                    int indent,
                                    java.util.Set<java.lang.String> fldNames,
                                    int sequence,
                                    boolean inclBlank,
                                    boolean soapXML)
Encodes this DBRecord into XML

Parameters:
sb - The StringBuffer to write the DBRecord XML to
indent - The number of spaces to indent
fldNames - The set of field names to include
sequence - Optional sequence value
inclBlank - Include blank fields
soapXML - True if SOAP XML
Returns:
The StringBuffer containing the XML

recordWillInsert

protected void recordWillInsert()
Callback when record is about to be inserted into the table


recordDidInsert

protected void recordDidInsert()
Callback after record has been be inserted into the table


recordWillUpdate

protected void recordWillUpdate()
Callback when record is about to be updated in the table


recordDidUpdate

protected void recordDidUpdate()
Callback after record has been be updated in the table


getTemporaryProperties

public RTProperties getTemporaryProperties()
Gets a temporary properties instance for this DBRecord

Returns:
The temporary RTProperties instance

hasTemporaryProperties

public boolean hasTemporaryProperties()
Returns true if this DBRecord has a temporary properties instance defined

Returns:
True if this DBRecord has a temporary properties instance defined