1/30/2018

Guide for Execution of Custom Entity Kaleo Workflow in Liferay DXP Including Coding Part

Title: Custom Entity Kaleo Workflow Integration in Liferay DXP Including Coding Part Workflow Engines have their own precise patterns starting from verification of the current status to determining the authority of users to executing condition script. The developer’s methodology to integrate it with the application defines the critical success factor of its optimum usability. Hereby, I am sharing one of my experiences of implementing Kaleo workflow engine in a Liferay development process.

Liferay supports Kaleo workflow engine already deployed in its server bundle as well as available at Liferay marketplace. Not only that, Kaleo substantially has out of the box unification with Liferay DXP’s functional characteristics for the creation of roles, users, and organizations. Hence, I opted for Kaleo for the project we are discussing as the used case.

Project Details:


  • A Liferay Portal Development project for building a domain-specific web-based collaboration platform similar to PeoplePerHour.com or Guru.com

  • User Details:
liferay kaleo workflow tutorial

Kaleo Workflow with custom entity "ABCTask"

To implement the above-described workflow in my Liferay Application Development process, I created a custom entity "ABCTask" followed by workflow inception programmatically. I preferred dynamic navigation from one node to other instead of using UI provided by Liferay DXP.

How to code for actual execution of Kaleo workflow


Know your Nodes first before you connect them

As a developer, we consider workflow to be a sensible connection between different nodes. Nodes can be:

liferay kaleo workflow tutorial


How to create Workflow Definition?


Creation of workflow definition (XML file) is an in-depth topic. I would suggest you be very clear about it. You can refer the following link for the same.

Link:- https://dev.liferay.com/discover/portal/-/knowledge_base/6-2/creating-new-workflow-definitions 


Coding Details


As developers, we are aware of the fact that when it comes to executing a workflow, all nodes are a task.

[A] Creation of Workflow Instance

When User A creates ABCTask, we need to start workflow instance of "ABCTask" entity using Workflow API provided by Liferay. The coding part is displayed below. 

 Create Workflow Definition Link such as:

liferay kaleo workflow tutorial

To enable a workflow for the custom entity, we have to make that entity an asset:

Custom Entity Kaleo Workflow in Liferay DXP

Start workflow instance:


Custom Entity Kaleo Workflow in Liferay DXP

When the workflow gets started, it will be the initial state, known as the CREATED state. The workflow will be executed to the Task node of the workflow. The user input will be required at Task node.

[B] Obtaining Workflow Task

When User B sends the proposal to User A and User A approves it, the state of Entity has to be moved from “Start” to “Approved”. Liferay’s API can be used for moving workflow task from one state/task to other state/task.

Of course, without completion of existing workflow task, you cannot move to another Task node. You can obtain Workflow Task from workflow logs. Please find the code snippet to obtain the workflow task and complete that task below

Workflow Instance is required to manage workflow operations:

Custom Entity Kaleo Workflow in Liferay DXP

[C] Obtaining the latest workflow taskId from logs:

Custom Entity Kaleo Workflow in Liferay DXP

[D] Completion of the Workflow Task:

You need next transition name to execute other nodes.


liferay dxp workflow


Conclusion:


Though technology world offers us unlimited tools to create business-friendly software applications, optimum utilization of Workflow Engines for desired process management demands individual creativity from a developer. This project enhanced my individual skills as a developer by driving my creative logic to the next level.  


Author of This Post


Author Bio: Namee Jani is a Passionate Digital Marketing Strategist working with Azilen Technologies. She is Certified Google Adwords & Analytics and adores catching new trends and techniques prevalent in the online marketing world. Click Here for more information about Author

No comments:

Post a Comment