Maintaining recent navigation history in ADF Faces applications – mimicking MS Word's Recent Documents history

Lucas Jellema

For one of our other ADF projects, we have an interesting requirement: the user should at all times see a little box with the recent case history, and the ability to return to one of the cases recently visited. In terms of the perpetual HRM application, that would mean a recent history overview of the Countries, Departments and Employees recently visited in the application, with the ability to select any one of those and navigate straight to them. It would look something like:

 

After navigation to the selected employee Shelley Higgins , we should see:....

Clicking on any of the items in the Recent History list should take us straight away to the details page for the Employee, Department or Country. Furthermore: the history should contain a limited number of entries, hold no double entries and always show the most recently visited cases on top.

This article discusses the – fairly straightforward – implementation of this functionality, including the sources.

 
The steps are:

  1. create classes HistoryController and HistoryEntry
  2. create an ADF DataControl for HistoryController
  3. configure a managed bean historyController based on HistoryController 
  4. create ADF Faces region HistoryRegion.jspx
  5. configure HistoryRegion.jspx in region-metadata.xml
  6. include region in all pages that should show history
  7. add a method binding on HistoryController’s registerHistory method in the pageDefinition for every page that you want to add to the recent history; also create an invokeAction for that methodBinding
  8. configure a "DeepLink invokeAction" in all pages that make an appearance in the recentHistory (as link target)

Improvements/To Do

  • Make the History persistent – when the user reconnects to the application, in a new session, the history from the previous session should still/again be available. This requires storage in the database – history associated with the user. The recording of history in the database is independent of the data manipulation transactions. It seems that a call to a database procedure that performs an autonomous commit is a good approach
  • Record timestamp for each history entry
  • Record type of ‘case’ (Employee, Department, Country)
  • Record additional descriptive text (to be shown as alt text) for each case added to the history
  • Allow additional filtering on cases added to the history – not just any case visited in qualifying pages, but only cases satisfying some conditions (Employees who are manager for example)
  • Display icon for each type
  • Configuration popup for the History Viewer where the history size, the display mode, filters etc. can be set
  • Support category view in History Viewer with cases grouped by type, ordered within group by timestamp
  • Along similar lines: allow cases to be explicitly added to a ToDo/Worklist (similar implementation as History, but no automatic adding of cases) 

Resources

Download the JDeveloper 10.1.3 Application: RecentHistoryNavigator.zip.

Next Post

Minify all your JavaScript and Stylsheets automatically with YUI Compressor and a Servlet Filter

In this article I will explain how to minify all your .js and .css files automatically with a servlet filter. This means you only have to define a servlet filter in your web.xml and everything works! In the project I’m currently working on we have some pretty large JavaScripts and […]
%d bloggers like this: