JHeadstart recipe - non-databound search-criteria americas cup win 2682133k1

JHeadstart recipe – non-databound search-criteria

From today’s customer assignment I extract the following recipe – for BC4J, JSP and Struts.: Suppose that on the FindPage of our JHeadstart generated JSP application we would like to add one or more search-criteria that are not directly bound to ViewObject attributes. For example in the context of the ALS application: the FindBookPage contains a field labeled AuthorFirstName. Here, the user may enter the firstname of an author. The application should now only return books in the result set that have at least one contributing author whose firstname matches the one entered by the end-user. The ViewObject underlying the Bookpages does not contains Authorships and Author information. A direct query on this ViewObject can not make use of the AuthorFirstName property. Of course, when no value is entered in this field, the query should not look for authors at all!

When a value for AuthorFirstName is provided, an additional piece of where-clause should be activated that looks from the ALS_BOOKS table via the ALS_AUTHORSHIPS table in the ALS_AUTHORS table.Now how are we going to do that?

1. Add additional search criteria to the JSP for the FindPage
2. Add Form Bean properties to the FindFormBean for these new fields
3. Create your own ApplicationModuleImpl (extend JhsApplicationModuleImpl) with a new and overloaded getRestrictedDataObjectSet method
4. Implement in the specific DataObjectHandlerImpl the getRestrictedDataObjectSet method that catches and processes additional, non VO-bound search criteria.

The recipe is found here, describing these steps in detail: Recipe for non-ViewObject Attribute bound search criteria.

See here for the entire AMIS JHeadstart Cookbook.

One Response

  1. Sanjay November 1, 2004