darquesdev / liferay-segments-criteria-extension-sample

Liferay Segments Criteria Extension Sample

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Liferay Segments Criteria Extension Sample

Code for Liferay's /dev/24 talk:

How to create your own segments criteria
  • Short introduction to Segmentation and Personalization
  • Personalization in Action!
  • Creating complex segments:
    • User & Organization criteria: fields and custom fields
    • Session criteria: session properties, request attributes, cookies, etc
    • Segments criteria: segments as criterion. Introduced in 7.3.
  • Hands-on Creating a Segment Criteria Contributor

This repo will guide you step-by-step on how to extend the Liferay Segments Criteria capabilities by creating your own Segment Criteria Contributor. As an example we'll create a contributor that segments users based on the Knowledge Base articles they have authored.

Screenshot of the Knowledge base segments criteria

Steps

  1. Make your related entity (KBArticle) searchable through OData queries:
    • EntityModel: represents your associated entity with its fields of interest.
    • ODataRetriever: obtains the KBArticles that match a given OData query.
  2. Customize fields of type ID to use an entity selector:
  3. Create the SegmentsCriteriaContributor: It contributes a query to filters users based on the articles they authored.

Follow the commits for a step by step explanation.

How to run it

Clone the repo and run the following:

LIFERAY_HOME=<your liferay home folder> ./gradlew deploy

In my case:

LIFERAY_HOME=~/projects/liferay/portal/bundles ./gradlew deploy ./gradlew deploy

Segmentation & Personalization docs

Thanks

Thanks to @4lejandrito, and the @liferay-tango team for helping with this talk.

About

Liferay Segments Criteria Extension Sample

License:GNU Lesser General Public License v2.1


Languages

Language:Java 100.0%