com.tivoli.twg.engine
Class TWGFilterConstraints

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

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

An instance of the TWGFilterConstraints class contains a collection of TWGFilterConstraint instances that define a dynamic group (filter). The level numbers of each constraint define a tree structure that specifies how they are logically combined when querying the Director database.

The first constraint added to a TWGFilterConstraints object must be a top level constraint. Top level constraints have only one qualifier in their level (for example 1, 2, and 23 qualify as top level but 1.2, 1.3.4, and 17.8 do not). It must also be a parent constraint. There can be only one top level constraint.

For each constraint added after the first, the constraint's parent must already have been added (level 1 must be added before 1.2, and level 1.4 must be added before 1.4.1).

See Also:
TWGFilterConstraints, Serialized Form

Constructor Summary
TWGFilterConstraints()
          Constructor
 
Method Summary
 void addConstraint(TWGFilterConstraint con)
          Add a constraint for the dynamic group (filter).
protected  TWGFilterConstraints createFilterInfo(java.util.Locale loc)
          This method is protected as an implementation side effect.
protected  void createSQL()
          This method should be run only in the Director engine.
 void flatten(TWGByteArrayOutputStream data)
          Write constraints contents to a byte array.
 TWGFilterConstraint getConstraint(java.lang.String level)
          Get a specific constraint by specifying the level.
 java.util.Vector getConstraints()
          Get all the constraints
 int getLoadRC()
          Get the constraints load completion return code.
 java.util.Enumeration keys()
          Get the keys for the constraints
protected  IntValueSet runSQL()
          This method should be run only in the Director Engine.
protected  IntValueSet runSQL(IntValueSet obj_ids)
          This method should be run only in the Director Engine.
 int size()
          Get the number of constraints in this object
 java.lang.String toString()
          Convert object to String for debug
 void unflatten(TWGByteArrayInputStream data)
          Recreate object from byte array.
protected  boolean verify()
          This method should be run only in the Director engine during engine initialization
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TWGFilterConstraints

public TWGFilterConstraints()
Constructor

Method Detail

createFilterInfo

protected TWGFilterConstraints createFilterInfo(java.util.Locale loc)
                                         throws TWGFilterException
This method is protected as an implementation side effect. Do not call or change. Its interface may be changed in a later release. This method should be used only in the Director engine.

Create a filter info version of this object (has display names filled in for tables, columns, etc.).

Throws:
TWGFilterException

keys

public java.util.Enumeration keys()
Get the keys for the constraints

Returns:
- all keys (the level numbers) for the constraints

getLoadRC

public int getLoadRC()
Get the constraints load completion return code.

Returns:
- constraints load code.

getConstraint

public TWGFilterConstraint getConstraint(java.lang.String level)
Get a specific constraint by specifying the level.

Returns:
- the constraint, or null if not found.

getConstraints

public java.util.Vector getConstraints()
Get all the constraints

Returns:
- the TWGFilterConstraint objects in a vector

size

public int size()
Get the number of constraints in this object

Returns:
- an integer with the number of constraints.

addConstraint

public void addConstraint(TWGFilterConstraint con)
                   throws TWGFilterException
Add a constraint for the dynamic group (filter).

Parameters:
con - - the constraint to be added
Throws:
TWGFilterException - if a constraint with the same level number already exists in this constraints set.

createSQL

protected void createSQL()
                  throws TWGFilterException
This method should be run only in the Director engine.

Create the SQL for generating sets of managed objects for this filter.

Throws:
TWGFilterException

runSQL

protected IntValueSet runSQL()
                      throws TWGFilterException
This method should be run only in the Director Engine. Run the SQL for generating sets of managed objects for this filter.

Returns:
an IntValueSet containing the managed objects in the database that match this constraint set.
Throws:
TWGFilterException

runSQL

protected IntValueSet runSQL(IntValueSet obj_ids)
                      throws TWGFilterException
This method should be run only in the Director Engine. Run the SQL for generating sets of managed objects for this filter.

Returns:
an IntValueSet containing the managed objects in the database that match this constraint set.
Throws:
TWGFilterException

verify

protected boolean verify()
This method should be run only in the Director engine during engine initialization

Verify that the tables and columns used in the constraints for the filter are still valid. If any Director extensions have been removed, tables defined by those extensions may be gone.

Returns:
- true if the constraints are all valid, otherwise false.

flatten

public void flatten(TWGByteArrayOutputStream data)
             throws TWGPersistentObjectSaveException
Write constraints contents to a byte array. Used for saveData (persistent store) of a TWGFilter instance.

Parameters:
data - - the TWGByteArrayOutputStream
Throws:
TWGPersistentObjectSaveException

unflatten

public void unflatten(TWGByteArrayInputStream data)
               throws TWGPersistentObjectRestoreException
Recreate object from byte array. Used for restoreData of a TWGFilter instance

Parameters:
data - - the TWGByteArrayOutputStream
Throws:
TWGPersistentObjectRestoreException

toString

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

Returns:
String with a textual description of this object