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:
- create classes HistoryController and HistoryEntry
- create an ADF DataControl for HistoryController
- configure a managed bean historyController based on HistoryController
- create ADF Faces region HistoryRegion.jspx
- configure HistoryRegion.jspx in region-metadata.xml
- include region in all pages that should show history
- 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
- 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.