|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.tivoli.twg.engine.TWGFilterConstraint
The TWGFilterConstraint class encapsulates a single constraint for a dynamic group (filter). Two types of constraints can be defined with this class:
Both child and parent constraints contain a level identifier that defines where in the logical tree the constraint belongs. The level should contain only numbers and periods. All constraints for a single dynamic group (filter) must begin with the same number. Examples of levels are 1, 1.1, 1.2, 1.2.4, and they define how the sets of results are logically combined.
TWGDbColumnFilter
,
TWGFilterConstraints
,
Serialized FormField Summary | |
---|---|
static int |
ALL
|
static int |
ALL_FOR_SAME
|
static java.lang.String |
AND
|
static int |
ANY
|
static int |
EACH_FOR_AT_LEAST_ONE
|
static java.lang.String |
OR
|
Constructor Summary | |
---|---|
TWGFilterConstraint()
Default constructor |
|
TWGFilterConstraint(java.lang.String level,
int op)
TWGFilterConstraint constructor for a parent constraint. |
|
TWGFilterConstraint(java.lang.String level,
java.lang.String factoryId,
TWGDbColumnFilter colFilter)
TWGFilterConstraint constructor for a child constraint. |
|
TWGFilterConstraint(TWGFilterConstraint copyCon)
TWGFilterConstraint constructor -- create a new TWGFilterConstraint object by copying another one. |
Method Summary | |
---|---|
protected void |
addSpecializedColumn(TWGDbColumnFilter colFilter)
Add column that has specialize filter requirements. |
protected TWGFilterConstraint |
createFilterInfo(java.util.Locale loc)
This method is protected as an implementation side effect. |
protected void |
createSQL(boolean full)
This method is protected as an implementation side effect. |
void |
flatten(TWGByteArrayOutputStream data)
Write constraint contents to a byte array. |
TWGDbColumnFilter |
getColumnFilter()
Get the column filter |
protected java.lang.String |
getDatabaseName()
This method is protected as an implementation side effect. |
int |
getDepth()
Get how many levels deep this constraint is in the tree. |
java.lang.String |
getFactoryDisplayName()
Get factory display name. |
java.lang.String |
getFactoryId()
Get the factory id |
java.lang.String |
getLevel()
Get the level for this filter constraint |
int |
getOperator()
Get the operator used between this constraint and others at same level in same |
java.lang.String |
getParent()
Get the parent level for this filter constraint |
protected java.util.Vector |
getSpecializedColumns()
Returns the Vector of columns with special filter requirements |
protected java.lang.String |
getSQL()
This method is protected as an implementation side effect. |
java.lang.String |
getTableName()
Get the table token name for filter constraint |
protected java.lang.String |
getWhereClause()
returns the where clause for this filter constraint. |
boolean |
isChildOf(java.lang.String parent)
Is this constraint an immediate child of the specified constraint (using level as determinant) |
boolean |
isDescendantOf(java.lang.String parent)
Is this constraint a descendant of the specified constraint (using level as determinant) |
boolean |
isParent()
Determine whether constraint is a parent of another constraint |
protected static int |
levelDepth(java.lang.String level)
Calculate the depth for a filter constraint's level ( 0 based). |
protected static java.lang.String |
parentLevel(java.lang.String level)
Determine the level of a child's parent. |
protected void |
resetSpecialProcessingColumns()
Add column that has specialize filter requirements. |
protected IntValueSet |
runSQL(TWGDbConnection conn)
This method is protected as an implementation side effect. |
protected IntValueSet |
runSQL(TWGDbConnection conn,
IntValueSet moids)
This method is protected as an implementation side effect. |
protected void |
setDbName(java.lang.String dbName)
This method is protected as an implementation side effect. |
protected void |
setDisplayNames(java.util.Locale loc)
This method is protected as an implementation side effect. |
protected void |
setSQL(java.lang.String sql)
This method is protected as an implementation side effect. |
protected void |
setWhereClause(java.lang.String whereClause)
Set the where clause for this filter constraint. |
java.lang.String |
toString()
Convert object to String for debug |
void |
unflatten(TWGByteArrayInputStream data)
Recreate object from byte array. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final int ANY
public static final int ALL
public static final int ALL_FOR_SAME
public static final int EACH_FOR_AT_LEAST_ONE
public static final java.lang.String OR
public static final java.lang.String AND
Constructor Detail |
public TWGFilterConstraint()
public TWGFilterConstraint(java.lang.String level, java.lang.String factoryId, TWGDbColumnFilter colFilter) throws TWGFilterInitException
level
- - the level of the constraint within the tree of all constraints
e.g. 1.2.5factoryId
- - the id string for the filter factory that the table in
the column filter is defined incolFilter
- - the TWGColumnFilter object that defines the table, column
value, and logical operatorpublic TWGFilterConstraint(java.lang.String level, int op) throws TWGFilterInitException
level
- - the level of the constraintop
- - the constraint operator for this level.
If a valid operator is not specified, the default of ANY will
be used.
TWGFilterException
TWGFilterInitException
public TWGFilterConstraint(TWGFilterConstraint copyCon) throws TWGFilterInitException
copyCon
- - the TWGFilterConstraint to be copied
TWGFilterInitException
Method Detail |
protected TWGFilterConstraint createFilterInfo(java.util.Locale loc) throws TWGFilterException
Create a filter info version of this constraint (has display values filled in)
loc
- - the local for translations
TWGFilterException
protected static int levelDepth(java.lang.String level)
level
- - the level to be checkedprotected static java.lang.String parentLevel(java.lang.String level)
level
- - the child's level
protected void createSQL(boolean full) throws TWGFilterException
Generate the SQL for the column filter
full
- - if true, requests the full SQL including the select and where
clauses.
if false, returns only the contents of the where clause
TWGFilterException
protected void setSQL(java.lang.String sql)
Set the SQL for this filter. Used for setting SQL field in a parent constraint with the combined SQL for its immediate children.
sql
- = the SQL stringprotected void setDbName(java.lang.String dbName)
Set the database name for this constraint. This is used when a parent constraint is set with the combined SQL of its children
dbName
- = the name for the databaseprotected java.lang.String getDatabaseName() throws TWGFilterException
Get the database name for the table in this constraint.
-
- TWGFilterException
TWGFilterException
protected IntValueSet runSQL(TWGDbConnection conn) throws TWGDbException
Run the SQL to get the list of managed objects.
conn
- - a TWGDbConnection object to the database that contains
the tables for the SQL query
-
- TWGDbException
TWGDbException
protected IntValueSet runSQL(TWGDbConnection conn, IntValueSet moids) throws TWGDbException
Run the SQL to get the list of managed objects.
conn
- - a TWGDbConnection object to the database that contains
the tables for the SQL querymoids
- - a list of moids to run the SQL statement on.
-
- TWGDbException
TWGDbException
public java.lang.String getLevel()
public int getDepth()
public java.lang.String getParent()
public boolean isChildOf(java.lang.String parent)
public boolean isDescendantOf(java.lang.String parent)
public java.lang.String getFactoryId()
protected void setDisplayNames(java.util.Locale loc) throws TWGFilterException
loc
- - the locale to use for translations
TWGFilterException
public java.lang.String getFactoryDisplayName()
public TWGDbColumnFilter getColumnFilter()
public int getOperator()
protected java.lang.String getSQL()
public java.lang.String getTableName()
public boolean isParent()
public void flatten(TWGByteArrayOutputStream data)
data
- - the TWGByteArrayOutputStreampublic void unflatten(TWGByteArrayInputStream data) throws TWGPersistentObjectRestoreException
data
- - the TWGByteArrayOutputStream
TWGPersistentObjectRestoreException
protected void addSpecializedColumn(TWGDbColumnFilter colFilter)
protected void resetSpecialProcessingColumns()
protected java.util.Vector getSpecializedColumns()
protected void setWhereClause(java.lang.String whereClause)
protected java.lang.String getWhereClause()
public java.lang.String toString()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |