Book Image

Activiti 5.x Business Process Management Beginner's Guide

By : Dr. Zakir Laliwala, Irshad Mansuri
Book Image

Activiti 5.x Business Process Management Beginner's Guide

By: Dr. Zakir Laliwala, Irshad Mansuri

Overview of this book

<p>Activiti is a light-weight workflow and Business Process Management (BPM) platform targeted at business people, developers, and system administrators. Its core is a super-fast and rock-solid BPMN 2 process engine for Java. Activiti runs in any Java application on a server, cluster and in the cloud. It integrates perfectly with Spring and it is based on simple concepts making it easy for users to maximize its potential.</p> <p>Activiti BPM Beginner’s Guide quickly introduces you to the Activiti Business Process Management methodology. This book will serve as an extremely useful starter guide for developers working on Activiti BPM who wish to integrate Activiti with other technologies.If you want to take full advantage of the power of the Activiti BPM, then this is the book for you.</p> <p>This book will teach you how to design advanced business workflows through easy steps as well as how to integrate your creations with various third party services. It will take you through a number of clear, practical steps that will help you to implement business workflow using standard BPMN notation.</p> <p>The key aim of this book is to guide you through how to develop business workflows so you can eventually remove the gap between the business analyst and the developer. The book focuses on development and delivery using Activiti BPM through integrating, migrating, and upgrading some advanced technological tools.</p> <p>You will learn everything you need to know to design effective and advanced business workflows and how to implement them with different applications.</p> <p>This book should be in the tool belt of any business analyst who wishes to model business processes and use these models to generate a fully-functioning workflow application.</p>
Table of Contents (17 chapters)
Activiti 5.x Business Process Management Beginner's Guide
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Time for action – creating our first process in Activiti


Now is the right time to look at one simple process in Activiti. We will be using the Eclipse IDE for designing the business process (the details of configuration are covered in Chapter 3, Designing Your Process Using the Activiti Designer). For now, we will just gain an understanding about creating a process.

We will create a simple leave process for employees in which we will have a script task and a user task. A script task is used for adding some logic within a process and a user task is used to indicate that there is some human interaction required in the process (there is a detailed explanation regarding tasks in Chapter 2, Modeling Using the Activiti Modeler).

Perform the following steps to create a process in Activiti:

  1. Create a new Activiti project in Eclipse by navigating to File | New | Project | Activiti Project and name your project SimpleLeave-Process.

  2. The SimpleLeave-Process project will have a folder structure as shown in the following screenshot:

  3. Now create an Activiti Diagram in the src/main/rersource/diagrams folder structure.

  4. To create a diagram, navigate to File | New | Other | Activiti Diagram and name your diagram SimpleLeaveProces s. The folder structure is shown in the following screenshot:

  5. On opening the .bpmn file, a white canvas will appear on which you can design the business process.

  6. To draw a business process, there is a Palette option available which contains most of the BPMN diagrams for designing the business process. First, we will be adding a StartEvent on the canvas from the Event tab of the Palette option. All these options are shown in the following screenshot:

  7. To add a script task, click on StartEvent and it will display the options as shown in the following screenshot. From those options, select the new element option, which will list down all the elements; from those elements, select Create script task, as shown in the following screenshot:

  8. To add a user task, click on Script Task and select new user task, which is the option displayed with a human icon as shown in the following screenshot:

  9. As each and every business process should have at least one end event, to add an end event, click on User Task and select the new end event option, as shown in the following screenshot:

  10. After adding the end event to the process, your business process should look similar to the following screenshot:

  11. Now we have to make some changes to the properties of the process.

  12. First, we will change the properties of the start event. Select the start event, open the Properties tab, and add Form Properties in the Form tab using the New button as shown in the following screenshot:

  13. Now, edit the properties for the script task. In the Main config tab, there is a Script field available; within that, insert the print statement out:println"ApplyforLeaveby"+Empname;. The Empname property is the form property that we created in the start event. The script task will print the message on the console when it is executed, as shown in the following screenshot:

  14. Now we will edit the user task properties. In the General tab, we will populate the Name property, which will be displayed in the user task node, as shown in the following screenshot:

  15. As the user task is to be performed by a specific user, we have to provide the name of the user who will be responsible for executing it.

  16. We have to populate the Assignee property of the Main config tab with the name of the person to whom the task should be assigned; as shown in the following screenshot, we will be assigning it to kermit:

  17. We can also view the .bpmn file in the XML format. Right-click on the SimpleLeaveProcess.bpmn file, browse to OpenWith | XML Editor, and it will be available in the XML format. The result of this step is shown in the following screenshot:

What just happened ?

We have created a leave process using the Eclipse editor.