Mid Sweden University The Department of Information Technology and Media (ITM) Author: Mikael Nilsson E-mail address: [email protected] Study programme: M. Sc. In engineering – computer engineering, 240 ECTS Examiner: Tingting Zhang, [email protected] Tutors: Anders Trollås, Cybercom Group, [email protected] Fredrik Håkansson, Mid Sweden University, [email protected] Scope: 29901 words inclusive of appendices Date: 2012-06-29

M.Sc. Thesis within Computer Engineering AV, 30 ECTS

Open-source Workflow Evaluation An evaluation of the BPM Platform

Mikael Nilsson Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform Abstract Mikael Nilsson 2012-06-29

Abstract The aim of this thesis is to evaluate the newly released open-source business process management platform Activiti. The platform is evalu- ated in the first instance by implementing the control-flow patterns which will be used at a later stage as a comparison with other platforms that have already been evaluated. Activiti comes with a web application called Activiti Explorer which is a graphical user interface between the process engine and the user. As all the desired features commissioned by the Cybercom Group were not available in the Activiti Explorer its source-code was extended. These extended features included support for several companies per installation and the ability to customize the layout of the components in user task forms. The report is concluded with a comparison between Activiti, jBPM, OpenWFE and Enhydra shark with regards to the control-flow patterns.

Keywords: Open-source, Workflow, BPM, BPMN 2.0, Activiti, Work- flow patterns, Control-flow patterns

ii Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform Acknowledgements Mikael Nilsson 2012-06-29

Acknowledgements Thanks to...

 Anders Trollås, my tutor from Cybercom Group, for your help, guidance and support during this thesis.

 Fredrik Håkansson, my tutor from Mid Sweden University, for your help, reviews and valuable advice for my report.

iii Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform Table of Contents Mikael Nilsson 2012-06-29

Table of Contents

Abstract ...... ii

Acknowledgements ...... iii

Terminology ...... ix

1 Introduction ...... 1 1.1 Background and problem motivation ...... 4 1.2 Overall aim and verifiable goals ...... 5 1.3 Scope ...... 6 1.4 Outline ...... 6 1.5 Contributions ...... 7

2 Theory ...... 8 2.1 BPMN 2.0 ...... 8 2.2 Activiti Designer ...... 8 2.3 Workflow Patterns ...... 9 2.4 Control-flow patterns ...... 9 2.4.1 Basic Control Flow Patterns ...... 9 2.4.2 Advanced Branching and Synchronization Patterns 10 2.4.3 Multiple Instance Patterns ...... 11 2.4.4 State-based Patterns ...... 11 2.4.5 Cancellation and Force Completion Patterns ...... 12 2.4.6 Iteration Patterns ...... 12 2.4.7 Termination Patterns ...... 12 2.4.8 Trigger Patterns ...... 12 2.5 Activiti ...... 13 2.6 Activiti Explorer ...... 13 2.6.1 Spring Framework ...... 13 2.6.2 Vaadin ...... 14 2.6.3 Activiti Process Engine ...... 16

iv Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform Table of Contents Mikael Nilsson 2012-06-29

3 Methodology ...... 18 3.1 Literature studies ...... 18 3.2 Workflow patterns initiative...... 18 3.3 Workflow patterns evaluation ...... 18 3.3.1 Implementing the patterns ...... 18 3.4 Product comparison ...... 19 3.5 Building the extended version of Activiti Explorer ...... 19

4 Implementation ...... 21 4.1 Control-flow patterns ...... 21 4.1.1 Pattern 1 – Sequence...... 21 4.1.2 Pattern 2 – Parallel split ...... 21 4.1.3 Pattern 3 – Synchronization ...... 22 4.1.4 Pattern 4 - Exclusive Choice ...... 22 4.1.5 Pattern 5 - Simple Merge ...... 23 4.1.6 Pattern 6 - Multi-Choice ...... 23 4.1.7 Pattern 7 - Structured Synchronizing Merge ...... 24 4.1.8 Pattern 8 - Multi-Merge ...... 24 4.1.9 Pattern 9 - Structured Discriminator ...... 25 4.1.10 Pattern 10 – Arbitrary Cycles ...... 25 4.1.11 Pattern 11 - Implicit Termination ...... 25 4.1.12 Pattern 12 - Multiple Instances without Synchronization ...... 26 4.1.13 Pattern 13 - Multiple Instances with a priori Design- Time Knowledge ...... 26 4.1.14 Pattern 14 - Multiple Instances with a priori Run-Time Knowledge ...... 27 4.1.15 Pattern 15 - Multiple instances without a priori run- time knowledge ...... 27 4.1.16 Pattern 16 - Deferred Choice ...... 27 4.1.17 Pattern 17 - Interleaved Parallel Routing ...... 28 4.1.18 Pattern 18 – Milestone ...... 28 4.1.19 Pattern 19 - Cancel Activity ...... 28

v Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform Table of Contents Mikael Nilsson 2012-06-29

4.1.20 Pattern 20 - Cancel Case ...... 29 4.1.21 Pattern 21 - Structured Loop ...... 29 4.1.22 Pattern 22 - Recursion ...... 30 4.1.23 Pattern 23 - Transient Trigger ...... 30 4.1.24 Pattern 24 - Persistent Trigger ...... 30 4.1.25 Pattern 25 - Cancel Region ...... 30 4.1.26 Pattern 26 - Cancel Multiple Instance Activity ...... 31 4.1.27 Pattern 27 - Complete Multiple Instance Activity ..... 31 4.1.28 Pattern 28 - Blocking Discriminator ...... 32 4.1.29 Pattern 29 - Cancelling Discriminator ...... 32 4.1.30 Pattern 30 - Structured Partial Join ...... 32 4.1.31 Pattern 31 - Blocking Partial Join ...... 32 4.1.32 Pattern 32 - Cancelling Partial Join ...... 33 4.1.33 Pattern 33 - Generalized AND-Join ...... 33 4.1.34 Pattern 34 - Static Partial Join for Multiple Instances 33 4.1.35 Pattern 35 - Cancelling Partial Join for Multiple Instances ...... 33 4.1.36 Pattern 36 - Dynamic Partial Join for Multiple Instances ...... 33 4.1.37 Pattern 37 - Acyclic Synchronizing Merge ...... 33 4.1.38 Pattern 38 - General Synchronizing Merge ...... 33 4.1.39 Pattern 39 - Critical Section ...... 33 4.1.40 Pattern 40 - Interleaved Routing ...... 34 4.1.41 Pattern 41 - Thread Merge ...... 34 4.1.42 Pattern 42 - Thread Split ...... 34 4.1.43 Pattern 43 - Explicit Termination ...... 34 4.2 Support for multiple companies ...... 34 4.2.1 Company Database and Admin web application ..... 34 4.2.2 CloudProcessEngines ...... 35 4.2.3 Login ...... 36 4.2.4 User Cache ...... 36 4.2.5 Activiti Company Deployment Manager ...... 36

vi Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform Table of Contents Mikael Nilsson 2012-06-29

4.2.6 Deployment helper tools ...... 38 4.3 Support for a business payment model ...... 39 4.4 Support for custom layout in task forms ...... 39 4.4.1 XML specification ...... 40 4.4.2 Validating custom forms ...... 42 4.4.3 Extending Activiti to support the custom form layouts ...... 42 4.4.4 Helper tools ...... 43 4.5 Improvements and bug fixes ...... 43 4.5.1 High resolution screen support ...... 43 4.5.2 Boolean bug fix ...... 44 4.5.3 Date field ...... 45 4.5.4 Enum fields...... 46 4.5.5 Textarea component ...... 46

5 Results ...... 47 5.1 Control-flow patterns evaluation ...... 47 5.2 Support for multiple companies ...... 50 5.2.1 Admin web application and payment model ...... 51 5.2.2 Activiti Company Deployment Manager ...... 52 5.2.3 Set up a new server with the extended version of Activiti Explorer...... 56 5.3 Support for custom layout in task forms ...... 57 5.4 Improvements and bug fixes ...... 61 5.4.1 Large screen support ...... 61 5.4.2 Boolean bug fix ...... 62 5.4.3 Date field ...... 62 5.4.4 Enum fields...... 63

6 Conclusions ...... 64 6.1 Control-flow evaluation ...... 64 6.1.1 Basic Control Flow Patterns ...... 64 6.1.2 Advanced Branching and Synchronization Patterns 64 6.1.3 Multiple Instance Patterns ...... 65

vii Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform Table of Contents Mikael Nilsson 2012-06-29

6.1.4 State-based Patterns ...... 65 6.1.5 Cancellation and Force Completion Patterns ...... 65 6.1.6 Iteration Patterns ...... 65 6.1.7 Termination Patterns ...... 65 6.1.8 Trigger Patterns ...... 66 6.1.9 Control-flow patterns ...... 66 6.2 Extended Activiti Explorer ...... 66 6.2.1 Support for multiple companies ...... 67 6.2.2 Support for custom layout in task forms ...... 67 6.2.3 Support for a business payment model ...... 67 6.2.4 Improvements and bug fixes ...... 68

7 Future work ...... 69 7.1 Workflow pattern evaluation ...... 69 7.2 Multiple companies...... 69 7.3 Custom form layout ...... 69

References ...... 70

Appendix A: Process constricts in Activiti Designer ...... 73

Appendix B: Control-flow patterns definitions ...... 78

Appendix C: New Features ...... 88

Appendix D: Improvements and bug fixes ...... 122

Appendix E: XML implementation of the supported patterns ...... 124

viii Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform Terminology Mikael Nilsson 2012-06-29

Terminology Acronyms BPM Business Process Management

BPMN Business Process Model and Notation

XML Extensible Markup Language

ix Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform 1 Introduction Mikael Nilsson 2012-06-29

1 Introduction The concept of workflow has its early roots in industrialization and was introduced in order to increase efficiency in production. In the begin- ning, processes were carried out entirely by humans but today processes are carried out partially or totally by computer information systems. According to Medina-Mora et al. [1] processes can be organized into material processes, information processes and business processes. Material processes consist of the assembly and delivery of physical products. Information processes are related to automated computer software that fully or partially perform tasks with interaction from humans. Business processes are a higher level concept and consist of information processes and/or material processes. Business processes describe the organization's activities from a market-centred perspective and are engineered to fulfil a business contract or to satisfy the require- ments of a specific customer. This thesis deals exclusively with business processes implemented as information processes. [1]

The term “workflow” is used casually to refer to a business process, the specification of a business process, the software that implements and automates a process or the software that supports the coordination and collaboration of people that implement a process. What workflow is and which features a workflow management system should support are not fully agreed upon, even the definition of the terms differs among soft- ware vendors. [2]

Georgakopoulos et al. [2] defines the term workflow as a collection of tasks organized to accomplish some business process (e.g., processing purchase orders over the phone, provisioning telephone services, processing insurance claims). A task can be performed by one or more software systems, one or a team of humans, or a combination of these. Human tasks include interacting with computers closely (e.g., providing input commands) or loosely (e.g., using computers only to indicate task progress). In addition to a collection of tasks, a workflow defines the order of task invocation or condition(s) under which tasks must be invoked, task synchronization, and information flow (dataflow). [2]

There are many different approaches to process specification with different syntax, semantics and terminology. This makes the choice of

1 Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform 1 Introduction Mikael Nilsson 2012-06-29 workflow system more complex because all process specifications have their weaknesses and their strengths thus making it difficult to choose a process definition language that is suitable for a particular project. This thesis focuses on the Business Process Model and Notation language (BPMN) version 2.0.

The Workflow Patterns initiative was started in 1999 by Eindhoven University of Technology and Queensland University of Technology. The goal of the initiative was to provide a comprehensive examination of the various perspectives supported by workflow systems and their process definition languages. This was conducted by categorizing com- mon constructs used in real world processes. The purpose of the pat- terns is to provide an objective means of evaluating and comparing different workflow platforms and their definition languages. At the beginning they received little attention outside academia but, as of the present time, more and more vendors are evaluating their products and submitting the results to workflow patterns initiative. [3]

This thesis deals with the control flow patterns as described by Wil van der Aalst et al. (2003, 2006) [4][5]. Workflow patterns are related to design patterns in architecture and computer science and were first introduced by Christopher Alexander (1977) [6] in the field of architec- ture and by the Gang of Four 1995 [7] in computer science. Christopher Alexander provides the following definition, Each pattern describes a problem that occurs over and over again in our environment, and then describes the core of the solution to that problem, in such a way that you can use this solution a million times over, without ever doing it the same way twice. [6]

Business Process Management (BPM) extends the concept of workflow by focusing on all aspects of processes within an organization. It has methods to handle both process reengineering and process redesign and it supports the complete business process lifecycle (Design & Analysis -> Configuration -> Enactment -> Evaluation) see figure 1. [8]

2 Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform 1 Introduction Mikael Nilsson 2012-06-29

Evaluation: Process Mining Business Activity Monitoring

Evaluation

Design: Business Process Identification and Enactment: Modeling Operation Enactment Business process lifecycle Design & Analysis Monitoring Analysis: Maintenance Validation Simulation Verification Configuration

Configuration: System Selection Implementation Test and Deployment

Figure 1: Business Process Lifecycle [8]

The reengineering addresses the issues of system efficiency, system cost and it explores the use of new advancement in technology. Business process redesign improves the efficiency of business operations, the quality of products, reduces costs, meets new business challenges and increases customer satisfaction. A software BPM platform delivers greater control and visibility over processes and workflow integration with other applications. [8]

Open-source software has grown both in popularity and maturity and is becoming a viable alternative to commercial enterprise business prod- ucts. The advantages associated with choosing open-source software are that there is full control over the source code meaning that it is possible to learn how it works, to modify it, fix errors and continue its develop- ment even after the product has been discontinued. Another benefit is that there are no license fees and free community support is available. For many businesses this is not sufficient and therefore many products offer full professional support and extra features but this involves a fee. The disadvantages of choosing an open-source product are that it might not be sufficiently developed to the degree that it is able to be used in a demanding business environment. Enterprise open-source products are often more difficult to learn than their proprietary counterparts and

3 Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform 1 Introduction Mikael Nilsson 2012-06-29

their intended user group are more focused towards software engineers than business analysts.

1.1 Background and problem motivation Activiti [9] is a new open-source light-weight workflow and Business Process Management platform. The development is led by Tom Baeyens and Joram Barrez and it is funded by the company Alfresco [21]. It had its first stable release on December 1st 2010 and it has been in active development ever since. The first stable release was version 5.0 and this was because the lead developers had previously worked on jBPM (up to version 4.0) before they left to work for Alfresco. Activiti is a relatively new product and it lacks proper independent evaluations and scientific reports. Petia Wohed et al 2007 [10] conducted a pattern-based evaluation of the open-source BPM systems, jBPM version 3.1.4 [11], OpenWFE version 1.7.3 [12] and Enhydra Shark version 2 [13]. The process definition languages used were jBPM Process Definition Lan- guage (jPDL) for jBPM, XPDL 1.0 for Enhydra shark and the OpenWFE process definition language for OpenWFE. They used the patterns from the workflow pattern initiative as the basis for their study. As of today this is the only evaluation of open-source BPM products available at the workflow patterns initiative website. Many other BPM platforms and process languages have been evaluated against the workflow patterns and the result can be found on their website [3], but since the focus of this thesis is on open-source platforms the results from other platforms will not be discussed.

At the time of writing, both Activiti and its process definition language BPMN 2.0 have not yet been evaluated by the workflow pattern initia- tive. For this reason the IT consulting company Cybercom Group would like Activiti to be evaluated against both the control flow patterns and as an open-source product. The result from the pattern evaluation makes it easy to compare Activiti with other products. It is also easier to choose an appropriate product for a particular project by looking at its strengths and weaknesses with regards to its supported patterns. The result from the pattern evaluation of Activiti should therefore be com- pared to the result from the open-source BPM evaluation conducted by Petia Wohed et al 2007 [10] to determine which platform is more suita- ble with regards to the control flow patterns.

4 Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform 1 Introduction Mikael Nilsson 2012-06-29

Activiti will also be evaluated as an open-source project by modifying and extending the source code to fit the requirements given by the Cybercom Group.

1.2 Overall aim and verifiable goals The overall aim of this thesis is to evaluate Activiti and detail its strengths and weaknesses. This result from the control flow evaluation should be used at a later stage to determine the suitability of using Activiti in a particular project and to compare it against the other open- source BPM platforms (jBPM, OpenWFE and Enhydra shark). The goal is also to offer a short theoretical overview of the control flow patterns and a brief theoretical overview of the frameworks used by the Activiti open-source project.

In the practical part of this thesis an attempt to implement all the control flow patterns is made. The result should include:

 Table of the evaluation of Activiti against all Control flow pat- terns

 Comparison of Activti, jBPM, OpenWFE and Enhydra shark in regards to their support for the control flow patterns defined in [5]. The pattern support for jBPM, OpenWFE and Enhydra shark are taken from [10].

The Cybercom Group also requested the following extensions and modifications to Activiti Explorer, for creating an extended Activiti Explorer:

 Support for multiple companies within Activiti Explorer

 Support for customizing the layout of user task forms in Activiti Explorer.

 Support to change the main colours and logotypes in Activiti Ex- plorer.

 Support for a business payment model (ex. pay per process in- stance).

5 Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform 1 Introduction Mikael Nilsson 2012-06-29

All of the above points must be implemented without changing the source code of the Activiti engine.

1.3 Scope The theoretical and practical parts of the pattern evaluation will be restricted to the control flow patterns. When conducting the evaluation each pattern is implemented in Activiti Designer and graded with a '+' for direct support, '+/-' for partial support and '-' if the pattern is not supported [30]. Activiti is an open-source platform and the main interest in this study is in relation to the suitability of Activiti when choosing an open-source BPM platform. This, and the fact that the majority of com- mercial software is not provided with source code, is the reason why this study is limited to only open-source products.

Since the extended Activiti Explorer platform is a commission from the Cybercom Group both the theoretical and practical parts will primarily focus on how to achieve the requested features. The evaluation, from an open-source perspective, consists of implementing two extensions and fixing some minor bugs. A brief theoretical presentation of the project and the major frameworks is also provided. Finally a list of all the required changes and the classes created to implement the extensions and fixes will be presented in Appendices C and D.

1.4 Outline  Chapter 2 introduces the reader to BPMN 2.0 and Activiti De- signer and to the control-flow patterns and then offers a short in- troduction to the foundation of the Activiti source code.

 Chapter 3 describes the methodology used in this thesis.

 Chapter 4 describes the implementation of the patterns and the modifications made to the source code.

 Chapter 5 presents the result of this thesis with tables for the pat- terns and screenshots of the added features.

 Chapter 6 presents the conclusion and discussion of this thesis.

 Chapter 7 presents the ideas for future work regarding the exten- sions to Activiti Explorer.

6 Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform 1 Introduction Mikael Nilsson 2012-06-29

 Appendix A: contains a list with description of the process con- structs used in Activiti Designer when implementing the pat- terns.

 Appendix B: contains the definitions of all 43 control-flow pat- terns.

 Appendix C: contains a description of how the new features were added to Activiti Explorer.

 Appendix D: contains a description of how the improvements and bug fixes were added to Activiti Explorer.

 Appendix E: contains the XML implementation of the supported patterns.

1.5 Contributions The author has contributed to the Activiti evaluation of the control- flow patterns, the XML specification for the custom form layout, ex- tensions made to the source-code of Activiti Explorer to support the requirements given by the Cybercom Group and the helper tools to facilitate the use of the extended version of Activiti Explorer.

7 Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform 2 Theory Mikael Nilsson 2012-06-29

2 Theory This chapter consists of a brief explanation of the BPMN 2.0 notation language, Activiti Designer and the workflow patterns. The last part consists of an overview of the Activiti source code and the frameworks used.

2.1 BPMN 2.0 BPMN stands for Business Process Model and Notation and version 2.0 specifies both a graphical notation language in addition to the XML notation language. It was developed by the Business Process Manage- ment Initiative and is now maintained by the Object Management Group since the merger in 2005. Business processes are modeled using connections, events, activities and gateways. Connections are used to connect activities, gateways and events together. Events are displayed as a circle and denote that something has occurred, for example start and end events. Events can also be throwing and catching events. Activ- ities represent a piece of work that is required to be conducted. The work can be automatic or manual with human involvment. Gateways are a means of splitting up or merging the execution flow in a process. The constructs used when modeling the control-flow patterns are de- scribed in Appendix A. [20]

2.2 Activiti Designer The Activiti Designer is an [22] plugin which allows the process developer to develop BPMN 2.0 processes using a graphical user inter- face with drag and drop components. Activiti Designer does not sup- port the complete set of BPMN 2.0 components and features at the present time, but more support arrives with each new version. Activiti 5.9 has just been released with support for some new components which, at present, are labeled experimental and which are not included in Activiti Designer. Experimental components were not used when modelling the patterns. For a description of the components used in the implementation of the workflow patterns see Appendix A.

8 Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform 2 Theory Mikael Nilsson 2012-06-29

2.3 Workflow Patterns The Workflow Patterns initiative was started in 1999 by Professor Wil van der Aals and Professor Arthur ter Hofstede [3]. It was established to describe the fundamental structures in an imperative way [3]. These structures are reoccurring over and over again when modelling business processes. The research project first produced a set of twenty control- flow patterns for workflow systems [4]. Since then patterns have evolved and they now cover the following workflow perspectives, control-flow, data, resource, exception handling and presentation. These patterns have been used to evaluate existing workflow systems so as to determine their suitability for a particular project and for the develop- ment of workflow systems. [24]

2.4 Control-flow patterns In 2006 a new paper with a revised view on the control-flow patterns was released [5]. The new revised definitions were an effort to make the implementation and interpretation of the patterns less ambiguous by taking the strictest possible interpretations. In addition to the twenty revised patterns, twenty-three new control-flow patterns were also introduced. For the definitions of all 43 control-flow patterns see Ap- pendix B. The forty-three control-flow patterns can be divided into eight classes which are described below. [25]

2.4.1 Basic Control Flow Patterns In the class Basic Control Flow Patterns are those patterns dealing with the execution order of activities and the ability to run activities concur- rently and patterns that deal with simple choice and merger. These patterns are the fundamental building blocks of a workflow system. The following patterns belong to the basic control flow patterns, for their definitions see Appendix B. [25]

1. Sequence

2. Parallel Split

3. Synchronization

4. Exclusive Choice

9 Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform 2 Theory Mikael Nilsson 2012-06-29

5. Simple Merge

2.4.2 Advanced Branching and Synchronization Patterns In the class Advance Branching and Synchronization Patterns are pat- terns that deal with advance merging and synchronization constructs during which several branches come together. There is also a pattern that deals with the choice regarding which branches to activate. In the case of synchronization the subsequent activity should be called first when all the active branches have reached the construct, while in some patterns, only the first thread is passed to the subsequent activity while the others are blocked. There are also patterns that deal with the crea- tion and synchronization of threads within a branch. The following is the complete set of patterns belonging to the advanced branching and synchronization patterns and for their definitions see Appendix B. [25]

6. Multi-Choice

7. Structured Synchronizing Merge

8. Multi-Merge

9. Structured Discriminator

28. Blocking Discriminator

29. Cancelling Discriminator

30. Structured Partial Join

31. Blocking Partial Join

32. Cancelling Partial Join

33. Generalised AND-Join

37. Local Synchronizing Merge

38. General Synchronizing Merge

41. Thread Merge

42. Thread Split

10 Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform 2 Theory Mikael Nilsson 2012-06-29

2.4.3 Multiple Instance Patterns In the class Multiple Instance Patterns are those patterns dealing with multiple instances of the same activity. The patterns deal with the initia- tion, the synchronization for completed instances and in dynamically adding new instances. The following patterns belong to the multiple instance patterns, for their definitions see Appendix B. [25]

12. Multiple Instances without Synchronization

13. Multiple Instances with a Priori Design-Time Knowledge

14. Multiple Instances with a Priori Run-Time Knowledge

15. Multiple Instances without a Priori Run-Time Knowledge

34. Static Partial Join for Multiple Instances

35. Cancelling Partial Join for Multiple Instances

36. Dynamic Partial Join for Multiple Instances

2.4.4 State-based Patterns In the class State-based Patterns are those patterns dealing with syn- chronization, choice and which branches are able to be activated based on the state of the process instance. The state of a process instance is referring to its execution status and the related process and working data, which includes the status of activities. The following patterns belong to the state-based patterns, for their definitions see Appendix B. [25]

16. Deferred Choice

17. Interleaved Parallel Routing

18. Milestone

39. Critical Section

40. Interleaved Routing

11 Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform 2 Theory Mikael Nilsson 2012-06-29

2.4.5 Cancellation and Force Completion Patterns In the class Cancellation and Force Completion Patterns are those pat- terns dealing with the forced cancellation and completion of running activities and process instances. These patterns can easily be implement- ed using exception handling. The following patterns belong to the cancellation and forced completion patterns, for their definitions see Appendix B. [25]

19. Cancel Task

20. Cancel Case

25. Cancel Region

26. Cancel Multiple Instance Activity

27. Complete Multiple Instance Activity

2.4.6 Iteration Patterns In the class Iteration Patterns are those patterns dealing with the repeti- tive behaviour of a process. The following patterns belong to the itera- tion patterns, for their definitions see Appendix B. [25]

10. Arbitrary Cycles

21. Structured Loop

22. Recursion

2.4.7 Termination Patterns In the class Termination Patterns are the patterns that deal with the termination and completion of a process. The following patterns belong to the termination patterns, for their definitions see Appendix B. [25]

11. Implicit Termination

43. Explicit Termination

2.4.8 Trigger Patterns In the class Trigger Patterns are those patterns dealing with the external signals that might be necessary to start certain activities. The following

12 Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform 2 Theory Mikael Nilsson 2012-06-29

patterns belong to the trigger patterns, for their definitions see Appen- dix B. [25]

23. Transient Trigger

24. Persistent Trigger

2.5 Activiti source code The Activiti open-source project consists of many different modules. The modules that are found in the Activiti 5.9 subversion repository [26] are activiti-cactus, activiti-camel, activiti-cdi, activiti-cxf, activiti-engine, activiti-mule, activiti-osgi, activiti-spring, activiti-webapp-exploirer2 and activiti-webbapp-rest2. The code is written in Java and it is using the build manager Maven. The modules that are of interest in this study are primarily the activiti-engine, which is a BPMN 2.0 process engine and the activiti-webapp-explorer2, which is a web interface that uses the process engine. All the source code is licensed under the Apache Li- cense, Version 2.0 [14].

2.6 Activiti Explorer Activiti Explorer [27] is a web application that is built with the Vaadin framework and it utilizes the Spring framework to start the process engine. It has an easy-to-use interface for starting processes and han- dling human tasks. On the task page, the tasks appear in the user’s inbox or, if they are assigned to a group, under the queued menu. The process page allows the users to start new processes or to view the current execution state on an already started processes belonging to the user. The manage page is visible for users with administrator rights. The administrator can deploy new processes in this page, delete old ones, manage users and groups and investigate the content in the database tables. [27]

2.6.1 Spring Framework The Spring framework assists in the building of enterprise Java applica- tions by allowing the programmer to focus on the problem rather than on pluming code [15]. The module used by Activiti is the inversion of control container, which is responsible for managing objects lifecycles, and this is conducted by means of dependency injection. The main principle behind dependency injection is to load objects at runtime

13 Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform 2 Theory Mikael Nilsson 2012-06-29

instead of at compile time, which is the usual way of loading objects. This is conducted by specifying all objects to be loaded in an XML file that is parsed by Spring and the objects are then instantiated and loaded into a container, accessible from the Java code. This makes it possible to add objects to the software without the necessity to recompile it. Apart from the late binding, it is also possible to assign values (this includes other objects loaded by Spring) to objects using either the constructor or setters directly in the XML file. This is of course a small sub set of the features provided by the Spring framework but deals with those used in Activiti.

2.6.2 Vaadin Vaadin [16] is a Java framework for rich internet applications. Vaadin is based on the Google Web Toolkit (GWT) [17], and it is a rapid applica- tion development framework to build secure rich internet applications. It allows the programmer to write an Internet application directly in Java and compiles it to both the client and server software. The client and server communicate via asynchronous Javascript (AJAX) and thus there is no requirement for any browser plugins. See figure 2 for the complete communication chain.

Web Browser Java Vaadin Web Service Client-Side Engine Your Web Server UI Components Java Application

EJB

DB

Figure 2: Vaadin communication [28]

Vaadin UI Components All user interface components that are available in Vaadin are listed in the inheritance diagram in figure 3.

14 Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform 2 Theory Mikael Nilsson 2012-06-29

Figure 3: UI Component Inheritance Diagram. [28]

The Component class is the top most class in this hierarchy. The compo- nents used when creating input forms are all descendants of the Field class and they are all implementing the AbstractField interface. Fields are components that have a value that can be changed directly in the interface by the user. Fields use the Vaadin data model which means that the value is handled as a Property. A Property is an interface that uses get and set methods which take a value of type Object. This makes the interface compatible with all types of components and values since all objects inherit from the Object class in Java. For the inheritance diagram of the Field class see figure 4. [28]

15 Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform 2 Theory Mikael Nilsson 2012-06-29

Figure 4: Field Interface Inheritance Diagram. [28]

2.6.3 Activiti Process Engine The central point of the Process Engine API is the ProcessEngine class. To create an instance of the ProcessEngine the ProcessEngineConfigura- tion object can be used via the Spring framework [15], xml or directly in Java code. To handle multiple instances of the ProcessEngine the Pro- cessEngines class can be used and it contains methods for safely creating and closing all running engines. Once an engine is up and running its services containing the workflow/BPM methods can be obtained by calling the corresponding getters on the engine object, see figure 5 for all available services. [29]

ProcessEngine

RepositoryService ManagmentService TaskService HistoryService

IdentityService FormService RuntimeService

Figure 5: Activiti Engine and its services [29]

 Repository Service The RepositoryService provides access to the repository of pro- cess definitions and other deployments. It is used for deploying to the database and retrieving deployed items. [29]

16 Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform 2 Theory Mikael Nilsson 2012-06-29

 Management Service The ManagementService is used for maintenance and administra- tion operations on the process engine. [29]

 Task Service The TaskService provides access to tasks and form operations. [29]

 History Service The HistoryService provides access to information about ongoing and past process instances. [29]

 Identity Service The IdentityService provides information on users and groups. [29]

 Form Service The FormService provides access to form data. [29]

 Runtime Service The RuntimeService provides access to process instances, defini- tions and deployments. [29]

17 Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform 3 Methodology Mikael Nilsson 2012-06-29

3 Methodology The methodology used in this thesis consists, in the first instance, a theoretical study on BPM, workflow patterns, Activiti and Vaadin. The second part is a practical implementation of the patterns and the exten- sion of the functionality of Activiti Explorer.

3.1 Literature studies The online library at Mid Sweden University was used to search for articles and publications regarding BPM and workflow patterns. The workflow patterns initiative website [3] also contained many sources. The following documents were found [1][2][4][5][8][10] via the online library or at the workflow patterns initiative website. To learn about Activiti and Vaadin the main websites [9][16] were used as the primary sources and, in addition, the following books were used [18][19].

3.2 Workflow patterns initiative The workflow patterns initiative website [3] together with the papers [4][5] were the main source of information regarding the patterns. The sources were used when studying the theory behind the patterns and for the implementation and to evaluate the result.

3.3 Workflow patterns evaluation When evaluating Activiti against the patterns, Activiti Designer was chosen as the process development tool. Because it is an official tool and offers an easy graphical environment with drag and drop components. There are other BPMN 2.0 modelling tools, for example, Activiti Model- ler, which is a web based modeller but these do not offer support for Activiti specific extensions to the BPMN 2.0 language. For the evalua- tion of the patterns, the requirement is that a graphical development tool is to be used and that the patterns are able to be implemented through its use. [30]

3.3.1 Implementing the patterns The description of the pattern was read first and from this the motiva- tion was provided as were the, context and implementation. Once the pattern had been fully understood an attempt was made to implement it

18 Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform 3 Methodology Mikael Nilsson 2012-06-29

in Activiti Designer. If the functionality of the pattern was achieved then the evaluation criteria and product evaluation was read. Finally, the finished implementation was graded according to the product evalua- tion criteria. If the functionality was not achieved then further reading with regards to Activiti and BPMN 2.0 was conducted. Once all the attempts have failed then the pattern is considered to be not supported. [30]

When grading the support for the patterns a “+” sign is given to the patterns that are directly supported, meaning that one of the language constructs satisfies the evaluation criteria of the pattern. For partial support “+/-“ is given, meaning that there is some limitation when implementing the pattern. The “–“ sign is given to patterns that are not supported. A pattern is considered to be not supported if any form of programming or scripting is required or the solution results in a spa- ghetti diagram. [30]

3.4 Product comparison The Activiti open-source BPM platform was compared to the other BPM platforms by looking at the support for the different control-flow pat- terns. The patterns support for the different platforms is discussed for each control-flow patterns class. The pattern support for jBPM, Open- WFE, and Enhydra Shark comes from this study [10] and the result is also available at the workflow patterns initiative website [30].

3.5 Building the extended version of Activiti Explorer The extended platform was created by extending the Activiti Explorer to support several companies per installation and the customization of user input forms. Since Activiti is an open-source project, the source code for Activiti Explorer was downloaded with Apache Subversion and modifications were made directly in the code. The development tool used was Eclipse with the Maven plugin installed. The code was firstly examined in order to discover a means of implementing the different features. Once a sound strategy had been determined that did not in- volve many changes, the implementation commenced. Following this, a great deal of testing was conducted to ensure that the implementation worked as intended. During the course of the project some bugs and smaller imperfections were discovered and changed to a more desirable

19 Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform 3 Methodology Mikael Nilsson 2012-06-29 solution. At the conclusion of the project, version 5.9 of Activiti was released. All the changes had been made to version 5.8 and these were re-examined and brought over to version 5.9 one at a time and all the changes documented (see Appendix C and D for details).

20 Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform 4 Implementation Mikael Nilsson 2012-06-29

4 Implementation The first part of this chapter shows the implementation of all control- flow patterns with a description and a diagram for the supported pat- terns. In the second part the implementation of the extended version of Activiti Explorer is explained.

4.1 Control-flow patterns All patterns are modelled using the Activiti Designer which is an eclipse plugin. A brief description is provided for all the patterns and a graph- ical diagram is additionally shown for the supported patterns. The graphical diagrams are saved as a png file in Activiti Designer and they depict the graphical representation of the process being modelled. When modelling the patterns, all tasks are represented by a user task that is assigned to the initiator. This simplifies the testing easier as the same user both initiates the process and receives all the user tasks. For each of the supported patterns there is also a detailed XML in Appendix E.

4.1.1 Pattern 1 – Sequence The pattern is directly supported by using a “Sequence Flow” construct between activities. For its graphical representation see figure 6.

Figure 6: Pattern 1 - Sequence

4.1.2 Pattern 2 – Parallel split The pattern is directly supported by using a “Parallel Gateway” con- struct. For its graphical representation see figure 7.

21 Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform 4 Implementation Mikael Nilsson 2012-06-29

Figure 7: Pattern 2 - Parallel split

4.1.3 Pattern 3 – Synchronization The pattern is directly supported by using a “Parallel Gateway” con- struct. For its graphical representation see figure 8.

Figure 8: Pattern 3 - Syncronization

4.1.4 Pattern 4 - Exclusive Choice The pattern is directly supported by using an “Exclusive Gateway” construct. For its graphical representation see figure 9.

22 Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform 4 Implementation Mikael Nilsson 2012-06-29

Figure 9: Pattern 4 - Exclusive choice

4.1.5 Pattern 5 - Simple Merge The pattern is directly supported by using an “Exclusive Gateway” construct. For its graphical representation see figure 10.

Figure 10: Pattern 5 - Simple merge

4.1.6 Pattern 6 - Multi-Choice The pattern is directly supported by using an “Inclusive Gateway” construct with conditions on the outgoing “Sequence Flows”. For its graphical representation see figure 11.

23 Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform 4 Implementation Mikael Nilsson 2012-06-29

Figure 11: Pattern 6 - Multi-choice

4.1.7 Pattern 7 - Structured Synchronizing Merge The pattern is directly supported by using an “Inclusive Gateway” construct. For its graphical representation see figure 12.

Figure 12: Pattern 7 - Structured synchronizing merge

4.1.8 Pattern 8 - Multi-Merge The pattern is directly supported by using an “Exclusive Gateway” construct. For its graphical representation see figure 13.

24 Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform 4 Implementation Mikael Nilsson 2012-06-29

Figure 13: Pattern 8 - Multi-merge

4.1.9 Pattern 9 - Structured Discriminator The pattern is not supported. Support for this pattern is referred to in the BPMN specification but Activiti Designer does not support the complex gateway construct.

4.1.10 Pattern 10 – Arbitrary Cycles The pattern is directly supported by using the “Exclusive Gateway” construct with “Sequence Flows” to construct the loops. For its graph- ical representation see figure 14.

Figure 14: Pattern 10 - Arbitrary cycles

4.1.11 Pattern 11 - Implicit Termination The pattern is directly supported by the BPMN process language and when all paths have reached an end event the process is terminated. For its graphical representation see figure 15.

25 Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform 4 Implementation Mikael Nilsson 2012-06-29

Figure 15: Pattern 11 - Implicit Termination

4.1.12 Pattern 12 - Multiple Instances without Synchronization The pattern is partially supported. By default, the multi instance task will synchronize and the subsequent flow will only be called once all instances are completed. In order to circumvent this a “Parallel Gate- way” is used to split the thread of control before calling the multi- instance. To specify the number of instances to be started, the Loop cardinality is set to the variable containing the number of instances. For its graphical representation see figure 16.

Figure 16: Pattern 12 - Multiple instances without synchronization

4.1.13 Pattern 13 - Multiple Instances with a priori Design-Time Knowledge The pattern is directly supported. The Loop cardinality for the multi- instance is set at the design time to the number of activity instances in this case 3. For its graphical representation see figure 17.

26 Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform 4 Implementation Mikael Nilsson 2012-06-29

Figure 17: Pattern 13 - Multiple instances with a priori design-time knowledge

4.1.14 Pattern 14 - Multiple Instances with a priori Run-Time Knowledge The pattern is directly supported. The Loop cardinality for the multi- instance is set at the design time to a process variable. For its graphical representation see figure 18.

Figure 18: Pattern 14 - Multiple instances with a priori run-time knowledge

4.1.15 Pattern 15 - Multiple instances without a priori run-time knowledge The pattern is not supported. The number of instances cannot be changed after the multi-instance task has started.

4.1.16 Pattern 16 - Deferred Choice The pattern is partially supported. It can be modelled using a sub pro- cess with error events to cancel the remaining listeners after a choice has been made. Experimental support exists for the event based gateway construct and signals which should offer full support for this pattern (Support for this patterns is therefore expected in future releases). For its graphical representation see figure 19.

27 Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform 4 Implementation Mikael Nilsson 2012-06-29

Figure 19: Pattern 16 - Deferred choice

4.1.17 Pattern 17 - Interleaved Parallel Routing The pattern is not supported. There is no construct that offers serial execution of parallel activities.

4.1.18 Pattern 18 – Milestone The pattern is not supported. Activiti has no support for states.

4.1.19 Pattern 19 - Cancel Activity The pattern is directly supported by using an error boundary event attached to the activity being cancelled and issue an error message to cancel the activity. For its graphical representation see figure 20.

28 Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform 4 Implementation Mikael Nilsson 2012-06-29

Figure 20: Pattern 19 - Cancel activity

4.1.20 Pattern 20 - Cancel Case The pattern is directly supported, by encapsulating the process in a sub- process and using error events. For its graphical representation see figure 21.

Figure 21: Pattern 20 - Cancel case

4.1.21 Pattern 21 - Structured Loop The pattern is directly supported. Both post- and pre-test loops can be constructed using exclusive gateways and a process variable. For the post-test loop see figure 22 and for the pre-test see figure 23.

29 Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform 4 Implementation Mikael Nilsson 2012-06-29

Figure 22: Pattern 21 - Structured loop (post-test)

Figure 23: Pattern 21 - Structured loop (pre-test)

4.1.22 Pattern 22 - Recursion The pattern is not supported. There is no means of specifying recursion in the Activiti Designer.

4.1.23 Pattern 23 - Transient Trigger The pattern is not supported.There is no means of specifying triggers in Activiti Designer.

4.1.24 Pattern 24 - Persistent Trigger The pattern is not supported. There is no means of specifying triggers in Activiti Designer.

4.1.25 Pattern 25 - Cancel Region The pattern is partially supported, by encapsulating the region in a sub- process and using error events to cancel the region. For its graphical representation see figure 24.

