Skip to Content

Implement Web Dynpro Paging with MDM Java API

In this short blog entry I would like to draw your attention to the benefits of Web Dynpro paging with MDM Java API commands. 

Developers often have to deal with retrieving thousands of records from MDM repository and fortunately MDM Java API search commands have paging ability that could be combined with Web Dynpro context paging.

Using Web Dynpro Java Table Paging Unleashed: Optimizing Heavy Table Performance instead of preloading all records from MDM repositories, we can retrieve records from MDM repositories on-the-fly using a PageableList implementation binded to the context.

Implement table paging can be done in the following ways using CMI.
Common Model Interface is, from the javadocs: “General interface for software layers to be used as model tiers in Web Dynpro applications”. It’s a thin glue between your UI and the underlaying logic.

a/ The simpler way is to implement the ICMIObservableList interface and retrieve each record one-by-one by implementing the following methods:
get(int index)
Your feeder class uses this index to retrieve the actual record from the repository. However you can also implement paging technique and retrieve the records from MDM – let’s say in a batch size of 50. The only drawback of this solution compared to the b/ option is that you cannot use Web Dynpro hint to notify your feeder class about what elements will be retrieved in the near future.
int size()
The result size is provided by the getSearchTableMatchCount() property of the command.
b/ You can make your solution a little more efficient if you go and implement the ICMIPageableList interface. This makes things a little bit complicated for the first sight, but later your application will function more smoothly with Web Dynpro!

So you subclass from CMIAbstractObservableList and implement ICMIPageableList interface with two more methods for your list:
Return a list of immutable elements prepared by the feeder. The feeder class calls MDM Java API commands and provides records to the PageableList. The returned list – called Page – passed to the PageableListIterator which implement the ICMIListIterator interface so we can bind it to the table’s context.
prepareElements(int index, int count) This method is called in an early phase during Web Dynpro page processing to notify the list about a range of elements that will be accessed in later stage.

For both solutions we can use MDM Java API search commands (like RetrieveLimitedRecordsCommand, etc.). They provide the necessary properties where we can specify the page index and page size to retrieve a set of records from the repository.
The only thing we have to take care of is to translate the received IWDNode’s index and the table size to MDM pageIndex() and pageSize().
You should either implement your eviction policy yourself using the remove() method or simply keep only the necessary records in your cache.
It’s also possible to pass your filtering and sorting criteria to your PageableList implementation and use it on your feeder class as SearchConstraint and SortDefinition. Later in another post I’ll explain in details with a sample application how this can be done in practice.

Class diagram:

Component diagram:

Have a nice holiday!

Be the first to leave a comment
You must be Logged on to comment or reply to a post.