Show TOC Start of Content Area

Syntax documentation Flexible UI Locate the document in its SAP Library structure

Use

When you implement flexible UI components, calls to the repository framework can slow down performance. You can speed up such calls with the help of different strategies. You can:

·        Reuse information within UI components

·        Use mass calls

Reusing Information

Flexible UI components like collection renderers or property renderers often have to retrieve information that is related to resources from the repository framework. However, this information is usually already available and therefore does not have to be requested again. Most of the methods implemented for a UI component require resource-related information as parameters. For example, in the code extract below, the renderProperty method requires a resource object as a parameter. The reference to the resource object can be reused for other purposes.  

 

 public class SimplePropertyRenderer implements IModelledPropertyRenderer

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

                                  throws WcmException {
         :

      }        

  }

 

Basic Code

In the coding for UI components, avoid retrieving IResource objects from the repository framework with RepositoryFactorycalls as shown in the following:  

 

     IResourceList res = ResourceFactory.getInstance().getResources(rl..);

     IRID rid = res.getRID();

     :

 

Optimized Code

Instead of calling the ResourceFactory,  use the local reference to the resource object passed as parameter to the renderProperty method.

 

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

 

  

Using Mass Calls

If you process multiple objects of the repository framework, for example, properties, use mass calls whenever possible.

In the following code, the ResourcePropertyAmalgamation class, which caches calls for properties, is used to access properties. The  instance of the class is obtained with IProxy.getAmalgamation().  The coding uses the class to return all properties of the resource, using cached properties whenever possible.

 

     IPropertyNameList nl = new PropertyNameList();

     nl.add(PropertyName.createLastModified());

     nl.add(PropertyName.createLastModifiedBy());

     nl.add(PropertyName.createDisplayName());

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

 

If  you have to call the repository framework directly, use the mass-call operation of the ResourceFactory  object.

 

     IRidList rl = new RidList();

     rl.add(RID.getRID("/documents/test.txt"));

     rl.add(RID.getRID("/documents/test2.txt"));

 

     IResourceList resList = ResourceFactory.getInstance().
                             getResources(rl,...);

 

 

End of Content Area