Posts

Showing posts from January, 2010

Customizing the execution of <af:fileDownloadActionListener> to validate user input

Let me explain an interesting use case on 'file downloading' and a possible solution at this time. Requirement is to accept user input and validate the same, before initiating the file download. If the validation fails, then file download should get suspended.

ADF Faces recommends to use <af:fileDownloadActionListener> for downloading file. This provides a declarative solution for the problem, in most of the cases. As you can see from tag documentation, <af:fileDownloadActionListener> is designed in a very generic way. Currently we don’t have any direct mechanism to intercept the invocation of fileDownloadActionListener, apparently solution for the above mentioned use case turns out to be bit tricky. (Thanks to Jeanne Waldman for sharing this idea )

Interesting part of the solutions is queuing the ActionEvent for a ‘hidden’ action component which wraps fileDownloadActionListener. The java script method to queue ActionEvent is invoked from second button’s (this a…

Search by child attributes on a tree table

Image
This example illustrates search functionality on a tree table (based  on both master and child record attributes). Steve discusses similar topic in one of his blog post http://blogs.oracle.com/smuenchadf/examples/ Example #150. This post is also based on the same idea (slightly differ, from implementation perspective).

Let me detail the use case with classic Department-Employee example. Your tree table may looks like as shown below. Search mechanism should enable user to search based on attributes both from parent and child records, i.e. Department and Employee entities.

-DeptID , DeptName
|
|__EmpId1, Firstname1, Email1
|__EmpId2, Firstname2, Email2

Obviously implementation part involves two ViewObjects, one for Department and the other for Employee. Next step is to define a ViewCriteriathat act as model for the query. Below image shows a ViewCriteria defined on DeprtmentViewObject.




Define another ViewCriteria on EmployeeViewOject, to filter out the 'Employee' child records …

Disclaimer

The views expressed on this blog are my own and do not necessarily reflect the views of my employer.