Show TOC

Background documentationCatalog Node Attributes Locate this document in the navigation structure

 

With the ICatalogNode interface, you can get information about portal objects in order to display them in administration editors or other applications. The interface, for example, is used by the Portal Catalog user interface to display the tree of portal content.

The following are the key methods:

  • getTitle(): Returns the friendly name of the object.

  • getIcon(): Returns a PcmUri object that enables you to get the URL for the image that represents the object's type.

The following retrieves the catalog node attributes for a portal object:

Syntax Syntax

  1. Hashtable env1 = new Hashtable();
    
    env1.put(Context.INITIAL_CONTEXT_FACTORY,
        IPcdContext.PCD_INITIAL_CONTEXT_FACTORY);
    env1.put(Context.SECURITY_PRINCIPAL, request.getUser());
    env1.put(Constants.REQUESTED_ASPECT, PcmConstants.ASPECT_ADMINISTRATION);
    
    InitialContext iCtx = null;
    
    try {
        iCtx1 = new InitialContext(env1);
        IAdminBase adminBase = (IAdminBase)iCtx.lookup(lookupObject);
    
        // Write type of portal object
        response.write("Object Type: " + adminBase.getObjectType()+"<BR>"); 
    
        // Get ICatalogNode interface
        ICatalogNode cn = (ICatalogNode) adminBase
            .getImplementation(IAdminBase.CATALOG_NODE);
    
        // Write title of portal object
        response.write(cn.getTitle(request.getLocale())+"<BR>");
    
        // Get object for obtaining image URL
        PcmUri pcmUri = cn.getIcon(ObjectState.DEFAULT);
    
    } catch (NamingException e) {}
End of the code.
Displaying Icons

The PcmUri is a generic object enabling you to derive the URL for an image. It is independent of the user interface technology.

The following code shows how to derive the URL from within a portal (PRT) application:

Syntax Syntax

  1. String iconURL = "";
    
    ICatalogNode cn = (ICatalogNode) adminBase
        .getImplementation(IAdminBase.CATALOG_NODE);
    PcmUri pcmUri = cn.getIcon(ObjectState.DEFAULT);
    
    switch (pcmUri.getUrlType()) {
    
        case PcmUri.URL_TYPE_APPLICATION_RESOURCE:
            iconURL = request.getWebResourcePath(pcmUri.getApplication())
                + "/" + pcmUri.toString();
            break;
    
        case PcmUri.URL_TYPE_JNDI_URL:
            IPortalComponentURI componentURI = 
                request.createPortalComponentURI();
            componentURI.setContextName(pcmUri.toString());
            iconURL = componentURI.toString();
            break;
    
        case PcmUri.URL_TYPE_ABSOLUTE:
            iconURL = pcmUri.toString();
            break;
    }
    
End of the code.

The following code shows how to derive the URL from within a Web Dynpro application:

Syntax Syntax

  1. String iconURL = "";
    
    ICatalogNode cn = (ICatalogNode) adminBase
        .getImplementation(IAdminBase.CATALOG_NODE);
    PcmUri pcmUri = cn.getIcon(ObjectState.DEFAULT);
    
    switch (pcmUri.getUrlType()) {
    
        case PcmUri.URL_TYPE_APPLICATION_RESOURCE:
            iconURL = WDPortalUtils
                .getPortalWebResourceURL(pcmUri.getApplication())
                    + "/" + pcmUri.toString();
            break;
    
        case PcmUri.URL_TYPE_JNDI_URL:
            iconURL = pcmUri.toString();
            break;
    
        case PcmUri.URL_TYPE_ABSOLUTE:
            iconURL = pcmUri.toString();
            break;
    }
    
End of the code.