About Find Mode for ADF Web Clients

When you create an ADF&ndashenabled web pages, you can support parameterized queries against ADF Business Components using an input form and setting the find mode for the page's ADF binding container to enabled. The ADF binding container supports find operations by executing a parameterized query using the search criteria specified in the form against the attributes of the view object specfied by an ADF iterator binding.

Note: It is not possible to initiate Find mode for ADF Business Component attributes that are Object types, Array types, and LOB domain types.

Once the Find operation is executed, the binding container is taken out of Find mode and the web page functions as an input entry form. In this way, the binding container toggles the Find mode between enabled and disabled for a specific web page.

About the Iterator Binding in Find Mode

In addition to its basic data iteration functionality, the iterator binding also cooperates with the bound data collection to simplify implementing query-by-example capability for your application data by providing:

In Oracle ADF, each data collection has an associated view criteria (ViewCriteria) collection of zero or more view criteria rows. Each view criteria row (ViewCriteriaRow) has the same attribute structure as a row in its related data collection, except that the attribute values are all treated as a String data type. This data type allows the user to enter query criteria containing comparison operators and wildcard characters.

For example, to indicate you want to find all departments whose department number is greater than 5 and whose department name matches the string 'ACC%', you would fill in the attributes of a view criteria row related to a DeptView collection (based on a query over the familiar DEPT table in the SCOTT schema) like this:

The iterator binding's Find mode makes it easy to create search pages that populate the attributes of the view criteria collection for query-by-example functionality. When an iterator binding is set to work in Find mode, it switches to use a different row set iterator over the related view criteria collection instead. This means that when Find mode is enabled, control bindings that reference the iterator binding will display and update attributes in the current view criteria row. Likewise, a range binding that references an iterator binding in Find mode allows you to render a table of current query-by-example view criteria rows.

When Find mode is disabled, the iterator binding switches back to work with its row set iterator over the data collection. This can be done explicitly by calling the iterator binding's setFindMode() method, or implicitly by calling its executeQuery() method.

Note: By calling the createRow() method on the iterator binding's row set iterator while in Find mode, it is possible to create additional view criteria rows and then proceed to populate their attributes with additional criteria. The default semantics are that query-by-example criteria in the same view criteria rows are logically AND-ed together, while criteria resulting from separate view criteria rows are logically OR-ed together. In actual practice using multiple view criteria rows is not a common use case, but knowing it is possible helps to explain functionality. However, after the user enters Find mode, it is no longer possible to create the row on the original collection. Only when the user exits Find mode will it be possible to create a row that does not participate in the view criteria.

While the ADF iterator binding provides its Find mode functionality independent of the kind of backend data control you choose, currently only the ADF Business Components data control makes automatic use of the view criteria collection of view criteria rows at runtime. It delegates the iterator binding's view criteria functionality to the underlying ADF view object, which implements the query-by-example criteria by automatically building appropriate SQL WHERE clause predicates based on the view criteria rows.

Other data control types would currently require a subclassed data control implementaiton containing some custom coding to read the query-by-example criteria from the ViewCriteria collection and translate them into an appropriate runtime search implementation.

About Parameterized Queries

A parameterized query is a query that contains a placeholder that must be supplied at runtime. For example, in the following PL/SQL statement, min_salary is a placeholder for a parameter value that will be supplied at runtime:

SELECT ename, job, mgr FROM emp WHERE sal < :min_salary

The input form in Find mode uses the ADF bindings to display fields for each attribute in the bound Business Components view object whose Queriable property is set to true. The view object defines the initial query executed by the business components.

Process for Displaying Results

In a Struts-based web application, the user interacts with an input form with find mode as follows:

  1. The web page with input form displayed by the user runs with find mode enabled.

    For instance, a user may click a link to open a page with the find mode enabled. How you want to enable Find mode is an application design decision. See the related topics below for details.

  2. The user enters search criteria to restrict the results of the data.

    The comparison symbol (>, <, =) can be entered by the user as appropriate. All values in the same view criteria participate in the search.

  3. The user clicks an Execute button on the form which initiates a find operation on a Struts action to perform an anchored, wild card search.

    The operation uses the first character of the search column as an anchor, where all the strings that begin with the entered string are matched.

  4. The Struts action forwards to another page, where a read-only table displays the results of the parameterized query.

For details about the usage of view criteria in Oracle ADF Business Components, see the JavaDoc for this class:

oracle.jbo.ViewCriteria


About Find Mode in JClient Controls

Working with Find Mode in ADF-Enabled Web Pages

 

Copyright © 1997, 2004, Oracle. All rights reserved.