30 Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform 4 Implementation Mikael Nilsson 2012-06-29

Figure 24: Pattern 25 - Cancel Region

4.1.26 Pattern 26 - Cancel Multiple Instance Activity The pattern is directly supported by using an error boundary event to cancel all remaining instances. For its graphical representation see figure 25.

Figure 25: Pattern 26 - Cancel Multiple Instance Activity

4.1.27 Pattern 27 - Complete Multiple Instance Activity The pattern is directly supported, by using a boundary event or setting the completion condition of the multi-instance. For the graphical repre- sentation when using a boundary event see figure 26 and figure 27 for an example using the completion condition.

31 Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform 4 Implementation Mikael Nilsson 2012-06-29

Figure 26: Pattern 27 - Complete Multiple Instance Activity (Boundary event)

Figure 27: Pattern 27 - Complete Multiple Instance Activity (completion condition)

4.1.28 Pattern 28 - Blocking Discriminator The pattern is not supported. Activiti Designer does not support the complex gateway construct.

4.1.29 Pattern 29 - Cancelling Discriminator The pattern is directly supported, using a sub-process and an error event to cancel the remaining activities. For its graphical representation see figure 28.

Figure 28: Pattern 29 - Cancelling Discriminator

4.1.30 Pattern 30 - Structured Partial Join The pattern is not supported. Activiti Designer does not support the complex gateway construct.

4.1.31 Pattern 31 - Blocking Partial Join The pattern is not supported. Activiti Designer does not support the complex gateway construct.

32 Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform 4 Implementation Mikael Nilsson 2012-06-29

4.1.32 Pattern 32 - Cancelling Partial Join The pattern is not supported. Activiti Designer does not support the complex gateway construct.

4.1.33 Pattern 33 - Generalized AND-Join The pattern is not supported. The parallel gateway executes the subse- quent activity when it has received the same number of input signals as the number of input branches, even if all signals come from the same branches.

4.1.34 Pattern 34 - Static Partial Join for Multiple Instances The pattern is not supported. There is no means of triggering the subse- quent task without cancelling the other instances. Signals, which at present are labelled experimental, might be used to accomplish this.

4.1.35 Pattern 35 - Cancelling Partial Join for Multiple Instances The pattern is supported, and can be modelled by using an error bound- ary event or by setting the completion condition to M=N. For its graph- ical representation see figure 29.

Figure 29: Pattern 35 - Cancelling partial join for multiple instances

4.1.36 Pattern 36 - Dynamic Partial Join for Multiple Instances The pattern is not supported. The number of instances cannot be changed after the multi-instance task has started.

4.1.37 Pattern 37 - Acyclic Synchronizing Merge The pattern is not supported. The “Inclusive Gateway” has to be used in a structured context. 4.1.38 Pattern 38 - General Synchronizing Merge The pattern is not supported. The “Inclusive Gateway” has to be used in a structured context. 4.1.39 Pattern 39 - Critical Section The pattern is not supported. Activiti Desiger offers no support for limiting concurrent execution of activities.

33 Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform 4 Implementation Mikael Nilsson 2012-06-29

4.1.40 Pattern 40 - Interleaved Routing The pattern is not supported. Ad-hoc processes are not supported in Activiti Designer. 4.1.41 Pattern 41 - Thread Merge The pattern is not supported. startQuantity attribute of activities is not supported in Activiti Designer. 4.1.42 Pattern 42 - Thread Split The pattern is not supported. completionQuantity attribute of activities is not supported in Activiti Designer.

4.1.43 Pattern 43 - Explicit Termination The pattern is not supported. The Terminate End Event construct is missing in Activiti Designer.

4.2 Support for multiple companies To support multiple companies without changing the code for the engine, the ProcessEngines class was used to register one engine per company. For a complete list of changes required to implement the multi-company support see Appendix C.

4.2.1 Company Database and Admin web application When Activiti Explorer is initialized it loads a configuration file via Spring to start the engine. Since one engine will be used per company, it is necessary to start several engines and to add engines without restart- ing the application. Because of this, the configuration file was changed to contain the configuration for a JDBC connection to a MySQL database that stores the configuration parameters for the engines. See figure 30 for the database table. When the application starts it loads the JDBC connection via Spring and investigates all the records and sets up one engine per company and starts it.

34 Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform 4 Implementation Mikael Nilsson 2012-06-29

Company PK CompanyName

DriverClassName URL UserName Password MailServerHost MailServerUserName MailServerPassword MailServerPort MailServerDefaultFrom MailServerUseTLS

Figure 30: Company database table

To handle the administration of companies, a Vaadin web application was created that can be accessed by adding “/admin” to the URL. The Admin web application can be used to start and stop the engines for companies that are already in the database. The login information for the admin web application is stored in the Admin database table (see figure 31) and the password is stored using a SHA-1 cryptographic hash function.

Admin

PK UserName

Password

Figure 31: Admin database table

4.2.2 CloudProcessEngines The CloudProcessEngines class was created to ease the handling of multiple companies. The class communicates directly with the engines, and all communications between a logged in user in Activiti Explorer and the engine pass through this object. All classes that have previously communicated with the engine were changed to communicate via the CloudProcessEngines with the exception of the classes handling the login of the user (see next section). When the process engines are regis- tered they are associated with a name, which in this case is the same as the company name. When getProcessEngine() method is called on the CloudProcessEngines object, it firstly reads the company name associat-

35 Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform 4 Implementation Mikael Nilsson 2012-06-29

ed with the logged in user and then calls the ProcessEngines class in order to retrieve the engine registered with that company name and then returns it. The Admin web application also communicates with this class.

4.2.3 Login A new implementation of the logged in user interface was created with the addition of a field containing the company name. This class is at- tached to the application object and is therefore globally available. The login screen was also extended to include an input field for the company name. When the user attempts to log in, an engine is loaded associated with the given company and, if it exists, the user’s credentials (name and password) are sent to the engine for verification. If no engine is associated with the company name, then the login fails. After the login has succeeded and providing that the credentials were correct, the user object (with company name) is attached to the application object and the user is logged in.

4.2.4 User Cache The user cache is used to cache users for the purpose of speeding up user lookup operations. Only one user cache does not work with multi- ple companies since they have different users, and because of this and the time constraints on this project, the user cache implemented simply retrieves users from the database instead of actually caching them.

4.2.5 Activiti Company Deployment Manager This application makes it easier to create and modify company infor- mation that is used when deploying a new company. It is a Java applica- tion with a graphical user interface (GUI) that is using the Swing framework. The file format, when saving and loading the company deployment file, is a zip file with the structure shown in figure 32. The theme/img directory contains all the images for the theme, the us- ers/pictures directory contains all the pictures of the users and the processes directory contains all processes to be deployed.

36 Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform 4 Implementation Mikael Nilsson 2012-06-29

/

theme

img

styles.xml

users

pictures

users.xml

processes

Figure 32: File structure of the company deployment zip file

To create a theme, one color is picked and the logos are loaded from a file or generated based on the first logo. After the color and logos have been selected the application will generate images for buttons and the menubar together with a css file to be used as a Vaadin theme. The algorithm used for the real-time preview of the menubar uses the hard- ware accelerated graphics and lower settings to make it faster on older machines. The algorithm used when generating the actual images uses the Java 2d graphics API with the best quality settings together with antialiasing. The theme can be exported as a Vaadin theme or saved in a zip file, making it usable for both the modified version in addition to the original version of Activiti Explorer.

Users can be easily added, deleted and edited directly in the application. The users are saved in an XML file, with pictures in a separate directory, for an example, see below. In the edit user dialog, groups can be added or removed. The dropdown menu of available users is loaded from the groups.xml file, which is located in the application directory. This file can be edited in a text editor to add more groups, see below for the xml structure.

The processes are merely a list of loaded process files that will be saved in the zip file.

37 Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform 4 Implementation Mikael Nilsson 2012-06-29

kermit Kermit The Frog kermit [email protected] kermit.jpg Admin Management Sales Marketing Engineering User xml file format

Admin Management Sales Marketing Engineering Groups xml file format

4.2.6 Deployment helper tools To make it easier to set up the initial database and to write the configu- ration file used by Activiti Explorer when it is started, a command line Java application was created. The application takes the path to the Activiti Explorer, database info and credentials (to create the schemas and tables). It creates the activiti_cloud schema and a MySQL user with the same name and sets the privileges for this user to only use Select operations on the activiti_cloud schema. The password for the user is auto generated with a simple random algorithm. Finally, the configura- tion file with the credentials is created in the Activiti Explorer directory path.

To make it easier to set up a new company a command line Java applica- tion was created. The application takes a zip file containing the theme to be used together with all users and processes (see Activiti Company Deployment Manager). It also takes the path to the theme directory and the database credentials. It firstly copies the theme to the Activiti Ex- plorer theme directory and then launches an offline process engine.

38 Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform 4 Implementation Mikael Nilsson 2012-06-29

Then a schema and a user are created (they both have the company name). Following this, the process engine sets up the database and builds all the tables. All users are then added to the database via the engine and finally the processes are deployed. When everything is completed the process engine is shut down and the configuration and the database credentials are written to the Company table (for uml diagram see figure 30).

4.3 Support for a business payment model The invoice can be reached from the admin web application (for an image see result chapter). For each company there is a date field and a button. By choosing a month and pressing the invoice data button an invoice for the selected month is downloaded for that company. The invoice is created by accessing the process engine for the selected com- pany and accessing its HistoryService. In order for this to work, the engine must be started and running. The invoice created is in a XML format for easy integration with the desired billing software, since it is a well-known standard in data serialization.

4.4 Support for custom layout in task forms By default, all form components are as shown in figure 33. There is no means of changing this layout, thus, in order to provide the process developer with the ability to change it, Activiti Explorer was extended. In order to support different types of layouts, an XML specification (for the tags see below) for describing the layout was developed. When developing processes, each user task has an associated formkey proper- ty, the name of this property should be the same as the filename of the desired layout file for that form. If this field is left empty the default layout is choosen, which is one field per row. When deploying processes which are using custom layouts, the process definition file, together with all layout files, must be zipped and deployed as a zip file, this is because no changes are required in the code responsible for the de- ployment.

39 Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform 4 Implementation Mikael Nilsson 2012-06-29

Figure 33: Standard form layout in Activiti Explorer.

4.4.1 XML specification The following shows, all the tags available in the XML specification created for the purpose of offering the process developer the ability to customize form layouts: Form, block, row, column, field, divider, a, img, br, space.

 form

The form is the outer most tag and it contains the entire layout.

 field

40 Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform 4 Implementation Mikael Nilsson 2012-06-29

The field is the graphical component that is displayed together with its label. The field takes an id attribute, which should be the same as the id of the field in the corresponding task form in the process definition. The description attribute is a text attribute that is used as a tool tip text, which is displayed when the user is hovering over the input field with the mouse pointer. If the id of a field is not found in the process definition file then the field is not displayed. The field tag cannot contain any other tags.

 block

The block layout can contain any of the following tags: row, col- umn, field, divider, a, img and br. It has a type attribute which can be one of the following two values “divider” and “panel”. The divider has a line on top and the panel has four borders that can be styled by specifing a style name in the style attribute (the name should corespond to a style in the Vaadin theme). The caption of the block is the title that is written at the top of the block. A block is only displayed if at least one of its interior fields is also displayed.

 row

The row tag displays all its conponents on a single line. It can contain the following tags: field, a, img and space. The expand at- tribute can be either true or false, with the true meaning being that all the components are distributed with equal width over the entire row and the false meaning being that the components are laid out one after the other with their default width.

 column

The column tag lays out the components one per row with the difference is that the label is on the left side of the component instead of being on top, which is the default. The column can contain the folowing tags: field, divider, a, img and br.

 divider

41 Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform 4 Implementation Mikael Nilsson 2012-06-29

The divider tag draws a line on the screen and the content of the element. It cannot contain any other tags.

 a

The a tag represents a url link. It can contain an img tag. Its attributes are href, used to refer to a static link and var, to a process variable that contains the link. If an image is not used the element is displayed.

 img

The img tag represents an image that is displayed. The image can be part of a link but cannot contain any tags. The src attribute is the URL in which the image can be reached. The alt attribute is the text that is displayed when the image cannot be located. The height and width attributes are used to change the default size of the image. All of these attributes are written directly to the HTML page that is viewed by the user.

 br

The br tag is used to write a linebrake by writing the br tag to the generated HTML page. The br tag cannot contain any tags, attribues or elements.

 space

The space tag is used to insert a space between components in the row tag when its expand attribute is set to false. It cannot contain any tags, attributes or elements

4.4.2 Validating custom forms When developing custom forms a dtd file can be used to validate its syntax. The dtd can be found in Appendix C.

4.4.3 Extending Activiti to support the custom form layouts The following classes were changed to add support for custom form layouts: FormPropertiesComponent, FormPropertiesForm, ProcessDefi- nitionDetailPanel and TaskDetailPanel. Their functions are to take data from the process engine and render the form and to send the data from

42 Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform 4 Implementation Mikael Nilsson 2012-06-29

the components to the process engine. For a more detailed description regarding the changes see Appendix C. The FormTemplateParser class was created and it is instantiated with the process instance id and the formkey. It loads the custom form layout xml by looking for the file with the same name as the formkey in the deployment of the process instance, by accessing the RepositoryService of the process engine. Once the xml is loaded it is parsed. The getFormLayout method is then called and it takes a map with all components (Vaadin Field objects) and properties, and returns a VerticalLayout with all components ready to be displayed. When the user is finished, the map with all the compo- nents is used to go through them for validation and if an error occurs then this is displayed and the user is unable to proceed before it is fixed. After the validation has finished successfully the component values are sent to the engine.

4.4.4 Helper tools To speed up the development of the custom form files, a command-line application written in Java was created. This application takes the path to the process definition file as the command-line input and writes one custom layout file per start event / user task that has a value written in the formkey property. This auto generated custom form file will have the same filename as the value in the formkey and contain all fields. The default files is an acceptable starting point when developing the custom form layouts as the developer only has to add rows, columns, blocks and so on.

4.5 Improvements and bug fixes Here are some of the improvements and bug fixes made to Activiti Explorer. A more detailed description is available in Appendix D.

4.5.1 High resolution screen support The reason why the Activiti Explorer web application is not able to achieve a webpage beyond the width of 1920 pixels (see figure 34) is that it is specified in the css file. By removing this line the webpage will fill up all the space on the higher resolution screens. For a detailed descrip- tion regarding how this can be performed see Appendix D.

43 Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform 4 Implementation Mikael Nilsson 2012-06-29

Figure 34: The Activiti web page not extending beyond 1920 pixels.

4.5.2 Boolean bug fix The reason why the Boolean datatype does not work (see figure 35) when it is referenced to display the value of a process variable is be- cause of a data conversion error. The checkbox component in Vaadin is using the interface Property, which has a member function setValue that takes a value of type Object (the object which all objects inherit from). In the particular case of the checkbox it takes the type Object to conform to the standard interfaces used by all components in Vaadin but it expects that it can be cast to a Boolean. The Activiti process engine stores pro- cess variables as strings, which cannot be cast to a Boolean and in order to to fix this a conversion from string to Boolean is necessary.

44 Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform 4 Implementation Mikael Nilsson 2012-06-29

Figure 35: Error message when trying to display a form using a Boolean field that is showing the value of a process variable.

4.5.3 Date field The standard date field is, by default, shown with controls with a reso- lution of milliseconds, even if the date format written in the process definition file is at a lower resolution. In figure 36 a date field with millisecond resolution and input field with a minute resolution is shown.

45 Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform 4 Implementation Mikael Nilsson 2012-06-29

Figure 36: Date field for selecting date and time with higher resolution than required.

4.5.4 Enum fields The enum fields have, by default, an empty option “null” even when it is a required field, making this choice invalid (see figure 37). That is why the null was removed when the field is required, even after it has been removed the field is empty before a choice is made.

Figure 37: Enum dialog for a required field

4.5.5 Textarea component To add a custom component such as the textarea component (figure 38) it is necessary to create two classes. The first class implements Abstract- FormType and it is used to register the type with the engine. The second class implements AbstractFormPropertyRenderer and it is used to convert between the Field and FormProperty. Both of these files are loaded with Spring when Activiti Explorer starts, thus it is possible to extend without the necessity of changing the source code. For a descrip- tion of changes and source code for the implemented classes see Ap- pendix D.

Figure 38: Textarea component

46 Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform 5 Results Mikael Nilsson 2012-06-29

5 Results This chapter is divided in two parts, the result from the control-flow pattern evaluations and then a presentation of the extended version of Activiti Explorer.

5.1 Control-flow patterns evaluation The result from the control-flow patterns implementation can be seen in table 1 together with the result from this paper [10].

Table 1: Control-flow pattern eveluation

Pattern

Activiti JBPM OpenWFE Shark Enhydra

Basic Control Flow Patterns

Pattern 1 (Sequence) + + + + Pattern 2 (Parallel Split) + + + + Pattern 3 (Synchronization) + + + + Pattern 4 (Exclusive Choice) + + + + Pattern 5 (Simple Merge) + + + + Advanced Branching and Synchronization Patterns Pattern 6 (Multi-Choice) + - +/- + Pattern 7 (Structured Synchronizing Merge) + - - - Pattern 8 (Multi-Merge) + + - - Pattern 9 (Structured Discriminator) - - + - Pattern 28 (Blocking Discriminator) - - - - Pattern 29 (Cancelling Discriminator) + - + - Pattern 30 (Structured Partial Join) - - + - Pattern 31 (Blocking Partial Join) - - - - Pattern 32 (Cancelling Partial Join) - - - - Pattern 33 (Generalized AND-Join) - + - - Pattern 37 (Local Synchronizing Merge) - - +/- - Pattern 38 (General Synchronizing Merge) - - - - Pattern 41 (Thread Merge) - +/- - - Pattern 42 (Thread Split) - +/- - -

47 Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform 5 Results Mikael Nilsson 2012-06-29

Pattern

Activiti JBPM OpenWFE Shark Enhydra Multiple Instance Patterns Pattern 12 (Multiple Instances without Synchronization) +/- + + + Pattern 13 (Multiple Instances with a priori Design-Time Knowledge) + - + - Pattern 14 (Multiple Instances with a priori Run-Time Knowledge) + - + - Pattern 15 (Multiple Instances without a priori Run-Time Knowledge) - - - - Pattern 34 (Static Partial Join for Multiple Instances) - - + - Pattern 35 (Cancelling Partial Join for Multiple Instances) + - + - Pattern 36 (Dynamic Partial Join for Multiple Instances) - - - - State-based Patterns Pattern 16 (Deferred Choice) +/- + - - Pattern 17 (Interleaved Parallel Routing) - - +/- - Pattern 18 (Milestone) - - - - Pattern 39 (Critical Section) - - - - Pattern 40 (Interleaved Routing) - - + - Cancellation and Force Completion Patterns Pattern 19 (Cancel Task) + + - - Pattern 20 (Cancel Case) + - +/- - Pattern 25 (Cancel Region) +/- - - - Pattern 26 (Cancel Multiple Instance Task) + - - - Pattern 27 (Complete Multiple Instance Task) + - - - Iteration Patterns Pattern 10 (Arbitrary Cycles) + + + + Pattern 21 (Structured Loop) + - + - Pattern 22 (Recursion) - - + + Termination Patterns Pattern 11 (Implicit Termination) + + + + Pattern 43 (Explicit Termination) - - - - Trigger Patterns Pattern 23 (Transient Trigger) - + + - Pattern 24 (Persistent Trigger) - - - -

In table 2, 3 and 4 are the number of directly, partially and not support- ed patterns per class for each platform. In table 5 the sum of all support- ed, partially supported and not supported patterns for each platform are shown.

48 Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform 5 Results Mikael Nilsson 2012-06-29

Table 2: Number of directly supported patterns per class.

Directly supported pattern classes

Activiti JBPM OpenWFE Shark Enhydra Basic Control Flow Patterns (5) 5 5 5 5 Advanced Branching and Synchronization Patterns (14) 4 2 3 1 Multiple Instance Patterns (7) 3 1 5 1 State-based Patterns (5) 0 1 1 0 Cancellation and Force Completion Patterns (5) 4 1 0 0 Iteration Patterns (3) 2 1 3 2 Termination Patterns (2) 1 1 1 1 Trigger Patterns (2) 0 1 1 0

Table 3: Number of partially supported patterns per class.

iti

Partially supported pattern classes

