This sample project is to help developers using the Personalization API to fully personalize the experience of your users with a personalization portlet.
This portlet works with four different users (Scott, Andy, Marge and Tawana) and a pre-configured backend database (pzndemo_db). The sample uses a JSP Portlet to show up personalized offers from a database to a specific user that is currently logged in into the HCL Digital Experience server. Details on the personalization demo users, pages and more are detailed in Personalization Demo.
A personalization portlet is a portlet that can show up specific information to a user based on rules. For details, please check: Personalization.
This project is an extension of the Personalization Demo. There are some prerequises needed to let the portlet run correctly. Detailed installation instructions can be found below.
- Maven need to be installed
- Microsoft Visual Studio Code
- git or git-bash
- HCL Digital Experience need to be installed locally or remotely. A single server instance is enough.
- dxclient should be installed, if the pre-configured deployment/undeployment task will be used.
This sample provides a Maven project, which is ready to use in Microsoft Visual Studio Code. Configuration introductions to setup your HCL DX Java Development environment can be found at HDX-DEV-300 HCL Digital Experience for Developers (Advanced) - Introduction lesson.
Please notice:
This sample project is created on a Microsoft Windows environment on which the pzndemo_db default location is configured to be on directory:
PZN-Database default location: C:\HCL\wp_profile\PortalServer\derby\pzndemo_db
Code changes in the hrf-files might be needed when the pzndemo_db will be installed on a different location.
-
Clone this repository to your development environment.
-
Import the rules located in hrf-files into your Digital Experience server. Use the following steps to import the rules:
-
Extract the Portal_rules_PznOffers.zip file located in the rules directory to any folder.
-
Login to the Portal Administration page as potal admin user.
-
Navigate to Personalization > Business Rules.
-
Click to New > Folder to create a new folder with name Pers Offers.
-
Click the Import button and import the following rules into the Pers Offers folder.
- Per_Offers_User.nodes
- Pzn_offers.nodes
- Show+Gold+Offers.nodes
- Show+Platinum+Offers.nodes
- Show+Titanium+Offers.nodes
- Show+Offers+by+Customer+Type.nodes
- Pers+Offers+User+Profiler.nodes
-
Click the Import button and select the following rule to be imported into the main (workspace) folder.
- Pzn_offers+spot.nodes
-
-
Run the following two ConfigEngine tasks on the HCL Digital Experience server to create the personalization demo users and the backend database with additonal resources like demo pages that will be used for this personalization.
UNIX™Linux™:
./ConfigEngine.sh create-pzndemo-users -DPortalAdminPwd=<password> -DWasPassword=<password>
./ConfigEngine.sh install-pzndemo -DPortalAdminPwd=<password> -DWasPassword=<password>
Microsoft Windows™:
ConfigEngine.bat create-pzndemo-users -DPortalAdminPwd=<password> -DWasPassword=<password>
ConfigEngine.bat install-pzndemo -DPortalAdminPwd=<password> -DWasPassword=<password>
These two tasks generate the demo-users and the pzndemo_db database that is used in this sample Portlet. For details, please check:
-
Open the folder \DX-Personalization-Development-Sample\Pers_Offers\pers_offers in your Microsoft Visual Studio code.
-
Compile and package the portlet using the Maven Lifecycle in Microsoft Visual Studio or by using the command line. The Maven package command helps to create the Portlet war file that by default will be located in the target directory of this project.
-
Deploy the portlet on a HCL Digital Experience environment using the dxclient (see tasks.json file) or by manually installing the WAR file.
Detailed steps to create such a personalization Portlet can also be found on the HCL Digital Experience Help Center page Develop a Personalization Portlet.
Please also check:
Portlets Development.