Defining default dynamic filters

This topic describes how to extend IBM Director to include user-defined dynamic filters.

Related topics

Related sample code

A dynamic filter defines the criteria used to query the IBM Director database tables and determine the managed objects that meet the criteria. The criteria can be combined using Boolean operations such as AND (all true) and OR (any true). A group is the set of managed objects determined by these constraints and operations, for example, the set of managed objects that have Pentium III processors and have a particular device using a Motorola chipset.

An IBM Director extension can define default dynamic filters that appear in the Groups pane of the IBM Director management console. (More information about the Groups pane and the console window can be found in the Primary Console Window topic). These filters are defined in the InitClassInstances() method of the extension's TWGExtension subclass.

To create a dynamic filter, you must first define TWGFilterConstraint objects that specify the criteria used to query the database tables and the operations used to combine the criteria. There are two types of constraints:

Child constraint
Specifies a single table, column, operator, and value for creating a database query to determine which managed objects in the table meet the criteria. It also specifies which filter factory (TWGFilterFactory) should be used to find the table.
Parent constraint
Specifies a Boolean operator that defines how its children should be combined.

Both child and parent constraints contain a level identifier that defines where in a logical tree the constraint belongs. The topmost element in the tree is always a parent constraint, even if it has only one child constraint below it. Assign this first parent constraint a level identifier with only one qualifier in it, for example, 0, 1, 42, or 999. All other constraints begin with that same qualifier. For example, if the top level constraint is 42, all of its descendant qualifiers begin with 42:  42.1, 42.2, 42.12, 42.1.8, and 42.12.3.

For example, to define a filter that includes all managed objects that have Pentium III processors and have a Motorola chipset device, you would need to create three constraint objects:

1: 
Parent constraint that specifies the All True operator (an AND operation) to combine the child constraints
1.1: 
Child constraint that contains a column filter that specifies the FAMILY column of the processor table, the value FAMILY_PENTIUMIII, and the EQUAL operator
1.2: 
Child constraint that contains a column filter that specifies the DEVICE_CHIPSET column of the device table, the value DEVICE_CHIPSET_MOTOROLA, and the EQUAL operator.

Once created, these constraints can be added to a TWGFilterParms object that defines all the parameters for a dynamic database filter.