Activ JBPM OpenWFE Shark Enhydra Basic Control Flow Patterns (5) 0 0 0 0 Advanced Branching and Synchronization Patterns (14) 0 2 2 0 Multiple Instance Patterns (7) 1 0 0 0 State-based Patterns (5) 1 0 1 0 Cancellation and Force Completion Patterns (5) 1 0 1 0 Iteration Patterns (3) 0 0 0 0 Termination Patterns (2) 0 0 0 0 Trigger Patterns (2) 0 0 0 0

49 Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform 5 Results Mikael Nilsson 2012-06-29

Table 4: Number of not supported patterns per class.

Not supported pattern classes

Activiti JBPM OpenWFE Shark Enhydra Basic Control Flow Patterns (5) 0 0 0 0 Advanced Branching and Synchronization Patterns (14) 10 10 9 13 Multiple Instance Patterns (7) 3 6 2 6 State-based Patterns (5) 4 4 3 5 Cancellation and Force Completion Patterns (5) 0 4 4 5 Iteration Patterns (3) 1 2 0 1 Termination Patterns (2) 1 1 1 1 Trigger Patterns (2) 2 1 1 2

Table 5: All control-flow patterns.

All control-flow patterns

Activiti JBPM OpenWFE Shark Enhydra Directly supported 19 13 19 10 Partially supported 3 2 4 0 Not supported 21 28 20 33

5.2 Support for multiple companies The extended login screen can be seen in figure 39 and the admin web application in figure 40 and 41.

50 Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform 5 Results Mikael Nilsson 2012-06-29

Figure 39: Activiti Explorer login screen with the extended support for multiple companies.

5.2.1 Admin web application and payment model The admin web application requires a different set of login credentials (which are stored in the admin database table). After a successful login the user has the ability to start and stop company engines for all compa- nies that have their configuration stored in the company database table. If the process engine of a company is stopped, then no proceses will run and users belonging to that company cannot log in. Another feature is the ability to download an invoice for a given company and month, below is en example of such an invoice.

4 The process id tag in the invoice is composed of ::. The generated id is a unique number to guarantee uniqueness in a cluster environment. Started is the number of times that the process has started and us- ertasks_started is the total number of user tasks started by the process (this number may vary for each run since there can be more than one path in a process).

51 Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform 5 Results Mikael Nilsson 2012-06-29

Figure 40: Admin web application login

Figure 41: Admin web application with one company

5.2.2 Activiti Company Deployment Manager The company deployment manager is used to create the company deployment file. This file contains the theme, users and processes for the company. In figure 42 is the application with the default theme used by Activiti.

52 Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform 5 Results Mikael Nilsson 2012-06-29

Figure 42: Company deployment manager with default theme

In figure 43 the company deployment manager with a custom theme is displayed. The buttons next to the logos are open file, reload original logo and the button with the gears is to auto generate a logo based on the top most logo which has been used in figure 43. Figure 46 shows this theme in use.

53 Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform 5 Results Mikael Nilsson 2012-06-29

Figure 43: Manager with custom theme

The company deployment manager is shown in figure 44 with the user’s tab selected and the user Kermit open for editing. In the user tab, users can be added, removed and edited from the user menu or by right clicking on a user in the table view. It is also possible to export and import users from an xml file.

54 Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform 5 Results Mikael Nilsson 2012-06-29

Figure 44: Editing a user in the company manager application

The company deployment manager is shown in figure 45 with the processes tab selected. Here, the user is able to add and remove process- es.

55 Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform 5 Results Mikael Nilsson 2012-06-29

Figure 45: Processes tab in the company manager application

5.2.3 Set up a new server with the extended version of Activiti Explorer. 1. Install Java, Tomcat and MySQL if they are not installed.

2. Deploy the war file in tomcat (wite down the path to the directory).

3. Run setup command-line Java application with the directory (from 2) and credentials to the database as parameters. To run this step requires credentials that can write on the path and create a schema and user in the database. Enter a username and password for the admin web appli- cation.

4. Restart the webapplication (required to obtain the database creden- tials).

5. Make a company deployment file (using the Activiti company de- ployment manager or manualy).

6. Run the company deployment command-line Java program with database credentials and the path to the deployment file. This step

56 Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform 5 Results Mikael Nilsson 2012-06-29

requires credentials that allow a write access to the company table and the creation of a new schema and user.

7. Log in to the admin web application and start company process engine.

To add more companies repeat steps 5, 6 and 7. 5.3 Support for custom layout in task forms The custom form layout works by deploying the process definition together with layout xml files for each user input form that has a name written in its formkey attribute. Below is an example of a task form declaration from a process definition file followed by a form layout that was auto generated using the helper tool and the final version which uses many of the tags for demonstration purposes.

57 Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform 5 Results Mikael Nilsson 2012-06-29


58 Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform 5 Results Mikael Nilsson 2012-06-29

Cybercom Group
Article
Email

All the tabs have been removed from the XML above in order to in- crease the readability in this document. In figures 46 and 47 screenshots regarding the appearance of the custom form (from the XML above) when it is displayed in the modified version of Activiti Explorer are shown.

59 Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform 5 Results Mikael Nilsson 2012-06-29

Figure 46: The first part of the custom form layout

This is almost the same user form as that in figure 33 (Implementation chapter) with the exception of the two textarea fields, which are not supported by default in Activiti Explorer. In figure 33, standard string input fields are used instead of the two textarea fields. Another differ- ence is that Related content, People and Subtasks have been moved to after the user input form since they are considered less important than the form.

60 Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform 5 Results Mikael Nilsson 2012-06-29

Figure 47: The second part of the custom form layout 5.4 Improvements and bug fixes The following provides information relating to some of the improve- ments and bug fixes performed in the extended version of Activiti Explorer.

5.4.1 Large screen support The fix for large screen support can be seen in figure 48.

61 Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform 5 Results Mikael Nilsson 2012-06-29

Figure 48: Large screen support

5.4.2 Boolean bug fix A Boolean field working without error messages when assigned a process variable can be seen in figure 49.

Figure 49: Working Boolean field

5.4.3 Date field The date field displaying only the controls nesssesary to enter a date and time in the requested resolution is shown in figure 50.

62 Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform 5 Results Mikael Nilsson 2012-06-29

Figure 50: Improved date field

5.4.4 Enum fields The enum field without the option to enter a null value when the field is required is shown in figure 51.

Figure 51: Improved enum field

63 Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform 6 Conclusions Mikael Nilsson 2012-06-29

6 Conclusions The first part of the conclusion concerns the control-flow pattern evalua- tion and the second part deals with the software extensions made to Activiti Explorer.

6.1 Control-flow evaluation One of the goals of this study was to perform a pattern based analysis of of Activiti using the control-flow patterns. The pattern based evaluation offers an independent and objective means of assessing the support of business process constructs that are commonly used in practice. When starting to evaluate Activiti, it became apparent that it does not offer full BPMN 2.0 support. There has been recently released experimental support for more BPMN constructs but these are not yet supported in Activiti Designer. Since Activiti is a relatively young product, the sup- port for signals and the event based gateway will eventually become stable and since they strive to be a BPMN 2.0 process engine, other constructs such as the complex gateway will probably also become available in future releases. Other open-source platforms that are start- ing to support BPMN 2.0 are jBPM (version 5) and ProcessMaker (bpmn 2.0 preview release). As is the case for many open-source offerings, Activiti is a work in progress and with each new release more function- ality is added to the engine.

6.1.1 Basic Control Flow Patterns All the basic control-flow patterns were supported, which was expected since they are the basic building blocks when modelling business pro- cesses. All open-source products offer full support for this class of control-flow patterns.

6.1.2 Advanced Branching and Synchronization Patterns Activiti offers very limited support in this class of control-flow patterns. The BPMN offers better support in this class with its complex gateway constructs and several attributes that are missing in Activiti. The parallel gateway is not implemented in Activiti as suggested and thus it does not support the generalized AND-join pattern. It became apparent after

64 Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform 6 Conclusions Mikael Nilsson 2012-06-29

an investigation involving other open-source offerings that they also offer limited support in this class.

6.1.3 Multiple Instance Patterns Activiti offers a wide support in relation to the multiple instance pat- terns. The main aspects which are missing are a means of adding in- stances to a multi-instance while it is executing and in completing the multi-instance without cancelling the remaining instances (using a condition). jBPM and Enhydra Shark offer almost no support for the multiple instance patterns while OpenWFE offers slightly better support than Activiti.

6.1.4 State-based Patterns All open-source products have either limited or no support for the state- based patterns. This is mostly because they do not support the notion of state or cannot act on it. When the event based gateway becomes availa- ble in Activiti the support will increase slightly. Even though there is only limited support for these patterns, some are able to be implement- ed using programming.

6.1.5 Cancellation and Force Completion Patterns The cancellation and force completion patterns are one of the ad- vantages of Activiti over the other open-source products. While Activiti is offering full support for almost all patterns, the other open-source products offer almost no support.

6.1.6 Iteration Patterns Activiti offers almost full support for the iteration patterns. The only pattern not supported is the recursive pattern. OpenWFE is the only platform that offers full support for these patterns.

6.1.7 Termination Patterns The termination patterns are partially supported by all open-source products. The implicit termination pattern is supported across the board while the explicit termination is not supported by any products. In older versions of Activiti, the explicit termination pattern was supported via a terminate end event but this construct is no longer available in Activiti Designer.

65 Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform 6 Conclusions Mikael Nilsson 2012-06-29

6.1.8 Trigger Patterns Activiti and Enhyrda Shark do not support any of the trigger patterns. jBPM and OpenWFE only support the Transient Trigger pattern.

6.1.9 Control-flow patterns The overall conclusion based on an evaluation of the control-flow pat- terns is that Activiti offers good support in comparison to that offered by the other open-source products. But there are some areas especially in the state-based patterns, trigger patterns and advanced branching and synchronization pattern that are not supported by Activiti. On the other hand an investigation of the Cancellation and Force Completion Patterns shows that Activiti is superior to the other platforms and offers almost full support. It is important to evaluate what kind of processes are going to be developed before choosing Activiti since there are other offerings, not dealt with in this study, that are able to offer more direct support for some specific needs. It is always better to have direct sup- port for the patterns used in a process than to rely on custom code or messy diagrams which can lead to logical errors and problems when improving the process during the redesigning phase. 6.2 Extended Activiti Explorer One important aspect of this evaluation was to evaluate Activiti as an open-source product with the possibility of extending the code. This was conducted by developing two significant extensions and by fixing some bugs and minor improvements. When this project started, the extensions were made to Activiti 5.8 and by the end of the project, version 5.9 had been released and all the changes were merged in to this version without any difficulties. Since Activiti is releasing newer ver- sions several times a year it can prove to be time consuming to maintain an extended version. From version 5.8 and 5.9 the majority of the im- provements have been to the engine and not the Activiti Explorer mod- ule, in fact only two Java files have been changed. The source code of Activiti is well structured and it uses good naming conventions which makes it easy to navigate and to understand. However, as with many software systems, it relies on underlying frameworks such as Spring and Vaadin. In order to better understand the source code it is important to have a more in-depth understanding of these frameworks.

66 Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform 6 Conclusions Mikael Nilsson 2012-06-29

6.2.1 Support for multiple companies The solution presented here has the advantage that it enables multiple companies in the same web application. One of the drawbacks involves scaling since there are limits associated with one server and, once this limit has been reached, it will be necessary to install one or more addi- tional servers. Another problem is the amount of changes required to implement this feature as it will prove be time consuming to merge this feature for each new version of Activiti. Another solution would be to install each company as a separate web application. This requires more work and takes up more disk space and uses one administrator applica- tion per company. By using the Activiti company deployment manager it is easy to assemble all company users and processes in addition to creating a customized appearance by choosing a color and new logo- types.

6.2.2 Support for custom layout in task forms Only four classes were changed and one was added to support the custom form tasks. The discovery involved in relation to the classes which were handling the form rendering and how it was possible to add the changes, this was facilitated by the naming and good organization of the packages and classes. The solution is relatively easy to use for a process developer and the helper tool makes it somewhat easier. The drawbacks associated with this solution are that XML editing is time consuming and the XML parsing is necessary every time a user task is executed, which consumes computer resources. The default behaviour makes the extended version of Activiti fully compatible with processes created for the original version. By creating blocks with common fields it is possible to build standard templates that can be used by several tasks, because the blocks are not displayed if they are empty and fields missing from the layout XML file will be displayed at the bottom of the form.

6.2.3 Support for a business payment model The payment model is very simple and it allows a pay per process instance and payment for each executed user task. Of course, it is also possible to charge a fixed price per month per process. When updating a process, both the old and new processes are listed separately in the invoice XML making it possible to have different charges, for example, taking out an extra charge for a new improved process. When starting a

67 Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform 6 Conclusions Mikael Nilsson 2012-06-29

new process it is always the newest version available that is started (user cannot choose) but previously started processes when a new version is deployed, will not change. Only processes that were started during the selected month are listed in the invoice XML. What is still missing is a means of integrating the invoice into billing software but since it is in an XML format it should be easy to make a converter that converts it to any desired format for a specific product.

6.2.4 Improvements and bug fixes When fixing bugs and making minor improvements it is vital to possess knowledge of the Vaadin framework. The source code for the Activiti Engine was also used as a source of information for the internal func- tionality in the engine.

68 Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform 7 Future work Mikael Nilsson 2012-06-29

7 Future work Here are some suggestions for future work that were not investigated because of time constraints.

7.1 Workflow pattern evaluation To better understand Activities capabilities it should be evaluated against the other workflow pattern perspectives provided by the work- flow patterns initiative:

 Workflow Resource Patterns

 Workflow Data Patterns

 Exception Handeling Patterns

 Presentation Patterns

7.2 Multiple companies To improve the scaling and administration, the engine should be sepa- rated from the graphical user interface. There is already an Activiti REST web application module but it is still labelled as being experi- mental. With this type of a setup one admin application can be used for all companies, even if they are installed on different machines, as long as they are accessible from the network. In relation to application to application communication there is no requirement for a single web application to control all engines and they can also be deployed as separate web applications.

7.3 Custom form layout To improve the solution, an eclipse plugin can be developed that inte- grates with Activiti Designer and provides the process developer with the ability to build the forms by using a graphical user interface with drag and drop components. To speed up the rendering of the task forms, the layout definitions can be parsed when they are deployed and saved in a binary format. The binary format has to be compact and to be read in a straightforward manner when creating the specific form for the user task in order to improve performance.

69 Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform Terminology Mikael Nilsson 2012-06-29

References [1] R. Medina-Mora, T. Winograd, and R. Flores, “ActionWorkflow as the Enterprise Integration Technology,” Bulletin of the Tech- nical Committee on Data Engineering, IEEE Computer Society, Vol. 16, No.2 June 1993.

[2] D. Georgakopoulos, M. Hornick, and A. Sheth. An Overview of Workflow Management: From process Modeling to Workflow Automation Infrastructure. Distributed and Parallel Databases, 3(2):119-153, April 1995.

[3] The Workflow Patterns Initiative, “Main page of the initiative site”, http://www.workflowpatterns.com/ Retrieved 2012-06-13.

[4] W.M.P van der Aalst, A.H.M. ter Hofstede, B. Kiepuszewski, and A.P. Barros. Workflow Patterns. Distributed and Parallel Data- bases, 14(3):5-51, July 2003.

[5] N. Russell, A.H.M. ter Hofstede, W.M.P. van der Aalst, and N. Mulyar. Workflow Control-Flow Patterns: A Revised View. BPM Center Report BPM-06-22, BPMcenter.org, 2006.

[6] Alexander, Christopher. A Pattern Language: Towns, Buildings, Construction. Oxford University Press. 1977.

[7] Erich Gamma, Richard Helm, Ralph Johnson, John Vlissides. Design Patterns: Elements of Reusable Object-Oriented Software, 1994

[8] Mathias Weske. Business Process Management: Concepts, Lan- guages, Architectures. Springer 2007

[9] Activiti, “Activiti website”, http://www.activiti.org/. Retrieved 2012-06-13

[10] P. Wohed, B. Andersson, A.H.M. ter Hofstede, N.C. Russell, and W.M.P. van der Aalst. Patterns-based Evaluation of Open Source

70 Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform Terminology Mikael Nilsson 2012-06-29

BPM Systems: The Cases of jBPM, OpenWFE, and Enhydra Shark. BPM Center Report BPM-07-12, BPMcenter.org, 2007.

[11] jBPM, “jBPM website”, http://www.jboss.org/jbpm, Retrieved 2012-06-13

[12] OpenWFE, “OpenWFE website”, http://sourceforge.net/projects/openwfe/, Retrieved 2012-06-13

[13] Enhydra Shark, “Enhydra shark website”, http://sourceforge.net/projects/sharkwf/, Retrieved 2012-02-23

[14] Apache 2.0 License, “Information about the Apache 2.0 license”, http://www.apache.org/licenses/LICENSE-2.0 Retrieved 2012-06- 13

[15] Spring Framework, “Spring framework website”, http://www.springsource.org/ Retrieved 2012-06-13

[16] Vaadin Framework, “Vaadin framework website”, https://vaadin.com/home Retrieved 2012-06-13

[17] Google Web Toolkit, “Google Web Toolkit website”, https://developers.google.com/web-toolkit/ Retrieved 2012-06-13

[18] Tijs Rademakers, Activiti in Action: Executable business process- es in BPMN 2.0, Manning Publications 2012.

[19] Nicolas Frankel, Learning Vaadin, Packt Publishing 2011.

[20] Object Management Group, “The BPMN 2.0 specification”, http://www.omg.org/spec/BPMN/2.0/ Retrieved 2012-06-13

[21] Alfresco, “Alfresco website”, http://www.alfresco.com/ Retrieved 2012-06-13

[22] Eclipse, “Eclipse project website”, http://www.eclipse.org/ Re- trieved 2012-06-13

[23] Activiti Designer, “Documentation about Activiti Desiger”, http://www.activiti.org/userguide/index.html#activitiDesigner Retrieved 2012-06-13

71 Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform Terminology Mikael Nilsson 2012-06-29

[24] The Workflow patterns, “Information about workflow patterns”, http://www.workflowpatterns.com/patterns/ Retrieved 2012-06- 13

[25] The Wokflow Patterns, “Information about the Control-Flow Patterns”, http://www.workflowpatterns.com/patterns/control/ Retrieved 2012-06-13

[26] Activiti subversion repository, “The Activiti source code”, http://svn.codehaus.org/activiti/ Retrieved 2012-06-13

[27] Activiti Explorer, “Information about Activiti Explorer”, http://www.activiti.org/userguide/index.html#activitiExplorer Retrieved 2012-06-13

[28] Marko Grönroos, Book of Vaadin - 4th Edition, Vaadin Ltd 2012- 06-11

[29] Activiti User Guide, “Information about Activiti”, http://www.activiti.org/userguide/index.html Retrieved 2012-06- 13

[30] The Workflow Patterns Initiative, “Information about open- source product evaluations”, http://www.workflowpatterns.com/evaluations/opensource/ Re- trieved 2012-06-13

72 Open-source Workflow Evaluation - An evaluation of the Appendix A: Process constricts in Activiti BPM Platform Activiti Designer Mikael Nilsson 2012-06-29

Appendix A: Process constricts in Activiti Designer Here are the constructs found in Activiti Designer 5.8 that are used when modeling the patterns.

Connection Sequence flow is used to connect activities, gateways and events to each other. The connection is in the direction of the arrow, its graphical notation is shown in figure 52.

Figure 52: Sequence Flow Event Start Event is used to define the starting point for the process. It can take values to be written into process variables and the name of the process variable to contain the name of the process initiator. Its graphical nota- tion is shown in figure 53.

Figure 53: Start Event

End Event is used to define where a process branch ends. The process ends first when all threads have reached an end event. The graphical notation (figure 54) is similar to Start Event but with a thicker boarder.

73 Open-source Workflow Evaluation - An evaluation of the Appendix A: Process constricts in Activiti BPM Platform Activiti Designer Mikael Nilsson 2012-06-29

Figure 54: End Event

Error End Event is an end event that throws an error inside a process that can be caught by the error boundary event. Its graphical notation is shown in figure 55.

Figure 55: Error End Event

Timer Start Event is used to start a process at a specific time or time intervals. Its graphical notation is shown in figure 56.

Figure 56: Timer Start Event

Task In the task category there are automated tasks and manual tasks that represent a piece of work that is part of the process. The only ones used when modeling the control-flow patterns are the user task and the sub process.

