Previous post Next post
Currently Being Moderated

Some performance hints from our project experience.

During reviews of several custom codings of Knowledge Management Flexible UI components, I often recognized performance-impacting coding pitfalls. I’d like to show here some general improvements you should use to avoid time-consuming calls to the Knowledge Management’s repository framework (RF) within your Flexible UI components.

Reuse of information within your component

Having implemented UI components like collection renderers, property renderers etc, you often have to retrieve resource-related information from the RF. Most of the UI component methods already provide this information to the implementing method:

     public class SimplePropertyRenderer implements IModelledPropertyRenderer

          public Component renderProperty(IProperty prop, IMetaName metaname, IResource r, IProxy proxy, IParameters p) throws WcmException {

Avoid retrieving IResource objects from the RF via RepositoryFactory calls within your UI components:

     IResource res = ResourceFactory.getInstance().getResource(...);
     IRID rid = res.getRID();

Use the local reference to the resource object passed by the method instead.

     IRID rid = r.getRID(); // r is the local referenced variable

Resource’s content and properties calls are expensive if you retrieve them always directly from the RF:

     IProperty p = r.getProperty(PropertyName.createDisplayName());
     // do something with p …
     p = r.getProperty(PropertyName.createLastModified());

      Try to use the IProxy or the PropertyAmalgamation mechanisme, which optimize the calles to the RF:

     IProperty p = proxy.getAmalgamation().getProperty(r, PropertyName.createDisplayName());


Use mass calls

If you have to process multiple objects of the RF, e.g. properties, try to use mass-calls, when ever it is possible:

     IPropertyNameList nl = new PropertyNameList();
     IPropertyMap propMap = proxy.getAmalgamation().getProperties(r, nl);

Or if you have to call the RF directly use the mass-call operation of the ResourceFactory object.

     IRidList rl = new RidList();

     IResource res = ResourceFactory.getInstance().getResources(rl, ...);

Useful utility class ResourcePropertyAmalgamation

The ResourcePropertyAmalgamation is located in the Java package com.sapportals.wcm.rendering.base and caches property calls against the RF. An instance can be get through the IProxy implementation:



Filter Blog

By date: