|
In this tutorial, we extend the capabilities of Websphere Portal attribute based personalization to a mobile device using MPA. A device has numerous properties/attribute and based on these properties/attributes values we can apply rules, that is we can decide to show or hide a portlet or page. This kind of personalization is very useful in places where we need to render a portlet or page based on device capability.Tags: mobile, mobile portal WEMP UI design, mptk61, Mobile MPA, Mobile portal Toolkit, Mobile Portal, Mobile Portal Accelarator, Mobile Portal Accelerator, MPA, MPA iPhone Mobile, MPA Mobile, MPTK, portal, Portal mobile
|
ShowTable of Contents Introduction
Attribute based personalization is a type of personalization used in ecommerce today where based on the attribute value, the portlet or page will be shown or hidden. This means that from a resource collection the attribute will be read and the corresponding range of value it supports. If the attribute is set to a value within a range then the portlet or page will be shown else it will be hidden. This type of personalization is very useful in Mobile based Portal systems where based on the device attribute the mobile supports we can show or hide a portlet or page from the user. In WebSphere Portal, you can attach a rule to a portlet or page to indicate when a rule or portlet should be visible. A rule defines the behavior or a portlet or page. If the rule conditions are satisfied then accordingly the page or portlet can be set to visible. Rules are nothing without input data; WebSphere Portal includes several out-of-the-box objects for accessing the portal user database, portlet configuration data, request, session, and date information in rules. These are often enough for a self-contained portal solution. Rules can be created from application objects which in turn access the resource collections to run the rule to determine the visibility of a page or portlet. Application Objects enable you to extend personalization with additional current information like weather, date and time, session or request information etc. Application objects are simply Java objects on the session or request. The rules engine finds the object on the session or request at a key you specify. The rules editor will introspect the Java class for the application object to determine what properties display in the editor. When a rule runs, the rules engine must find an instance of the application object. Normally, Personalization will look for an application object at a key specified by you when the application object is defined in the Personalization portlet.
In this tutorial, we extend the capabilities of Websphere Portal attribute based personalization to a mobile device using MPA. A device has numerous properties/attribute and based on these properties/attributes values we can apply rules, that is we can decide to show or hide a portlet or page. This kind of personalization is very useful in places where we need to render a portlet or page based on device capability. Prerequisites
This article requires the following runtime environment:
Mobile Portal Accelerator 6.1.X/7.0
To test this use mobile simulators or firefox add-on called User-Agent-Switcher to simulate mobile device requests. Adding the Application Object Download & placing the JAR File
o Download the PZNAppObjPortal.jar file
o Place this jar file in the required location. If your portal server is local then copy to \pzn\ prereq.pzn\collections\, substituting your portal server installation directory . For example, the portal installation directory for a Windows Machine could be C:\IBM\WebSphere\PortalServer\
o If you are using a remote portal server save the JAR locally and then copy the JAR to the collections directory on your portal server. The collections folder is part of a shared library created during the install and is intended to store custom application object and resource collection classes.
o Restart the portal server for the jar file to be absorbed
Download the Nodes File
o Download the devicePropApplObj.nodes file.
o Store the file locally on the system
Download and placing the XML File
o Download the extendedproperties.xml file
o Place the file in the /PortalServer/wp.mobile/wp.mobile.mwp/shared/app/config
o For example if it is a windows system the path could be :
C:\IBM\Websphere\wp_profile\PortalServer\wp.mobile\wp.mobile.mwp\shared\app\config
Import .nodes file
o Login into the portal server as admin
o Click on the Applications tab as shown below
o Click on the Content tab under Applications as shown below

o Click on the Business Rules under Content -> Personalization

o In the Personalization Navigator Portlet, click on the Import icon

o Browse through the documents to import the devicePropApplObj.nodes file
o After browsing, click on the Import Button
Creating a rule
o Under Personalization tab, click on Business Rules
o In the Personalization Navigator portlet, click on New icon/button

o Under New Icon, select Rule
o Name the rule as devicePropRule
o Select Rule type as Visibility Rule
o In the rule, click on attribute*
o Select devicePropApplObj
o Select any of the attributes from the list as shown

o For example if you select pixelsx
o Enter the value for the attribute selected. For the above example enter value 750
o Click Submit
o Click on the Preview tab in the Personalization Editor portlet below
o You will see the page/portlet result as Show. For all other values of relation “is” it will be hide
o Go back to New Rule tab.
o Click Save
o The relation between attribute and value can be changed also according to requirements
Applying a Rule (Portlet)
o Select a portlet on which a rule has to be applied and the page on which the portlet is rendered
o Goto Manage Pages
o Select the page on which the required portlet is rendered
- For example the page is Test and the page contains portlet About WebSphere Portal on which the rule has to be applied
o Next to Test select the icon Edit page layout
o Click on Show Portlet Rule Mapping

o Select the downward arrow next to No Rule Mapped below the Portlet name
o Select Select Rule from the list of options
o Check on the checkbox devicePropRule
o Click Ok
o Click Done
Applying a Rule (Page)
o Goto Manage Pages
o Now select a page (XDIME page) on which a rule has to be applied
o For example if the page is Test, next to Test Select the icon Edit page Properties
o Expand Advanced option section
o Select the downward arrow next to Show or Hide page rule: No Rule Mapped below
o Select Rule from the list of options

o Check on the checkbox "devicePropRule" (The rule that you created)
o Click Ok
o Click Ok
Testing
o Using a mobile device simulator/ UserAgent we can test this feature
o To test the rule that is applied on a portlet. Goto the page where this portlet is placed and check if the rule works on that portlet
o To test the rule that is applied on a page. Just see if that particular page is visible or hidden base on the rule that you have applied or selected
References
[1] Extending WebSphere Portal V6 personalization capabilities: Part 1. Including external data in personalization applications
Link: http://www.ibm.com/developerworks/websphere/library/techarticles/0702_brunn/0702_brunn.html
[2] Extending WebSphere Portal V6 personalization capabilities: Part 2. Creating a "Hello World" application object
Link: http://www.ibm.com/developerworks/websphere/library/techarticles/0702_brunn/0702_brunn.html
[3] Extending WebSphere Portal V6 personalization capabilities: Part 3. Creating a Web service application object
Link: http://www.ibm.com/developerworks/websphere/tutorials/0702_brunn3/ |