com.tivoli.twg.engine
Class TWGDbDateColumn

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

public class TWGDbDateColumn
extends TWGDbColumn

TWGDbDateColumn is a container class that encapsulates a database table column where the column type is Date. This uses the java.sql.Date class which contains only the date fields, as opposed to java.date which has both date and time fields.

See Also:
Serialized Form

Constructor Summary
TWGDbDateColumn(java.lang.String realName, java.lang.String tokenName)
          Create a date column TWGDbDateColumn.
TWGDbDateColumn(TWGDbDateColumn copyCol)
          Create a TWGDbDateColumn by copying another one
 
Method Summary
protected  TWGDbColumn createFilterColumn(java.util.Locale loc, TWGDatabaseTable table)
          Create a filter version of this column (display name is translated).
protected  java.io.Serializable getDistinctValues(java.util.Locale loc, TWGDatabaseTable table)
          Get column distinct values (database engine use)
 long[] getValues()
          Gets the array of distinct values for this column.
protected  void insertDistinctValue(java.lang.Object value)
          This method is protected as an implementation side effect.
protected  void replaceDistinctValues(LongValueSet newValues)
          This method is protected as an implementation side effect.
protected  void replaceDistinctValues(java.sql.ResultSet rs)
          This method is protected as an implementation side effect.
 void setDefaultValue(java.sql.Date defaultValue)
          Set a default value for this column.
 void setDefaultValue(long defaultValue)
          Set a default value for this column.
 void setDefaultValue(java.lang.String defaultValue)
          Set a default value for this column.
 void setDistinctValues(LongValueSet values)
          Set the distinct values for this column to a constant set.
protected  void setDistinctValues(java.lang.Object vals)
          Set distinct values (console use)
 void setInitialDistinctValues(TWGDate dv)
          Set the initial distinct values for this column.
 void setInitialDistinctValues(TWGLong dv)
          Set the initial distinct values for this column.
 void setInitialDistinctValues(TWGLongArray dv)
          Set the initial distinct values for this column.
 java.lang.String toString()
          Convert column to String for debug
 
Methods inherited from class com.tivoli.twg.engine.TWGDbColumn
allowsGTLT, compareTo, getColumnDefaultValue, getColumnId, getColumnlength, getColumnType, getDisplayName, getInitialDistinctValues, getKeyNum, getMatchingMoids, getMetaType, getRealColumnName, getTable, getTokenColumnName, implementsFilterProcessing, isFilterColumn, isMappedColumn, queryDistinctValues, refreshDistinctIfNeeded, refreshDistinctValues, setAllowsGTLT, setColumnId, setColumnLength, setColumnNameLength, setDefaultValue, setDisplayName, setFilterColumn, setFilterProcessing, setInitialDistinctValues, setKeyNum, setMappedColumn, setMetaType, setQueryDistinctValues, setShortColumnName, setTableName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TWGDbDateColumn

public TWGDbDateColumn(java.lang.String realName,
                       java.lang.String tokenName)
Create a date column TWGDbDateColumn. It will hold the year, month, and day.

Parameters:
realName - -- the actual column name for the table
tokenName - -- a nickname used to refer to the column for all

TWGDbDateColumn

public TWGDbDateColumn(TWGDbDateColumn copyCol)
Create a TWGDbDateColumn by copying another one

Parameters:
copyCol - -- the column to be copied
Method Detail

createFilterColumn

protected TWGDbColumn createFilterColumn(java.util.Locale loc,
                                         TWGDatabaseTable table)
Create a filter version of this column (display name is translated). This method is to be used only in the Director engine.

Specified by:
createFilterColumn in class TWGDbColumn
Parameters:
loc - - the locale to use for translations
table - - the TWGDatabaseTable that this column belongs to
Returns:
a TWGDbColumn

setDefaultValue

public void setDefaultValue(long defaultValue)
Set a default value for this column. Any default values for columns in the table key are ignored. Default is TWGDbDateColumn.NULL.

Parameters:
defaultValue - - the date represented as a long (number of milliseconds from midnight, GMT, January 1st, 1970)

setDefaultValue

public void setDefaultValue(java.sql.Date defaultValue)
Set a default value for this column. Any default values for columns in the table key are ignored. Default is TWGDbDateColumn.NULL.

Parameters:
defaultValue - - the value as a java.sql.Date object

setDefaultValue

public void setDefaultValue(java.lang.String defaultValue)
Set a default value for this column. Any default values for columns in the table key are ignored.

Parameters:
defaultValue - - the value as a string in yyyy-mm-dd format

getDistinctValues

protected java.io.Serializable getDistinctValues(java.util.Locale loc,
                                                 TWGDatabaseTable table)
Get column distinct values (database engine use)

Specified by:
getDistinctValues in class TWGDbColumn
Returns:
LongValueSet containing column distinct values

setDistinctValues

protected void setDistinctValues(java.lang.Object vals)
Set distinct values (console use)

Specified by:
setDistinctValues in class TWGDbColumn

replaceDistinctValues

protected void replaceDistinctValues(java.sql.ResultSet rs)
                              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.

Replace the saved list of distinct values with a new set from a database query.

Overrides:
replaceDistinctValues in class TWGDbColumn
Parameters:
rs - - The query ResultSet.
Throws:
TWGDbException

replaceDistinctValues

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

Replace the saved list of distinct values with a new set from a database query.

Parameters:
newValues - - The LongValueSet containing the new values
See Also:
LongValueSet

insertDistinctValue

protected void insertDistinctValue(java.lang.Object value)
                            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.

Insert a distinct date value into the list of distinct values.

Specified by:
insertDistinctValue in class TWGDbColumn
Parameters:
value - - The value to be inserted.
Throws:
- - TWGDbException
TWGDbException

getValues

public long[] getValues()
Gets the array of distinct values for this column.

Returns:
a long array of distinct values (dates stored number of milliseconds from midnight, GMT, January 1st, 1970) /*

setDistinctValues

public void setDistinctValues(LongValueSet values)
Set the distinct values for this column to a constant set. Using this method sets the queryForDistinctValues attribute to false. The only distinct values used will be those provided by this method. No refresh from actual database column contents will be done for this column.

This method should be called only in the create method of a TWGDatabaseTable subclass when defining the table

Parameters:
values - - The LongValueSet array containing the constant distinct values
See Also:
LongValueSet

setInitialDistinctValues

public void setInitialDistinctValues(TWGLong dv)
Set the initial distinct values for this column. These values will always be displayed in the dynamic filter builder.

Parameters:
dv - - TWGLong datavalue

setInitialDistinctValues

public void setInitialDistinctValues(TWGLongArray dv)
Set the initial distinct values for this column. These values will always be displayed in the dynamic filter builder.

Parameters:
dv - - TWGLongArray datavalue

setInitialDistinctValues

public void setInitialDistinctValues(TWGDate dv)
Set the initial distinct values for this column. These values will always be displayed in the dynamic filter builder.

Parameters:
dv - - TWGDate datavalue

toString

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

Overrides:
toString in class TWGDbColumn
Returns:
String with a textual description of the column.