getTreeNodes()

Constructs an array of tree nodes that represents one level in the hierarchy of source nodes.

Syntax

public TreeNode[] getTreeNodes(String parentNodePath, String searchPattern);
 

Parameters

parentNodePath
Is a fully qualified path from the top-level node to the source node whose children are to be returned to Business Object Wizard; each node in the path is separated by a colon (:).
searchPattern
Is the user-specified search pattern for the child nodes in the expandable parentNodePath node.

Return values

An array of TreeNode objects, which tree-node object is a child node in the hierarchy of specified objects.

Exceptions

ODKException
Thrown if the Object Discovery Agent encounters a problem getting the tree nodes.

Notes

The getTreeNodes() method is the source-node-generation method for the IGeneratesBoDefs interface. Business Object Wizard invokes getTreeNodes() to obtain the array of tree nodes that initializes its Select Source (Step 3) dialog box. From this dialog box, the user selects specific source nodes for business-object-definition generation. Within the getTreeNodes() method, you must construct tree nodes to represent the hierarchy of source nodes in the data source. The getTreeNode() method returns this source-node hierarchy as an array of TreeNode objects to its caller, Business Object Wizard.

The tree-node array that getTreeNodes() returns provides the source nodes at one particular level of the source-node hierarchy. At any given level, some source nodes might be expandable (have child nodes) and some might be leaf (terminating) nodes. The user can traverse the hierarchy by expanding any source node that displays a plus (+) sign to its left. When the user expands a node, Business Object Wizard calls getTreeNodes() again, providing as its parentNodePath argument the name of the node the user wants to expand. This node name consists of the names of each of the nodes in the path, separated by a colon (:).

Note:
An ODA uses the colon rather than a slash or backslash to keep the path operating-system-independent.

The getTreeNodes() method performs the following basic tasks to generate the source nodes:

  1. Parse the parentNodePath to identify the parent object to search for in the data source.
  2. Discover the child objects for the specified data-source parent object.

    If Business Object Wizard provides a searchPattern argument to getTreeNodes(), the user has specified search criteria. Therefore, getTreeNodes() must return only those child nodes of the parentNodePath node that match searchPattern search criteria. The ability to apply a search pattern to source nodes requires that the following conditions are true:

  3. Construct tree nodes for the child objects and put these nodes into the tree-node array.

For more information on how to implement getTreeNodes(), see Generating source nodes.

See also

For related reference information, see TreeNode class.

Copyright IBM Corp. 1997, 2003