ShowTable of Contents
Overview
Within WCM, content can be categorized. Normally, this is used to allow WCM menus to display content related to specific categories. However, it is also possible for users within WCM to have categories associated with their profile. This can be done within the
WCM Authoring UI
, the user can select their own categories using a
Taxonomy Element
, or can be done
programmatically
. Once the user is associated with categories, a WCM menu can then retrieve content that is associated with the same categories as the user.
In this example, we will show how these categories can be used within PZN rules to retrieve the content that is related to the categories that the user is interested in.
One note, the APAR PM75476 is necessary for this example to work if the WCM Dynamic Mapper is being used.
Creating and Deploying the Custom Application Object
There are 2 approaches that we can use for this application object. One is to retrieve the values that WCM has associated with the user. This is useful if the end user has categories stored within WCM, the dynamic mapper approach is being used (categories added to WCM Users programmatically), or the end user is selecting their own categories using the taxonomy tree. The other approach is that the custom application object can associate categories for the specific user programmatically. This approach is useful, because categories can selected based on things like user cookies, request attributes in the current request, etc. This particular example will retrieve the categories directly from WCM for the user.
Create the Custom Application Object
I used Rational Application Developer for this process. If you are using a different IDE, your steps may be different.
- Click new -> Dynamic Web Project. Name the project CustomUserCategoryApplicationObject. You can pretty much leave the defaults for the values, click finish:

- In the project that was created expand Java Resources, and right click on the src folder. Click new -> package. Enter com.ibm.websphere.personalization.custom.appobject and click finish. Repeat, and enter com.ibm.wcm.sample.categorycache
Export and Deploy the Custom Application Object
Now that the custom application object code is in place, we need to deploy to the WebSphere Portal server. In order for custom application objects to be used by Personalization, the code has to be placed in /WPHOME/pzn/prereq.pzn/lib.
- In your custom application project, right click the src folder, and select export. Select to export as a .jar file
- Ensure the Export generated class files and resources is checked.
- Ensure the Export java source files and resources is checked.
- Ensure the Add directory entries is checked.
- Ensure the Compress contents of the JAR file is checked.
- Select a location for the .jar and click finish.

- Copy the .jar file to /WPHOME/pzn/prereq.pzn/lib directory and restart the Portal server.
Create the Application Object within PZN UI
Creating the PZN rules
To display the results, we will create a WCM PZN Component in order to reference the rule.
- Navigate to the WCM Authoring UI, open the library that you wish to store the PZN component in.
- Create new -> Component -> Personalization
- Name the component PZN - Current User Category Content
- For the Personalization Element, click New. Create the rule to select Web Content whose category is associated with CurrentUserCatsApp.currentCategoriesUuidString:

- Click Save.
- In the PZN Component, for the Design for each Menu search result, put the following:
[Property type="content" context="autofill" field="title"] - [Property type="content" context="autofill" field="categories"]<br>
This will render the title of the content, as well as the categories that the content is associated with. This will tell us whether the rule is working.
- Save and close the component
Rendering the Results
Now that we have the WCM Component in place, we just have to reference it from a WCM Rendering Portlet.