Customizing the aggregator to utilize custom properties

You can customize the aggregator to utilize custom attributes or rules.

About this task

Because the XDIME aggregator JSPs are included in the MPATheme EAR, you must update and redeploy the EAR if you add or modify an aggregator JSP. See the topic Deploying updates to the MPATheme EAR in this information center.

You must place the JSP in the same subdirectory in which it is located. It is located under the wp_profile_root/installedApps/node_name/MPATheme.ear/MPATheme.war/themes/xdime directory structure.

After the custom attributes have been added, you will need to update the aggregator JSPs to utilize the new attributes. The following example is used in the Adding custom extended properties topic. The new headerlogo attribute defines the new icon resource to use in place of the default logo.

Procedure

  1. Open wp_profile_root/installedApps/node_name/MPATheme.ear/MPATheme.war/themes/xdime/mpatheme/common/Header.jsp with a text editor.
  2. Find the following line:
    <img pane="G" src="<mwp : vpMapper name="/wp/logo.ming"/> alt="WebSphere Portal" />

    The src for this image will be replaced by the image defined for the node.

  3. Replace the line with the following:
    <% 
     //default header logo src is the original /wp/ logo.ming resource
     String headerLogoSrc = "/wp/ logo.ming";
    
     //check if the current node metadata exists 
    if (nodeMetadata != null) {
     com.ibm.mwp.metadata.MetaData headerLogoMetadata =
    
     nodeMetadata.getMetaData ("ea.attr.custom.headerlogo"
    );
     // check if the header logo metadata exists
     if(headerLogoMetadata != null) {
     //set the new header logo src if the metadata exists
     headerLogoSrc = headerLogoMetadata.getLiteral ();
     } 
    } 
    %>
    
     <img pane= "G" src="<mwp:vpMapper name=" <%=headerLogoSrc%>" />" a
    lt="WebSphere Portal" />

    The new code creates a new variable called headerLogoSrc, that is set to the original default of /wp/logo.mimg.

    The nodeMetaData variable contains all attributes for the current page. First, check whether nodeMetaData actually exists. If it does exist, see whether headerLogoMetaData exists, by fetching it with the fully qualified path ea.attr.custom.headerlogo. If it does exist, then you can get the literal string value for the image source that an administrator has set for this page. This new image overrides the original value in the headerLogoSrc variable, and it is then used in the <img> tag to render the image in the device.




Terms of use
(C) Copyright IBM Corporation 2012. All Rights Reserved.