|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.opengts.dbtools.DBFactory<gDBR>
public class DBFactory<gDBR extends DBRecord>
DBFactory
provides SQL table specific information
Nested Class Summary | |
---|---|
static interface |
DBFactory.CustomFactoryHandler
CustomFactoryHandler interface |
static interface |
DBFactory.InsertionValidator
InsertionValidator interface |
static class |
DBFactory.KeyType
DBRecord key type |
protected static class |
DBFactory.MySQLDumpReader
MySQLDumpReader class |
static class |
DBFactory.ValidationLog
ValidationLog class |
static class |
DBFactory.ValidationNotImplementedException
ValidationNotImplementedException class |
Field Summary | |
---|---|
static java.lang.String |
_DUMP_EXT_CSV
|
static java.lang.String |
_DUMP_EXT_SQL
|
static java.lang.String |
_DUMP_EXT_TXT
|
static java.lang.String |
_DUMP_EXT_XML
|
static java.lang.String |
_LOAD_EXT_CSV
|
static java.lang.String |
_LOAD_EXT_DUMP
|
static java.lang.String |
_LOAD_EXT_SQL
|
static java.lang.String |
_LOAD_EXT_TXT
|
static java.lang.String |
ARCHIVE_EXT_CSV
|
static java.lang.String |
ARCHIVE_EXT_DUMP
|
static java.lang.String |
ARCHIVE_EXT_SQL
|
static java.lang.String |
ARCHIVE_EXT_TXT
|
static java.lang.String |
ARCHIVE_EXT_XML
|
static java.lang.String |
ATTR_alternateKeys
|
static java.lang.String |
ATTR_count
|
static java.lang.String |
ATTR_name
|
static java.lang.String |
ATTR_partial
|
static java.lang.String |
ATTR_primaryKey
|
static java.lang.String |
ATTR_sequence
|
static java.lang.String |
ATTR_table
|
static java.lang.String |
ATTR_title
|
static java.lang.String |
ATTR_type
|
static java.lang.String |
CMD_dbcreate
|
static java.lang.String |
CMD_dbdel
|
static java.lang.String |
CMD_dbget
|
static java.lang.String |
CMD_dbput
|
static java.lang.String |
CMD_dbschema
|
static int |
DUMP_FORMAT_CSV
|
static int |
DUMP_FORMAT_SQL
|
static int |
DUMP_FORMAT_XML
|
protected static java.util.List<DBFactory> |
factoryList
|
static int |
MSQL_ERR_CANT_DROP_TABLE
|
static int |
MSQL_ERR_INVALID_OBJECT
|
static int |
MSQL_ERR_LOGIN_EXISTS
|
static int |
MSQL_ERR_USER_EXISTS
|
static int |
SQLERR_DATABASE_EXISTS
|
static int |
SQLERR_DUPLICATE_KEY
|
static int |
SQLERR_INVALID_AUTH
|
static int |
SQLERR_SYNTAX_ERROR
|
static int |
SQLERR_TABLE_NONEXIST
|
static int |
SQLERR_TABLE_NOTLOCKED
|
static int |
SQLERR_UNKNOWN_COLUMN
|
static int |
SQLERR_UNKNOWN_DATABASE
|
protected static java.util.HashMap<java.lang.String,java.lang.String> |
TableNameMap
|
static java.lang.String |
TAG_Description
|
static java.lang.String |
TAG_Field
|
static java.lang.String |
TAG_Record
|
static java.lang.String |
TAG_RecordKey
|
static java.lang.String |
TAG_RecordKeys
|
static java.lang.String |
TAG_Records
|
static java.lang.String |
TAG_TableSchema
|
static java.lang.String |
TAG_TableSchemas
|
Constructor Summary | |
---|---|
DBFactory(java.lang.String utableName,
DBField[] field,
DBFactory.KeyType keyType,
java.lang.Class<gDBR> rcdClass,
java.lang.Class<? extends DBRecordKey<gDBR>> keyClass,
boolean editable,
boolean viewable)
Constructor |
Method Summary | ||
---|---|---|
protected int |
_addColumns(DBField[] cols,
int ndx)
Adds the specified column to this table, or alters the column if it already exists. |
|
protected static java.lang.String |
_beanMethodName(java.lang.String prefix,
java.lang.String fieldName)
Returns the BeanMethod name for the specified field name |
|
protected void |
_dropColumn(DBField col)
Drips the specified column from this table |
|
protected void |
_dumpTable(java.io.PrintWriter dumpOutStream,
DBSelect<gDBR> dsel,
java.lang.String[] fldn,
int outFmt)
Dumps the table represented by this DBFactory to the specified file. |
|
protected long |
_loadTable(java.lang.String[] oldFieldNames,
java.io.File fromFile,
DBFactory.InsertionValidator validator,
boolean insertRecords,
boolean overwriteExisting,
boolean noDropWarning)
Loads the data in the specified file into the table represented by this DBFactory |
|
protected long |
_loadTableCSV(java.io.File fromFile,
DBFactory.InsertionValidator validator,
boolean insertRecords,
boolean overwriteExisting,
boolean noDropWarning)
Loads table data from the specified CSV file |
|
protected static java.lang.String |
_methodScope(int mods)
Returns the String representation of the scope 'modifications' |
|
protected static void |
addActualTableName(java.lang.String globalTableName,
java.lang.String actualTableName)
Add a table name mapping |
|
int |
addColumns(DBField[] cols,
int ndx)
Adds the specified column to this table, or alters the column if it already exists. |
|
void |
addParentTable(java.lang.String utableName)
Adds this table as a dependent of the specified parent table name |
|
void |
clearExistingColumnMap()
Clears the column map for the existing columns |
|
static
|
createDBFactory(java.lang.String utableName,
DBField[] field,
DBFactory.KeyType keyType,
java.lang.Class<T> rcdClass,
java.lang.Class<? extends DBRecordKey<T>> keyClass,
boolean editable,
boolean viewable)
Create a DBFactory instance. |
|
DBRecordKey<gDBR> |
createKey()
Creates/returns an empty DBRecordKey for this DBFactory |
|
DBRecordKey<gDBR> |
createKey(java.util.Map<java.lang.String,java.lang.String> valMap)
Creates/returns a DBRecordKey for this DBFactory populated with key values from the specified Value-Map |
|
DBRecordKey<gDBR> |
createKey(java.util.Map<java.lang.String,java.lang.String> valMap,
int partialKeyType)
Creates/returns a DBRecordKey for this DBFactory populated with key values from the specified Value-Map |
|
DBRecordKey<gDBR> |
createKey(java.sql.ResultSet rs)
Creates/returns a DBRecordKey for this DBFactory populated with key values from the specified ResultSet |
|
gDBR |
createRecord(org.w3c.dom.Element record)
Creates/returns a DBRecord for this DBFactory populated with key values from the specified XML Element |
|
gDBR |
createRecord(java.util.Map<java.lang.String,java.lang.String> valMap)
Creates/returns a DBRecord for this DBFactory populated with key values from the specified Value-Map (record not yet saved) |
|
gDBR |
createRecord(java.sql.ResultSet rs)
Creates/returns a DBRecord for this DBFactory populated with key values from the specified ResultSet (record not yet saved) |
|
void |
createTable()
Creates the table represented by this DBFactory |
|
void |
dropColumn(DBField col)
Drips the specified column from this table |
|
void |
dropTable()
Drops the table represented by this DBFactory |
|
void |
dumpTable(java.io.File toFile)
Dumps the table represented by this DBFactory to the specified file |
|
void |
dumpTable(java.io.File toFile,
DBSelect<gDBR> dsel)
Dumps the table represented by this DBFactory to the specified file. |
|
void |
dumpTable(java.io.File toFile,
DBSelect<gDBR> dsel,
java.lang.String[] fldn)
Dumps the table represented by this DBFactory to the specified file. |
|
boolean |
equals(java.lang.Object other)
Returns true if this DBFactory is equal to the specified object. |
|
static java.lang.String |
getActualTableName(java.lang.String utableName)
Gets the actual table name for the specified class module table name |
|
boolean |
getAllowInnoDBCOUNT()
Gets Allow 'COUNT(*)' |
|
DBAlternateIndex |
getAlternateIndex(java.lang.String name)
Returns the DBAlternateIndex definition for the specified alternate index name |
|
int |
getAlternateIndexCount()
Returns the number of alternate indexes defined for this table |
|
DBAlternateIndex[] |
getAlternateIndexes()
Returns the DBAlternateIndex definition (if any) for this DBFactory |
|
java.lang.String[] |
getAlternateIndexNames()
Returns an array of alternate index names (if any) for this DBFactory |
|
DBField |
getAutoIndexField()
Gets the "autoIndex" key field (if any) |
|
DBFactory<? extends DBRecord>[] |
getChildFactories()
Returns the DBFactories of the dependent children of this table |
|
java.lang.String |
getDescription(java.util.Locale loc)
Return the description of the table represented by this DBFactory |
|
java.util.Map<java.lang.String,DBField> |
getExistingColumnMap(boolean update)
Retrieves the list of existing columns in the database for this DBFactory |
|
DBField[] |
getExistingColumns(boolean update)
Retrieves an array of existing columns in the database for this DBFactory |
|
static DBFactory |
getFactoryByName(java.lang.String utableName)
Gets the DBFactory for the specified table name |
|
DBField |
getField(java.lang.String name)
Gets the DBField for the specified name |
|
int |
getFieldCount()
Returns the number of defined fields in this DBFactory |
|
java.lang.String[] |
getFieldNames()
Returns a String array of all field names defined in this DBFactory |
|
static java.lang.String[] |
getFieldNames(DBField[] flds)
Returns an array of names for the specified fields |
|
DBField[] |
getFields()
Returns an array of all DBFields defined by this DBFactory |
|
DBField[] |
getFields(java.util.Set<java.lang.String> fieldNames)
Returns a set of DBFields defined by this DBFactory |
|
DBField[] |
getFields(java.lang.String... fieldNames)
Returns a set of DBFields defined by this DBFactory |
|
int |
getFieldStringLength(java.lang.String name)
Gets the String length for the specified DBField |
|
DBField[] |
getFieldsWithBoolean(java.lang.String key,
boolean value)
Returns all fields which have the specified property set to the specified boolean value. |
|
java.lang.String |
getIndexType()
Gets the MySQL index type (engine) |
|
java.lang.Class<? extends DBRecordKey<gDBR>> |
getKeyClass()
Gets the key class |
|
DBField[] |
getKeyFields()
Gets a list of primary key fields |
|
java.lang.String[] |
getKeyNames()
Gets a list of field names representing the primary keys fields |
|
java.lang.String |
getKeyType()
Gets the key type |
|
static java.lang.String |
getKeyTypeName(DBFactory.KeyType type)
Returns the key type String name for the specified key type index |
|
java.lang.String |
getMappedFieldName(java.lang.String cn)
This method can be used for field 'renaming'. |
|
long |
getMySQLTableStatus()
Retrieve the current table status. |
|
DBField[] |
getNamedFields(java.lang.String[] fieldNames)
Return an array of DBFields matching the names of the specified fields. |
|
java.util.List<java.lang.String> |
getParentTables()
Get the list of parent ancestors |
|
java.lang.Class<gDBR> |
getRecordClass()
Returns the DBRecord class for this DBFactory |
|
long |
getRecordCount(DBWhere where,
boolean actualCount)
Returns the number of records contained in the table represented by this DBFactory and based on the specified 'where' clause. |
|
long |
getRecordCount(java.lang.String where,
boolean actualCount)
Returns the number of records contained in the table represented by this DBFactory and based on the specified 'where' clause. |
|
DBRecordListener<gDBR> |
getRecordListener()
Gets the DBRecordListnener for this DBFactory |
|
java.lang.String |
getTranslatedTableName()
Gets the translated table name for this DBSelect |
|
java.lang.String |
getUntranslatedTableName()
Returns the untranslated table for for this DBFactory |
|
boolean |
hasAlternateIndexes()
Returns true if this DBFactory supports any alternate indexes |
|
boolean |
hasField(java.lang.String name)
Returns true if the specified field exists in this DBFactory |
|
int |
hashCode()
Returns this hashcode for this DBFactory |
|
boolean |
hasParentTable(java.lang.String utableName)
Returns true if this table has the specified table name as a parent |
|
boolean |
isEditable()
Returns true if this table is editable |
|
boolean |
isMySQLInnoDB()
Returns true if this table is MySQL and "InnoDB" |
|
boolean |
isRequired()
Returns true if this table is required. |
|
boolean |
isViewable()
Returns true if this table is viewable |
|
long |
loadTable(java.io.File fromFile)
Loads the data in the specified file into the table represented by this DBFactory |
|
long |
loadTable(java.io.File fromFile,
boolean insertRecords,
boolean overwriteExisting)
Deprecated. |
|
long |
loadTable(java.io.File fromFile,
boolean insertRecords,
boolean overwriteExisting,
boolean noDropWarning)
Loads the data in the specified file into the table represented by this DBFactory |
|
long |
loadTable(java.io.File fromFile,
DBFactory.InsertionValidator validator,
boolean insertRecords,
boolean overwriteExisting)
Deprecated. |
|
long |
loadTable(java.io.File fromFile,
DBFactory.InsertionValidator validator,
boolean insertRecords,
boolean overwriteExisting,
boolean noDropWarning)
Loads the data in the specified file into the table represented by this DBFactory |
|
boolean |
logMissingColumnWarning()
Returns true to log warnings regarding missing columns on insert/update |
|
static boolean |
mysqlTableExistsUseSelectCount()
|
|
static DBFactory |
parseXML_DBFactory(org.w3c.dom.Element node,
java.lang.String... nodeNames)
Parse and return a DBFactory from the specified XML node atribute "table". |
|
static DBRecord<?> |
parseXML_DBRecord(org.w3c.dom.Element rcdTag)
Parse and return a DBRecord from the specified XML node. |
|
static DBRecordKey<?> |
parseXML_DBRecordKey(org.w3c.dom.Element rcdTag)
Parse and return a DBRecordKey from the specified XML node. |
|
static java.util.Map<java.lang.String,java.lang.String> |
parseXML_FieldValueMap(org.w3c.dom.Element node,
DBFactory tableFact)
Parse and return a field value map from "Field" child node of the specified XML node element. |
|
void |
recordDidInsert(gDBR rcd)
Callback after record has been be inserted into the table |
|
void |
recordDidUpdate(gDBR rcd)
Callback after record has been be updated in the table |
|
void |
recordWillInsert(gDBR rcd)
Callback when record is about to be inserted into the table |
|
void |
recordWillUpdate(gDBR rcd)
Callback when record is about to be updated in the table |
|
void |
recreateAlternateIndexes()
Recreates the alternate key index for the table represented by this DBFactory |
|
void |
recreatePrimaryKey()
Recreates the Primary Key for the table represented by this DBFactory |
|
void |
setAllowInnoDBCOUNT(boolean countOK)
Gets Allow 'COUNT(*)' |
|
static void |
setCustomFactoryHandler(DBFactory.CustomFactoryHandler factoryHandler)
Sets the global CustomFactoryHandler |
|
boolean |
setFieldDefaultValue(java.lang.String fldName,
java.lang.Object dftVal)
Set the field default value. |
|
void |
setLogMissingColumnWarnings(boolean state)
Sets the state for logging warnings for missing table columns |
|
void |
setRecordListener(DBRecordListener<gDBR> rcdListener)
Sets the DBRecordListnener for this DBFactory param rcdListener The DBRecordListener |
|
void |
setRequired(boolean required)
Sets the 'required' state of this DBFactory |
|
boolean |
supportsEfficientCount()
Return true if this DBFactory suports efficient records countins. |
|
boolean |
tableExists()
Return true if the table represented by this DBFactory exists |
|
boolean |
tableRequired()
Return true if the table represented by this DBFactory is required |
|
java.lang.String |
toString()
Returns a String representation of this DBFactory (the table name) |
|
java.lang.StringBuffer |
toXML(java.lang.StringBuffer sb,
int indent)
Returns an XML representation of this DBFactory |
|
java.lang.StringBuffer |
toXML(java.lang.StringBuffer sb,
int indent,
boolean soapXML)
Returns an XML representation of this DBFactory |
|
boolean |
validateColumns()
Validate all existing table columns against the list of defined table columns. |
|
boolean |
validateColumns(int validateMask)
Validate all existing table columns against the list of defined table columns. |
|
boolean |
validateColumns(int validateMask,
boolean refreshColumns)
Validate all existing table columns against the list of defined table columns. |
|
java.util.List |
validateFieldBeanMethods(DBField field)
Validate the specified DBField for proper getter/setter bean access methods |
|
boolean |
validateTable(boolean inclWarn)
Validates the table defined by this DBFactory. |
|
void |
validateTableBeanMethods()
Validates all bean-access methods for this DBFactory |
|
static java.lang.StringBuffer |
writeXML_DBField(java.lang.StringBuffer sb,
int indent,
DBField fld,
boolean inclInfo,
java.lang.String value)
Create an XML DBField description tag |
|
static java.lang.StringBuffer |
writeXML_DBField(java.lang.StringBuffer sb,
int indent,
DBField fld,
boolean inclInfo,
java.lang.String value,
boolean soapXML)
Create an XML DBField description tag |
|
static java.lang.StringBuffer |
writeXML_DBFields(java.lang.StringBuffer sb,
int indent,
DBField[] fld,
DBFieldValues fldVals)
Create a list of XML DBField description tags with values |
|
static java.lang.StringBuffer |
writeXML_DBFields(java.lang.StringBuffer sb,
int indent,
DBField[] fld,
DBFieldValues fldVals,
boolean soapXML)
Create XML DBField description XML (entity reference encoded) |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String ARCHIVE_EXT_CSV
public static final java.lang.String ARCHIVE_EXT_DUMP
public static final java.lang.String ARCHIVE_EXT_SQL
public static final java.lang.String ARCHIVE_EXT_TXT
public static final java.lang.String ARCHIVE_EXT_XML
public static final java.lang.String CMD_dbget
public static final java.lang.String CMD_dbput
public static final java.lang.String CMD_dbdel
public static final java.lang.String CMD_dbcreate
public static final java.lang.String CMD_dbschema
public static final java.lang.String TAG_TableSchemas
public static final java.lang.String TAG_TableSchema
public static final java.lang.String TAG_Records
public static final java.lang.String TAG_Record
public static final java.lang.String TAG_RecordKeys
public static final java.lang.String TAG_RecordKey
public static final java.lang.String TAG_Field
public static final java.lang.String TAG_Description
public static final java.lang.String ATTR_table
public static final java.lang.String ATTR_name
public static final java.lang.String ATTR_sequence
public static final java.lang.String ATTR_type
public static final java.lang.String ATTR_title
public static final java.lang.String ATTR_primaryKey
public static final java.lang.String ATTR_alternateKeys
public static final java.lang.String ATTR_partial
public static final java.lang.String ATTR_count
public static final int SQLERR_DATABASE_EXISTS
public static final int SQLERR_INVALID_AUTH
public static final int SQLERR_UNKNOWN_DATABASE
public static final int SQLERR_UNKNOWN_COLUMN
public static final int SQLERR_DUPLICATE_KEY
public static final int SQLERR_SYNTAX_ERROR
public static final int SQLERR_TABLE_NOTLOCKED
public static final int SQLERR_TABLE_NONEXIST
public static final int MSQL_ERR_INVALID_OBJECT
public static final int MSQL_ERR_CANT_DROP_TABLE
public static final int MSQL_ERR_LOGIN_EXISTS
public static final int MSQL_ERR_USER_EXISTS
protected static java.util.HashMap<java.lang.String,java.lang.String> TableNameMap
protected static java.util.List<DBFactory> factoryList
public static final java.lang.String _DUMP_EXT_TXT
public static final java.lang.String _DUMP_EXT_SQL
public static final java.lang.String _DUMP_EXT_CSV
public static final java.lang.String _DUMP_EXT_XML
public static final int DUMP_FORMAT_CSV
public static final int DUMP_FORMAT_SQL
public static final int DUMP_FORMAT_XML
public static final java.lang.String _LOAD_EXT_CSV
public static final java.lang.String _LOAD_EXT_DUMP
public static final java.lang.String _LOAD_EXT_SQL
public static final java.lang.String _LOAD_EXT_TXT
Constructor Detail |
---|
public DBFactory(java.lang.String utableName, DBField[] field, DBFactory.KeyType keyType, java.lang.Class<gDBR> rcdClass, java.lang.Class<? extends DBRecordKey<gDBR>> keyClass, boolean editable, boolean viewable)
utableName
- The untranslated name of the tablefield
- The DBFields in the tablekeyType
- The table key typercdClass
- The DBRecord subclass representing the tablekeyClass
- The DBRecordKey subclass representing the table keyeditable
- True if this table should be editable, false otherwise.
This value is used by the GTSAdmin application.viewable
- True if this table should be viewable, false otherwise.
An 'editable' table is automatically considered viewable.
This value is used by the GTSAdmin application.Method Detail |
---|
public static boolean mysqlTableExistsUseSelectCount()
public static void setCustomFactoryHandler(DBFactory.CustomFactoryHandler factoryHandler)
factoryHandler
- The CustomFactoryHandlerprotected static void addActualTableName(java.lang.String globalTableName, java.lang.String actualTableName)
globalTableName
- Class name of table (sans package name)actualTableName
- Assigned name of table (untranslated)public static java.lang.String getActualTableName(java.lang.String utableName)
public static DBFactory getFactoryByName(java.lang.String utableName)
utableName
- The untranslated table name
public static <T extends DBRecord<T>> DBFactory<T> createDBFactory(java.lang.String utableName, DBField[] field, DBFactory.KeyType keyType, java.lang.Class<T> rcdClass, java.lang.Class<? extends DBRecordKey<T>> keyClass, boolean editable, boolean viewable)
utableName
- The untranslated name of the tablefield
- The DBFields in the tablekeyType
- The table key typercdClass
- The DBRecord subclass representing the tablekeyClass
- The DBRecordKey subclass representing the table keyeditable
- True if this table should be editable, false otherwise.
This value is used by the GTSAdmin application.viewable
- True if this table should be viewable, false otherwise.
An 'editable' table is automatically considered viewable.
This value is used by the GTSAdmin application.
public java.lang.String getDescription(java.util.Locale loc)
loc
- The Locale representing the language for the returned description
public void setRequired(boolean required)
required
- The 'required' statepublic boolean isRequired()
public boolean isEditable()
public boolean isViewable()
public void clearExistingColumnMap()
public java.util.Map<java.lang.String,DBField> getExistingColumnMap(boolean update) throws DBException
update
- True to update the current map, false to return the previously cached map
DBException
- If a database error occurspublic DBField[] getExistingColumns(boolean update) throws DBException
update
- True to update the current list of columns, false to return the previously cached columns
DBException
- If a database error occurspublic boolean validateColumns()
public boolean validateColumns(int validateMask)
validateMask
- A bitmask indicating which type(s) of validation to perform
public boolean validateColumns(int validateMask, boolean refreshColumns)
validateMask
- A bitmask indicating which type(s) of validation to performrefreshColumns
- If true, the list of existing columns will be updated prior to validation.
public DBField[] getFields()
public DBField[] getFields(java.util.Set<java.lang.String> fieldNames)
fieldNames
- A set of field names representing fields to return (null for all)
field names which are not defined in this DBFactory are quietly ignored.
public DBField[] getFields(java.lang.String... fieldNames)
fieldNames
- An array of field names representing fields to return (null for all).
Field names which are not defined in this DBFactory are quietly ignored.
public java.lang.String getMappedFieldName(java.lang.String cn)
cn
- The old field name
public boolean hasField(java.lang.String name)
name
- A field name to test
public DBField getField(java.lang.String name)
name
- The name of the field to retrieve
public int getFieldStringLength(java.lang.String name)
name
- The name of the field for which the String length is retrieved.
public int getFieldCount()
public java.lang.String[] getFieldNames()
public static java.lang.String[] getFieldNames(DBField[] flds)
flds
- An array of fields
public DBField[] getFieldsWithBoolean(java.lang.String key, boolean value)
key
- The property key searched in the property/attribute stringvalue
- The required value of the specified property used for inclusion in the return field list
public DBField[] getNamedFields(java.lang.String[] fieldNames)
fieldNames
- The field names for which the array of DBFields will be returned
public boolean setFieldDefaultValue(java.lang.String fldName, java.lang.Object dftVal)
fldName
- The field namedftVal
- The default value (no checking is done on the datatype)
public void setLogMissingColumnWarnings(boolean state)
state
- True to warn (default), false otherwisepublic boolean logMissingColumnWarning()
public DBField getAutoIndexField()
public DBField[] getKeyFields()
public java.lang.String[] getKeyNames()
public java.lang.String getKeyType()
public static java.lang.String getKeyTypeName(DBFactory.KeyType type)
type
- The key type index
public java.lang.Class<? extends DBRecordKey<gDBR>> getKeyClass()
public DBRecordKey<gDBR> createKey() throws DBException
DBException
- If a database error occurspublic DBRecordKey<gDBR> createKey(java.sql.ResultSet rs) throws DBException
rs
- The SQL query ResultSet
DBException
- If a database error occurspublic DBRecordKey<gDBR> createKey(java.util.Map<java.lang.String,java.lang.String> valMap) throws DBException
valMap
- The Field==>Value map
DBException
- If a database error occurspublic DBRecordKey<gDBR> createKey(java.util.Map<java.lang.String,java.lang.String> valMap, int partialKeyType) throws DBException
valMap
- The Field==>Value mappartialKeyType
- DBWhere [KEY_FULL|KEY_PARTIAL_FIRST|KEY_PARTIAL_ALL]
DBException
- If no key field specified or field no foundpublic gDBR createRecord(java.sql.ResultSet rs) throws DBException
rs
- The SQL query ResultSet
DBException
- If a database error occurspublic gDBR createRecord(java.util.Map<java.lang.String,java.lang.String> valMap) throws DBException
valMap
- The Field==>Value map
DBException
- If a database error occurspublic gDBR createRecord(org.w3c.dom.Element record) throws DBException
record
- The XML Element
DBException
- If field does not specify a 'name' or a general
DB exception occurspublic int getAlternateIndexCount()
public boolean hasAlternateIndexes()
public DBAlternateIndex[] getAlternateIndexes()
public java.lang.String[] getAlternateIndexNames()
public DBAlternateIndex getAlternateIndex(java.lang.String name)
public java.lang.Class<gDBR> getRecordClass()
public java.lang.String getUntranslatedTableName()
public java.lang.String getTranslatedTableName()
public boolean tableExists() throws DBException
DBException
- If a database error occurspublic boolean tableRequired()
public long getMySQLTableStatus() throws DBException
DBException
- if an error occured fetching table statuspublic boolean validateTable(boolean inclWarn)
inclWarn
- If true, warnings will also be displayed
public int addColumns(DBField[] cols, int ndx) throws DBException
cols
- An array of columns to add/alterndx
- The index of the first column to start adding/altering
DBException
- If a database error occursprotected int _addColumns(DBField[] cols, int ndx) throws java.sql.SQLException, DBException
cols
- An array of columns to add/alterndx
- The index of the first column to start adding/altering
java.sql.SQLException
- If an SQL error occurs
DBException
- If a database error occurspublic void dropColumn(DBField col) throws DBException
col
- The column specification to drop
DBException
- If a database error occursprotected void _dropColumn(DBField col) throws java.sql.SQLException, DBException
col
- The column specification to drop
java.sql.SQLException
- If an SQL error occurs
DBException
- If a database error occurspublic void recreatePrimaryKey() throws DBException
DBException
- If a database error occurspublic void recreateAlternateIndexes() throws DBException
DBException
public void createTable() throws DBException
DBException
- If a database error occurspublic void dropTable() throws DBException
DBException
- If a database error occurspublic void dumpTable(java.io.File toFile) throws DBException
toFile
- The destination file
DBException
- If a database error occurspublic void dumpTable(java.io.File toFile, DBSelect<gDBR> dsel) throws DBException
toFile
- The destination filedsel
- The selection specification indicating which records should be 'dumped'
DBException
- If a database error occurspublic void dumpTable(java.io.File toFile, DBSelect<gDBR> dsel, java.lang.String[] fldn) throws DBException
toFile
- The destination filedsel
- The selection specification indicating which records should be 'dumped'fldn
- A list of field names to include in the dump file
DBException
- If a database error occursprotected void _dumpTable(java.io.PrintWriter dumpOutStream, DBSelect<gDBR> dsel, java.lang.String[] fldn, int outFmt) throws DBException
dumpOutStream
- The destination output streamdsel
- The selection specification indicating which records should be 'dumped'outFmt
- The output format
DBException
- If unable to successfully dump the tablepublic long loadTable(java.io.File fromFile) throws DBException
fromFile
- The file containing the record data to load
DBException
- If a database error occurs@Deprecated public long loadTable(java.io.File fromFile, boolean insertRecords, boolean overwriteExisting) throws DBException
fromFile
- The file containing the record data to loadinsertRecords
- True to insert records, false otherwiseoverwriteExisting
- True to overwrite existing matching records
DBException
- If a database error occurspublic long loadTable(java.io.File fromFile, boolean insertRecords, boolean overwriteExisting, boolean noDropWarning) throws DBException
fromFile
- The file containing the record data to loadinsertRecords
- True to insert records, false otherwiseoverwriteExisting
- True to overwrite existing matching recordsnoDropWarning
- True to supress field "will be dropped" warnings.
DBException
- If a database error occurs@Deprecated public long loadTable(java.io.File fromFile, DBFactory.InsertionValidator validator, boolean insertRecords, boolean overwriteExisting) throws DBException
fromFile
- The file containing the record data to loadvalidator
- The InserstionValidator filter which determines whether a given record
should be inserted into the table.insertRecords
- True to insert records, false otherwiseoverwriteExisting
- True to overwrite existing matching records
DBException
- If unable to load the tablepublic long loadTable(java.io.File fromFile, DBFactory.InsertionValidator validator, boolean insertRecords, boolean overwriteExisting, boolean noDropWarning) throws DBException
fromFile
- The file containing the record data to loadvalidator
- The InserstionValidator filter which determines whether a given record
should be inserted into the table.insertRecords
- True to insert records, false otherwiseoverwriteExisting
- True to overwrite existing matching recordsnoDropWarning
- True to supress field "will be dropped" warnings.
DBException
- If unable to load the tableprotected long _loadTable(java.lang.String[] oldFieldNames, java.io.File fromFile, DBFactory.InsertionValidator validator, boolean insertRecords, boolean overwriteExisting, boolean noDropWarning) throws DBException
oldFieldNames
- A list of field names to use for insertion validation instead of the list
of field names present in the loaded file specification section.fromFile
- The file containing the record data to loadvalidator
- The InserstionValidator filter which determines whether a given record
should be inserted into the table.insertRecords
- True to insert records, false otherwiseoverwriteExisting
- True to overwrite existing matching recordsnoDropWarning
- True to supress field "will be dropped" warnings.
DBException
- If a database error occursprotected long _loadTableCSV(java.io.File fromFile, DBFactory.InsertionValidator validator, boolean insertRecords, boolean overwriteExisting, boolean noDropWarning) throws DBException
fromFile
- The CSV filevalidator
- The insertion validatoroverwriteExisting
- True to overwrite any existing db record, false to leave existing db record as-is
DBException
- If unable to load the tablepublic void addParentTable(java.lang.String utableName)
utableName
- The parent untranslated table namepublic java.util.List<java.lang.String> getParentTables()
public boolean hasParentTable(java.lang.String utableName)
utableName
- The parent untranslated table name to test
public DBFactory<? extends DBRecord>[] getChildFactories()
public java.lang.String getIndexType()
public boolean isMySQLInnoDB()
public boolean supportsEfficientCount()
public boolean getAllowInnoDBCOUNT()
public void setAllowInnoDBCOUNT(boolean countOK)
public long getRecordCount(java.lang.String where, boolean actualCount) throws DBException
where
- The 'where' selection clauseactualCount
- True to return actual record count, false for estimated (InnoDB only)
DBException
- If a database error occurspublic long getRecordCount(DBWhere where, boolean actualCount) throws DBException
where
- The 'where' selection clause
DBException
- If a database error occurspublic java.lang.StringBuffer toXML(java.lang.StringBuffer sb, int indent)
public java.lang.StringBuffer toXML(java.lang.StringBuffer sb, int indent, boolean soapXML)
public java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object other)
equals
in class java.lang.Object
other
- The other Object to test
public int hashCode()
hashCode
in class java.lang.Object
public void setRecordListener(DBRecordListener<gDBR> rcdListener)
public DBRecordListener<gDBR> getRecordListener()
public void recordWillInsert(gDBR rcd)
recordWillInsert
in interface DBRecordListener<gDBR extends DBRecord>
rcd
- The record about to be insertedpublic void recordDidInsert(gDBR rcd)
recordDidInsert
in interface DBRecordListener<gDBR extends DBRecord>
rcd
- The record that was just insertedpublic void recordWillUpdate(gDBR rcd)
recordWillUpdate
in interface DBRecordListener<gDBR extends DBRecord>
rcd
- The record about to be updatedpublic void recordDidUpdate(gDBR rcd)
recordDidUpdate
in interface DBRecordListener<gDBR extends DBRecord>
rcd
- The record that was just updatedprotected static java.lang.String _beanMethodName(java.lang.String prefix, java.lang.String fieldName)
prefix
- The "get" or "set" prefixfieldName
- The field name
protected static java.lang.String _methodScope(int mods)
mods
- The method modifications
public java.util.List validateFieldBeanMethods(DBField field)
field
- The DBField to validate
public void validateTableBeanMethods()
public static java.lang.StringBuffer writeXML_DBFields(java.lang.StringBuffer sb, int indent, DBField[] fld, DBFieldValues fldVals)
sb
- The StringBuffer to write the tag toindent
- The number of spaces to indentfld
- The DBFields to includefldVals
- The field column values
public static java.lang.StringBuffer writeXML_DBFields(java.lang.StringBuffer sb, int indent, DBField[] fld, DBFieldValues fldVals, boolean soapXML)
sb
- The StringBuffer to write the tag toindent
- The number of spaces to indentfld
- The DBFields to includefldVals
- The field column valuessoapXML
- True if SOAP XML
public static java.lang.StringBuffer writeXML_DBField(java.lang.StringBuffer sb, int indent, DBField fld, boolean inclInfo, java.lang.String value)
sb
- The StringBuffer to write the tag toindent
- The number of spaces to indentfld
- The DBField to create a tag forinclInfo
- True if field datatype/description should be includedvalue
- The value of the tag element
public static java.lang.StringBuffer writeXML_DBField(java.lang.StringBuffer sb, int indent, DBField fld, boolean inclInfo, java.lang.String value, boolean soapXML)
sb
- The StringBuffer to write the tag toindent
- The number of spaces to indentfld
- The DBField to create a tag forinclInfo
- True if field datatype/description should be includedvalue
- The value of the tag elementsoapXML
- True is SOAP XML
public static DBFactory parseXML_DBFactory(org.w3c.dom.Element node, java.lang.String... nodeNames) throws DBException
node
- The XML nodenodeNames
- A list of valid/expected node names
DBException
- if unable to create the DBFactorypublic static java.util.Map<java.lang.String,java.lang.String> parseXML_FieldValueMap(org.w3c.dom.Element node, DBFactory tableFact) throws DBException
node
- The XML node
DBException
- if unable to create the field value mappublic static DBRecordKey<?> parseXML_DBRecordKey(org.w3c.dom.Element rcdTag) throws DBException
rcdTag
- The XML node representing a "RecordKey" tag
DBException
- if unable to create the DBRecordKeypublic static DBRecord<?> parseXML_DBRecord(org.w3c.dom.Element rcdTag) throws DBException
rcdTag
- The XML node representing a "Record" tag
DBException
- if unable to create the DBRecord
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |