Show TOC Start of Content Area

Background documentation Working with Administration (PCM) Objects  Locate the document in its SAP Library structure

When working with PCD objects, you can use administration objects, which provide general methods that are valid for all semantic objects – less specific than methods exposed by semantic interfaces but semantically richer than those exposed by low-level PCD interfaces.

For more information on PCM and the purpose of administration interfaces, see Portal Content Model (PCM).

There is one main administration interface, IAdminBase, which you obtain directly from a PCD lookup, as described below. From the IAdminBase interface, you can derive the following additional interfaces:

      IAttributeSet: Provides access to an object’s attributes, and enables you to look up, create, modify and delete attributes and meta-attributes, as described in Attributes.

      IPermission: Provides access to an object’s permissions, and enables you to check if a user has a specific permission for an object, as described in Permissions.

      ICatalogNode: Provides information about the object that is useful for building an administration editor, as described in Catalog Node Attributes.

For example, this interface provides the icon and display name for the underlying object, which can then be displayed in an editor.

You can also find out the underlying object type of a PCD object by calling the IAdminBase.getObjectType() method.

Getting the IAdminBase Interface

The following describes how to get the main administration interface, IAdminBase, for a specific object.

...

       1.      Set the parameters for a JNDI lookup in the PCD, including setting the aspect to ASPECT_ADMINISTRATION.

Hashtable env = new Hashtable();

env.put(Context.INITIAL_CONTEXT_FACTORY,
    IPcdContext.PCD_INITIAL_CONTEXT_FACTORY);

env.put(Context.SECURITY_PRINCIPAL, request.getUser());

env.put(Constants.REQUESTED_ASPECT, PcmConstants.ASPECT_ADMINISTRATION);

       2.      Perform a lookup by doing the following:

...

                            a.      Create an initial context with the parameters in your Hashtable object.

                            b.      Perform a lookup on your initial context, supplying the PCD name of the object, and then cast the returned object to IAdminBase.

InitialContext iCtx = null;

try {

    String objectName = "pcd:portal_content/myFolder/stocks";

 

    iCtx = new InitialContext(env);

    IAdminBase result =(IAdminBase)iCtx.lookup(objectName);

}      

catch(Exception e) {}

Getting Other Interfaces

The following shows how to get secondary administration interfaces (IAttributeSet, IPermission and ICatalogNode) from an IAdminBase object:

IAdminBase result =(IAdminBase)iCtx.lookup(objectName);

 

IAttributeSet myIview = (IAttributeSet)
   
result.getImplementation(IAdminBase.ATTRIBUTE_SET);

End of Content Area