|
|||||||||||
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.TWGDatabaseQuery
The TWGDatabaseQuery class is used to define queries on the Director database. These * queries can be saved queries (their definition is retained in the Director persistent store), or non-saved queries which are executed once and not retained. There are two types of saved queries:
Both default and user-defined queries are viewable using the Director inventory query browser.
There are two format options available for all queries:
The join format is not recommended when two or more tables in the query have multiple rows per managed object, since the output is not user-friendly. For example if table A has four rows per managed object and table B has three, the query result will have twelve rows for that managed object (all possible combinations).
Join format is recommended when doing single table queries or queries where a table with one row per managed object is joined with another that has one or more rows per managed object.
More complex queries should either be broken down into multiple join format queries (such as one per table) or the report format should be used.
Field Summary | |
---|---|
static int |
JOIN_FORMAT
Query format where multiple tables are joined on MANAGED_OBJ_ID when the database query is executed. |
static int |
REPORT_FORMAT
Query format where each table is queried separately. |
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 | |
---|---|
TWGDatabaseQuery()
|
|
TWGDatabaseQuery(TWGDbQueryParms query_parms)
Constructor for TWGDatabaseQuery. |
Method Summary | |
---|---|
void |
changeQuery(TWGDbQueryParms query_parms)
The method to change the query definition. |
void |
Destroy()
Destroy the TWGDatabaseQuery object. |
static TWGDatabaseQuery |
findQueryByIdString(java.lang.String id)
Get a reference to a default TWGDatabaseQuery object by id_string. |
java.lang.String[] |
getAttributeIDList()
Attribute ID enumeration : this method is expected to return a list of strings containing the String names of the attributes supported for a given object. |
int |
getAttributeType(java.lang.String id)
Get type of attribute value for given attribute |
DataValue |
getAttributeValue(java.lang.String id,
java.util.Locale loc)
Get value of attribute with given ID |
java.lang.String |
getBundleKey()
Get the key for the resource bundle for the query name. |
java.lang.String |
getBundleName()
Get the name of the resource bundle used by this query for translating the query name for default queries. |
protected java.lang.String |
getBundleString(java.lang.String bundleKey,
java.util.Locale loc)
Look up a value in the resource bundle |
TWGDatabase |
getDatabase()
Get a reference to the database the query is in. |
java.lang.String |
getDatabaseName()
Get the database name which the query is in. |
boolean |
getDefault()
Is the query a default query |
int |
getFormat()
Method to get the query format. |
java.lang.String |
getGroupName()
The class method gets the group name that is associated with the database query. |
java.lang.String |
getIdString()
Get the id string for the query. |
static java.util.Enumeration |
getIdStrings()
Get id strings for all the queries that have id strings. |
protected TWGDbQueryReply |
getMyQueryInfo(java.util.Locale loc)
The instance method gets a TWGDbQueryReply object which contains information about the query. |
protected static int |
getNumberOfQueries()
Get the number of existing saved queries. |
static TWGDatabaseQuery |
getQuery(long queryId)
The class method gets a reference to a TWGDatabaseQuery object. |
static TWGDatabaseQuery |
getQuery(java.lang.Long queryId)
The class method gets a reference to a TWGDatabaseQuery object. |
java.lang.String |
getQueryDisplayName()
Get the display name for the query. |
java.lang.Long |
getQueryId()
Get the persistent object id for the query. |
protected static java.util.Enumeration |
getQueryIds()
Get all the query persistent object ids. |
static java.util.Enumeration |
getQueryObjects()
Gets an enumeration of all TWGDatabaseQuery objects. |
TWGDbQueryParms |
getQueryParms()
Get a the query parameters used to create this query |
protected Vect |
getSelectedFields()
Gets list of selected field names for the query. |
StringValueSet |
getTableClasses()
Get the list of table class names for the tables used in this query |
protected boolean |
isCopiedQuery()
Get whether the query is the copy of a default query. |
static void |
removeQueryByIdString(java.lang.String id_string)
Remove a TWGDatabaseQuery object from the default queries query by specifying the query id string. |
protected void |
restoreData(TWGPersistentObjectDictionary dict,
boolean do_resolve)
Restore method for database query object |
void |
run(TWGDbResultSet trs,
Vect reportResultSet,
LongValueSet managed_obj_id,
java.util.Locale loc)
Method for running query with passed list of managed object ids. |
protected void |
saveData(TWGPersistentObjectDictionary dictionary)
Method for saving persistent object data. |
boolean |
setAttributeValue(java.lang.String id,
DataValue val)
Set value of attribute with given ID |
protected void |
setCopiedQuery(boolean isClone)
Set whether the query is the copy of another one. |
protected void |
setGroupName(java.lang.String groupName)
Sets group string value. |
protected void |
setIdString(java.lang.String idString)
Sets id string value. |
protected void |
setQueryDisplayName()
Set the query display name using default locale as input. |
protected void |
setQueryDisplayName(java.util.Locale queryLocale)
Set the query display name. |
java.lang.String |
toString()
Convert object to String for debug |
boolean |
verify()
Verify the validity of this query Database queries have the validity of tables and columns checked. |
protected static void |
verifyAll()
Run the verify method for each database query. |
Methods inherited from class com.tivoli.twg.engine.TWGPersistentObject |
---|
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 int JOIN_FORMAT
public static final int REPORT_FORMAT
Constructor Detail |
public TWGDatabaseQuery()
public TWGDatabaseQuery(TWGDbQueryParms query_parms) throws TWGDbException
query_parms
- - the query parameters
TWGDbException
TWGDbQueryParms
Method Detail |
public static TWGDatabaseQuery getQuery(java.lang.Long queryId) throws TWGDbQueryNotFoundException
queryId
- - the persistent object id
TWGDBException
TWGDbQueryNotFoundException
public static TWGDatabaseQuery getQuery(long queryId) throws TWGDbQueryNotFoundException
queryId
- - the persistent object id
TWGDBException
TWGDbQueryNotFoundException
protected static int getNumberOfQueries()
public static TWGDatabaseQuery findQueryByIdString(java.lang.String id)
id
- - id string used to identify default query.
public static java.util.Enumeration getQueryObjects()
protected static java.util.Enumeration getQueryIds()
public static java.util.Enumeration getIdStrings()
protected Vect getSelectedFields() throws TWGDbException
This method is protected as an implementation side effect. Do not call or change. Its interface may be changed in a later release.
TWGDbException
protected void setIdString(java.lang.String idString)
idString
- - id stringprotected void setGroupName(java.lang.String groupName)
groupName
- - group name for querypublic java.lang.String getIdString()
public int getFormat()
public java.lang.String getGroupName()
public static void removeQueryByIdString(java.lang.String id_string)
id_string
- - the unique string identification for default queries.public java.lang.String getBundleName()
public java.lang.String getBundleKey()
protected java.lang.String getBundleString(java.lang.String bundleKey, java.util.Locale loc) throws java.util.MissingResourceException
loc
- - locale for the bundle
java.util.MissingResourceException
protected void setQueryDisplayName(java.util.Locale queryLocale)
queryLocale
- - Locale for translating the query.protected void setQueryDisplayName()
public boolean getDefault()
public java.lang.String getQueryDisplayName()
public java.lang.String getDatabaseName()
public TWGDatabase getDatabase() throws TWGDbException
TWGDbException
TWGDatabase
public java.lang.Long getQueryId()
protected boolean isCopiedQuery()
protected void setCopiedQuery(boolean isClone)
isClone
- - true if the query is the copy of the other one. False if not.public TWGDbQueryParms getQueryParms() throws TWGDbException
TWGDbException
- if unable to create a TWGDbQueryParms objectTWGDbQueryParms
public void changeQuery(TWGDbQueryParms query_parms) throws TWGDbException
TWGDbException
TWGDbQueryParms
public void run(TWGDbResultSet trs, Vect reportResultSet, LongValueSet managed_obj_id, java.util.Locale loc) throws TWGDbException
trs
- - output parameter to contain the result set returned after the query running.reportResultSet
- - Vect used as output parameter to contain list of result set and it's meta data
for each subquery for each table.managed_obj_id
- - a reference to a LongValueSet object indicating a list managed object ids.loc
- - Locale of the caller console.
TWGDbException,
- TWGDbException
TWGDbException
TWGDbResultSet
,
com.tivoli.twg.libs.IntSortSet.
protected TWGDbQueryReply getMyQueryInfo(java.util.Locale loc) throws TWGDbException
TWGDbException
TWGDbQueryReply
public StringValueSet getTableClasses()
protected static void verifyAll()
public boolean verify()
protected void saveData(TWGPersistentObjectDictionary dictionary) throws TWGPersistentObjectSaveException
saveData
in class TWGPersistentObject
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 Destroy() throws TWGObjectDestroyException
Destroy
in class TWGPersistentObject
TWGObjectDestroyException
- if error during destroypublic java.lang.String toString()
public java.lang.String[] getAttributeIDList()
getAttributeIDList
in interface TWGGetSetInterface
public DataValue getAttributeValue(java.lang.String id, java.util.Locale loc)
getAttributeValue
in interface TWGGetSetInterface
id
- - attribute ID requestedloc
- - locale to use for value, if applicable
public boolean setAttributeValue(java.lang.String id, DataValue val)
setAttributeValue
in interface TWGGetSetInterface
id
- - attribute ID to be setval
- - attribute value to be set
public int getAttributeType(java.lang.String id)
getAttributeType
in interface TWGGetSetInterface
id
- - attribute ID
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |