com.tivoli.twg.engine
Class TWGDbQueryParms

java.lang.Object
  extended bycom.tivoli.twg.engine.TWGDbQueryParms
All Implemented Interfaces:
java.io.Serializable

public class TWGDbQueryParms
extends java.lang.Object
implements java.io.Serializable

The TWGDbQueryParms class contains the parameters to create a query. It is used in the create query and change query commands.

All tables used in a query must be from one physical Director database.

See Also:
Serialized Form

Constructor Summary
protected TWGDbQueryParms(byte[] buf)
          Constructor for the TWGDbQueryParms class using an intel byte buffer format of a TWGDbQueryParms object as input.
  TWGDbQueryParms(java.lang.String select_field)
          Constructor for the TWGDbQueryParms class.
  TWGDbQueryParms(java.lang.String[] select_fields)
          Constructor for the TWGDbQueryParms class that specifies multiple selected fields (columns).
  TWGDbQueryParms(java.lang.String[] select_fields, java.lang.String database_name)
          Constructor for the TWGDbQueryParms class that specifies multiple selected fields (columns) and a specific database.
  TWGDbQueryParms(java.lang.String select_field, java.lang.String database_name)
          Constructor for the TWGDbQueryParms for a query that uses one table column and specifies a database.
  TWGDbQueryParms(java.util.Vector select_fields)
          Constructor for the TWGDbQueryParms class that specifies multiple selected fields (columns).
  TWGDbQueryParms(java.util.Vector select_fields, java.lang.String database_name)
          Constructor for the TWGDbQueryParms class that specifies multiple selected fields (columns) and a specific database.
  TWGDbQueryParms(Vect select_fields, java.lang.String database_name)
          Constructor for the TWGDbQueryParms class that specifies multiple selected fields (columns) and a specific database.
 
Method Summary
 void addSelectFields(java.lang.String[] select_fields)
          Add additional select fields to the current select fields for the query.
 void addSelectFields(Vect select_fields)
          Add additional select fields to the current select fields for the query.
 void addSelectFields(java.util.Vector select_fields)
          Add additional select fields to the current select fields for the query.
 void changeDatabaseName(java.lang.String dbName)
          Set the database name the tables in the query are in.
 TWGDbColumnFilter getColumnFilter()
          Get the column filter for the query.
protected  TWGDbColumnFilter getColumnFilterByTable(java.lang.String tableName)
          Method to get column filter for a specific table in the query.
 java.lang.String getDatabaseName()
          Get the database name that all the tables in the query are in.
 boolean getDefault()
          Is the query a default query?
 boolean getDistinctRows()
          Are distinct rows to be returned in the query results (duplicate rows omitted).
protected  int[] getFieldsByTable(java.lang.String tableName, Vect queryColumnIds, java.util.Vector fields)
          Method to get list of TWGDbQueryField objects used for the select fields in the query for a table.
 int getFormat()
          Method to get the query format.
 java.lang.String getGroupName()
          Get the group name which is used to group queries.
 java.lang.String getIdString()
          Get the id string which is used to uniquely identify a default queries.
protected  Vect getListTableTokens()
          Method to get list of the token names of tables to select fields from.
 java.lang.String getQueryDisplayName()
          This method applies to user defined queries to get the query name user provides.
 java.lang.String getQueryGraphic()
          Get the icon name for the query
 int getQueryParmBufLen()
          Get length of buffer containing information about query parms.
 java.lang.String getResourceBundleKey()
          Get resource bundle key for default query to get the localized query name.
 java.lang.String getResourceBundleName()
          Get the resource bundle base class name for the default query.
 boolean getSavedQuery()
          Is this a saved query
 java.util.Vector getSelectFields()
          Get a list of TWGDbQueryField objects which contain the selected columns in the query.
 Vect getSelectFieldsInVect()
          Get a list of TWGDbQueryField objects as a Vect
 java.util.Vector getSortFields()
          Get a list of TWGDbQueryField objects that aontain the column fields by which to sort the result set of the query
