liferay 6.2 + activiti integration. · as liferay is a java based framework that provides list of...

23
Liferay 6.2 + Activity | 1 Liferay 6.2 + Activiti Integration. By Amin Chakchaktawala

Upload: others

Post on 07-Mar-2020

4 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Liferay 6.2 + Activiti Integration. · As Liferay is a JAVA based framework that provides list of portlets out of box and easy integration with various third party support. In liferay

Liferay 6.2 + Activity | 1

Liferay 6.2 +

Activiti

Integration.

By Amin Chakchaktawala

Page 2: Liferay 6.2 + Activiti Integration. · As Liferay is a JAVA based framework that provides list of portlets out of box and easy integration with various third party support. In liferay

Liferay 6.2 + Activity | 2

What is Activiti?

Activiti is Lightweight BPM engine. Activiti is Uses BPMN 2.0

Standards to Model Business Process. And It Execute Business

Process.

Liferay :

As Liferay is a JAVA based framework that provides list of

portlets out of box and easy integration with various third party

support. In liferay we can define Business Workflow for BPMN

process , with liferay 6.2 we get Kaleo as a default work flow

but if we want to use some other work flow engine instead of

Kaleo then it also possible.

Here we are going to integrate Activity as a workflow engine

instead the default Kaleo, with Liferay 6.2. Step by step guide of

whole process is described below with proper explanation of

each.

Page 3: Liferay 6.2 + Activiti Integration. · As Liferay is a JAVA based framework that provides list of portlets out of box and easy integration with various third party support. In liferay

Liferay 6.2 + Activity | 3

Setups Requirements:

For this entire process you require some setups as a .war

files.

1> Activity Engine: Which helps to apply work flow on any

Business Process.

You can download Activity Engine for Liferay – 6.2 from URL:

https://www.dropbox.com/s/z9hpjh8pfq5c4

li/activiti-web-6.2.0.14.war

2> Activity Explorer: Which provide UI to design work flow with

in Liferay itself.

You can also get Activity Explorer for Liferay – 6.2 from :

https://www.dropbox.com/s/lwxi7o2vwgdll72/ac

tiviti-explorer.war

Page 4: Liferay 6.2 + Activiti Integration. · As Liferay is a JAVA based framework that provides list of portlets out of box and easy integration with various third party support. In liferay

Liferay 6.2 + Activity | 4

Step 1

As a first step we need to remove that default Kaleo workflow

from our Liferay server. As Kaleo and Acitiviti both using some

same resources of liferay server. So to make Activiti to come in

we need to make Kaleo to exit from Liferay. For that,

Start Liferay-6.2 server.

Go to Admin - > Control Panel - > App Manager

Uninstall Kale Workflow Web.

Figure 1 –

App Manager page to remove Kaleo.

Page 5: Liferay 6.2 + Activiti Integration. · As Liferay is a JAVA based framework that provides list of portlets out of box and easy integration with various third party support. In liferay

Liferay 6.2 + Activity | 5

After that if you want to check, if kaleo removed properly or

not? You can follow tomcat console logs OR in Control Panel,

Under Configuration Section notice that “work flow“ option is

now no more.

Figure 2

Configuration page showing work flow option gone as a result of

Kaleo removal.

Page 6: Liferay 6.2 + Activiti Integration. · As Liferay is a JAVA based framework that provides list of portlets out of box and easy integration with various third party support. In liferay

Liferay 6.2 + Activity | 6

Step 2:

Now Let’s Add Activity Work flow engine in place of Kaleo, For

that you just need to place downloaded activity-web -6.2.0.war

file in your liferay-portal-6.2.0-ce-ga1\deploy folder. And let

tomcat deploy it. After successful deployment again visit,

Admin -> Control Panel -> Configuration section.

Figure 3 -

Work Flow option is available, which shows that Activity

Engine has configured properly.

Page 7: Liferay 6.2 + Activiti Integration. · As Liferay is a JAVA based framework that provides list of portlets out of box and easy integration with various third party support. In liferay

Liferay 6.2 + Activity | 7

Step 3 :

Assign Demo Work Flow on Blogs and

Comments.

Visit Control Panel - > workflow - > Default Configuration.

You will find that initially No workflow is assigned to any of that

options. So, let’s assign one to them ,

For that first you require a work flow which can be created

using work flow designer but till now we haven’t configure any

activity workflow designer with liferay. Then also liferay provide

facility to import workflow file which is created using any other

external tool. . Here we are going to use one external bpmn file

which was created externally named as

“MyLiferayProcess.bpmn20”.

You can get this demo file from :

https://www.dropbox.com/s/o3b8l9zyly72dqo/MyLiferayProcess.bpmn20

.xml

Download this file and import it to

Control Panel - >Configuration ->work flow - > upload new

Definition.

Page 8: Liferay 6.2 + Activiti Integration. · As Liferay is a JAVA based framework that provides list of portlets out of box and easy integration with various third party support. In liferay

Liferay 6.2 + Activity | 8

Figure 4 –

Upload new workflow definition.

Now , switch to Default Configuration Tab , and assign “My

Process” work flow to resources of your choice. We are adding

this work flow on Blogs Entry and Comments.

Figure 5 –

Assign work flow to Resource like Blog, Comments etc.

Page 9: Liferay 6.2 + Activiti Integration. · As Liferay is a JAVA based framework that provides list of portlets out of box and easy integration with various third party support. In liferay

Liferay 6.2 + Activity | 9

Step 4:

Check How My process workflow will work.

Let’s check that how MyProcess Workflow will work, as we

have applied it on Blogs entry and Comments. For that,

First we need to create one Blog post , so login as Admin in

Liferay server and add Blog protlet on any of your site page.

After that create a new user and assign that site on which you

have placed Blog portlet to that new user and logout from

Admin, then login as a new user which you have just created.

Figure 6 –

Blog portlet added on one site page.

Page 10: Liferay 6.2 + Activiti Integration. · As Liferay is a JAVA based framework that provides list of portlets out of box and easy integration with various third party support. In liferay

Liferay 6.2 + Activity | 10

Here, I am logged in with another user name and one Blog is

available there on site page which was added by admin. So,

let’s make some comments on it.

Figure 7 –

Add comments on Blog.

If you notice in this comment page below, you will find that

after comment box instead of just “Post comment” button you

got option like “submit for Publication” which shows that work

flow assigned on this resource.

Page 11: Liferay 6.2 + Activiti Integration. · As Liferay is a JAVA based framework that provides list of portlets out of box and easy integration with various third party support. In liferay

Liferay 6.2 + Activity | 11

After you submit this comment for publication, it will transfer in

Review Asset mode means it still Pending and not publish to

view by any other user.

Figure 8 –

Comment transfer to Pending mode (Moderation).

This pending Task assigned to Admin role (you can assign it to

any other role also, but in MyProcessWorkflow we have assign

this task to Admin role.), so as you logged as Admin you will

find notification available for you to perform task on this

pending request.

Page 12: Liferay 6.2 + Activiti Integration. · As Liferay is a JAVA based framework that provides list of portlets out of box and easy integration with various third party support. In liferay

Liferay 6.2 + Activity | 12

Figure 9 –

Review task notification to Admin role.

Sometime it may be possible that you don’t get this

notification, then also check for any available or pending tasks

in User’s My Account option.

Figure 10 –

Check for available task in User’s Account.

Page 13: Liferay 6.2 + Activiti Integration. · As Liferay is a JAVA based framework that provides list of portlets out of box and easy integration with various third party support. In liferay

Liferay 6.2 + Activity | 13

To proceed further in work flow, admin need to accept this task

means admin have to assign this task to him self, So Click on

Action - > Assign to Me .

Figure 11-

Assign task to me.

As admin accept this task, all further decisions regarding

this particular content either to approved it or reject it depends

on him. If admin approve this content then it will be published,

but if reject then notification for this rejection will be send to

owner of this content with reason of rejection. User can also

edit this content again submit it for approval and again whole

same process will continue.

Page 14: Liferay 6.2 + Activiti Integration. · As Liferay is a JAVA based framework that provides list of portlets out of box and easy integration with various third party support. In liferay

Liferay 6.2 + Activity | 14

Note : On windows during assigning work flow task it may create

some errors. So to resolve that error you need to create a new

folder called “ endorsed “ in Liferay-portal-6.2/tomcat. And place

jaxb-api.2.2.1.jar file in that. You can get this .jar file from

https://www.dropbox.com/s/lnckwax6fo9gv8u/jaxb-api-

2.2.1.jar

Figure 12 –

Approve or Reject content.

Page 15: Liferay 6.2 + Activiti Integration. · As Liferay is a JAVA based framework that provides list of portlets out of box and easy integration with various third party support. In liferay

Liferay 6.2 + Activity | 15

Let’s approve this comment. After you approve this, again

logged in as a user who has post this comment on blog. And

check for the status of that comment now.

Figure 13-

Comment approved and published.

Page 16: Liferay 6.2 + Activiti Integration. · As Liferay is a JAVA based framework that provides list of portlets out of box and easy integration with various third party support. In liferay

Liferay 6.2 + Activity | 16

Step : 5

Add Activiti work flow designer to Liferay.

Till now we have just focuses on applying workflow which was

created externally , but let’s say if we want to create our own

Activiti workflow through Liferay it self then we need to add

activiti work flow designer portlet to Liferay server. For that,

Place you downloaded .war file for activiti-explorer to “Liferay-

portal 6.2 /deploy“ folder. After successful deployment you will

find“ activiti-explorer“ portlet available in Add option under

Undefined section. Add this designer portlet to site page.

Figure 14-

Activiti Designer portlet added to site page.

Page 17: Liferay 6.2 + Activiti Integration. · As Liferay is a JAVA based framework that provides list of portlets out of box and easy integration with various third party support. In liferay

Liferay 6.2 + Activity | 17

Logged into this activiti designer using User Id: kermit

Password: kermit. After logged in, you will find a window where

you can create a new work flow definition or can import

existing one for modification.

Figure 15 –

create new work flow definition.

If we import “MyprocessWorkflow” which we have applied on blog

comments, here and edit it, then that entire .bpmn file will in

front of us in diagram format where you can see all task and

overall work flow for more clear vision. For this existing workflow

we can modify task as well change roles of all task based on our

requirements.

Page 18: Liferay 6.2 + Activiti Integration. · As Liferay is a JAVA based framework that provides list of portlets out of box and easy integration with various third party support. In liferay

Liferay 6.2 + Activity | 18

Figure- 16

MyProcessWorkflow file in from of Diagram.

Now, If we want to create a new work flow from scratch based

on our own requirement and task, then we can create it from

screen shown in Figure -15, by clicking on “New Model” button.

Figure 17 :

Create new work flow.

Page 19: Liferay 6.2 + Activiti Integration. · As Liferay is a JAVA based framework that provides list of portlets out of box and easy integration with various third party support. In liferay

Liferay 6.2 + Activity | 19

Activiti provide various components to create events like strat

event , stop event & task like User task, service task , script

task, and much more drag and drop options to create entire

work flow.

Figure – 18

Activiti compnonets.

Let’s do one exercise to assign user role/user to perfom User

task, If you observe screen shown in above image , at right

hand side one sliding menu option is there, just click on that

small icon for sliding menu and propertise and further options

to set user task are front of you. Click on Assignments property

which pops up one dialog box as shown in below image.

Page 20: Liferay 6.2 + Activiti Integration. · As Liferay is a JAVA based framework that provides list of portlets out of box and easy integration with various third party support. In liferay

Liferay 6.2 + Activity | 20

Figure 19 –

Assign task to User role.

From dropdown option select any one to which category you

want to assign this particular task. And under “Resource

Assignment expression“ option place,

#{liferayGroups.getGroups(execution,”Community

Administrator, Community Content Reviewer,

Administrator”)}

This sentence declares that this user task will Assign to

Community Administrator, Community Content Reviewer, and

Administrator. Some extra roles like Power User, Guest,

organization admin etc. can also be added here comma

separated.

Page 21: Liferay 6.2 + Activiti Integration. · As Liferay is a JAVA based framework that provides list of portlets out of box and easy integration with various third party support. In liferay

Liferay 6.2 + Activity | 21

One more thing to remember, you need to provide a unique

process – identifier name.

Figure 20 – Assign process identifier name.

For this workflow we have provide “Activiti Demo“ as

Process Identifier.(Right side 3rd option). After all stuff done

regarding drawing and assigning name and task and all that,

save this work flow and close designer.

Creating and saving diagram only not complete the entire

task, means what work flow we have created is not directly

available for use with liferay. We need to export it as .xml file

and then from “work flow“ option under

Control panel ->configuration section import it, as just done

before.

Page 22: Liferay 6.2 + Activiti Integration. · As Liferay is a JAVA based framework that provides list of portlets out of box and easy integration with various third party support. In liferay

Liferay 6.2 + Activity | 22

Step 6 : - Export Work flow .

Figure 21 –

export work flow.

To export work flow as a .xml file, from this above window

right side click on arrow button ,select Export Model option

from it.After you import this newly created work flow check in

Configuration -> workflow option this will avilble there for use.

Page 23: Liferay 6.2 + Activiti Integration. · As Liferay is a JAVA based framework that provides list of portlets out of box and easy integration with various third party support. In liferay

Liferay 6.2 + Activity | 23

But you need to note one thing , after creating workflow

from Activiti designer in Liferay portlet it will not going to ready

for use directly. You need to export it and then import it form

work flow option which is mandatory.

So with this last step we have successfully integrated

Activiti work flow engine as well Activiti work flow designer

with liferay 6.2 and both are ready to implement some BPM

rules and flow over any content that created in Liferay.