Icon
For a walk-through the steps of the workflow and its configuration, we refer to Voting Sub-Process Walk-Through

Over view of the completed workflow

Step 1: Create a new Activiti project and/or Activiti diagram

The creation of a new Activiti project/diagram is explained in the section on Setting Up Your Workflow Design Workbench

Step 2: Change the Identifier, Name and Description of the Process

We refer to the section Designing Your First Workflow From Scratch, subsection "Change the Identifier, Name and Description of the Process" for an explanation on how  to change the identifier, name and description. For this case, name the workflow (e.g., the default would be "Voting Sub Process") and give it an identifier (e.g., the default name would be "votingSubProcess"). 

Step 3: Create a Start and End Event

We refer to the section Designing Your First Workflow From Scratch, subsection "Create a Start / End Event" for a general explanation.

Add the start and end events:

Add the Configuration Variables to the start event:

Start Event > Properties Tab > Form

Configuration Variables:

IdNameTypeDefaultRequiredReadableWriteable
decisionInfoDecision Info

string

 truetruetrue
voterUserExpressionThe user expression resulting to users required to votestring truetruetrue
votePercentageThe percentage of voters that are needed to approve (%)long50truetruetrue
voteWarningTimeDurationTime duration before a warning mail is send to votestringB3Dtruetruetrue
voteTimeoutDurationTime duration before the voting is stopped and the process continuedstringB5Dtruetruetrue
addCommentsAdd voting comments to resourcebooleanfalsefalsetruetrue
addCommentsToParentProvide the id of a comment if you want comments to be added to a parent commentstring truetruetrue
earlyCompleteStop voting if votingPercentage is impossible to reachbooleanfalsetruetruetrue
voteButtonLabelLabel for the voting buttonstring truetruetrue
voteTaskNameThe name of the actual voting taskstring truetruetrue
sendActionEmailSend a mail to the users allowing completing the vote by sending a emailbooleanfalsefalsetruetrue

Step 4: Create list of voters

Create a service task that will create a list of voters.

Set the Properties:

Service Task > Properties Tab > Main config

SettingValueDescription
Service classcom.collibra.dgc.core.workflow.activiti.delegate.CreateVotersListThis is the name of the delegate class
voterUserExpression{voterUserExpression}The delegate needs to the know the role to be counted. In this case it will be a Steward

This Delegate Class can be found at: <yourCollibraDomain>/docs/index.html > core >Package: com.collibra.dgc.core.workflow.activiti.delegate > Interface: CreateVotersList

Icon
For more information about Delegates, go to: Developing Workflows > Delegates

Step 5: Create Vote Sub-Process

Create an EventSubProcess container

Give the EventSubProcess an Id and Name:

EventSubProcess > Properites Tab > General

SettingValueDescription
IdvoteSubProcessThe Id of the sub-process. It will be used to call the sub-process from another workflow
NameVoteProvides a label for the sub-process

Make this EventSubProcess a loop by Using the "Multi instance" settings. The Vote event sub-process will be repeated for each voter:

SettingValueDescription
CollectionvotersThe list to loop through (Output variable by createVoterList delegate)
Element variable

voter

The single voter of the voter list
Completion condition${completion}Condition of when to stop the loop (Output variable by createVoterList delegate)

Add a Timer Boundary Event to determine the voting period.

 

Timer Boundary Event > Properties Tab > Main Config

SettingValueDescription
Cancel activityfalse 
Time Duration${voteTimeoutDuration}The duration variable when the event will fire. See the Configuration Variables

 

Step 6: Create the Voting Form

Create a User Task that will create the voting form for the user

Set the Properties:


Create a form for the user to vote:

User Task > Properties Tab > Form

IdNameTypeDefaultRequiredReadableWriteable
commentWhat is your reason for approving/rejecting?textarea falsetruetrue
approveApprovebuttonfalsetruetruetrue
rejectRejectbuttonfalsetruetruetrue
voteButton${voteButtonLabel}taskButton falsetruefalse
Icon
For more information about Form Types, go to: Developing Workflows > Form Types

User Task > Properties Tab > Main config

SettingValueDescription
Candidate usersuser(${voter})This variable is from the Multi Instance of the EventSubProcess
Documentation${decisionInfo}This variable is from the Configuration Variables on the Start Event. Provides a description of the task to the user

User Task > Properties Tab > Listeners

Listener implementationTypeEventFieldsDescription
com.collibra.dgc.core.workflow.activiti.tasklistener.ActionMailSenderclasscreateexecuteIfTrue:${sendActionEmail} This Mail sender will send workflow action emails for the task that this Task Listener is configured for. Only simple tasks are possible without required form input except buttons. Setting executeIfTrue to "True" will determine if action email is sent
Icon

Documentation of this Task Listener can be found at: <yourCollibraDomain>/docs/index.html > core >Package: com.collibra.dgc.core.workflow.activiti.tasklistener > Interface: ActionMailSender

 

Step 7: Send Reminder Mail

Create a service task to send a reminder email based on a boundary timer:

Add the TimerBoundaryEvent to the ${votTaskName} User Task and set its properties:

TimerBoundaryEvent > Properties Tab > Main config

SettingValueDescription
Cancel activityfalse 
Time Duration${voteWarningTimeDuration}The duration variable when the event will fire. See the Configuration Variables
Icon
For more information about Duration Variables, go to: Managing Workflows > Duration Variables

Create the Send reminder mail service task. This service task will use the MailSender Delegate. Set its properties:

Service Task > Properties Tab > Main config

SettingValueDescription
Service classcom.collibra.dgc.core.workflow.activiti.delegate.MailSenderMailSender Delegate class

Fields:

Field nameString valueExpressionDescription
mailTo user(${voter})The input for the email recipient. It will be the voter.
templatereminder The input field for the email template

This Delegate Class can be found at: <yourCollibraDomain>/docs/index.html > core >Package: com.collibra.dgc.core.workflow.activiti.delegate > Interface: MailSender

Icon

For an explanation of using the MailSender Delegate, go to: Designing Your First Workflow From Scratch > Defining a service task that sends and email-notification

 

Step 8: Add Vote Outcome to List

Add a service task to count the votes. Then create an exclusive gateway the will operate based on if the option to add comments (via the form property addComments) is set or or not:

Set the properties:

Service Task > Properties Tab > Main config

SettingValueDescription
Service Classcom.collibra.dgc.core.workflow.activiti.delegate.AddDecisionVoteSee API documentation

This Delegate Class can be found at: <yourCollibraDomain>/docs/index.html > core >Package: com.collibra.dgc.core.workflow.activiti.delegate > Interface: AddDescisionVote

Create the Exclusive Gateway and define the sequence flow outputs:

SequenceFlow > Properties Tab > Main config

Flow NameConditionDescription
addComments${addComments}Will result in "true" if comments are added
!addComments${!addComments}Will result in "false" if comments are added

 

Step 9: Store Comment

Create a service task to store the comment. This service task will use the AddComment delegate. Then close the sub process

Set the properties:

Service Task > Properties Tab > Main config

SettingValueDescription
Service classcom.collibra.dgc.core.workflow.activiti.delegate.AddComment

AddComment Delegate class

Fields:

Field nameString valueExpressionDescription
comment ${comment}The input for the comment text. Variable was created in previous user task.
parent ${addCommentsToParent}The input field that will allows you to override the default behavior and add the comment to as a sub comment of a parent comment. See configuration variables for the parent comment Id.

This Delegate Class can be found at: <yourCollibraDomain>/docs/index.html > core >Package: com.collibra.dgc.core.workflow.activiti.delegate > Interface: AddComment



Step 10: Count voting result

Create a service task to count the votes that were added using the looped EventSubProcess:

Set the properties:

Service Task > Properties Tab > Main config

 

SettingValueDescription
Service classcom.collibra.dgc.core.workflow.activiti.delegate.CountVoteResultThis is the name of the delegate class
This Delegate Class can be found at: <yourCollibraDomain>/docs/index.html > core > Package: com.collibra.dgc.core.workflow.activiti.delegate > Interface: CountVoteResult

Step 11: Publish Result

Add a service task to send out an email notifying voters of the result:

Set the properties:

 

Service Task > Properties Tab > Main config

 

SettingValueDescription
Service classcom.collibra.dgc.core.workflow.activiti.delegate.MailSender

MailSender Delegate class

Fields:

Field nameString valueExpressionDescription
template result This email will use the "result" email template.
mailTo ${voterUserExpression}This is the list of voters. See the configuration variables

Attachments:

image2014-4-17 12:30:43.png (image/png)
image2014-4-17 12:55:12.png (image/png)
image2014-4-17 12:59:55.png (image/png)
image2014-4-17 13:8:16.png (image/png)
image2014-4-17 13:12:9.png (image/png)
image2014-4-17 13:12:28.png (image/png)
image2014-4-17 13:15:50.png (image/png)
image2014-4-17 13:22:10.png (image/png)
image2014-4-17 13:31:50.png (image/png)
image2014-4-17 13:34:45.png (image/png)
image2014-4-17 13:38:34.png (image/png)
image2014-4-17 13:52:27.png (image/png)
image2014-4-17 14:16:6.png (image/png)
image2014-4-17 14:25:12.png (image/png)
image2014-4-17 14:30:1.png (image/png)
image2014-4-17 14:32:8.png (image/png)
image2014-4-17 14:43:32.png (image/png)
image2014-4-17 16:1:21.png (image/png)
image2014-4-17 16:8:18.png (image/png)
image2014-4-17 17:0:25.png (image/png)
image2014-4-17 17:22:32.png (image/png)
image2014-4-17 17:23:7.png (image/png)
image2014-4-17 17:30:33.png (image/png)
image2014-4-17 17:42:24.png (image/png)
image2014-4-17 17:48:14.png (image/png)
image2014-4-17 17:51:2.png (image/png)
image2014-4-17 17:55:53.png (image/png)
image2014-4-17 17:56:12.png (image/png)
image2014-4-17 18:0:23.png (image/png)
image2014-4-17 18:2:47.png (image/png)
image2014-4-17 18:8:20.png (image/png)
image2014-4-17 18:14:58.png (image/png)
image2014-4-18 9:17:21.png (image/png)
image2014-4-18 9:20:23.png (image/png)
image2014-4-18 9:23:21.png (image/png)
image2014-4-18 9:25:31.png (image/png)
image2014-4-18 9:40:13.png (image/png)
image2014-5-13 21:46:48.png (image/png)
image2014-5-13 21:58:14.png (image/png)