Additional Blogs by SAP
cancel
Showing results for 
Search instead for 
Did you mean: 
Dan_Wroblewski
Developer Advocate
Developer Advocate
0 Kudos
First, if your going to Tech Ed in Amsterdam next week, please stop by the Web Dynpro basics course (CD155) -- I'll be conducting a hands-on session on Web Dynpro-Portal integration. Not to be missed -- I'll be giving out candy to the developers who finish first or ask the most interesting questions. Second, I'm sorry it took so long to return to blogging on portal development (in the middle of my series on the PCD). Finally, let's discuss PCM. PCM (Portal Content Model) has existed for a while, but rarely is it discussed. PCM-related interfaces are used by portal developers, but usually without any understanding of what PCM is. PCM is a set of interfaces that all portal objects must implement -- at least if they want to be displayed in the Portal Catalog. The administration tools -- most notably the Portal Content Studio -- requires all portal objects to provide a few basic interfaces so that it can display them in the Portal Catalog. The main provider until now, of course, has been the PCD, but there may be other providers of portal objects. So the portal needed a set of interfaces for portal objects that was not dependent on the PCD. The interface that all portal objects must provide is IAdminBase, from which you can obtain the following interfaces:
  • IAttributeSet: Provides information on the attributes of the object, so these can be displayed in the Property Editor.
  • IPermission: Provides information about who has permission to modify and delete the object.
  • ICatalogNode: Provides additional information for displaying the object in the Portal Catalog, such as the URL for the image to display as the object icon.
To get a the IAdminBase of a portal object, just specify the administration aspect when performing a lookup for the object, as in the following example:    Hashtable env = new Hashtable();    env.put(Context.INITIAL_CONTEXT_FACTORY,       IPcdContext.PCD_INITIAL_CONTEXT_FACTORY);    env.put(Constants.REQUESTED_ASPECT, PcmConstants.ASPECT_ADMINISTRATION);    env.put(Context.SECURITY_PRINCIPAL, request.getUser());    InitialContext iCtx = null;    String myRole = "portal_content/MyContent/Corporate";    try {       iCtx = new InitialContext(env);       IAdminBase myAdmin = (IAdminBase)iCtx.lookup(myRole);       IPermission myIview = (IPermission)myAdmin.getImplementation(IAdminBase.PERMISSION);       String[] myPermissions = myIview.getAllPermissions();       for (int i = 0; i < myPermissions.length; i++) {          response.write(myPermissions[i] + "
");       }    }    catch (Exception e) { }
The above code gets an IAdminBase for the specified portal object, then gets an IPermission object from this, and displays all the permissions assigned to this object. Just a side note: Permissions are a little tricky, as there are PCD permissions, PCM permissions, and you could assign your own permissions to an object. More on this in my next blog. All of this, including how to the key interfaces, is described in painstaking detail at Accessing the PCD. Hopefully, I'll see you all at Tech Ed.
3 Comments