Using the Workflow Portlet

odecrackAI and Robotics

Oct 29, 2013 (5 years and 8 months ago)


Using the Workflow Portlet

liferay v5.0

liferay v5.1

using liferay

To run the workflow
portlet using saw
web, see

Step 1: Get the plugins source.

The workflow portlet was previously part of the LR
core, but since 5.1.x it has been
to the plguins directory. So firstly we need to get the LR source. Do an svn co on This would get all the stuff from the LR
plugins. Modify the appropriately.

Step 2: Modi
fy jbpm

Modify jbpm
hibernate.cfg.xml to make it point to the
appropriate Database. By default it points to hypersonic. Make sure all the entries are correct.

Step 3: Deploy jbpm

Now run "ant" on the plugins
web. This default target compiles, wars and
deploys the jbpm

Step 4: Deploy mule

Now run "ant" on <liferay
web This default ant target compiles,
wars and deploys the mule


Ensure that the value for "jbi.w
orkflow.url" key in is

This ensures that we use mule as the ESB.


LR workflow Portlet does not work when servicemix esb is used. It w
orks with Mule.

for details.

Step 5: Deploy workflow portlet

Now run "ant"

on plugins
portlet. This default ant target compiles, wars
and deploys the workflow

Step 6: Add workflow portlet to the portal page.

Access the portal page and login as the admin. Goto dock
> Add Application
> search for
orkflow portlet
> Add the portlet to the page.

Step 7: Deploy a buisness process

Assume that you want to deploy the holiday_Definition business process that is available in
definitions. Modify i
t appropriately by
giving correct values for the companyId and id. Paste it in the space provided and click on "Add
Definition" The Business process has now been added. Click on Search Definitions and you would
see the business process that you just deploy

Working with Workflow

As an administrator, you may need to provide an environment for Users to manage

workflows at the Page, "Workflow", under the Page, "Community", of the Book

Lovers community. For example, the User, "Lotti Stein", at the Edit
orial department

submits a request, "request
holiday", and the manager, "David Berger", at the

Editorial department reviews/approves/rejects the request via a workflow. First,

let's set up workflow as follows:

1. Add a Page named "Workflow" under
the Page, "Community", of the Book

Lovers community.

2. If the Workflow portlet is not already present, add it in the Page,

"Workflow", of the Book Lovers Community, where you want to let Users

manage workflows by other portals.

Now, you are ready to deploy a workflow.

g Workflow

Suppose that a workflow, "holiday", was used for the above example. Let's deploy

this workflow as follows:

1. Navigate to the Page, "Workflow", under the Page, "Community", at the

Book Lovers community.

2. Locate the Workflow portlet.

3. By default, the Definitions tab is selected as shown in the following figure.

The Workflow portlet displays all the workflows that have been deployed in

the system.

4. T
o deploy a workflow, say "holiday", click on the Add Definition button.

5. At this point, you can paste the contents of a definition XML.

6. Click the Save New Version button.

7. An error message will be displayed, if the input is invalid. A success

will be displayed, if the input is valid.

In order to make Workflow work well, you have to deploy jbpm

(WAR) and mule
web (WAR) or Servicemix
web (WAR) first. Refer to

Chapter 10 to know how to deploy po
rtlets. The Workflow portlet works

well in version 4.3.4. Staging enhancement and Workflow is available in

version 5.x. For more details, refer to Chapter 13.

Shared Calendars, WSRP And Workflow

f course, you can deploy other workflow definitions, such as "Websale" and

"Datatypes". After deploying workflow definitions "Websale" and "Datatypes", you

can view workflows.

Managing Definitions

Since business processes may change over time, we ha
ve to manage every version

of Workflows. To edit an existing Workflow version, simply click on the Edit icon

located next to the definition name (or from the Actions next to the definition name).

Update the XML in the text area first, and then click the

Save New Version button.

The new version number will be incremented by one from the previous version

number. For example, the current version of Workflow, "datatypes", is 1.0. Then the

new version number of Workflow, "datatypes", would be 2.0.

g Instances

Now a Definition, "Holiday", is deployed. We are ready to add a new Instance of a

Workflow Definition. "Holiday". Let's do as follows:

1. By default, the Definitions tab is selected.

2. Locate the Workflow Definition,"Holiday", and
simply click on the Add

Instance icon.

3. A new instance will appear on the Instances tab.

Now, a Definition "Holiday"

was deployed and an Instance of that Definition

was started. It is up to the User to manage the life cycle of the Instance. Instance

management is controlled from the Instances tab with an icon, "Manage".

You can view all Instances of a Workflow D
efinition. To view all the Instances of a

particular Definition, click the View Instances icon. Finally, you can also search for a

Definition by name using the Definition Name and Definition Version input boxes.

The Instances tab displays every instance

of every version of every Workflow

deployed in the system. They are listed alphabetically by Definition Name

followed by Definition Version, Start Date, End Date, State and set of actions in

descending order.

The Instances of Workflow Definitions are
searchable. You can search Instances by

Definition Name and Definition Version. The Search form at the top of the screen

allows you to find specific Instances to manage. You display only active, running

Instances by checking the box, Hide instances that

have already ended checkbox.

The date ranges also allow you to search by Start Date and/or End Date. In addition,

you will see the first row for a given Instance that describes the state of the Instance,

and following rows for a given Instance specify
tasks that are associated with the

current state. Frequently, the current state and current task have the same name.

You can play with the given Instance in its current state by the Actions in the

most column in the results table. The actions will

either be blank or appear

with the Manage icon, and/or the Permissions icon.

Shared Calendars, WSRP And Workflow

Managing Tasks

As a User at the Editorial department, "Lotti Stein" plans to use Workflow by

sending a holiday request to the manager,"David Berger", for approval. Suppose that

"Lotti Stein" has proper Permissions to do so:

1. Log in as "Lotti Stein".

2. Navigate to the Page, "Workflow", under the Page, "Community", at the

k Lovers community.

3. Locate the Workflow portlet.

4. Select the Tasks tab. You will find Task Name, "request
holiday", with an

action icon, Manage.

5. Locate the Task, "request

6. Click on the icon Manage.

Input the start day as say Feb. 11, 2008.

8. Input the end day as say Feb.15, 2008.


Click on the Save button when you are ready.

As a User of the Editorial department, "Lotti Stein"

has sent a holiday request to

the manager. Now it is up to the manager "David Berger", to Approve or Reject the

request, or send the request back to the requester for review. As a manager at the

Editorial department, "David Berger" has to take decision
s based on the request:

1. Log in as "David Berger".

2. Navigate to the Page, "Workflow", under the Page, "Community", at the

Book Lovers community.

3. Locate the Workflow portlet.

4. Select the Instances tab. You will find the Task Name, "request

with an action icon, Manage.

5. You can view the request Start Date and End Date.

Input your Comments as "This is my comments", as shown in the

following figure:

Click the Approve button if you want to approve it, or click the Reject button

if you want to reject the request. Click the send
review b
utton, if

you want to send it back for review.

Here, we only use the Workflow, "Holiday", as an example for tasks management

and instances management. Of course, you can use other Workflows such as

"datatypes", "websale", and your own workflo

Using Permissions

We have used a default setting for the Workflow portlet in the Page, "Workflow",

of the Page, "Community", under the Book Lovers Community. When the

administrator "Palm Tree" logs in, he/she will see the button, Add Definition, as

mentioned earlier. We know that the User "Lotti Stein" is also a member of the Book

Lovers community. Try to log in as "Lotti Stein", and you will see that there is no

Add Definition button. Further, you will also see the Instances without the Action

icons,Signal, Permissions and Manage.

Why are the two cases different? This is something related to Permissions. There

are four levels of Permissions: portlet Permissions, Permissions on Definitions,

Instances and Tasks.

Portlet Permissions

The follow
ing table shows Permissions related to the Workflow portlet. A

Community User may set up all Permissions, (marked 'X'): View, Add Definition,

and Configuration, while a Guest User may set up Permissions, View and

Configuration. By default, a Community h
as the Permission action View

(marked '*') and so does a Guest User.

Action Description Community


Views this portlet X, * X, *


Configures this portlet X X


Adds a Definition to the portlet X

Add Definition

Obviously, as a User of the Book Lovers Community, "Lotti Stein" has only

View Permissions on the Workflow portlet, by default. Since the Book Lovers

community has no Add Definition Permission, "Lotti Stein" too has no Add

Definition Per

Permissions on Definitions

The following table shows Permissions related to the Definitions on the Workflow

portlet. A Community User may set up all Permissions (marked 'X'), View, Add

Instance, Update, and Permissions, while a Guest User may set up Permissions,

View and Permissions. By default, a Community has Permission action View

(marked '*') and so does a Guest User.

Action Description

Community Guest

Views this Definition X, * X, *


Updates this Definition X


Changes Permissions on t
his Definition X X


Adds an Instance to this Definition X

Add Instance

Obviously, as a User of the Book Lovers Community, "Lotti Stein" has only View

Permissions on the Definition, by default. Since

the Book Lovers community has no

Permission, "Add Instance", "Lotti Stein" too has no Permission, "Add Instance".

Permissions on Instances

The following table shows Permissions related to the Instances on the Workflow

portlet. A Community User may set

up all Permissions (marked 'X'), Manage,

Signal and Permissions, while a Guest User may set up Permissions, Permissions.

By default, neither a Community nor a Guest User has a Permission action.

Action Description

Community Guest

Manages the Instance X


Signals the Instance X


Changes permissions on this Instances X X


Permissions on Tasks

The following table shows Permissions related to the Tasks on the Workflow

portlet. A Community User may set up all Permissions (marked 'X'), Manage and

Permissions, while a Guest User may set up Permission, Permissions. By d

neither a Community nor a Guest User has a Permission action.

Action Description Community Guest

Manage this Task X


Change permissions on this Task X



Using Workflow Effectively

In the case where a portal is used as the foundation of a website, the Users are

responsible for using the tools provided by the portal for laying out a website, its

Pages, the contents of each

Page, assigning layouts, themes, friendly URLs and so

on. Workflow provides the ability to take what is essentially a working copy of a

layout (that is portal Page) and its associated assets called the process assets, and

send them through a process. T
hroughout the Workflow, the process assets should

be previewed. Workflow could be different across Organizations, and thus any

solution should provide the opportunity for an Organization to define its workflow.

The Workflow portlet provides the
ability to manage the Workflows at the

presentation layer. Further, it allows the Users to create and edit Workflows using a

simple drag and drop style interface.

The Workflow portlet works based on ESB (Enterprise Service Bus), a switching

station b
etween services. The portal also needs a Workflow service. Although there

are several different Workflow engines that would satisfy the needs, you have high

flexibility in choosing the one you want to use. Therefore, the portal will directly

access the
ESB, and the ESB will then decide on which Workflow component to use,

to access the Workflow service. Thus, no matter how many ways the Workflow

service changes, the portal would never be directly impacted. The ESB provides a

mechanism to plug in
services, and you can therefore update services easily with

little or no impact to the portal configuration. Currently both Service
Mix and Mule

are useful for these purposes.

Mix is truer to the traditional definition of an ESB (
it adheres

to the Java Business Integration (JBI) JSR
208 specification), whereas

Mule is based on ESB (it doesn't adhere to the specification) and is more

flexible. In short, Mule is a bit easier to configur
e and set up and running.

However, Service
Mix has a smaller footprint than Mule has.

Define Business Process

The following figure depicts a business process example called holiday. The Start

State is called "request
holiday", foll
owed by the "Task Node", "evaluate

request". Then the following could apply to the Task "send

"resubmit", "approve" and "reject". Finally, there is an End State, "End".

Business processes in jBPM are defined by XML documents (
called process

definitions) written in jBPM Process Definition Language (JPDL). These XML specify

the following:

The entities such as the process roles known as swim
lanes, the various states

such as "Start State" known as Node

The Tasks such as "evaluate
request" associated with each Node

such as "notify

The transitions from one Node to the next

The variables associated with each Task's form

The Roles associated with each Task

The external actions executed on entry or exit of a Node

JBoss jBPM is a workflow and BPM (Business Process Management)

engine that enables the creation of business processes that coordinate

between people, applications and services. With its modular architecture,

jBPM combines easy development of workflow applications with

a flexible and scalable process engine. The jBPM process designer

graphically represents the business process steps in order to facilitate a

strong link between the business analyst and the technical developer.

Integrate with Users, Groups And Roles

Workflow can be integrated with Users, groups, and Roles. You can use process

roles named swim
lanes associated with Users, groups, and Roles In JPDL.

<swimlane name="approver">

<assignment clas
s="*" config






As shown, the "approver" swimlane is associated with the user, "David Berger"

who has a User ID "10838", and belongs to a Company ID,"". That is,

"David Berger" is acting as an approver.

Similar to associating a user with User ID, you can also associate a user such as

"David Berger" with a swimlane by email address, such
as "", as

shown in the following XML snippet.

<swimlane name="approver">

<assignment class="*" config






As shown in the previous XML, the "approver" swimlane is associated with the

user, "David Berger", who has an email addres
s, "", and belongs to

a Company ID, ""

<swimlane name="approver">

<assignment class="*" config






In the previous XML, the "approver" swimlane is associated with any user that

belongs to a group with the Group ID, "1116" (which defaults to the Book Lovers

community), and Company ID, "". In other
words, the "approver"

swimlane is assigned to the pool of "Book Lovers" Users. If one of the "Book Lovers"

Users were to manage an approver task, this User would automatically be assigned

to all other approver Tasks in the Workflow.

<swimlane n

<assignment class="*" config



<name>Book Lovers</name>



The previous XML shows a
n alternative way to associate the "approver" swimlane

with the Book Lovers community using the actual Community's name. Again, as the

Community names must be unique per Company ID, this format accomplishes the

same results as the previous XML.

<swimlane name="approver">

<assignment class="*" config






ane name="approver">

<assignment class="*" config



<name>MB Topic Admin</name>



As shown above, t
he two XML snippets are very similar to the Group XML snippets.

But both of them associate their swimlanes with a role, the first XML uses the Role

ID, "11123", and the second XML uses the role's unique name, "MB Topic Admin".

For more det
ails about jPDL, refer to jPDL specification at http://

Working with jBPM:

From workflow management to business intelligence

Abstract. The competitive busine
ss world demands more efficient tech

nologies to deliver products and services to clients. jBPM, as a workflow

engine, offers a way to automatize the business and, therefore, a way to

offer more consistency and faster response to customer requests. How

ever, if a company wants to succeed in the new market, it has to optimize

its processes and react on time to changes, features that are not provided

by a workflow system.

Our project aims at extending the jBPM platform to support data mining

and AI tools that will be used to analyze, monitor and optimize the

business process. Instead of embedding the intelligent algorithms wi

the jBPM code, we extend the engine to obtain an easy integration of

the new components, providing a reusable framework where different AI

algorithms can be tested.

1 Introduction

In order to achieve good performance le
vels enterprises expend huge amounts of

money analyzing their processes.The objective of Business Intelligence (BI) is

to automatize these tasks with the consequent improvement in cost and, funda

mentally, in accurancy and response time. As Charles Dar
win said: It is not the

strongest of the species that survive, nor the most intelligent, but the one most

responsive to change.

To make it possible we should start by creating a process model and providing

a way to keep the track of its execution.
This is exactly what a workflow engine

offers. jBPM is, among the workflow engines, the one we thought was most suited

for our purposes because of its flexibility and good design.

But a BI platform is much more than a workflow engine. Using jBPM as

our core component, we created a system where we can painlessly insert our

intelligent components. For that reason we had to decouple the kernel from

these future units. We tackl
e this problem by defining three different elements

that will be needed to execute any intelligent data processing:

1. Data storage : we extend the jBPM system to store the audit data trail in

a structured way in the database. We also specify how

to define and store

new attributes specific to different processes and tasks.

2. Key performance indicators and business goals : the process information by

itself is purposeless. We have to define metrics over the attributes and link

them to the business goals to set the targets of our processing.

3. Process inter
action : we also specify the way in which the intelligent compo

nents can act on the process to optimize it. We identify three different ways

in which we can tune the process.

The remainder of this paper is structured as follows: Secti
on 2 reviews the

origin of Business Intelligence and its relation to Workflow Management System

(Wfms). Section 3 describes jBPM and its main features. Section 4,5 & 6 describe

how the three identified elements are treated. We show our conclusions in se


2 Workflow and Business Process Management

Wfms emerged in the late 80’s to automate business processes involving combi

nations of human and machine
based activities. A workflow management system

is, as defined in [3], a software compon
ent that takes as input a formal description

of business processes and maintains the state of processes executions, thereby del

egating activities amongst people and applications. The main objective of these

systems is to get the work done efficiently
while delivering consistency.

Although no standard has succeeded in the Wfms world, these systems are

widely used in modern enterprises, not only as separated products but also in

tegrated in other platforms like ERP or CRM Systems.

In recen
t years, a new methodology has attracted the attention of the ex

perts. Many companies have realized that, although automating the business

is necessary, it is not enough. They need to manage their processes, monitor

ing and controlling the execution.

This new approach is called Business Process

Management (BPM). A BPMS (BPM System) is in its core a workflow system,

but has been enriched with new services that provide more control and visibility

over the process, like real
time monitoring or a busin
ess rules engine.

One of the most innovative research areas in BPM is Business Intelligence(BI),

which aims at developing techniques and tools for monitoring, managing, ana

lyzing, and optimizing the entire e
business platform [1].

BI benefits from the availability of workflow audit trail information to extract

new knowledge about the proce
sses. That information can be used by decision

makers to improve the business or, in more ambitious systems, to automatically

optimize the process by the own BI system.

3 jBPM

jBPM is a flexible java
based Workflow Management System that leads the


ecution of processes keeping track of their current state [?]. In order to do that,

the user has to define the process using the jPdl language, that represents the

process in terms of states and transitions.

The user can interact with jBPM in
two main ways: initiating a process

instance and defining the beginning and end of a task. In both cases jBPM will

calculate the next state according to the process definition.

The process logic is inserted using actions to handle the node’s main events

leave. . . ). An action is just a method implementing the action

interface that will be exe
cuted every time that an event occurs.

For its persistence, jBPM uses hibernate internally. Apart from traditional

O/R mapping, Hibernate also resolves the SQL dialect differences between the

different databases.

This simple approach permits to

use jBPM in different environments as the

platform is not attached to any technology like J2EE or RMI, as it is a simple

java library.

Task assignment policies and organizational models have been separated from

the system, so that the user can def
ine his own implementation specific to his

enterprise architecture.

For our first prototype we have implemented a simple organizational model

based on organizational roles and work groups.We store different information

related to the employee
depending on his role.

4 Data storage

Although jBPM maintains a database with the current state of all active processes,

it doesn’t keep a history of past processes nor the whole track of current processes.

To develop a Business Intelligence platfor
m, the first feature we need to add is

persistence of the process data trail.

In order to achieve the maximum generality, we need customization for the

information that we store about the processes. That is why we have added to

the process and task

definition the possibility to specify their specific attributes

in a separate XML file.

This XML file is processed with the jPdl definition, creating the tables in

the database that will gather the history of all the process instances related to

ach process. To keep consistency with the jBPM framework we use the same

persistence model, Hibernate, making use of the session open by jBPM to store

our information.

In this way, every time a new process definition is deployed the system creates

new java classes representing the process and tasks instances, new tables in the

database and Hibernate mappings that connect the former with the latter. This

process can be done without stopping the server, allowing on
fly updates of

the process.

The task and process instances are accessed at runtime using reflection, as

these classes are created dynamically and their properties are unknown until the

deployment process.

All the information is stored in a structured way with its process c

making it easier for the posterior use of data analysis and data mining techniques

as proposed by [6].

5 KPI and business goals

Once we have the process and task properties, we need to define how they will

be treated to obtain the Key Perf
ormance Indicators (KPI) for our process.

A Key Performance Indicator (KPI) is a metric that performs accountability

to measure the degree to which the process is acting congruently in support of

line goals and strategies. KPIs must adhere to the SMART pattern, requiring

them to be:

Specific: they have to be specific and targeted to the area.

Measurable: there is a way to collect accurate data .

Actionable: the metrics are easy

Relevant: important to the user.

Timely: you have to be able to get the data when you need it.

KPIs and their desired values is the only way to set the targets for

the process and, consequently, the goals of the BI analysis and monitoring.

In our system KPIs are defined indicating explicitly the business goals that

they support, so that the u
ser can track down how the business strategies are

being implemented. This way we connect the abstract goals of the enterprise to

the actual execution as shown in Fig. 1.

The goals have a hierarchical structure because some goals can be subdivided

in several sub
goals. In any case, the leaves of the tree we will always have KPIs.








Fig. 1. Process abstraction

An impo
rtant characteristic of the business goals is that they are defined for

the scope of an enterprise. The goals offer a way to break the isolation of the

processes connecting their outputs in terms of KPIs to achieve the enterprise

targets. We should noti
ce that resources are enterprise
wide and making goals

wide and also allows us to do the analysis and optimization at this

ambit instead of the reduced ambit of a process.

6 Data analysis

When the system receives a new event, it is proces
sed by jBmp, storing the re

quired data and informing the monitoring components using the observer design

pattern. These components register themselves as event listeners providing real

time monitoring while they can simultaneously access the process
history from

the database for a longer term analysis as described in Fig. 2.


BPM System History











Fig. 2. Enterprise model

This model has the advantage of keeping loosely coupled the relationship

between the BPM core and the analyzing components. This feature is quite

important, as the main area of research will be the intelligent analysis and we

will be able to chang
e this component without modifying any other part of the

system (core, process definitions, data storage . . . ).

Using data
mining techniques and real
time monitoring simultaneously we

aspire to:

Capture dynamic changes in the process behavior
, preventing exceptions that

can cause low performance and alerting user of important circumstances.

Identify the rules that guide the process to achieve a better performance.

7 Process interaction

Although the first objective of the platfor
m is to provide support for business

knowledge extraction, it is one of our future goals to implement a more reactive

behavior in the system.

The information extracted by the data analysis component will be used to

achieve the business goals or, in

terms of execution, to optimize the KPI. Any

change in the policies in the enterprise will be reflected in the KPI and conse

quently will be considered by the optimizing system automatically.

There are three main means to optimize a process using
jBPM as the base


Task assignment: the most obvious way to improve the efficiency of a process

is to provide a better means to assign resources. Old priority
based schedul

ing algorithms can be replaced with more intelligent me

Task routing: a jBPM process can define routing nodes where the system

can decide which path the instance will take depending on the goals of the


Process modification: with jBPM the process definition can change at run

time providing great flexibility to the user. Although redesigning the process

to improve the performance automatically is theoretically possible, it con

stitutes a challenge that we are currently far from achieving successfully.

In both the first and the second case, the only thing that we need to do to

insert ou
r improved selection is to substitute the default handler with a call to

our intelligent method.

8 Conclusions

This paper describes a platform for Business Intelligent based on jBPM. Identify

ing and specifying the main elements required for the b
usiness analysis (Fig. 3),

we are able to decouple the intelligent components from the execution engine.

Firstly we provide a way to store the audit data trail in a structured way.

Secondly we indicate the targets of our processes thanks to the defi
nition of KPI

and business goals. Finally we identify the approaches that our algorithms can

take to optimize our processes in jBPM.

Enterprise Model

cess Descriptions

Resource model

jPdl Process Definitions

Attribute Definitions

Goal definitions

PKI Definitions

Fig. 3. Enterprise model

The platform is not only able to perform static data analysis, but in real

analyze, monitor and optimize thanks to the use of ev
ent listeners and action

handlers. We believe that these features make this platform a tool not only for

research purposes but a competitive prototype for commercial use.


[1] F. Casati, U. Dayal, M. Sayal, and M. Shan, ”Business Process Intelligence” , 2002

[2] T. Baeyens, ”The state of workflow”, 2004

[3] Workflow Management Coalition. ”Terminology and Glossary” (WFMC

, 1999

[4] L. Lachal . ”Workflow versu
s BPM” Ovum , 2002

[5] Various . ”JBoss JBpm 3.0 User Guide ” JBoss , 2005

[6] J. Schiefer, B. List, and R. M. Bruckner, ”Process Data Store: A Real
time Data

Store for Monitoring Business Processes,” , 2003