protected  java.util.Vector getSortFieldsByTable(java.lang.String tableName)
          Method to get list of TWGDbQueryField objects used to sort the query for a table.
 Vect getSortFieldsInVect()
          Get a list of TWGDbQueryField objects which contain the column fields by which to sort the result set of the query
 boolean getTranslateValues()
          Are column values returned in this query to be translated for columns that support translation or enumeration.
protected  java.lang.String getUserId()
          Get the user id for the query.
 void setColumnFilter(TWGDbColumnFilter columnFilter)
          Set column filter used to select specific table rows base on the values in a column.
 void setDefault(boolean isDefaultQuery)
          Set true if the query is default query created by an Director extension, false if the query is user defined.
 void setFormat(int queryFormat)
          Method to set the query format.
 void setGraphic(java.lang.String queryGraphic)
          Set the name of the icon for the query
 void setGroupName(java.lang.String groupName)
          Set the group name of the query.
 void setIdString(java.lang.String id_string)
          Set the id string which is used to uniquely identify default queries.
 void setIntelByteBufferParms(Command cmd)
          This method is public as an implementation side effect.
 void setQueryDisplayName(java.lang.String queryDisplayName)
          Set the display name of the query.
 void setResourceBundleKey(java.lang.String key)
          Set resource bundle key for default query to get the localized query name.
 void setResourceBundleName(java.lang.String resourceBundleName)
          Set the resource bundle base class name for the default query.
 void setRowDistinct(boolean distinctRows)
          Set true, if entire duplicate rows are omitted in result set.
 void setSavedQuery(boolean savedQuery)
          Set true to save the query and false not to save the query.
 void setSelectFields(java.lang.String[] select_fields)
          Set the selected fields for the query
 void setSelectFields(Vect select_fields)
          Set the selected fields for the query
 void setSelectFields(java.util.Vector select_fields)
          Set the selected fields for the query.
 void setSortField(java.lang.String sort_field)
          Method to set column field by which to sort the result set.
 void setSortField(Vect sort_fields)
          Method to set column fields by which to sort the result set.
 void setSortField(java.util.Vector sort_fields)
          Method to set column fields by which to sort the result set.
 void setTranslateValues(boolean translateValues)
          Set true to translate the values of the query result set into the specific language or enumeration and false to keep the raw original values.
protected  void setUserId(java.lang.String userId)
          Sets user id for the query.
 java.lang.String toString()
          Convert object to String for debug
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TWGDbQueryParms

public TWGDbQueryParms(java.lang.String select_field,
                       java.lang.String database_name)
                throws TWGDbException
Constructor for the TWGDbQueryParms for a query that uses one table column and specifies a database. Valid database names are found in TWGDatabaseConstants

Parameters:
select_field - - The selected column name. It should be column full name. The format is 'table_token_name.column_token_name'
database_name - - database name in which the query is.
See Also:
com.tivoli.twg.engine.TWGDatabaseconstants

TWGDbQueryParms

public TWGDbQueryParms(java.lang.String select_field)
                throws TWGDbException
Constructor for the TWGDbQueryParms class. The default Director database is used

Parameters:
select_field - - The selected column name. The format should be 'table_token_name.column_token_name'

TWGDbQueryParms

public TWGDbQueryParms(java.util.Vector select_fields,
                       java.lang.String database_name)
                throws TWGDbException
Constructor for the TWGDbQueryParms class that specifies multiple selected fields (columns) and a specific database. All tables used in a query must be in the same physical database.

Parameters:
select_fields - - Vector of TWGDbQueryField or String objects. The format for strings must be "table_token_name.column_token_name"
database_name - - database name in which the query is.
See Also:
TWGDbQueryField

TWGDbQueryParms

public TWGDbQueryParms(Vect select_fields,
                       java.lang.String database_name)
                throws TWGDbException
Constructor for the TWGDbQueryParms class that specifies multiple selected fields (columns) and a specific database. All tables used in a query must be in the same physical database.

Parameters:
select_fields - - Vect of TWGDbQueryField or String objects. The format for strings must be "table_token_name.column_token_name"
database_name - - database name in which the query is.
See Also:
TWGDbQueryField, Vect

TWGDbQueryParms

public TWGDbQueryParms(java.util.Vector select_fields)
                throws TWGDbException
Constructor for the TWGDbQueryParms class that specifies multiple selected fields (columns). The default Director database is used. All tables used in a query must be in the same physical database.

Parameters:
select_fields - - Vector of TWGDbQueryField or String objects. The format for strings must be "table_token_name.column_token_name"
See Also:
TWGDbQueryField

TWGDbQueryParms

public TWGDbQueryParms(java.lang.String[] select_fields,
                       java.lang.String database_name)
                throws TWGDbException
Constructor for the TWGDbQueryParms class that specifies multiple selected fields (columns) and a specific database. All tables used in a query must be in the same physical database.

Parameters:
select_fields - - String array containing selected fields for the query. The format for strings must be "table_token_name.column_token_name"
database_name - - database name in which the query is.

TWGDbQueryParms

public TWGDbQueryParms(java.lang.String[] select_fields)
                throws TWGDbException
Constructor for the TWGDbQueryParms class that specifies multiple selected fields (columns). All tables used in a query must be in the same physical database.

Parameters:
select_fields - - String array containing selected fields for the query. Its syntax should be table_token_name.column_token_name.

TWGDbQueryParms

protected TWGDbQueryParms(byte[] buf)
                   throws TWGDbException
Constructor for the TWGDbQueryParms class using an intel byte buffer format of a TWGDbQueryParms object as input.

This method should be called only in the Director server engine.

Parameters:
buf - - the intel byte buffer format of a TWGDbQueryParms object
Method Detail

getListTableTokens

protected Vect getListTableTokens()
Method to get list of the token names of tables to select fields from.

This method is protected as an implementation side effect. Do not call or change. Its interface may be changed in a later release.

Returns:
Vect
See Also:
com.tivoli.twg.libs.Vect.

getFieldsByTable

protected int[] getFieldsByTable(java.lang.String tableName,
                                 Vect queryColumnIds,
                                 java.util.Vector fields)
                          throws TWGDbException
Method to get list of TWGDbQueryField objects used for the select fields in the query for a table. It is used for report format queries.

This method is protected as an implementation side effect. Do not call or change. Its interface may be changed in a later release.

Parameters:
tableName - - table token name
queryColumnIds - - Vect containing the column numbers for the query.
fields - - store the TWGDbQueryField objects in the query for the table passed. It's output parameter.
Returns:
int array containing the mapping of column ids from single query to it's super query starting from unit 1.
Throws:
TWGDbException

getSortFieldsByTable

protected java.util.Vector getSortFieldsByTable(java.lang.String tableName)
Method to get list of TWGDbQueryField objects used to sort the query for a table.

This method is protected as an implementation side effect. Do not call or change. Its interface may be changed in a later release.

Parameters:
tableName - - table token name
Returns:
Vect

getColumnFilterByTable

protected TWGDbColumnFilter getColumnFilterByTable(java.lang.String tableName)
Method to get column filter for a specific table in the query.

This method is protected as an implementation side effect. Do not call or change. Its interface may be changed in a later release.

Parameters:
tableName - - table token name
Returns:
TWGDbColumnFilter. May be null if no column filter is found

setFormat

public void setFormat(int queryFormat)
Method to set the query format. A description of valid formats is found in TWGDatabaseQuery.

Parameters:
queryFormat - - query format
See Also:
TWGDatabaseQuery

setUserId

protected void setUserId(java.lang.String userId)
Sets user id for the query. The default is empty.

This method should be called only in the Director server engine.

Parameters:
userId - - user identification

setIdString

public void setIdString(java.lang.String id_string)
Set the id string which is used to uniquely identify default queries.

Parameters:
id_string - - id string.

setQueryDisplayName

public void setQueryDisplayName(java.lang.String queryDisplayName)
Set the display name of the query. Used for only user defined queries.

Parameters:
queryDisplayName - - query name for display.

setGroupName

public void setGroupName(java.lang.String groupName)
Set the group name of the query.

Parameters:
groupName - - group name of the query.

changeDatabaseName

public void changeDatabaseName(java.lang.String dbName)
Set the database name the tables in the query are in.

Parameters:
dbName - - database name

setDefault

public void setDefault(boolean isDefaultQuery)
Set true if the query is default query created by an Director extension, false if the query is user defined.


setGraphic

public void setGraphic(java.lang.String queryGraphic)
Set the name of the icon for the query


setColumnFilter

public void setColumnFilter(TWGDbColumnFilter columnFilter)
Set column filter used to select specific table rows base on the values in a column.

Parameters:
columnFilter - - reference to a TWGDbColumnFilter object.
See Also:
TWGDbColumnFilter

setSortField

public void setSortField(java.util.Vector sort_fields)
Method to set column fields by which to sort the result set. This option is valid for only JOIN_FORMAT queries. It sorts the original data from the database. If any translation or enumeration was done on the data after the query, the data is not re-sorted.

See Also:
TWGDbQueryField

setSortField

public void setSortField(Vect sort_fields)
Method to set column fields by which to sort the result set. This option is valid for only JOIN_FORMAT queries. It sorts the original data from the database. If any translation or enumeration was done on the data after the query, the data is not re-sorted.

See Also:
TWGDbQueryField

setSortField

public void setSortField(java.lang.String sort_field)
                  throws TWGDbException
Method to set column field by which to sort the result set. This option is valid for only JOIN_FORMAT queries. It sorts the original data from the database. If any translation or enumeration was done on the data after the query, the data is not re-sorted.

Throws:
TWGDbException

setSavedQuery

public void setSavedQuery(boolean savedQuery)
Set true to save the query and false not to save the query.

Parameters:
savedQuery - - boolean variable

setTranslateValues

public void setTranslateValues(boolean translateValues)
Set true to translate the values of the query result set into the specific language or enumeration and false to keep the raw original values.

Parameters:
translateValues - - boolean variable

setResourceBundleName

public void setResourceBundleName(java.lang.String resourceBundleName)
Set the resource bundle base class name for the default query. It is used to translate the query name for default queries.

Parameters:
resourceBundleName - - the base class name for resource bundle objects

setResourceBundleKey

public void setResourceBundleKey(java.lang.String key)
Set resource bundle key for default query to get the localized query name.

Parameters:
key - - a resource bundle key for the query name

setRowDistinct

public void setRowDistinct(boolean distinctRows)
Set true, if entire duplicate rows are omitted in result set. False, allow duplicate rows in result set.

Parameters:
distinctRows - - true if duplicate rows are removed, otherwise, false

getFormat

public int getFormat()
Method to get the query format. Valid formats are found in TWGDatabaseQuery

Returns:
int - indicating the query format.
See Also:
TWGDatabaseQuery

getDatabaseName

public java.lang.String getDatabaseName()
Get the database name that all the tables in the query are in.

Returns:
String

getDefault

public boolean getDefault()
Is the query a default query?

Returns:
True if it is a default query, false if user query.

getIdString

public java.lang.String getIdString()
Get the id string which is used to uniquely identify a default queries.

Returns:
String

getQueryDisplayName

public java.lang.String getQueryDisplayName()
This method applies to user defined queries to get the query name user provides.

Returns:
String indicating query name.

getGroupName

public java.lang.String getGroupName()
Get the group name which is used to group queries.

Returns:
String indicating group name.

getQueryGraphic

public java.lang.String getQueryGraphic()
Get the icon name for the query

Returns:
The name of the icon

getUserId

protected java.lang.String getUserId()
Get the user id for the query. This field is valid only in the Director server engine.

Returns:
String

getColumnFilter

public TWGDbColumnFilter getColumnFilter()
Get the column filter for the query.

Returns:
TWGDbColumnFilter

getSelectFieldsInVect

public Vect getSelectFieldsInVect()
Get a list of TWGDbQueryField objects as a Vect

Returns:
a Vect of select fields
See Also:
TWGDbQueryField

getSelectFields

public java.util.Vector getSelectFields()
Get a list of TWGDbQueryField objects which contain the selected columns in the query.

Returns:
a Vector of select fields
See Also:
TWGDbQueryField

getSortFieldsInVect

public Vect getSortFieldsInVect()
Get a list of TWGDbQueryField objects which contain the column fields by which to sort the result set of the query

Returns:
a vector of sort fields

getSortFields

public java.util.Vector getSortFields()
Get a list of TWGDbQueryField objects that aontain the column fields by which to sort the result set of the query

Returns:
a vector of sort fields

getDistinctRows

public boolean getDistinctRows()
Are distinct rows to be returned in the query results (duplicate rows omitted).

Returns:
true if duplicate rows should be omitted, otherwise false

getSavedQuery

public boolean getSavedQuery()
Is this a saved query

Returns:
true if query is a saved query, otherwise false

getTranslateValues

public boolean getTranslateValues()
Are column values returned in this query to be translated for columns that support translation or enumeration.

Returns:
true if values are to be translated, otherwise false

getResourceBundleName

public java.lang.String getResourceBundleName()
Get the resource bundle base class name for the default query.

Returns:
the bundle name

getResourceBundleKey

public java.lang.String getResourceBundleKey()
Get resource bundle key for default query to get the localized query name.

Returns:
the bundle key

setSelectFields

public void setSelectFields(java.util.Vector select_fields)
                     throws TWGDbException
Set the selected fields for the query.

Parameters:
select_fields - - Vector of TWGDbQueryField or String objects. Format for strings must be "table_token_name.column_token_name"
Throws:
TWGDbException
See Also:
TWGDbQueryField

setSelectFields

public void setSelectFields(Vect select_fields)
                     throws TWGDbException
Set the selected fields for the query

Parameters:
select_fields - - Vect of TWGDbQueryField or String objects. Format for strings must be 'table_token_name.column_token_name"
Throws:
TWGDbException
See Also:
TWGDbQueryField

setSelectFields

public void setSelectFields(java.lang.String[] select_fields)
                     throws TWGDbException
Set the selected fields for the query

Parameters:
select_fields - - Array of String objects. Format for strings must be 'table_token_name.column_token_name"
Throws:
TWGDbException
See Also:
TWGDbQueryField

addSelectFields

public void addSelectFields(java.util.Vector select_fields)
                     throws TWGDbException
Add additional select fields to the current select fields for the query.

Parameters:
select_fields - - Vector of TWGDbQueryField or String objects. Format for strings must be 'table_token_name.column_token_name"
Throws:
TWGDbException
See Also:
TWGDbQueryField

addSelectFields

public void addSelectFields(Vect select_fields)
                     throws TWGDbException
Add additional select fields to the current select fields for the query.

Parameters:
select_fields - - Vect of TWGDbQueryField or String objects. Format for strings must be 'table_token_name.column_token_name"
Throws:
TWGDbException
See Also:
TWGDbQueryField

addSelectFields

public void addSelectFields(java.lang.String[] select_fields)
                     throws TWGDbException
Add additional select fields to the current select fields for the query.

Parameters:
select_fields - - Array of String objects. Format for strings must be 'table_token_name.column_token_name"
Throws:
TWGDbException
See Also:
TWGDbQueryField

setIntelByteBufferParms

public void setIntelByteBufferParms(Command cmd)
                             throws TWGDbException
This method is public as an implementation side effect. Do not call or change. Its interface may be changed in a later release.

Build IntelByteBuffer parms version of this command and add them to the IPC command

Parameters:
cmd - - the IPC command whose input parameters will be set by this method
Throws:
- - TWGDbException thrown for parameter or version errors
TWGDbException

getQueryParmBufLen

public int getQueryParmBufLen()
Get length of buffer containing information about query parms.

This method is public as an implementation side effect. Do not call or change. Its interface may be changed in a later release.


toString

public java.lang.String toString()
Convert object to String for debug

Returns:
String with a textual description of this object