User task is used to model a task that has to be completed by a human actor. The User Task can be used to write process variables with values provided by the user. It is possible to create multiple instances of a task by setting the properties in the multi-instance tab. Its graphical notation is shown in figure 57.

74 Open-source Workflow Evaluation - An evaluation of the Appendix A: Process constricts in Activiti BPM Platform Activiti Designer Mikael Nilsson 2012-06-29

Figure 57: User Task

Sub Process can be used to construct a process inside a process. On the sub process boundary events can be attached for error handling and timers. The graphical notation is shown in figure 58.

Figure 58: Sub Process Gateway Parallel Gateway is used to execute activities in parallel or to make sure that all incoming activities have to be completed before the subsequent activity is executed. Its graphical notation is shown in figure 59.

Figure 59: Parallel Gateway

Exclusive gateway is used for selecting one outgoing sequence flow based on conditional logic. Each incoming thread will result in a thread

75 Open-source Workflow Evaluation - An evaluation of the Appendix A: Process constricts in Activiti BPM Platform Activiti Designer Mikael Nilsson 2012-06-29 being passed to the subsequent activity. Its graphical notation is shown in figure 60.

Figure 60: Exclusive Gateway

Inclusive Gateway is used for conditional logic such as the Exclusive Gateway but the difference being that more than one outgoing sequence flow can be used. The subsequent activity will be executed first when all incoming branches that were split with an inclusive gateway earlier in the process have been activated. Its graphical notation is shown in figure 61.

Figure 61: Inclusive Gateway

Boundary Event Error Boundary Event is used to catch errors that are thrown inside the activity where it is defined. Its graphical notation is shown in figure 62.

Figure 62: Error Boundary Event

Timer Boundary Event is used to attach a timer to an activity that starts when the activity is executed and fires when the specified time is reached. When the timer fires the execution of the activity is halted and the sequence flow following the boundary event is executed. Its graph- ical notation is shown in figure 63.

76 Open-source Workflow Evaluation - An evaluation of the Appendix A: Process constricts in Activiti BPM Platform Activiti Designer Mikael Nilsson 2012-06-29

Figure 63: Timer Boundary Event

Intermediate Event Timer Catching Event is used to create a timer to delay the execution of the subsequent activity. When the timer is executed the countdown starts and the subsequent activity is executed first when the countdown has reached zero. Its graphical notation is shown in figure 64.

Figure 64: Timer Catching Event

77 Open-source Workflow Evaluation - An evaluation of the Appendix B: Control-flow patterns Activiti BPM Platform definitions Mikael Nilsson 2012-06-29

Appendix B: Control-flow patterns definitions This chapter consists of a brief explanation of the 43 control-flow work- flow patterns with their original definition.

Pattern 1 – Sequence An activity in a workflow process is enabled after the completion of a preceding activity in the same process. [5]

Synonyms Sequential routing, serial routing [5].

Pattern 2 – Parallel split The divergence of a branch into two or more parallel branches each of which execute concurrently. [5]

Synonyms AND-split, parallel routing, parallel split, fork [5]. Pattern 3 – Synchronization The convergence of two or more branches into a single subsequent branch such that the thread of control is passed to the subsequent branch when all input branches have been enabled. [5]

Synonyms AND-join, rendezvous, synchronizer [5]. Pattern 4 - Exclusive Choice The divergence of a branch into two or more branches. When the incom- ing branch is enabled, the thread of control is immediately passed to precisely one of the outgoing branches based on the outcome of a logical expression associated with the branch. [5]

Synonyms XOR-split, exclusive OR-split, conditional routing, switch, decision, case statement [5].

78 Open-source Workflow Evaluation - An evaluation of the Appendix B: Control-flow patterns Activiti BPM Platform definitions Mikael Nilsson 2012-06-29

Pattern 5 - Simple Merge The convergence of two or more branches into a single subsequent branch. Each enablement of an incoming branch results in the thread of control being passed to the subsequent branch. [5]

Synonyms XOR-join, exclusive OR-join, asynchronous join, merge [5]. Pattern 6 - Multi-Choice The divergence of a branch into two or more branches. When the incom- ing branch is enabled, the thread of control is immediately passed to one or more of the outgoing branches based the outcome of distinct logical expressions associated with each of the branches. [5]

Synonyms Conditional routing, selection, OR-split, multiple choice [5].

Pattern 7 - Structured Synchronizing Merge The convergence of two or more branches (which diverged earlier in the process at a uniquely identifiable point) into a single subsequent branch. The thread of control is passed to the subsequent branch when each active incoming branch has been enabled. [5]

Synonyms Synchronizing join, synchronizer [5].

Pattern 8 - Multi-Merge The convergence of two or more branches into a single subsequent branch. Each enablement of an incoming branch results in the thread of control being passed to the subsequent branch. [5]

Pattern 9 - Structured Discriminator The convergence of two or more branches into a single subsequent branch following a corresponding divergence earlier in the process model. The thread of control is passed to the subsequent branch when the first incoming branch has been enabled. Subsequent enablements of incoming branches do not result in the thread of control being passed on. The discriminator construct resets when all incoming branches have been enabled. [5]

79 Open-source Workflow Evaluation - An evaluation of the Appendix B: Control-flow patterns Activiti BPM Platform definitions Mikael Nilsson 2012-06-29

Synonyms 1-out-of-M join [5].

Pattern 10 – Arbitrary Cycles The ability to represent cycles in a process model that have more than one entry or exit point. [5]

Synonyms Unstructured loop, iteration, cycle [5]. Pattern 11 - Implicit Termination A given process (or sub-process) instance should terminate when there are no remaining work items that are able to be done either now or at any time in the future. [5]

Pattern 12 - Multiple Instances without Synchronization Within a given process instance, multiple instances of an activity can be created. These instances are independent of each other and run concur- rently. There is no requirement to synchronize them upon completion. [5]

Synonyms Multi threading without synchronization, spawn off facility [5].

Pattern 13 - Multiple Instances with a priori Design-Time Knowledge Within a given process instance, multiple instances of an activity can be created. The required number of instances is known at design time. These instances are independent of each other and run concurrently. It is necessary to synchronize the activity instances at completion before any subsequent activities can be triggered. [5]

Pattern 14 - Multiple Instances with a priori Run-Time Knowledge Within a given process instance, multiple instances of an activity can be created. The required number of instances may depend on a number of runtime factors, including state data, resource availability and inter- process communications, but is known before the activity instances must be created. Once initiated, these instances are independent of each

80 Open-source Workflow Evaluation - An evaluation of the Appendix B: Control-flow patterns Activiti BPM Platform definitions Mikael Nilsson 2012-06-29 other and run concurrently. It is necessary to synchronize the instances at completion before any subsequent activities can be triggered. [5]

Pattern 15 - Multiple instances without a priori run-time knowledge Within a given process instance, multiple instances of an activity can be created. The required number of instances may depend on a number of runtime factors, including state data, resource availability and inter- process communications and is not known until the final instance has completed. Once initiated, these instances are independent of each other and run concurrently. At any time, whilst instances are running, it is possible for additional instances to be initiated. It is necessary to syn- chronize the instances at completion before any subsequent activities can be triggered. [5]

Pattern 16 - Deferred Choice A point in a workflow process where one of several branches is chosen based on interaction with the operating environment. Prior to the deci- sion, all branches present possible future courses of execution. The decision is made by initiating the first activity in one of the branches i.e. there is no explicit choice but rather a race between different branches. After the decision is made, execution alternatives in branches other than the one selected are withdrawn. [5]

Synonyms External choice, implicit choice, deferred XOR-split [5].

Pattern 17 - Interleaved Parallel Routing A set of activities has a partial ordering defining the requirements with respect to the order in which they must be executed. Each activity in the set must be executed once and they can be completed in any order that accords with the partial order. However, as an additional requirement, no two activities can be executed at the same time (i.e. no two activities can be active for the same process instance at the same time) . [5]

Pattern 18 – Milestone An activity is only enabled when the process instance (of which it is part) is in a specific state (typically in a parallel branch). The state is assumed to be a specific execution point (also known as a milestone) in the process model. When this execution point is reached the nominated

81 Open-source Workflow Evaluation - An evaluation of the Appendix B: Control-flow patterns Activiti BPM Platform definitions Mikael Nilsson 2012-06-29 activity can be enabled. If the process instance has progressed beyond this state, then the activity cannot be enabled now or at any future time (i.e. the deadline has expired). Note that the execution does not influ- ence the state itself, i.e. unlike normal control-flow dependencies it is a test rather than a trigger. [5]

Synonyms Test arc, deadline, state condition, withdraw message [5].

Pattern 19 - Cancel Activity An enabled activity is withdrawn prior to it commencing execution. If the activity has started, it is disabled and, where possible, the currently running instance is halted and removed. [5]

Synonyms Withdraw activity.

Pattern 20 - Cancel Case A complete process instance is removed. This includes currently execut- ing activities, those which may execute at some future time and all sub- processes. The process instance is recorded as having completed unsuc- cessfully. [5]

Synonyms Withdraw case.

Pattern 21 - Structured Loop The ability to execute an activity or sub-process repeatedly. The loop has either a pre-test or post-test condition associated with it that is either evaluated at the beginning or end of the loop to determine whether it should continue. The looping structure has a single entry and exit point. [5]

Pattern 22 - Recursion The ability of an activity to invoke itself during its execution or an ancestor in terms of the overall decomposition structure with which it is associated. [5]

82 Open-source Workflow Evaluation - An evaluation of the Appendix B: Control-flow patterns Activiti BPM Platform definitions Mikael Nilsson 2012-06-29

Pattern 23 - Transient Trigger The ability for an activity to be triggered by a signal from another part of the process or from the external environment. These triggers are transient in nature and are lost if not acted on immediately by the re- ceiving activity. [5]

Pattern 24 - Persistent Trigger The ability for an activity to be triggered by a signal from another part of the process or from the external environment. These triggers are persistent in form and are retained by the workflow until they can be acted on by the receiving activity. [5]

Pattern 25 - Cancel Region The ability to disable a set of activities in a process instance. If any of the activities are already executing, then they are withdrawn. The activities need not be a connected subset of the overall process model. [5]

Pattern 26 - Cancel Multiple Instance Activity Within a given process instance, multiple instances of an activity can be created. The required number of instances is known at design time. These instances are independent of each other and run concurrently. At any time, the multiple instance activity can be cancelled and any in- stances which have not completed are withdrawn. This does not affect activity instances that have already completed. [5]

Pattern 27 - Complete Multiple Instance Activity Within a given process instance, multiple instances of an activity can be created. The required number of instances is known at design time. These instances are independent of each other and run concurrently. It is necessary to synchronize the instances at completion before any subsequent activities can be triggered. During the course of execution, it is possible that the activity needs to be forcibly completed such that any remaining instances are withdrawn and the thread of control is passed to subsequent activities. [5]

Pattern 28 - Blocking Discriminator The convergence of two or more branches into a single subsequent branch following one or more corresponding divergences earlier in the process model. The thread of control is passed to the subsequent branch

83 Open-source Workflow Evaluation - An evaluation of the Appendix B: Control-flow patterns Activiti BPM Platform definitions Mikael Nilsson 2012-06-29 when the first active incoming branch has been enabled. The discrimina- tor construct resets when all active incoming branches have been ena- bled once for the same process instance. Subsequent enablements of incoming branches are blocked until the discriminator has reset. [5]

Pattern 29 - Cancelling Discriminator The convergence of two or more branches into a single subsequent branch following one or more corresponding divergences earlier in the process model. The thread of control is passed to the subsequent branch when the first active incoming branch has been enabled. Triggering the discriminator also cancels the execution of all of the other incoming branches and resets the construct. [5]

Pattern 30 - Structured Partial Join The convergence of M branches into a single subsequent branch follow- ing a corresponding divergence earlier in the process model. The thread of control is passed to the subsequent branch when N of the incoming branches have been enabled. Subsequent enablements of incoming branches do not result in the thread of control being passed on. The join construct resets when all active incoming branches have been enabled. [5]

Pattern 31 - Blocking Partial Join The convergence of two or more branches into a single subsequent branch following one or more corresponding divergences earlier in the process model. The thread of control is passed to the subsequent branch when N of the incoming branches have been enabled. The join construct resets when all active incoming branches have been enabled once for the same process instance. Subsequent enablements of incoming branches are blocked until the join has reset. [5]

Pattern 32 - Cancelling Partial Join The convergence of two or more branches into a single subsequent branch following one or more corresponding divergences earlier in the process model. The thread of control is passed to the subsequent branch when N of the incoming branches have been enabled. Triggering the join also cancels the execution of all of the other incoming branches and resets the construct. [5]

84 Open-source Workflow Evaluation - An evaluation of the Appendix B: Control-flow patterns Activiti BPM Platform definitions Mikael Nilsson 2012-06-29

Pattern 33 - Generalized AND-Join The convergence of two or more branches into a single subsequent branch such that the thread of control is passed to the subsequent branch when all input branches have been enabled. Additional triggers received on one or more branches between firings of the join persist and are retained for future firings. [5]

Pattern 34 - Static Partial Join for Multiple Instances Within a given process instance, multiple concurrent instances of an activity can be created. The required number of instances is known when the first activity instance commences. Once N of the activity instances have completed, the next activity in the process is triggered. Subsequent completions of the remaining M-N instances are inconse- quential. [5]

Pattern 35 - Cancelling Partial Join for Multiple Instances Within a given process instance, multiple concurrent instances of an activity can be created. The required number of instances is known when the first activity instance commences. Once N of the activity instances have completed, the next activity in the process is triggered and the remaining M-N instances are cancelled. [5]

Pattern 36 - Dynamic Partial Join for Multiple Instances Within a given process instance, multiple concurrent instances of an activity can be created. The required number of instances may depend on a number of runtime factors, including state data, resource availabil- ity and inter-process communications and is not known until the final instance has completed. At any time, whilst instances are running, it is possible for additional instances to be initiated providing the ability to do so has not been disabled. A completion condition is specified which is evaluated each time an instance of the activity completes. Once the completion condition evaluates to true, the next activity in the process is triggered. Subsequent completions of the remaining activity instances are inconsequential and no new instances can be created. [5]

Pattern 37 - Acyclic Synchronizing Merge The convergence of two or more branches which diverged earlier in the process into a single subsequent branch. The thread of control is passed to the subsequent branch when each active incoming branch has been

85 Open-source Workflow Evaluation - An evaluation of the Appendix B: Control-flow patterns Activiti BPM Platform definitions Mikael Nilsson 2012-06-29 enabled. Determination of how many branches require synchronization is made on the basis of information locally available to the merge con- struct. This may be communicated directly to the merge by the preced- ing diverging construct or alternatively it can be determined on the basis of local data such as the threads of control arriving at the merge. [5]

Pattern 38 - General Synchronizing Merge The convergence of two or more branches which diverged earlier in the process into a single subsequent branch. The thread of control is passed to the subsequent branch when each active incoming branch has been enabled or it is not possible that the branch will be enabled at any future time. [5]

Pattern 39 - Critical Section Two or more connected subgraphs of a process model are identified as “critical sections”. At runtime for a given process instance, only activi- ties in one of these “critical sections” can be active at any given time. Once execution of the activities in one “critical section” commences, it must complete before another “critical section” can commence.

Pattern 40 - Interleaved Routing Each member of a set of activities must be executed once. They can be executed in any order but no two activities can be executed at the same time (i.e. no two activities can be active for the same process instance at the same time). Once all of the activities have completed, the next activi- ty in the process can be initiated. [5]

Pattern 41 - Thread Merge At a given point in a process, a nominated number of execution threads in a single branch of the same process instance should be merged to- gether into a single thread of execution. [5]

Pattern 42 - Thread Split At a given point in a process, a nominated number of execution threads can be initiated in a single branch of the same process instance. [5]

Pattern 43 - Explicit Termination A given process (or sub-process) instance should terminate when it reaches a nominated state. Typically this is denoted by a specific end

86 Open-source Workflow Evaluation - An evaluation of the Appendix B: Control-flow patterns Activiti BPM Platform definitions Mikael Nilsson 2012-06-29 node. When this end node is reached, any remaining work in the pro- cess instance is cancelled and the overall process instance is recorded as having completed successfully. [5]

87 Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform Appendix C: New Features Mikael Nilsson 2012-06-29

Appendix C: New Features Adding multiple company support 1. Changed class org.activiti.explorer.ui.login.ExplorerLoginForm 1. Added field companyCaption [String] 2. Added in constructor companyCaption = i18nManager.getMessage(Messages.LOGIN_COMPANY); 3. Changed getLoginHTML to include input field for company. 2. Changed class org.activiti.explorer.Messages 1. Added under //login static final String LOGIN_COMPANY = "login.company"; 3. Changed class messages.properties 1. Added under #login, login.company = Company 4. Changed class org.activiti.explorer.identity.LoggedInUser 1. Added method String getCompany(); 5. Changed class org.activiti.explorer.identity.LoggedInUserImpl 1. Added field protected String company; 2. Changed constructor to include company public LoggedInUserImpl(String company, User user, String password) 3. Added method String getCompany(); 6. Added class org.activiti.cloud.CloudProcessEngines (see added classes section) 7. Changed class org.activiti.explorer.ui.login.LoginHandler 1. Added parameter to method authenticate, LoggedInUser authenticate(String company, String userName, String password); 8. Changed class org.activiti.explorer.ui.login.DefaultLoginHandler 1. Deleted field private IdentityService identityService and setter; 2. Added parameter to method authenticate, public LoggedInUserImpl authenticate(String company, String userName, String password) 3. Added company check and retrieving the identityService for the given company using ProcessEngines for authentication. 9. Changed class org.activiti.explorer.ui.login.LoginPage 1. Deleted field identityService 2. Added in method ActivitiLoginListener.onLogin code for retrieving the company name

88 Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform Appendix C: New Features Mikael Nilsson 2012-06-29

3. Added company parameter to call to login handler, loginHandler.authenticate(company, userName, password); 4. Added setTheme to company name in method ActivitiLoginListener.onLogin 10. Changed class org.activiti.explorer.ui.profile.ChangePasswordPopupWindow 1. Deleted field identityService 2. Added in method handlePasswordChange IdentityService identityService = CloudProcessEngines.getIdentityService(); 3. Change authenticate in method handlePasswordChange to include company. 11. Changed class org.activiti.explorer.DefaultViewManager 1. Deleted field taskService 2. Deleted field historyService 3. Deleted field identityService 4. Added in method showTaskPage, TaskService taskService = CloudProcessEngines.getTaskService(); 5. Added in method showTaskPage, HistoryService historyService = CloudProcessEngines.getHistoryService(); 6. Added in method getGroupIds, IdentityService identityService = CloudProcessEngines.getIdentityService(); 12. Changed class org.activiti.explorer.navigation.TaskNavigator 1. Deleted field taskService 2. Deleted field historyService 3. Deleted field identityService 4. Added in method directToSpecificTaskPage 1. TaskService taskService = CloudProcessEngines.getTaskService(); 2. HistoryService historyService = CloudProcessEngines.getHistoryService(); 3. IdentityService identityService = CloudProcessEngines.getIdentityService(); 5. Added in getGroupIds IdentityService identityService = CloudProcessEngines.getIdentityService(); 13. Changed class org.activiti.explorer.ui.alfresco.ProcessInstanceTableLazyQuery 1. Deleted field runtimeService 2. Added in method constructQuery RuntimeService runtimeService = CloudProcessEngines.getRuntimeService();

89 Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform Appendix C: New Features Mikael Nilsson 2012-06-29

14. Changed class org.activiti.explorer.ui.content.CreateAttachmentPopupWindow 1. Deleted field taskService 15. Changed class org.activiti.explorer.ui.content.file.ImageAttachmentRenderer 1. Change in getDetailComponent ◦ TaskService taskService = ProcessEngines.getDefaultProcessEngine().getTaskService(); TaskService taskService = CloudProcessEngines.getTaskService(); ◦ taskService = ProcessEngines.getDefaultProcessEngine().getTaskService(); taskService = CloudProcessEngines.getTaskService(); 16. Changed class org.activiti.explorer.ui.content.url.UrlAttachmentEditorComponent 1. Deleted in constructor taskService = ProcessEngines.getDefaultProcessEngine().getTaskService(); 17. Changed class org.activiti.explorer.ui.custom.TaskListHeader 1. Deleted field taskService 2. Added in method initKeyboardListener TaskService taskService = CloudProcessEngines.getTaskService(); 18. Changed class org.activiti.explorer.ui.custom.UserProfileLink 1. Deleted field identityService 19. Changed class org.activiti.explorer.ui.form.FormPropertiesForm 1. Deleted field formService 20. Changed class org.activiti.explorer.ui.management.db.DatabaseDetailPanel 1. Deleted field managementService 2. Added in method addTableData, ManagementService managementService = CloudProcessEngines.getManagementService(); 21. Changed class org.activiti.explorer.ui.management.db.DatabasePage 1. Deleted field managementService 2. Added in method populateTableList, ManagementService managementService = CloudProcessEngines.getManagementService(); 22. Changed class org.activiti.explorer.ui.management.db.TableDataQuery 1. Deleted field managementService 23. Changed class org.activiti.explorer.ui.management.deployment.DeleteDeploymentPopup Window 1. Deleted field repositoryService

