|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.tivoli.twg.engine.TWGObject
com.tivoli.twg.engine.TWGPersistentObject
com.tivoli.twg.engine.TWGDatabaseTable
TWGDatabaseTable: The abstract base class for all database tables in the Director Server database. To subclass this class you must override the create and getTableVersion methods. In addition every subclass must have a column called MANAGED_OBJ_ID. The physical database tables will be created during Director Server initialization. Changes: 03/19/99, Dennis Brown: - changed DEFAULT_GRAPHIC_NAME to an actual file name - make validChars public so UserTableFactory could use it
Field Summary | |
---|---|
static java.lang.String |
CLASSNAME
|
static java.lang.String[] |
DbKeyWords
|
static java.lang.String |
DEFAULT_TABLE_BUNDLE_NAME
|
static java.lang.String |
MANAGED_OBJ_ID
|
static java.lang.String |
validChars
|
Fields inherited from class com.tivoli.twg.engine.TWGPersistentObject |
---|
CLASS_NAME, SIZEOF_BYTE, SIZEOF_CHAR, SIZEOF_DOUBLE, SIZEOF_FLOAT, SIZEOF_INT, SIZEOF_LONG, SIZEOF_SHORT |
Constructor Summary | |
---|---|
TWGDatabaseTable()
Default constructor. |
Method Summary | |
---|---|
abstract void |
create()
Abstract method must be overriden by subclass to define the table. |
int |
deleteManagedObject(long managed_obj_id,
TWGDbConnection conn)
Delete all rows with specified managed object id. |
void |
deleteTable(TWGDbConnection conn)
Method to delete the physical database table. |
static TWGDatabaseTable |
findTableByClassName(java.lang.String table_class)
Class method to get a reference to a TWGDatabaseTable by searching on class name. |
void |
flatten(TWGByteArrayOutputStream data)
Write table contents to a byte array. |
java.util.Vector |
getAllFullColumnNames()
Gets the full names of columns in the table. |
java.lang.String |
getAllTrue(java.util.Locale loc)
Get the translated "all true" prompt string |
java.lang.String |
getAllTrueForSame(java.util.Locale loc)
Get the translated "all true for same" prompt string |
java.lang.String |
getAnyTrue(java.util.Locale loc)
Get the translated "any true" prompt string |
java.lang.String |
getBundleName()
Returns the bundle name for this database table. |
java.lang.String |
getBundleString(java.lang.String bundleKey,
java.util.Locale loc)
Get the value for a bundle string key |
TWGDbColumn |
getColumn(java.lang.String token)
Get a table column by column token name |
TWGDbColumn |
getColumnByColumnRealName(java.lang.String realName)
Get a table column by column real name |
int |
getColumnLength(java.lang.String token)
Get the number of characters in the column specified. |
java.util.Vector |
getColumnLength(java.util.Vector ColumnTokens)
Get number of characters in columns specified. |
java.util.Vector |
getColumnLengths()
Get the number of characters for each column in the table. |
java.util.Enumeration |
getColumns()
Get database table columns |
int |
getColumnType(java.lang.String token)
Get the data type for specified column. |
java.util.Vector |
getColumnType(java.util.Vector ColumnTokens)
Get data types for columns specified. |
java.util.Vector |
getColumnTypes()
Get data types for all the columns in the table. |
TWGDatabase |
getDatabase()
Get the database that the table is in. |
java.lang.Object |
getDefaultValue(java.lang.String token)
Get the default value for the specified column |
java.util.Vector |
getDefaultValue(java.util.Vector ColumnTokens)
Get default values for specified columns |
java.util.Vector |
getDefaultValues()
Get the default values for each column. |
java.lang.String |
getDisplayColumnName(java.lang.String token,
java.util.Locale loc)
Get the displayable translated name for a table column. |
java.util.Vector |
getDisplayFullColumnNames(java.util.Locale loc)
Get the displayable translated table and column name pairs for all columns. |
java.lang.String |
getDisplayName(java.util.Locale loc)
Get the translated table name for display. |
java.lang.String[] |
getDisplayValues(java.lang.String column,
java.lang.String[] values,
java.util.Locale loc)
Get the translated display values for a list of values in a string (CHAR or VARCHAR) column. |
java.lang.String |
getEachTrueForAtLeastOne(java.util.Locale loc)
Get the translated "each true for at least one" prompt string |
java.util.Vector |
getFilterColumns(java.util.Locale loc)
Get all columns that are filter columns. |
java.lang.String |
getFilterPrompt(java.lang.String promptKey,
java.util.Locale loc)
Look up filter prompt string in resource bundle. |
java.lang.String |
getFilterSQL(TWGDbColumnFilter columnFilter)
Build SQL for WHERE clause of a query. |
java.lang.String |
getGraphicName()
Get name of the icon graphic for this table. |
java.util.Vector |
getKey()
Get the token column names for each key field. |
IntValueSet |
getMatchingMoids(TWGFilterConstraint filterConstraint,
TWGDbConnection conn,
IntValueSet moids)
This method implements the ALL_FOR_SAME_ADDRESS and for filters that have columns that require special processing. |
MultiLocaleBundle |
getMultiLocaleBundle()
Get the bundle string key |
protected static java.lang.String |
getMyClassName(java.lang.Object objectVariable)
This method is protected as an implementation side effect. |
int |
getNumberOfColumns()
Get the number of columns in the table. |
java.lang.String |
getRealColumnName(java.lang.String token)
Get the real name for the specified column. |
java.util.Vector |
getRealColumnName(java.util.Vector ColumnTokens)
Get real names for columns specified. |
java.util.Vector |
getRealColumnNames()
Get all real column names. |
java.lang.String |
getRealName()
Get the real table name. |
java.lang.String |
getShortClassName()
The getBundleString requires that the key use the last piece of the class name to identify the table. |
static TWGDatabaseTable |
getTable(java.lang.String tokenName)
Class method to get a reference to a TWGDatabaseTable object. |
static TWGDatabaseTable |
getTableBy(java.lang.String shortClassName)
The resource bundles refer to tables by a shortened class name. |
static TWGDatabaseTable |
getTableByRealTableName(java.lang.String tableRealName)
Class method to get a reference to a TWGDatabaseTable object by table real name. |
TWGDbTableReply |
getTableInfo(java.util.Locale loc)
Gets descriptive information about this table including translated titles |
protected MultiLocaleBundle |
getTableMultiLocaleBundle(java.lang.String bundleName)
Get the requested multi-locale resource bundle |
java.lang.String |
getTableName()
Method to return the table name. |
static java.util.Hashtable |
getTables()
Class method to get a hashtable that contains references for all table object. |
abstract java.lang.String |
getTableVersion()
Abstract method must be overriden by subclass to get the version for table |
java.util.Vector |
getTokenColumnNames()
Get all column token names. |
java.lang.String |
getTokenName()
Get the token table name. |
int |
insertOrDeleteRow(Vect columnTokens,
Vect columnValues,
TWGDbConnection conn,
boolean update_only,
boolean delete_only)
The instance method inserts or deletes a row into the table. |
int |
insertRow(Vect columnTokens,
Vect columnValues,
TWGDbConnection conn)
The instance method inserts a row into the table. |
boolean |
isFilterColumn(java.lang.String token)
Is the column to be displayed in the group edit (filter) panels as a selectable column? |
boolean |
isMappedColumn(java.lang.String token)
Are the values for the specified column mapped to translated values in a resource bundle? |
protected void |
restoreData(TWGPersistentObjectDictionary dict,
boolean do_resolve)
Restore method for database table object |
protected void |
saveData(TWGPersistentObjectDictionary dict)
Method for saving persistent object data. |
void |
setShortTableName(java.lang.String shortTableName)
Specify the name of the table if short names are required |
java.lang.String |
toString()
Convert Table to String for debug |
void |
TWGInitTable(java.lang.String dbName,
java.lang.String tokenName,
java.lang.String realName,
TWGDbColumnData colData,
TWGDbTableParms parms,
java.lang.String bundleName)
TWGDatabaseTable initialization for a table This method initializes the instance variables, checks that the real database table name and token table name are unique within the database, and runs SQL to create the table and any indices in the database. |
protected java.lang.String |
userTableFixClassName(java.lang.String className)
If className is "TWGDbUserTable" then the user table token name is added to it, so that NLS works--all keys in the resource bundles use TWGDBUserTable?tabletoken as the classname. |
Methods inherited from class com.tivoli.twg.engine.TWGPersistentObject |
---|
Destroy, enableAsyncWrites, fromPersistID, initialize, isNewPersistentStore, isSaveRequired, PersistID, restore, restoreAll, save, save, setSaveRequired, terminate, toPersistID |
Methods inherited from class com.tivoli.twg.engine.TWGObject |
---|
AllObjects, AllObjects, Delete, DumpTWGObjects, FindObject, isDeleted, isNewObject, isPersistent, isPersistent, isValid, isValid, ObjectID, setDistinctObjectID, SetObjectID |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final java.lang.String CLASSNAME
public static final java.lang.String DEFAULT_TABLE_BUNDLE_NAME
public static final java.lang.String MANAGED_OBJ_ID
public static final java.lang.String validChars
public static final java.lang.String[] DbKeyWords
Constructor Detail |
public TWGDatabaseTable()
Method Detail |
public abstract void create() throws TWGDbException
TWGDbException
public abstract java.lang.String getTableVersion()
public void TWGInitTable(java.lang.String dbName, java.lang.String tokenName, java.lang.String realName, TWGDbColumnData colData, TWGDbTableParms parms, java.lang.String bundleName) throws TWGDbRealTableNameNotUniqueException, TWGDbTokenTableNameNotUniqueException, TWGDbException
dbName
- - the identifier of the Director database in which the table will be
created. Currently TWGDatabase.TWG_DB_NAME is the only database
defined.tokenName
- - the proposed token name for the table.realName
- - the proposed real name for the table. Name will be set to upper
casecolData
- - An object describing the database columns. There must be a column
called MANAGED_OBJ_ID in each subclass.parms
- - optional table parametersbundleName
- - the name of the resource bundle that stores displayable table names,
column names, column values for mapped columns, and prompt strings
TWGDbException
- - general database exception
TWGDbRealTableNameNotUniqueException
- - real table name already in use
TWGDbTokenTableNameNotUniqueException
- - token table name already in useTWGDbColumnData
,
TWGDbTableParms
public static TWGDatabaseTable getTable(java.lang.String tokenName) throws TWGDbException
TWGDbException
- if table not foundpublic static TWGDatabaseTable getTableBy(java.lang.String shortClassName) throws TWGDbException
shortClassName
- - short class name ( used in resource bundles.)
TWGDbException
- if table not foundgetShortClassName
public static TWGDatabaseTable getTableByRealTableName(java.lang.String tableRealName)
tableRealName
- - table real name for the table
public static java.util.Hashtable getTables()
public static TWGDatabaseTable findTableByClassName(java.lang.String table_class) throws TWGDbException
table_class
- the class name for the table
TWGDbException
- for database exceptionsprotected MultiLocaleBundle getTableMultiLocaleBundle(java.lang.String bundleName)
bundleName
- - the name of the resource bundle used for translating table data
protected static java.lang.String getMyClassName(java.lang.Object objectVariable)
objectVariable
- - reference to an object
public java.lang.String getShortClassName()
protected java.lang.String userTableFixClassName(java.lang.String className)
className
- the classname to fix
public void deleteTable(TWGDbConnection conn) throws TWGDbException
conn
- - a connection to the database
TWGDbException
public int insertRow(Vect columnTokens, Vect columnValues, TWGDbConnection conn) throws TWGDbException
columnTokens
- - a list of column token names provided for the rowcolumnValues
- - values for the corresponding columns. If not all
columns are provided, use default values for non-key
columns.conn
- - a TWGDbConnection to the database
TWGDbException
TWGDbConnection
public int insertOrDeleteRow(Vect columnTokens, Vect columnValues, TWGDbConnection conn, boolean update_only, boolean delete_only) throws TWGDbException
columnTokens
- - a list of column token names provided for the rowcolumnValues
- - values for the corresponding columns. If not all
columns are provided, use default values for non-key
columns.conn
- - a TWGDbConnection to the databaseupdate_only
- - only do update if set, try insert first if cleardelete_only
- - only do delete if set, do insert or update if clear
TWGDbException
TWGDbConnection
public int deleteManagedObject(long managed_obj_id, TWGDbConnection conn) throws TWGDbException
managed_obj_id
- - the managed object id whose rows should be deletedconn
- - a connection to the database
TWGDbException
public java.lang.String getFilterSQL(TWGDbColumnFilter columnFilter) throws TWGDbException
columnFilter
- - the column filter
TWGDbException
TWGDbColumnFilter
public int getNumberOfColumns()
public boolean isMappedColumn(java.lang.String token) throws TWGDbException
token
- - token name for the column
TWGDbException
public boolean isFilterColumn(java.lang.String token) throws TWGDbException
token
- - token name for the column
TWGDbException
public TWGDbTableReply getTableInfo(java.util.Locale loc) throws TWGDbException
loc
- - the Locale for translations
TWGDbException
TWGDbTableReply
public TWGDbColumn getColumn(java.lang.String token) throws TWGDbException
token
- - the column token name
TWGDbException
public TWGDbColumn getColumnByColumnRealName(java.lang.String realName) throws TWGDbException
realName
- - the column real name
TWGDbException
- if column not foundpublic java.util.Vector getColumnType(java.util.Vector ColumnTokens) throws TWGDbException
ColumnTokens
- - a list of column token names.
-TWGDbException
TWGDbException
TWGDatabase
public int getColumnType(java.lang.String token) throws TWGDbException
TWGDbException
TWGDatabase
public java.util.Vector getColumnTypes() throws TWGDbException
TWGDbException
TWGDatabase
public java.util.Vector getRealColumnName(java.util.Vector ColumnTokens) throws TWGDbException
ColumnTokens
- - a list of column token names.
-TWGDbException
TWGDbException
public java.lang.String getRealColumnName(java.lang.String token) throws TWGDbException
token
- - the token name for the column.
TWGDbException
public java.util.Vector getRealColumnNames() throws TWGDbException
-TWGDbException
TWGDbException
public java.util.Vector getDisplayFullColumnNames(java.util.Locale loc) throws TWGDbException
-TWGDbException
TWGDbException
public java.lang.String getDisplayColumnName(java.lang.String token, java.util.Locale loc) throws TWGDbException
token
- - the token name for the tableloc
- - the locale for the translation
TWGDbException
public java.util.Vector getTokenColumnNames() throws TWGDbException
-TWGDbException
TWGDbException
public java.util.Vector getAllFullColumnNames() throws TWGDbException
TWGDbException
public java.util.Vector getFilterColumns(java.util.Locale loc) throws TWGDbException
loc
- - the Locale for translations
TWGDbException
public java.util.Vector getColumnLength(java.util.Vector ColumnTokens) throws TWGDbException
ColumnTokens
- - a list of column token names.
-TWGDbException
TWGDbException
public int getColumnLength(java.lang.String token) throws TWGDbException
token
- - column token name
TWGDbException
public java.util.Vector getColumnLengths() throws TWGDbException
-TWGDbException
TWGDbException
public java.util.Vector getDefaultValue(java.util.Vector ColumnTokens) throws TWGDbException
ColumnTokens
- - a list of column token names.
-TWGDbException
TWGDbException
public java.lang.Object getDefaultValue(java.lang.String token) throws TWGDbException
token
- - column token name
TWGDbException
public java.util.Vector getDefaultValues() throws TWGDbException
-TWGDbException
TWGDbException
public java.util.Vector getKey()
public TWGDatabase getDatabase()
public java.lang.String getRealName()
public java.lang.String getTokenName()
public java.lang.String getDisplayName(java.util.Locale loc)
loc
- - the locale for the translation
public java.lang.String getFilterPrompt(java.lang.String promptKey, java.util.Locale loc)
promptKey
- - the id of the prompt we are looking for. One of
loc
- - the locale for the user
public java.lang.String getAllTrue(java.util.Locale loc)
loc
- - the locale for the user
public java.lang.String getAnyTrue(java.util.Locale loc)
loc
- - the locale for the user
public java.lang.String getAllTrueForSame(java.util.Locale loc)
loc
- - the locale for the user
public java.lang.String getEachTrueForAtLeastOne(java.util.Locale loc)
loc
- - the locale for the user
public java.lang.String[] getDisplayValues(java.lang.String column, java.lang.String[] values, java.util.Locale loc)
column
- - the token name for the columnvalues
- - the values to look up the display valuesloc
- - the locale
public java.lang.String getBundleString(java.lang.String bundleKey, java.util.Locale loc) throws java.util.MissingResourceException
loc
- - locale
java.util.MissingResourceException
public MultiLocaleBundle getMultiLocaleBundle() throws java.util.MissingResourceException
java.util.MissingResourceException
public java.lang.String getGraphicName()
public void flatten(TWGByteArrayOutputStream data) throws TWGPersistentObjectSaveException
data
- - the TWGByteArrayOutputStream
TWGPersistentObjectSaveException
protected void saveData(TWGPersistentObjectDictionary dict) throws TWGPersistentObjectSaveException
saveData
in class TWGPersistentObject
dict
- - dictionary used to accumulate data
TWGPersistentObjectSaveException
- thrown to
abort save procedure.protected void restoreData(TWGPersistentObjectDictionary dict, boolean do_resolve) throws TWGPersistentObjectRestoreException
restoreData
in class TWGPersistentObject
dict
- - dictionary containing data to be restoreddo_resolve
- - true if second pass of restore (do resolve)
TWGPersistentObjectRestoreException
- if restore abortedpublic void setShortTableName(java.lang.String shortTableName)
shortTableName
- - name of table if short names requiredpublic java.lang.String toString()
public java.lang.String getTableName()
public java.util.Enumeration getColumns()
public IntValueSet getMatchingMoids(TWGFilterConstraint filterConstraint, TWGDbConnection conn, IntValueSet moids)
filterConstraint
- - filter constraint that describes the filterconn
- - the TWGDbConnection to use for the database querymoids
- - this is the list of moids to check for inclusion in the
filter. If the moids value is null, then check all against
all moids.
public java.lang.String getBundleName()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |