com.tivoli.twg.engine
Class TWGDbColumnFilter

java.lang.Object
  extended bycom.tivoli.twg.engine.TWGDbColumnFilter
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
TWGDbDoubleColumnFilter, TWGDbFloatColumnFilter, TWGDbIntegerColumnFilter, TWGDbLongColumnFilter, TWGDbShortColumnFilter, TWGDbStringColumnFilter

public abstract class TWGDbColumnFilter
extends java.lang.Object
implements java.io.Serializable

TWGDbColumnFilter is an abstract base class that encapsulates the common parameters used to filter rows in a table based on the values of a column. The table name, column name , and logical operator are included. Subclasses of this class hold the values used to filter the column based on the type of data in the column.

See Also:
Serialized Form

Constructor Summary
protected TWGDbColumnFilter(byte[] buf, int offset, java.lang.String version)
          This method is protected as an implementation side effect.
  TWGDbColumnFilter(java.lang.String columnFullName, java.lang.String operation)
          Constructor for the TWGDbColumnFilter class.
  TWGDbColumnFilter(java.lang.String tableName, java.lang.String columnName, java.lang.String operation)
          Constructor for the TWGDbColumnFilter class.
  TWGDbColumnFilter(TWGDbColumnFilter copyColFilter)
          Constructor to create a copy of another column filter.
 
Method Summary
 boolean allowsGTLT()
          Is the user allowed to use greater than and less than in queries and filters for this column?
protected  boolean checkOperator(java.lang.String op)
          Check the validity of the operator
static TWGDbColumnFilter create(byte[] buf, int offset, java.lang.String version)
          This method is public as an implementation side effect.
protected abstract  TWGDbColumnFilter createFilterInfo(java.util.Locale loc)
          Abstract method to create a columnFilter with locale specific info filled in.
 java.lang.String getColumnDisplayName()
          Get the displayable column name for this column filter.
 java.lang.String getColumnFullName()
          Get the combined table token name and column token name for this filter.
 java.lang.String getColumnName()
          Get the token column name for this column filter
 int getColumnType()
          Get the column type for the column this filter was used for.
abstract  int getDataValueType()
          Abstract method to return data value type.
protected  int getIntelByteBufferSize()
          This method is protected as an implementation side effect.
 java.lang.String getOperator()
          Get the logical operator for this filter
 java.lang.String getTableDisplayName()
          Get the displayable table name for this column filter.
 java.lang.String getTableName()
          Get the token table name for this column filter
abstract  java.util.Vector getValuesAsObject()
          Abstract method to translate values into corresponding Objects and put them in a vector.
abstract  int getValueSize()
          Abstract method to get the size of the values array.
protected  void setFilterInfo(java.util.Locale loc)
          This method is protected as an implementation side effect.
 int setIntelByteBufferParms(byte[] buf, int offset)
          This method is protected as an implementation side effect.
 void setOperator(java.lang.String operation)
          Set the operator for this filter.
 java.lang.String toString()
          Convert column to String for debug
protected  boolean verify()
          This method should be called only from withing the Director engine.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TWGDbColumnFilter

public TWGDbColumnFilter(java.lang.String columnFullName,
                         java.lang.String operation)
                  throws TWGDbException
Constructor for the TWGDbColumnFilter class.

Parameters:
columnFullName - - table token name plus column token name. Format is "tableName.columnName".
operation - - operator for the filter. Valid values are: TWGDbColumnOperators.EQUAL NOT_EQUAL GREATER_THAN GREATER_THAN_OR_EQUAL LESS_THAN LESS_THAN_OR_EQUAL
Throws:
TWGDbException
See Also:
TWGDbColumnOperators

TWGDbColumnFilter

public TWGDbColumnFilter(java.lang.String tableName,
                         java.lang.String columnName,
                         java.lang.String operation)
                  throws TWGDbException
Constructor for the TWGDbColumnFilter class.

Parameters:
tableName - - table token name
columnName - - column token name
operation - - operator for the filter. Valid values are: TWGDbColumnOperators.EQUAL NOT_EQUAL GREATER_THAN GREATER_THAN_OR_EQUAL LESS_THAN LESS_THAN_OR_EQUAL \
Throws:
TWGDbException
See Also:
TWGDbColumnOperators

TWGDbColumnFilter

public TWGDbColumnFilter(TWGDbColumnFilter copyColFilter)
Constructor to create a copy of another column filter.


TWGDbColumnFilter

protected TWGDbColumnFilter(byte[] buf,
                            int offset,
                            java.lang.String version)
                     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.

Constructor to create a column filter from an intel byte buffer format byte array

Parameters:
buf - - the byte array
offset - - the offset in the buffer that the column filter starts at
version - - the database version
Throws:
TWGDbException
Method Detail

create

public static TWGDbColumnFilter create(byte[] buf,
                                       int offset,
                                       java.lang.String version)
                                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.

Create a column filter from an intel byte buffer format byte array

Parameters:
buf - - the byte array
offset - - the offset in the buffer that the column filter starts at
version - - the database version
Throws:
TWGDbException

createFilterInfo

protected abstract TWGDbColumnFilter createFilterInfo(java.util.Locale loc)
                                               throws TWGDbException
Abstract method to create a columnFilter with locale specific info filled in.

Parameters:
loc - - the Locale for translations
Throws:
TWGDbException

getValueSize

public abstract int getValueSize()
Abstract method to get the size of the values array. Must be overriden by subclass

Returns:
the size of the array.

getOperator

public java.lang.String getOperator()
Get the logical operator for this filter

Returns:
the operator.

setOperator

public void setOperator(java.lang.String operation)
                 throws TWGDbException
Set the operator for this filter.

Parameters:
operation - - the logical operator for this filter. Valid values are found in TWGDatabaseConstants
Throws:
TWGDbException
See Also:
TWGDatabaseConstants

getColumnFullName

public java.lang.String getColumnFullName()
Get the combined table token name and column token name for this filter. Format

Returns:
the name in the format "table_name.column_name"

getTableName

public java.lang.String getTableName()
Get the token table name for this column filter

Returns:
the table name

getTableDisplayName

public java.lang.String getTableDisplayName()
Get the displayable table name for this column filter. This field will be null except when infromation about a column filter is sent through the IPC in response to a request for query information.

Returns:
the displayable table name or null

setFilterInfo

protected void setFilterInfo(java.util.Locale loc)
                      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. Set the filter information to be passed back to the console. This includes the translated display column and table names, the column type from the database table, and whether less than or greater than is allowed to be used on this column for queries and filters

Parameters:
loc - - the locale to use for translations
Throws:
- - a TWGDbException if the table or column is not found.
TWGDbException

allowsGTLT

public boolean allowsGTLT()
Is the user allowed to use greater than and less than in queries and filters for this column?

Returns:
true if user may use greater than and less than, otherwise, false

getColumnType

public int getColumnType()
Get the column type for the column this filter was used for. This field is valid when a column filter is passed back to the console. Otherwise it contains zero. Valid types for this field are found in TWGDatabaseConstants

Returns:
the column type

getColumnName

public java.lang.String getColumnName()
Get the token column name for this column filter

Returns:
the token column name

getColumnDisplayName

public java.lang.String getColumnDisplayName()
Get the displayable column name for this column filter. This field will be null except when infromation about a column filter is sent through the IPC in response to a request for query information.

Returns:
the displayable column name or null

getValuesAsObject

public abstract java.util.Vector getValuesAsObject()
Abstract method to translate values into corresponding Objects and put them in a vector. Method must be overridden by the subclass.

Returns:
Vector of objects containing the values for the column query

getDataValueType

public abstract int getDataValueType()
Abstract method to return data value type. Possible types are defined in com.tivoli.twg.libs.DataValue. This method must be overridden by the subclass.

Returns:
the value type.
See Also:
DataValue

verify

protected boolean verify()
This method should be called only from withing the Director engine. Verify that the table and column for this filter are valid

Returns:
true if valid, otherwise false

checkOperator

protected boolean checkOperator(java.lang.String op)
Check the validity of the operator

Returns:
true if valid, otherwise false

setIntelByteBufferParms

public int setIntelByteBufferParms(byte[] buf,
                                   int offset)
                            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.

Write an intel byte buffer version of this column filter to a byte array at the offset specified.

Parameters:
buf - - byte array in which to write the data
offset - - offset into the array to start writing
Throws:
- - TWGDbException thrown for parameter or version errors
TWGDbException

getIntelByteBufferSize

protected int getIntelByteBufferSize()
This method is protected as an implementation side effect. Do not call or change. Its interface may be changed in a later release. Determines the IntelByteBuffer size for this column filter

Returns:
- size of buffer needed

toString

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

Returns:
String with a textual description of the column filter.