90 Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform Appendix C: New Features Mikael Nilsson 2012-06-29

2. Deleted field runtimeService 3. Added in method addDeleteWarning 1. RuntimeService runtimeService = CloudProcessEngines.getRuntimeService(); 2. RepositoryService repositoryService = CloudProcessEngines.getRepositoryService(); 4. Added in method addButtons, RepositoryService repositoryService = CloudProcessEngines.getRepositoryService(); 24. Changed class org.activiti.explorer.ui.management.deployment.DeploymentDetailPanel 1. Deleted field repositoryService 2. Added in methods constructor, addProcessDefinitionLinks, addResourceLinks 1. RepositoryService repositoryService = CloudProcessEngines.getRepositoryService(); 25. Changed class org.activiti.explorer.ui.management.deployment.DeploymentListQuery 1. Deleted field repositoryService 2. Added in methods loadItems, loadSingleResult, size 1. RepositoryService repositoryService = CloudProcessEngines.getRepositoryService(); 26. Changed class org.activiti.explorer.ui.management.deployment.DeploymentUploadReceive r 1. Deleted field repositoryService 2. Added in method deployUploadedFile, RepositoryService repositoryService = CloudProcessEngines.getRepositoryService(); 27. Changed class org.activiti.explorer.ui.management.identity.GroupDetailPanel 1. Deleted field identityService 2. Added in methods constructor, initSaveButton, initDeleteButton, initAddMembersButton 1. IdentityService identityService = CloudProcessEngines.getIdentityService(); 28. Changed class org.activiti.explorer.ui.management.identity.GroupListQuery 1. Deleted field identityService 2. Added in methods size, loadItems, loadSingleResult 1. IdentityService identityService =

91 Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform Appendix C: New Features Mikael Nilsson 2012-06-29

CloudProcessEngines.getIdentityService(); 29. Changed class org.activiti.explorer.ui.management.identity.GroupMembersQuery 1. Deleted field identityService 2. Added in methods size, loadItems, GroupMemberItem 1. IdentityService identityService = CloudProcessEngines.getIdentityService(); 30. Changed class org.activiti.explorer.ui.management.identity.NewGroupPopupWindow 1. Deleted field identityService 2. Added in methods initInputFields, createGroup 1. IdentityService identityService = CloudProcessEngines.getIdentityService(); 31. Changed class org.activiti.explorer.ui.management.identity.NewUserPopupWindow 1. Deleted field identityService 2. Added in methods initInputFields, createUser 1. IdentityService identityService = CloudProcessEngines.getIdentityService(); 32. Changed class org.activiti.explorer.ui.management.identity.UserDetailPanel 1. Deleted field identityService 2. Added in methods constructor, loadPicture, initSaveButton, initDeleteButton, initAddGroupsButton, initGroupsTable 1. IdentityService identityService = CloudProcessEngines.getIdentityService(); 33. Changed class org.activiti.explorer.ui.management.identity.UserListQuery 1. Deleted field identityService 2. Added in methods size, loadItems, loadSingleResult 1. IdentityService identityService = CloudProcessEngines.getIdentityService(); 34. Changed class org.activiti.explorer.ui.management.job.JobDetailPanel 1. Deleted field managementService 2. Added in methods constructor, addActions, addJobState 1. ManagementService managementService = CloudProcessEngines.getManagementService(); 35. Changed class org.activiti.explorer.ui.management.job.JobListQuery

92 Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform Appendix C: New Features Mikael Nilsson 2012-06-29

1. Deleted field repositoryService [ManagementService] 2. Added in methods size, loadItems, loadSingleResult 1. ManagementService managementService = CloudProcessEngines.getManagementService(); 36. Changed class org.activiti.explorer.ui.management.process.DeleteProcessInstanceClickList ener 1. Changed in method buttonClick ◦ RuntimeService runtimeService = ProcessEngines.getDefaultProcessEngine().getRuntimeService(); ◦ RuntimeService runtimeService = CloudProcessEngines.getRuntimeService(); 37. Changed class org.activiti.explorer.ui.management.process.ProcessInstanceDetailPanel 1. Deleted fields runtimeService, repositoryService, taskService, historyService, identityService 2. Added in method addProcessImage 1. RepositoryService repositoryService = CloudProcessEngines.getRepositoryService(); 2. RuntimeService runtimeService = CloudProcessEngines.getRuntimeService(); 3. Added in method addTasks, HistoryService historyService = CloudProcessEngines.getHistoryService(); 4. Added in method getTaskAssigneeComponent, IdentityService identityService = CloudProcessEngines.getIdentityService(); 5. Added in method addVariables, RuntimeService runtimeService = CloudProcessEngines.getRuntimeService(); 6. Added in method getProcessInstance, RuntimeService runtimeService = CloudProcessEngines.getRuntimeService(); 7. Added in method getHistoricProcessInstance, HistoryService historyService = CloudProcessEngines.getHistoryService(); 8. Added in method getProcessDefinition, RepositoryService repositoryService = CloudProcessEngines.getRepositoryService(); 38. Changed class org.activiti.explorer.ui.management.process.ProcessInstanceListQuery 1. Deleted fields runtimeService, repositoryService 2. Added in method constructQuery, RuntimeService runtimeService = CloudProcessEngines.getRuntimeService();

93 Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform Appendix C: New Features Mikael Nilsson 2012-06-29

3. Added in method getProcessDefinitionName, RepositoryService repositoryService = CloudProcessEngines.getRepositoryService(); 39. Changed class org.activiti.explorer.ui.process.MyProcessInstancesPage 1. Deleted fields historyService, repositoryService 2. Added in method createLazyLoadingQuery 1. RepositoryService repositoryService = CloudProcessEngines.getRepositoryService(); 2. HistoryService historyService = CloudProcessEngines.getHistoryService(); 40. Changed class org.activiti.explorer.ui.process.ProcessDefinitionDetailPanel 1. Deleted fields formService, repositoryService 2. Added in constructor RepositoryService repositoryService = CloudProcessEngines.getRepositoryService(); 3. Added in method showProcessStartForm FormService formService = CloudProcessEngines.getFormService(); 41. Changed class org.activiti.explorer.ui.process.ProcessDefinitionInfoComponent 1. Deleted field repositoryService 2. Added in initImage RepositoryService repositoryService = CloudProcessEngines.getRepositoryService(); 42. Changed class org.activiti.explorer.ui.process.ProcessDefinitionPage 1. Deleted field repositoryService 2. Added in method createList, RepositoryService repositoryService = CloudProcessEngines.getRepositoryService(); 43. Changed class org.activiti.explorer.ui.process.listener.StartProcessInstanceClickListener 1. Deleted fields runtimeService, taskService, formService 2. Added in method buttonClick 1. FormService formService = CloudProcessEngines.getFormService(); 2. RuntimeService runtimeService = CloudProcessEngines.getRuntimeService(); 3. TaskService taskService = CloudProcessEngines.getTaskService(); 44. Changed class org.activiti.explorer.ui.profile.ProfilePanel 1. Deleted field identityService 2. Added in methods loadProfileData, initChangePictureButton, initSaveProfileButton

94 Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform Appendix C: New Features Mikael Nilsson 2012-06-29

1. IdentityService identityService = CloudProcessEngines.getIdentityService(); 45. Changed class org.activiti.explorer.ui.task.ArchivedPage 1. Changed in method createDetailComponent  HistoryService historyService = ProcessEngines.getDefaultProcessEngine().getHistoryService();  HistoryService historyService = CloudProcessEngines.getHistoryService(); 46. Changed class org.activiti.explorer.ui.task.HistoricTaskDetailPanel 1. Deleted fields historyService, taskService 2. Added in methods initParentTaskLink, initSubTasks 1. HistoryService historyService = CloudProcessEngines.getHistoryService(); 3. Added in method initRelatedContent, TaskService taskService = CloudProcessEngines.getTaskService(); 47. Changed class org.activiti.explorer.ui.task.NewCasePopupWindow 1. Deleted field historyService, taskService 2. Added in method handleFormSubmit, TaskService taskService = CloudProcessEngines.getTaskService(); 48. Changed class org.activiti.explorer.ui.task.SubTaskComponent 1. Deleted fields taskService, historyService 2. Added in method initAddSubTaskPanelKeyboardActions, TaskService taskService = CloudProcessEngines.getTaskService(); 3. Added in methods initSubTasks, refreshSubTasks 1. HistoryService historyService = CloudProcessEngines.getHistoryService(); 49. Changed class org.activiti.explorer.ui.task.TaskDetailPanel 1. Deleted fields taskService, formService, repositoryService 2. Added in methods initHeader, initClaimButton, initDescription, initParentTaskLink, initTaskForm, canUserClaimTask 1. TaskService taskService = CloudProcessEngines.getTaskService(); 3. Added in method initProcessLink, RepositoryService repositoryService = CloudProcessEngines.getRepositoryService(); 4. Added in method initTaskForm, final FormService formService = CloudProcessEngines.getFormService(); 50. Changed class org.activiti.explorer.ui.task.TaskEventsPanel

95 Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform Appendix C: New Features Mikael Nilsson 2012-06-29

1. Deleted fields identityService, taskService 2. Added in methods addTaskEvents, addNewComment 1. TaskService taskService = CloudProcessEngines.getTaskService(); 3. Added in method addTaskEventPicture, IdentityService identityService = CloudProcessEngines.getIdentityService(); 51. Changed class org.activiti.explorer.ui.task.TaskInvolvedPeopleComponent 1. Deleted field taskService 2. Added in methods initAddPeopleButton, initInvolvedPeople, refreshPeopleGrid, refreshAssignee, refreshOwner 1. TaskService taskService = CloudProcessEngines.getTaskService(); 52. Changed class org.activiti.explorer.ui.task.TaskMenuBar 1. Deleted field identityService 2. Added in method initItems, IdentityService identityService = CloudProcessEngines.getIdentityService(); 53. Changed class org.activiti.explorer.ui.task.TaskPage 1. Deleted field taskService 2. Added in method createDetailComponent, TaskService taskService = CloudProcessEngines.getTaskService(); 54. Changed class org.activiti.explorer.ui.task.TaskRelatedContentComponent 1. Deleted field taskService 2. Added in methods refreshTaskAttachments, confirmed 1. TaskService taskService = CloudProcessEngines.getTaskService(); 55. Changed class org.activiti.explorer.ui.task.UserDetailsComponent 1. Deleted field identityService 2. Added in methods constructor, addUserPicture 1. IdentityService identityService = CloudProcessEngines.getIdentityService(); 56. Changed class org.activiti.explorer.ui.task.data.AbstractTaskListQuery 1. Deleted field taskService 57. Changed class org.activiti.explorer.ui.task.data.ArchivedListQuery 1. Deleted field historyService 2. Added in method createQuery, HistoryService historyService = CloudProcessEngines.getHistoryService(); 58. Changed class org.activiti.explorer.ui.task.data.InboxListQuery 1. Added in method getQuery, TaskService taskService =

96 Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform Appendix C: New Features Mikael Nilsson 2012-06-29

CloudProcessEngines.getTaskService(); 59. Changed class org.activiti.explorer.ui.task.data.InvolvedListQuery 1. Added in method getQuery, TaskService taskService = CloudProcessEngines.getTaskService(); 60. Changed class org.activiti.explorer.ui.task.data.QueuedListQuery 1. Deleted field taskService 2. Added in method getQuery, TaskService taskService = CloudProcessEngines.getTaskService(); 61. Changed class org.activiti.explorer.ui.task.data.TasksListQuery 1. Added in method getQuery, TaskService taskService = CloudProcessEngines.getTaskService(); 62. Changed class org.activiti.explorer.ui.task.listener.ChangeOwnershipListener 1. Change in method buttonClick 1. ProcessEngines.getDefaultProcessEngine().getTaskService().setOwner( task.getId(), selectedUser); 2. CloudProcessEngines.getTaskService().setOwner(task.getId(), selectedUser); 63. Changed class org.activiti.explorer.ui.task.listener.DeleteSubTaskClickListener 1. Change in method click  final TaskService taskService = ProcessEngines.getDefaultProcessEngine().getTaskService();  final TaskService taskService = CloudProcessEngines.getTaskService(); 64. Changed class org.activiti.explorer.ui.task.listener.ReassignAssigneeListener 1. Change in method buttonClick  ProcessEngines.getDefaultProcessEngine().getTaskService().setAssign ee(task.getId(), selectedUser);  CloudProcessEngines.getTaskService().setAssignee(task.getId(), selectedUser); 65. Changed class org.activiti.explorer.ui.task.listener.RemoveInvolvedPersonListener 1. Deleted fields taskService, identityService 2. Added in method buttonClick 1. IdentityService identityService = CloudProcessEngines.getIdentityService(); 2. TaskService taskService = CloudProcessEngines.getTaskService();

97 Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform Appendix C: New Features Mikael Nilsson 2012-06-29

66. Changed class org.activiti.explorer.form.UserFormType 1. Change in method convertFormValueToModelValue  long count = ProcessEngines.getDefaultProcessEngine().getIdentityService().create UserQuery().userId(propertyValue).count();  long count = CloudProcessEngines.getIdentityService().createUserQuery().userId(p ropertyValue).count(); 67. Changed class org.activiti.explorer.ui.content.GenericAttachmentRenderer 1. Change in method getDetailComponent 1. TaskService taskService = ProcessEngines.getDefaultProcessEngine().getTaskService(); 2. TaskService taskService = CloudProcessEngines.getTaskService(); 68. Changed class org.activiti.explorer.ui.content.email.EmailDetailPanel 1. Deleted field taskService 2. Added in constructor TaskService taskService = CloudProcessEngines.getTaskService(); 69. Changed class org.activiti.explorer.ui.content.file.FileAttachmentEditorComponent 1. Deleted field taskService 2. Added in method getAttachment, TaskService taskService = CloudProcessEngines.getTaskService(); 70. Changed package org.activiti.explorer.cache 1. Delete all clasdes except for UserCache 2. Add class NoUserCache (see added classes section) 71. Changed package org.activiti.explorer.demo 1. Delete all classes (DemoDataGenerator). 72. Changed xml file applicationContext.xml 1. Delete bean repositoryService 2. Delete bean runtimeService 3. Delete bean taskService 4. Delete bean historyService 5. Delete bean managementService 6. Delete bean identityService 7. Delete bean demoDataGenerator

98 Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform Appendix C: New Features Mikael Nilsson 2012-06-29

8. Delete bean dataSource 9. Delete bean transactionManager 10. Delete in activitiLoginHandler 11. Change bean processEngine  12. Change bean processEngineConfiguration to

73. Changed xml file activiti-ui-context.xml 1. Change bean userCache Textarea component 1. Added class org.activiti.explorer.form.TextAreaFormType (see added classes section) 2. Added class org.activiti.explorer.ui.form.TextAreaFormPropertyRenderer (see added classes section) 3. Changed xml applicationContext.xml  Added bean  Added in bean processEngineConfiguration under customFormTypes 4. Changed xml activiti-ui-context.xml

99 Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform Appendix C: New Features Mikael Nilsson 2012-06-29

 Added in bean formPropertyRendererManager under propertyRenderers Custom task forms 1. Added class org.activiti.explorer.ui.form.FormTemplateParser (see added classes section) 2. Changed class org.activiti.explorer.ui.form.FormPropertiesComponent 1. Added field processInstanceId [String] 2. Added field formkey [String] 3. Deleted field form [Form] 4. Changed type of field propertyComponents to protected Map; 5. Changed Constructor to public FormPropertiesComponent(String processInstanceId, String formkey) 6. Deleted method initForm 7. Deleted method setFormEnabled 8. Changed method setFormProperties to public void setFormProperties(List formProperties) { this.formProperties = formProperties;

removeAllComponents();

if (propertyComponents == null) { propertyComponents = new LinkedHashMap(); } else { propertyComponents.clear(); }

for (FormProperty formProperty : this.formProperties) { FormPropertyRenderer renderer = getRenderer(formProperty); propertyComponents.put(formProperty, renderer.getPropertyField(formProperty)); }

FormTemplateParser formParser = new FormTemplateParser(processInstanceId, formkey); VerticalLayout mainFormLayout = formParser .getFormLayout(propertyComponents); if (mainFormLayout != null) { addComponent(mainFormLayout); }

100 Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform Appendix C: New Features Mikael Nilsson 2012-06-29

}

9. Changed method getFormPropertyValues to public Map getFormPropertyValues() throws InvalidValueException {

for (FormProperty formProperty : propertyComponents.keySet()) { Field field = propertyComponents.get(formProperty); field.validate(); }

Map formPropertyValues = new HashMap();

for (FormProperty formProperty : propertyComponents.keySet()) { if (formProperty.isWritable()) { Field field = propertyComponents.get(formProperty); FormPropertyRenderer renderer = getRenderer(formProperty); String fieldValue = renderer.getFieldValue(formProperty, field); formPropertyValues.put(formProperty.getId(), fieldValue); } } return formPropertyValues; }

3. Changed class org.activiti.explorer.ui.form.FormPropertiesForm 1. Added field processInstanceId [String] 2. Added field formkey [String] 3. Changed Constructor to public FormPropertiesForm(String processInstanceId, String formkey) (set fields) 4. Changed method initFormPropertiesComponent  formPropertiesComponent = new FormPropertiesComponent();  formPropertiesComponent = new FormPropertiesComponent(processInstanceId, formkey); 5. Added in method initListeners (to catch block) 1. submitFormButton.setComponentError(new UserError(ive.getMessage()));

4. Changed class org.activiti.explorer.ui.process.ProcessDefinitionDetailPanel 1. Changed method showProcessStartForm  processDefinitionStartForm = new FormPropertiesForm();  processDefinitionStartForm = new FormPropertiesForm(null,

101 Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform Appendix C: New Features Mikael Nilsson 2012-06-29

startFormData.getFormKey());

5. Changed class org.activiti.explorer.ui.task.TaskDetailPanel 1. Changed method initTaskForm  taskForm = new FormPropertiesForm();  taskForm = new FormPropertiesForm(task.getProcessInstanceId(), formData.getFormKey());

6. Added in css styles.css table.divider { padding:0px; margin:0px; width:100%; }

td.startline { padding:1px; margin:0px; width:16px; }

td.caption { padding:1px; margin:0px; text-align:left; white-space:nowrap; width:1px; color:#3c3c3c; font:bold 12px Arial, Helvetica, sans-serif; }

td.endline { padding:1px; margin:0px; width:auto; } Activiti custom form dtd

102 Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform Appendix C: New Features Mikael Nilsson 2012-06-29

Added Classes org.activiti.cloud.CloudProcessEngines

package org.activiti.cloud; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.Statement; import java.util.ArrayList; import java.util.List; import org.activiti.cloud.admin.Company; import org.activiti.engine.FormService; import org.activiti.engine.HistoryService; import org.activiti.engine.IdentityService; import org.activiti.engine.ManagementService; import org.activiti.engine.ProcessEngine; import org.activiti.engine.ProcessEngineConfiguration; import org.activiti.engine.ProcessEngines; import org.activiti.engine.RepositoryService; import org.activiti.engine.RuntimeService; import org.activiti.engine.TaskService; import org.activiti.explorer.ExplorerApp; import org.activiti.spring.SpringProcessEngineConfiguration; import org.apache.commons.dbcp.BasicDataSource; import org.springframework.jdbc.datasource.DataSourceTransactionManager;

/** * @author Mikael Nilsson Handles all connections to Activiti Process Engines. * One Engine is started and registered per company. */ public class CloudProcessEngines {

103 Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform Appendix C: New Features Mikael Nilsson 2012-06-29

private static SpringProcessEngineConfiguration processEngineConfiguration;

public CloudProcessEngines() { }

public synchronized static void startProcessEngine(ProcessEngine processEngine) { ProcessEngines.registerProcessEngine(processEngine); }

public synchronized static boolean startProcessEngine(String company) { Connection connect = null; Statement statement = null; ResultSet resultSet = null;

String driverClassName = processEngineConfiguration.getJdbcDriver(); String url = processEngineConfiguration.getJdbcUrl(); String username = processEngineConfiguration.getJdbcUsername(); String password = processEngineConfiguration.getJdbcPassword();

try { Class.forName(driverClassName);

connect = DriverManager.getConnection(url + "user=" + username + "&password=" + password);

statement = connect.createStatement();

statement.executeUpdate("USE activiti_cloud");

resultSet = statement .executeQuery("SELECT * FROM `Company` WHERE `CompanyName` = '" + company + "'");

if (resultSet.next()) { BasicDataSource dataSource = new BasicDataSource(); dataSource.setDriverClassName(resultSet.getString("DriverClassName")); dataSource.setUrl(resultSet.getString("URL")); dataSource.setUsername(resultSet.getString("UserName")); dataSource.setPassword(resultSet.getString("Password")); dataSource.setDefaultAutoCommit(false);

DataSourceTransactionManager transactionManager = new DataSourceTransactionManager(); transactionManager.setDataSource(dataSource);

SpringProcessEngineConfiguration springProcessEngineConfiguration = new SpringProcessEngineConfiguration(); springProcessEngineConfiguration.setProcessEngineName(resultSet .getString("CompanyName"));

104 Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform Appendix C: New Features Mikael Nilsson 2012-06-29

springProcessEngineConfiguration.setDataSource(dataSource); springProcessEngineConfiguration .setTransactionManager(transactionManager); springProcessEngineConfiguration.setDatabaseSchemaUpdate("true"); springProcessEngineConfiguration.setJobExecutorActivate(true); springProcessEngineConfiguration .setCustomFormTypes(processEngineConfiguration.getCustomFormTypes()); springProcessEngineConfiguration .setHistory(ProcessEngineConfiguration.HISTORY_FULL);

springProcessEngineConfiguration.setMailServerHost(resultSet .getString("MailServerHost")); springProcessEngineConfiguration.setMailServerUsername(resultSet .getString("MailServerUserName")); springProcessEngineConfiguration.setMailServerPassword(resultSet .getString("MailServerPassword")); springProcessEngineConfiguration.setMailServerPort(resultSet .getInt("MailServerPort")); springProcessEngineConfiguration.setMailServerDefaultFrom(resultSet .getString("MailServerDefaultFrom")); springProcessEngineConfiguration.setMailServerUseTLS(resultSet .getBoolean("MailServerUseTLS"));

startProcessEngine(springProcessEngineConfiguration .buildProcessEngine()); return true; } } catch (Exception e) { e.printStackTrace(); } return false; }

public synchronized static void stopProcessEngine(String company) { ProcessEngines.unregister(org.activiti.engine.ProcessEngines .getProcessEngine(company)); }

public static synchronized ProcessEngine getProcessEngine() { String company = ExplorerApp.get().getLoggedInUser().getCompany(); return org.activiti.engine.ProcessEngines.getProcessEngine(company); }

public static synchronized RepositoryService getRepositoryService() { return getProcessEngine().getRepositoryService(); }

public static synchronized RuntimeService getRuntimeService() { return getProcessEngine().getRuntimeService();

105 Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform Appendix C: New Features Mikael Nilsson 2012-06-29

}

public static synchronized TaskService getTaskService() { return getProcessEngine().getTaskService(); }

public static synchronized HistoryService getHistoryService() { return getProcessEngine().getHistoryService(); }

public static synchronized ManagementService getManagementService() { return getProcessEngine().getManagementService(); }

public static synchronized IdentityService getIdentityService() { return getProcessEngine().getIdentityService(); }

public static synchronized FormService getFormService() { return getProcessEngine().getFormService(); }

public static SpringProcessEngineConfiguration getProcessEngineConfiguration() { return processEngineConfiguration; }

public void setProcessEngineConfiguration( SpringProcessEngineConfiguration processEngineConfiguration) { CloudProcessEngines.processEngineConfiguration = processEngineConfiguration; Connection connect = null; Statement statement = null; ResultSet resultSet = null;

String driverClassName = processEngineConfiguration.getJdbcDriver(); String url = processEngineConfiguration.getJdbcUrl(); String username = processEngineConfiguration.getJdbcUsername(); String password = processEngineConfiguration.getJdbcPassword();

try { Class.forName(driverClassName);

connect = DriverManager.getConnection(url + "user=" + username + "&password=" + password);

statement = connect.createStatement();

statement.executeUpdate("USE activiti_cloud");

resultSet = statement.executeQuery("SELECT * FROM Company");

106 Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform Appendix C: New Features Mikael Nilsson 2012-06-29

while (resultSet.next()) { BasicDataSource dataSource = new BasicDataSource(); dataSource.setDriverClassName(resultSet.getString("DriverClassName")); dataSource.setUrl(resultSet.getString("URL")); dataSource.setUsername(resultSet.getString("UserName")); dataSource.setPassword(resultSet.getString("Password")); dataSource.setDefaultAutoCommit(false);

DataSourceTransactionManager transactionManager = new DataSourceTransactionManager(); transactionManager.setDataSource(dataSource);

SpringProcessEngineConfiguration springProcessEngineConfiguration = new SpringProcessEngineConfiguration(); springProcessEngineConfiguration.setProcessEngineName(resultSet .getString("CompanyName")); springProcessEngineConfiguration.setDataSource(dataSource); springProcessEngineConfiguration .setTransactionManager(transactionManager); springProcessEngineConfiguration.setDatabaseSchemaUpdate("true"); springProcessEngineConfiguration.setJobExecutorActivate(true); springProcessEngineConfiguration .setCustomFormTypes(processEngineConfiguration.getCustomFormTypes()); springProcessEngineConfiguration .setHistory(ProcessEngineConfiguration.HISTORY_FULL);

springProcessEngineConfiguration.setMailServerHost(resultSet .getString("MailServerHost")); springProcessEngineConfiguration.setMailServerUsername(resultSet .getString("MailServerUserName")); springProcessEngineConfiguration.setMailServerPassword(resultSet .getString("MailServerPassword")); springProcessEngineConfiguration.setMailServerPort(resultSet .getInt("MailServerPort")); springProcessEngineConfiguration.setMailServerDefaultFrom(resultSet .getString("MailServerDefaultFrom")); springProcessEngineConfiguration.setMailServerUseTLS(resultSet .getBoolean("MailServerUseTLS"));

startProcessEngine(springProcessEngineConfiguration .buildProcessEngine()); } } catch (Exception e) { e.printStackTrace(); } }

public synchronized static List getCompanies() { List returList = new ArrayList();

107 Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform Appendix C: New Features Mikael Nilsson 2012-06-29

Connection connect = null; Statement statement = null; ResultSet resultSet = null;

String driverClassName = processEngineConfiguration.getJdbcDriver(); String url = processEngineConfiguration.getJdbcUrl(); String username = processEngineConfiguration.getJdbcUsername(); String password = processEngineConfiguration.getJdbcPassword();

try { Class.forName(driverClassName);

connect = DriverManager.getConnection(url + "user=" + username + "&password=" + password);

statement = connect.createStatement();

statement.executeUpdate("USE activiti_cloud");

resultSet = statement.executeQuery("SELECT * FROM Company"); while (resultSet.next()) { String companyName = resultSet.getString("CompanyName"); boolean active = (org.activiti.engine.ProcessEngines .getProcessEngine(companyName) != null); returList.add(new Company(companyName, active)); } } catch (Exception e) { e.printStackTrace(); } return returList; }

public void destroy() { ProcessEngines.destroy(); } } org.activiti.explorer.cache.NoUserCache package org.activiti.explorer.cache; import java.util.ArrayList; import java.util.List; import org.activiti.cloud.CloudProcessEngines; import org.activiti.engine.IdentityService; import org.activiti.engine.identity.User;

108 Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform Appendix C: New Features Mikael Nilsson 2012-06-29

/** * * @author Mikael Nilsson Simple UserCache implementation that reads the users * from database instead of caching them */ public class NoUserCache implements UserCache {

public List findMatchingUsers(String prefix) { List usersReturn = new ArrayList(); IdentityService identityService = CloudProcessEngines.getIdentityService(); List users = identityService.createUserQuery().list(); for (User user : users) { if (user.getId().toLowerCase().startsWith(prefix.toLowerCase()) || prefix.equals("")) { usersReturn.add(user); } } return usersReturn; }

public User findUser(String userId) { IdentityService identityService = CloudProcessEngines.getIdentityService(); return identityService.createUserQuery().userId(userId).singleResult(); }

public void notifyUserDataChanged(String userId) { }

} org.activiti.explorer.form.TextAreaFormType package org.activiti.explorer.form; import org.activiti.engine.impl.form.AbstractFormType;

/** * Form type for a textarea component. * @author Mikael Nilsson */ public class TextAreaFormType extends AbstractFormType {

public static final String TYPE_NAME = "textarea";

public TextAreaFormType() {}

public String getName() { return TYPE_NAME;

109 Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform Appendix C: New Features Mikael Nilsson 2012-06-29

}

public String getMimeType() { return "text/plain"; }

public Object convertFormValueToModelValue(String propertyValue) { return propertyValue; }

public String convertModelValueToFormValue(Object modelValue) { return (String) modelValue; } } org.activiti.explorer.ui.form.TextAreaFormPropertyRenderer

package org.activiti.explorer.ui.form; import org.activiti.engine.form.FormProperty; import org.activiti.explorer.Messages; import org.activiti.explorer.form.TextAreaFormType; import com.vaadin.ui.Field; import com.vaadin.ui.TextArea;

/** * @author Mikael Nilsson */ public class TextAreaFormPropertyRenderer extends AbstractFormPropertyRenderer {

public TextAreaFormPropertyRenderer() { super(TextAreaFormType.class); }

@Override public Field getPropertyField(FormProperty formProperty) { TextArea textArea = new TextArea(getPropertyLabel(formProperty)); textArea.setRequired(formProperty.isRequired()); textArea.setEnabled(formProperty.isWritable()); textArea.setRequiredError(getMessage(Messages.FORM_FIELD_REQUIRED, getPropertyLabel(formProperty)));

if (formProperty.getValue() != null) { textArea.setValue(formProperty.getValue()); }

return textArea; }

110 Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform Appendix C: New Features Mikael Nilsson 2012-06-29

} org.activiti.explorer.ui.form.FormTemplateParser

package org.activiti.explorer.ui.form; import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; import java.util.List; import java.util.Map; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import org.activiti.cloud.CloudProcessEngines; import org.activiti.engine.form.FormProperty; import org.activiti.engine.repository.ProcessDefinition; import org.activiti.engine.runtime.ProcessInstance; import org.w3c.dom.Document; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import com.vaadin.ui.AbstractOrderedLayout; import com.vaadin.ui.Alignment; import com.vaadin.ui.Component; import com.vaadin.ui.Field; import com.vaadin.ui.FormLayout; import com.vaadin.ui.HorizontalLayout; import com.vaadin.ui.Label; import com.vaadin.ui.Panel; import com.vaadin.ui.VerticalLayout;

/** * * @author Mikael Nilsson * Creates a VerticalLayout with components from the process descriptor (Map). * The order and placement of the components are read from the form file * (specified in the formkey field of the task). * In the case that the form file does not exits all components are arranged * in a column. */ public class FormTemplateParser { private String formKey; private Document formXML = null; private List formProperties; private String processInstanceId = null;

111 Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform Appendix C: New Features Mikael Nilsson 2012-06-29

/** * @param formKey is the name of the file that holds the xml form template. */ public FormTemplateParser(String processInstanceId, String formKey) { this.processInstanceId = processInstanceId; this.formKey = formKey; parseXML(); }

/** * Parses the form xml and creates a Document. */ private void parseXML() { if (formKey != null && !formKey.equals("")) { InputStream is = null; try { // For Activiti Explorer replace CloudProcessEngines with // ProcessEngines.getDefaultProcessEngine() ProcessInstance processInstance = CloudProcessEngines .getRuntimeService().createProcessInstanceQuery() .processInstanceId(processInstanceId).singleResult(); ProcessDefinition processDefinition = CloudProcessEngines .getRepositoryService().createProcessDefinitionQuery() .processDefinitionId(processInstance.getProcessDefinitionId()) .singleResult(); is = CloudProcessEngines.getRepositoryService().getResourceAsStream( processDefinition.getDeploymentId(), formKey); } catch (Exception e) { } // form key not found in deployment (bar, zip)

try { // turn of dtd validation DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setValidating(false); dbf.setFeature("http://xml.org/sax/features/namespaces", false); dbf.setFeature("http://xml.org/sax/features/validation", false); dbf.setFeature( "http://apache.org/xml/features/nonvalidating/load-dtd-grammar", false); dbf.setFeature( "http://apache.org/xml/features/nonvalidating/load-external-dtd", false); DocumentBuilder db = dbf.newDocumentBuilder();

formXML = db.parse(is); } catch (Exception e) { formXML = null; } finally {

112 Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform Appendix C: New Features Mikael Nilsson 2012-06-29

try { is.close(); } catch (IOException e) { } } } }

/** * * @param propertyComponents Map file containing all id's and fields. * @return a VerticalLayout containing all the components */ public VerticalLayout getFormLayout( Map propertyComponents) { this.formProperties = new ArrayList( propertyComponents.keySet()); VerticalLayout mainLayout = new VerticalLayout(); mainLayout.setMargin(true, false, true, false);

if (formXML != null) { NodeList forms = formXML.getElementsByTagName("form"); for (int j = 0; j < forms.getLength(); j++) { Node form = forms.item(j); NodeList blocks = form.getChildNodes(); for (int i = 0; i < blocks.getLength(); i++) { Node block = blocks.item(i); if (block.getNodeName().equals("block")) { Component componentBlock = getBlock(block, propertyComponents); if (componentBlock != null) { mainLayout.addComponent(componentBlock); } } else if (block.getNodeName().equals("row")) { Component componentRow = getRow(block, propertyComponents); if (componentRow != null) { mainLayout.addComponent(componentRow); } } else if (block.getNodeName().equals("field")) { Component fieldComponent = getField(block, propertyComponents); if (fieldComponent != null) { mainLayout.addComponent(fieldComponent); } } else if (block.getNodeName().equals("column")) { Component columnComponent = getColumn(block, propertyComponents); if (columnComponent != null) { mainLayout.addComponent(columnComponent); } } else if (block.getNodeName().equals("divider")) { mainLayout.addComponent(getDividerLabel(block.getTextContent()));

113 Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform Appendix C: New Features Mikael Nilsson 2012-06-29

} else if (block.getNodeName().equals("a")) { mainLayout.addComponent(htmlLink(block)); } else if (block.getNodeName().equals("br")) { mainLayout.addComponent(getBr()); } else if (block.getNodeName().equals("img")) { mainLayout.addComponent(new Label(imageLink(block), Label.CONTENT_XHTML)); } } }

AbstractOrderedLayout otherComponents = getOtherComponents( propertyComponents, mainLayout.getComponentCount() == 0); if (otherComponents.getComponentCount() > 0) { mainLayout.addComponent(otherComponents); }

return mainLayout; }

AbstractOrderedLayout otherComponents = getOtherComponents( propertyComponents, true); if (otherComponents.getComponentCount() > 0) { mainLayout.addComponent(otherComponents); return mainLayout; }

return null; }

/** * * @param propertyComponents Map file containing all id's and fields. * @param useFormLayout if true from layout is used instead of vertical layout * @return vertical or form layout with unused components */ private AbstractOrderedLayout getOtherComponents( Map propertyComponents, boolean useFormLayout) { AbstractOrderedLayout componentsLayout = null; if (useFormLayout) { componentsLayout = new FormLayout(); componentsLayout.setSizeFull(); for (FormProperty formProperty : this.formProperties) { Field field = propertyComponents.get(formProperty); field.setWidth("100%"); componentsLayout.addComponent(field); } } else { componentsLayout = new VerticalLayout();

114 Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform Appendix C: New Features Mikael Nilsson 2012-06-29

componentsLayout.setWidth("100%"); for (FormProperty formProperty : this.formProperties) { Field field = propertyComponents.get(formProperty); field.setWidth("100%"); componentsLayout.addComponent(field); } } return componentsLayout; }

/** * * @param block xml node describing the block * @param propertyComponents Map file containing all id's and fields. * @return a vertical layout with a block of field, rows or columns. */ private Component getBlock(Node block, Map propertyComponents) { int dividerCounter = 0; VerticalLayout layout = new VerticalLayout(); NamedNodeMap blockAttributes = block.getAttributes(); if (blockAttributes.getNamedItem("type").getNodeValue().equals("divider")) { Node caption = blockAttributes.getNamedItem("caption"); if (caption != null) { layout.addComponent(getDividerLabel(caption.getNodeValue())); } else { layout.addComponent(getDividerLabel("")); } dividerCounter++; }

NodeList rows = block.getChildNodes(); for (int i = 0; i < rows.getLength(); i++) { Node row = rows.item(i); if (row.getNodeName().equals("row")) { Component componentRow = getRow(row, propertyComponents); if (componentRow != null) { layout.addComponent(componentRow); } } else if (row.getNodeName().equals("field")) { Component fieldComponent = getField(row, propertyComponents); if (fieldComponent != null) { layout.addComponent(fieldComponent); } } else if (row.getNodeName().equals("column")) { Component columnComponent = getColumn(row, propertyComponents); if (columnComponent != null) { layout.addComponent(columnComponent); }

115 Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform Appendix C: New Features Mikael Nilsson 2012-06-29

} else if (row.getNodeName().equals("divider")) { Label divider = getDividerLabel(row.getTextContent()); VerticalLayout vl = new VerticalLayout(); vl.addComponent(divider); vl.setMargin(true, true, false, true); layout.addComponent(vl); dividerCounter++; } else if (row.getNodeName().equals("a")) { Component link = htmlLink(row); VerticalLayout vl = new VerticalLayout(); vl.addComponent(link); vl.setMargin(true, true, false, true); layout.addComponent(vl); dividerCounter++; } else if (row.getNodeName().equals("br")) { layout.addComponent(getBr()); dividerCounter++; } else if (row.getNodeName().equals("img")) { layout.addComponent(new Label(imageLink(row), Label.CONTENT_XHTML)); dividerCounter++; }

}

if (layout.getComponentCount() > dividerCounter) { if (blockAttributes.getNamedItem("type").getNodeValue().equals("panel")) { VerticalLayout vl = new VerticalLayout(); Panel panel = new Panel(); layout.setMargin(true, false, true, false); panel.setContent(layout); Node caption = blockAttributes.getNamedItem("caption"); if (caption != null) { panel.setCaption(caption.getNodeValue()); } Node style = blockAttributes.getNamedItem("style"); if (style != null) { panel.addStyleName(style.getNodeValue()); } vl.addComponent(panel); return vl; } return layout; } return null; }

/** * * @param row xml node describing the row

116 Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform Appendix C: New Features Mikael Nilsson 2012-06-29

* @param propertyComponents Map file containing all id's and fields. * @return Column of fields in a horizontal layout */ private HorizontalLayout getColumn(Node row, Map propertyComponents) { int dividerCounter = 0; FormLayout formLayout = new FormLayout();

NodeList fields = row.getChildNodes(); for (int i = 0; i < fields.getLength(); i++) { Node field = fields.item(i); if (field.getNodeName().equals("field")) { HorizontalLayout fieldComponent = getField(field, propertyComponents); if (fieldComponent != null) { formLayout.addComponent(fieldComponent.getComponent(0)); } } else if (field.getNodeName().equals("a")) { formLayout.addComponent(htmlLink(field)); } else if (field.getNodeName().equals("divider")) { formLayout.addComponent(getDividerLabel(field.getTextContent())); dividerCounter++; } else if (field.getNodeName().equals("divider")) { formLayout.addComponent(getBr()); dividerCounter++; } else if (field.getNodeName().equals("img")) { formLayout .addComponent(new Label(imageLink(field), Label.CONTENT_XHTML)); dividerCounter++; } } if (formLayout.getComponentCount() > dividerCounter) { HorizontalLayout outerLayout = new HorizontalLayout(); outerLayout.setWidth("100%"); outerLayout.setMargin(false, true, false, true); outerLayout.addComponent(formLayout); return outerLayout; } return null; }

/** * * @param row xml node describing the row * @param propertyComponents * Map file containing all id's and fields. * @return VAADIN horizontal layout with a row of fields */ private HorizontalLayout getRow(Node row, Map propertyComponents) {

117 Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform Appendix C: New Features Mikael Nilsson 2012-06-29

int spaces = 0; HorizontalLayout rowLayout = new HorizontalLayout(); NamedNodeMap rowAttributes = row.getAttributes(); Node expand = rowAttributes.getNamedItem("expand"); if (expand == null || expand.getNodeValue().equals("true")) { rowLayout.setSizeFull(); } NodeList fields = row.getChildNodes(); for (int i = 0; i < fields.getLength(); i++) { Node field = fields.item(i); if (field.getNodeName().equals("field")) { Component fieldComponent = getField(field, propertyComponents); if (fieldComponent != null) { rowLayout.addComponent(fieldComponent); rowLayout .setComponentAlignment(fieldComponent, Alignment.BOTTOM_LEFT); } } else if (field.getNodeName().equals("a")) { Component link = htmlLink(field); rowLayout.addComponent(link); rowLayout.setComponentAlignment(link, Alignment.BOTTOM_LEFT); } else if (field.getNodeName().equals("space")) { rowLayout.addComponent(getSpace()); spaces++; } else if (field.getNodeName().equals("img")) { rowLayout .addComponent(new Label(imageLink(field), Label.CONTENT_XHTML)); } } if (rowLayout.getComponentCount() > spaces) { return rowLayout; } return null; }

/** * * @param field xml node describing the field * @param propertyComponents * Map file containing all id's and fields. * @return VAADIN field inside a horizontal layout */ private HorizontalLayout getField(Node field, Map propertyComponents) { NamedNodeMap fieldAttributes = field.getAttributes(); String id = fieldAttributes.getNamedItem("id").getNodeValue(); Node description = fieldAttributes.getNamedItem("description"); Field componentField = getFieldComponent(propertyComponents, id);

118 Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform Appendix C: New Features Mikael Nilsson 2012-06-29

if (componentField != null) { HorizontalLayout componentLayout = new HorizontalLayout(); componentLayout.setSizeFull(); componentLayout.setMargin(false, true, false, true); if (description != null && !description.getNodeValue().equals("")) { componentField.setDescription(description.getNodeValue()); } componentField.setWidth("100%"); componentLayout.addComponent(componentField); return componentLayout; } return null; }

/** * * @param caption label in the divider line * @return VAADIN Label with the divider */ private Label getDividerLabel(String caption) { if (caption != null && !caption.equals("")) { StringBuffer sb = new StringBuffer(); sb.append("

"); sb.append(""); sb.append(""); sb.append(""); sb.append(""); sb.append(""); sb.append("

" + caption + "
"); return new Label(sb.toString(), Label.CONTENT_XHTML); } return new Label("
", Label.CONTENT_XHTML);

}

private Label getSpace() { return new Label(" ", Label.CONTENT_XHTML); }

private Label getBr() { return new Label("
", Label.CONTENT_XHTML); }

/** * * @param propertyComponents Map file containing all id's and fields. * @param name id of the field to be returned * @return VAADIN Field */

119 Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform Appendix C: New Features Mikael Nilsson 2012-06-29

private Field getFieldComponent(Map propertyComponents, String name) { for (FormProperty formProperty : propertyComponents.keySet()) { if (formProperty.getId().equals(name)) { formProperties.remove(formProperty); return propertyComponents.get(formProperty); } } return null; }

/** * * @param a xml node describing the link * @return VAADIN component describing a html link */ private Component htmlLink(Node a) { VerticalLayout vl = new VerticalLayout();

NodeList images = a.getChildNodes(); NamedNodeMap linkAttributes = a.getAttributes(); Node staticLink = linkAttributes.getNamedItem("href"); Node varLink = linkAttributes.getNamedItem("var"); String link = null;

if (staticLink != null) { link = staticLink.getNodeValue(); } else if (processInstanceId != null && varLink != null) { String linkVar = varLink.getNodeValue(); if (linkVar != null) { Object varValue = CloudProcessEngines.getRuntimeService().getVariable( processInstanceId, varLink.getNodeValue()); if (varValue != null) { link = varValue.toString(); } } }

String tagContent = a.getTextContent(); for (int i = 0; i < images.getLength(); i++) { Node image = images.item(i); if (image.getNodeName().endsWith("img")) { tagContent = imageLink(image); break; } } vl.addComponent(new Label("" + tagContent + "", Label.CONTENT_XHTML)); return vl;

120 Open-source Workflow Evaluation - An evaluation of the Activiti BPM Platform Appendix C: New Features Mikael Nilsson 2012-06-29

}

/** * * @param img xml node describing a html image tag * @return html image tag */ private String imageLink(Node img) { NamedNodeMap imageAttributes = img.getAttributes(); String src = imageAttributes.getNamedItem("src").getNodeValue(); Node alt = imageAttributes.getNamedItem("alt"); Node height = imageAttributes.getNamedItem("height"); Node width = imageAttributes.getNamedItem("width"); StringBuffer contentBuffer = new StringBuffer(""); return contentBuffer.toString(); } }

121 Open-source Workflow Evaluation - An evaluation of the Appendix D: Improvements and Activiti BPM Platform bug fixes Mikael Nilsson 2012-06-29

Appendix D: Improvements and bug fixes Date Field component improvement 74. Changed class org.activiti.explorer.ui.form.DateFormPropertyRenderer 1. Added to method getPropertyField  dateField.setResolution(getResolution(datePattern)); 2. Added method getResolution private int getResolution(String datePattern) { if(datePattern.contains("S")) { return PopupDateField.RESOLUTION_MSEC; } else if(datePattern.contains("s")) { return PopupDateField.RESOLUTION_SEC; } else if(datePattern.contains("m")) { return PopupDateField.RESOLUTION_MIN; } else if(datePattern.contains("h")) { return PopupDateField.RESOLUTION_HOUR; } else if(datePattern.contains("d")) { return PopupDateField.RESOLUTION_DAY; } else if(datePattern.contains("M")) { return PopupDateField.RESOLUTION_MONTH; } else if(datePattern.contains("y")) { return PopupDateField.RESOLUTION_YEAR; } return PopupDateField.RESOLUTION_MIN; } Enum component improvement  Changed class org.activiti.explorer.ui.form.EnumFormPropertyRenderer

◦ Added in method getPropertyField if(formProperty.isRequired()) { comboBox.setNullSelectionAllowed(false); }

Change Panel order on user task page  Changed class org.activiti.explorer.ui.task.TaskDetailPanel ◦ Changed execution order in method init to initHeader(); initDescriptionAndClaimButton(); initProcessLink();

122 Open-source Workflow Evaluation - An evaluation of the Appendix D: Improvements and Activiti BPM Platform bug fixes Mikael Nilsson 2012-06-29

initTaskForm(); initRelatedContent(); initParentTaskLink(); initPeopleDetails(); initSubTasks(); Auto Update GUI on task complete 3. Changed class org.activiti.explorer.ui.form.FormPropertiesForm 1. Added in method initListeners  ExplorerApp.get().getViewManager().showInboxPage(); Large Screen support  Changed css styles.css ◦ Deleted line in body segment max-width:1920px; Increase Visibility of disabled fields  Changed css styles.css

◦ Adding section .v-app .v-textfield.v-disabled, .v-app .v-caption.v-disabled, .v-app .v-textarea.v-disabled, .v-app .v-checkbox.v-disabled { color:black; opacity:0.5; } Boolean Component bug  Changed class org.activiti.explorer.ui.form.BooleanFormPropertyRenderer ◦ Changed method getPropertyField 5. checkBox.setValue(formProperty.getValue()); 6. checkBox.setValue(Boolean.valueOf(formProperty.getValue()));

123 Open-source Workflow Evaluation - An evaluation of the Appendix E: XML implementation Activiti BPM Platform of the supported patterns Mikael Nilsson 2012-06-29

Appendix E: XML implementation of the supported patterns Pattern 1 – Sequence Implementation of Pattern 1 Sequence

124 Open-source Workflow Evaluation - An evaluation of the Appendix E: XML implementation Activiti BPM Platform of the supported patterns Mikael Nilsson 2012-06-29

Pattern 2 – Parallel split Implementation of Pattern 2 Parallel Split

125 Open-source Workflow Evaluation - An evaluation of the Appendix E: XML implementation Activiti BPM Platform of the supported patterns Mikael Nilsson 2012-06-29

126 Open-source Workflow Evaluation - An evaluation of the Appendix E: XML implementation Activiti BPM Platform of the supported patterns Mikael Nilsson 2012-06-29

Pattern 3 – Synchronization Implementation of Pattern 3 Synchronization

127 Open-source Workflow Evaluation - An evaluation of the Appendix E: XML implementation Activiti BPM Platform of the supported patterns Mikael Nilsson 2012-06-29

128 Open-source Workflow Evaluation - An evaluation of the Appendix E: XML implementation Activiti BPM Platform of the supported patterns Mikael Nilsson 2012-06-29

Pattern 4 - Exclusive Choice Implementation of Pattern 4 Exclusive Choice

129 Open-source Workflow Evaluation - An evaluation of the Appendix E: XML implementation Activiti BPM Platform of the supported patterns Mikael Nilsson 2012-06-29

130 Open-source Workflow Evaluation - An evaluation of the Appendix E: XML implementation Activiti BPM Platform of the supported patterns Mikael Nilsson 2012-06-29

Pattern 5 - Simple Merge Implementation of Pattern 5 Simple Merge

131 Open-source Workflow Evaluation - An evaluation of the Appendix E: XML implementation Activiti BPM Platform of the supported patterns Mikael Nilsson 2012-06-29

132 Open-source Workflow Evaluation - An evaluation of the Appendix E: XML implementation Activiti BPM Platform of the supported patterns Mikael Nilsson 2012-06-29

Pattern 6 - Multi-Choice Implementation of Pattern 6 Multi Choice

133 Open-source Workflow Evaluation - An evaluation of the Appendix E: XML implementation Activiti BPM Platform of the supported patterns Mikael Nilsson 2012-06-29

134 Open-source Workflow Evaluation - An evaluation of the Appendix E: XML implementation Activiti BPM Platform of the supported patterns Mikael Nilsson 2012-06-29

Pattern 7 - Structured Synchronizing Merge Implementation of Pattern 7 Structured Synchronizing Merge

135 Open-source Workflow Evaluation - An evaluation of the Appendix E: XML implementation Activiti BPM Platform of the supported patterns Mikael Nilsson 2012-06-29

136 Open-source Workflow Evaluation - An evaluation of the Appendix E: XML implementation Activiti BPM Platform of the supported patterns Mikael Nilsson 2012-06-29

137 Open-source Workflow Evaluation - An evaluation of the Appendix E: XML implementation Activiti BPM Platform of the supported patterns Mikael Nilsson 2012-06-29

Pattern 8 - Multi-Merge Implementation of Pattern 8 Multi Merge

138 Open-source Workflow Evaluation - An evaluation of the Appendix E: XML implementation Activiti BPM Platform of the supported patterns Mikael Nilsson 2012-06-29

139 Open-source Workflow Evaluation - An evaluation of the Appendix E: XML implementation Activiti BPM Platform of the supported patterns Mikael Nilsson 2012-06-29

Pattern 10 – Arbitrary Cycles Implementation of Pattern 10 Arbitrary Cycles

140 Open-source Workflow Evaluation - An evaluation of the Appendix E: XML implementation Activiti BPM Platform of the supported patterns Mikael Nilsson 2012-06-29

141 Open-source Workflow Evaluation - An evaluation of the Appendix E: XML implementation Activiti BPM Platform of the supported patterns Mikael Nilsson 2012-06-29

142 Open-source Workflow Evaluation - An evaluation of the Appendix E: XML implementation Activiti BPM Platform of the supported patterns Mikael Nilsson 2012-06-29

143 Open-source Workflow Evaluation - An evaluation of the Appendix E: XML implementation Activiti BPM Platform of the supported patterns Mikael Nilsson 2012-06-29

Pattern 11 - Implicit Termination Implementation of Pattern 11 Implicit Termination

144 Open-source Workflow Evaluation - An evaluation of the Appendix E: XML implementation Activiti BPM Platform of the supported patterns Mikael Nilsson 2012-06-29

145 Open-source Workflow Evaluation - An evaluation of the Appendix E: XML implementation Activiti BPM Platform of the supported patterns Mikael Nilsson 2012-06-29

Pattern 12 - Multiple Instances without Synchronization

146 Open-source Workflow Evaluation - An evaluation of the Appendix E: XML implementation Activiti BPM Platform of the supported patterns Mikael Nilsson 2012-06-29 xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" typeLan- guage="http://www.w3.org/2001/XMLSchema" expressionLan- guage="http://www.w3.org/1999/XPath" target- Namespace="http://www.activiti.org/patterns"> Implementation of Pattern 12 Multiple Instances without Synchronization 3

147 Open-source Workflow Evaluation - An evaluation of the Appendix E: XML implementation Activiti BPM Platform of the supported patterns Mikael Nilsson 2012-06-29

Pattern 13 - Multiple Instances with a priori Design-Time Knowledge Implementation of Pattern 13 Multiple Instances with a priori Design-Time Knowledge 3 ${nrOfActiveInstances == 0}

148 Open-source Workflow Evaluation - An evaluation of the Appendix E: XML implementation Activiti BPM Platform of the supported patterns Mikael Nilsson 2012-06-29

Pattern 14 - Multiple Instances with a priori Run-Time Knowledge

149 Open-source Workflow Evaluation - An evaluation of the Appendix E: XML implementation Activiti BPM Platform of the supported patterns Mikael Nilsson 2012-06-29

Implementation of Pattern 14 Multiple Instances with a priori Run-Time Knowledge ${instances}

150 Open-source Workflow Evaluation - An evaluation of the Appendix E: XML implementation Activiti BPM Platform of the supported patterns Mikael Nilsson 2012-06-29

Pattern 16 - Deferred Choice Implementation of Pattern 16 Deferred Choice

151 Open-source Workflow Evaluation - An evaluation of the Appendix E: XML implementation Activiti BPM Platform of the supported patterns Mikael Nilsson 2012-06-29

PT30S

152 Open-source Workflow Evaluation - An evaluation of the Appendix E: XML implementation Activiti BPM Platform of the supported patterns Mikael Nilsson 2012-06-29

153 Open-source Workflow Evaluation - An evaluation of the Appendix E: XML implementation Activiti BPM Platform of the supported patterns Mikael Nilsson 2012-06-29

Pattern 19 - Cancel Activity Implementation of Pattern 19 Cancel Task

154 Open-source Workflow Evaluation - An evaluation of the Appendix E: XML implementation Activiti BPM Platform of the supported patterns Mikael Nilsson 2012-06-29

155 Open-source Workflow Evaluation - An evaluation of the Appendix E: XML implementation Activiti BPM Platform of the supported patterns Mikael Nilsson 2012-06-29

156 Open-source Workflow Evaluation - An evaluation of the Appendix E: XML implementation Activiti BPM Platform of the supported patterns Mikael Nilsson 2012-06-29

157 Open-source Workflow Evaluation - An evaluation of the Appendix E: XML implementation Activiti BPM Platform of the supported patterns Mikael Nilsson 2012-06-29

Pattern 20 - Cancel Case Implementation of Pattern 20 Cancel Case.

158 Open-source Workflow Evaluation - An evaluation of the Appendix E: XML implementation Activiti BPM Platform of the supported patterns Mikael Nilsson 2012-06-29

159 Open-source Workflow Evaluation - An evaluation of the Appendix E: XML implementation Activiti BPM Platform of the supported patterns Mikael Nilsson 2012-06-29

160 Open-source Workflow Evaluation - An evaluation of the Appendix E: XML implementation Activiti BPM Platform of the supported patterns Mikael Nilsson 2012-06-29

161 Open-source Workflow Evaluation - An evaluation of the Appendix E: XML implementation Activiti BPM Platform of the supported patterns Mikael Nilsson 2012-06-29

Pattern 21 - Structured Loop (post-test) Implementation of Pattern 21 Structured Loop

162 Open-source Workflow Evaluation - An evaluation of the Appendix E: XML implementation Activiti BPM Platform of the supported patterns Mikael Nilsson 2012-06-29

163 Open-source Workflow Evaluation - An evaluation of the Appendix E: XML implementation Activiti BPM Platform of the supported patterns Mikael Nilsson 2012-06-29

Pattern 21 - Structured Loop (pre-test) Implementation of Pattern 21 Structured Loop 2

164 Open-source Workflow Evaluation - An evaluation of the Appendix E: XML implementation Activiti BPM Platform of the supported patterns Mikael Nilsson 2012-06-29

165 Open-source Workflow Evaluation - An evaluation of the Appendix E: XML implementation Activiti BPM Platform of the supported patterns Mikael Nilsson 2012-06-29

Pattern 25 - Cancel Region Implementation of Pattern 25 Cancel Region

166 Open-source Workflow Evaluation - An evaluation of the Appendix E: XML implementation Activiti BPM Platform of the supported patterns Mikael Nilsson 2012-06-29

167 Open-source Workflow Evaluation - An evaluation of the Appendix E: XML implementation Activiti BPM Platform of the supported patterns Mikael Nilsson 2012-06-29

168 Open-source Workflow Evaluation - An evaluation of the Appendix E: XML implementation Activiti BPM Platform of the supported patterns Mikael Nilsson 2012-06-29

169 Open-source Workflow Evaluation - An evaluation of the Appendix E: XML implementation Activiti BPM Platform of the supported patterns Mikael Nilsson 2012-06-29

170 Open-source Workflow Evaluation - An evaluation of the Appendix E: XML implementation Activiti BPM Platform of the supported patterns Mikael Nilsson 2012-06-29

Pattern 26 - Cancel Multiple Instance Activity Implementation of Pattern 26 Cancel Multiple Instance Task

171 Open-source Workflow Evaluation - An evaluation of the Appendix E: XML implementation Activiti BPM Platform of the supported patterns Mikael Nilsson 2012-06-29

3

172 Open-source Workflow Evaluation - An evaluation of the Appendix E: XML implementation Activiti BPM Platform of the supported patterns Mikael Nilsson 2012-06-29

173 Open-source Workflow Evaluation - An evaluation of the Appendix E: XML implementation Activiti BPM Platform of the supported patterns Mikael Nilsson 2012-06-29

Pattern 27 - Complete Multiple Instance Activity (Boundary event) Implementation of Pattern 27 Complete Multiple Instance Task 5 ${nrOfActiveInstances == 0}

174 Open-source Workflow Evaluation - An evaluation of the Appendix E: XML implementation Activiti BPM Platform of the supported patterns Mikael Nilsson 2012-06-29

PT1M

175 Open-source Workflow Evaluation - An evaluation of the Appendix E: XML implementation Activiti BPM Platform of the supported patterns Mikael Nilsson 2012-06-29

Pattern 27 - Complete Multiple Instance Activity (completion condition) Implementation of Pattern 27 Complete Multiple Instance Task 2

176 Open-source Workflow Evaluation - An evaluation of the Appendix E: XML implementation Activiti BPM Platform of the supported patterns Mikael Nilsson 2012-06-29

5 ${cancel || nrOfActiveInstances == 0}

177 Open-source Workflow Evaluation - An evaluation of the Appendix E: XML implementation Activiti BPM Platform of the supported patterns Mikael Nilsson 2012-06-29

Pattern 29 - Cancelling Discriminator Implementation of Pattern 29 Cancelling Discriminator

178 Open-source Workflow Evaluation - An evaluation of the Appendix E: XML implementation Activiti BPM Platform of the supported patterns Mikael Nilsson 2012-06-29

179 Open-source Workflow Evaluation - An evaluation of the Appendix E: XML implementation Activiti BPM Platform of the supported patterns Mikael Nilsson 2012-06-29

180 Open-source Workflow Evaluation - An evaluation of the Appendix E: XML implementation Activiti BPM Platform of the supported patterns Mikael Nilsson 2012-06-29

Pattern 35 - Cancelling Partial Join for Multiple Instances Implementation of Pattern 35 Cancelling Partial Join for Multiple Instances. ${nrInstances} ${nrInstancesToComplete == nrOfCompletedInstances}

181 Open-source Workflow Evaluation - An evaluation of the Appendix E: XML implementation Activiti BPM Platform of the supported patterns Mikael Nilsson 2012-06-29

182