Obsolete Pages{{Obsolete}}
The official documentation is at: http://docs.alfresco.com
Back to Workflow.
Starting from Alfresco Community 3.4.e, you can deploy Activiti process definitions to specify workflows. The Activiti BPMN 2.0 BPM engine is now embedded in Alfresco in addition to the current jBPM engine. Both workflow engines are encapsulated in the workflow service that provides a standard interface to the underlying workflow engine itself.
Activiti process definitions are written in BPMN 2.0 and are deployed and managed in exactly the same way as the current jBPM process definitions.
Alfresco provides the same set of pre-defined process templates for Activiti, and for jBPM. In Alfresco Community 3.4.e, this feature is provided as a technology preview only.
Activiti | jBPM | |
---|---|---|
Process definition Language | BPMN 2.0 | jPDL |
Embedded in Alfresco? | Yes | Yes |
Pre-defined workflows? | Yes | Yes |
Workflow process designer | Activiti Eclipse Designer, or any other BPMN 2.0 compliant modeler | JBoss jBPM Process Designer |
Activiti is a light-weight workflow and Business Process Management (BPM) Platform targeted at business people, developers and system administrators. It provides a fast and reliable BPMN 2 process engine for Java. It is open-source and distributed under an Apache license. Activiti is lightweight, based on open standards and is designed to integrate well with Spring applications, like Alfresco. You can learn more about Activiti on the Activiti website.
BPMN 2.0 (Business Process Modeling Notation) is an open standard developed by the Object Management Group (OMG)
to provide a notation that is easily understandable by all business users: business
analysts designing processes, developers implementing technology to perform those processes, and, business people managing and monitoring those
processes. BPMN creates a standardized bridge for the gap between the business process design and process.
The first version BPMN specification defined graphical notation only, and became quickly popular within the business analyst audience .It defined how concepts such as a human task, an executable script, an automated decision are visualized in a vendor-neutral, standardized way. The second version extended the standard to include execution semantics and a common exchange format. This means that BPMN 2.0 process definition models can be exchanged between graphical editors, and executed on any BPMN 2.0 compliant engine such as Activiti.
You can learn more about BPMN on the OMG website.
For a user, tasks for working with workflows in Afresco Share remain the same. The only change is in the
in the contents of the Workflow list displayed on the Start Workflow page where you select the type of workflow you want to define. Out of the box, Share now includes the following preconfigured workflows for both Activiti and jBPM:-
You can see more on working with workflows in the Alfresco Documentation.
In Alfresco, a workflow consists a number of artifacts. The diagram below shows the artifacts and the relationship between them:-
none|Workflow Definition
The embedded Activiti process engine accepts process definitions written in BPMN 2.0. A process definition is an xml document.
The description is used to drive the user interface dialog for viewing and managing the Task.
Alfresco provides a 'Data Dictionary' for describing types of object to store, view and edit. This mechanism is also used to describe Workflow Tasks.
You can customize the presentation of Tasks to the user in Alfresco Share.
Customizing allows:
There is more information in Custom Share Workflow UI.
A workflow resource bundle provides all the human-readable messages displayed in the user interface for managing the workflow. Messages include Task titles, task property names, task choices etc.
Alfresco supports full localisation of Alfresco Share, including workflow. Therefore, the same Alfresco Share resource bundle configuration extends to workflow too.
You can create the BPMN 2.0 process definition manually in a text or XML editor, or by using a BPMN 2.0 compliant business process modeler such as Activiti Eclipse Designer. You can use the process definitions supplied in Alfresco for the preconfigured workflows as examples. These can be found in webapps/alfresco/WEB-INF/classes/alfresco/workflow.
Process Definition File | Workflow |
---|---|
adhoc.bpmn20.xml | Adhoc Activiti Process |
parallel-review-group.bpmn20.xml | Parallel Group Review And Approve Activiti Process |
parallel-review.bpmn20.xml | Parallel Review And Approve Activiti Process |
review-pooled.bpmn20.xml | Pooled Review And Approve Activiti Process |
review.bpmn20.xml | Review And Approve Activiti Process |
Further information on creating BPMN 2.0 process definitions can be found on the omg website, and in the Activiti 5.3 User Guide. The example listing below shows the adhoc Activiti process definition:-
<definitions id='adhoc-definitions'
typeLanguage='http://www.w3.org/2001/XMLSchema'
expressionLanguage='http://www.w3.org/1999/XPath'
targetNamespace='http://activiti.org/bpmn20'
xmlns='http://www.omg.org/spec/BPMN/20100524/MODEL'
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
xmlns:activiti='http://activiti.org/bpmn'>
<process id='activitiAdhoc' name='Adhoc Activiti Process'>
<startEvent id='start'
activiti:formKey='wf:submitAdhocTask' />
<sequenceFlow id='flow1'
sourceRef='start'
targetRef='adhocTask' />
<userTask id='adhocTask' name='Adhoc Task'
activiti:formKey='wf:adhocTask'>
<extensionElements>
<activiti:taskListener event='create'
class='org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener'>
<activiti:field name='script'>
<activiti:string>
if (typeof bpm_workflowDueDate !=
'undefined') task.setVariableLocal('bpm_dueDate', bpm_workflowDueDate);
if (typeof bpm_workflowPriority != 'undefined')
task.priority = bpm_workflowPriority;
</activiti:string>
</activiti:field>
</activiti:taskListener>
</extensionElements>
<humanPerformer>
<resourceAssignmentExpression>
<formalExpression>${bpm_assignee.properties.userName}</formalExpression>
</resourceAssignmentExpression>
</humanPerformer>
</userTask>
<sequenceFlow id='flow2'
sourceRef='adhocTask'
targetRef='verifyTaskDone' />
<userTask id='verifyTaskDone' name='Verify Adhoc Task Completed.'
activiti:formKey='wf:completedAdhocTask' >
<documentation>
Verify the arbitrary task was completed.
</documentation>
<extensionElements>
<activiti:taskListener event='create'
class='org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener'>
<activiti:field name='script'>
<activiti:string>
if (typeof bpm_workflowDueDate !=
'undefined') task.setVariableLocal('bpm_dueDate',
bpm_workflowDueDate);
if (typeof bpm_workflowPriority != 'undefined')
task.priority = bpm_workflowPriority;
if (wf_notifyMe)
{
var mail = actions.create('mail');
mail.parameters.to = initiator.properties.email;
mail.parameters.subject = 'Adhoc Task ' + bpm_workflowDescription;
mail.parameters.from = bpm_assignee.properties.email;
mail.parameters.text = 'It's done';
mail.execute(bpm_package);
}
</activiti:string>
</activiti:field>
</activiti:taskListener>
</extensionElements>
<humanPerformer>
<resourceAssignmentExpression>
<formalExpression>${initiator.properties.userName}</formalExpression>
</resourceAssignmentExpression>
</humanPerformer>
</userTask>
<sequenceFlow id='flow3' sourceRef='verifyTaskDone'
targetRef='theEnd' />
<endEvent id='theEnd' />
</process>
</definitions>
Note in particular the activiti:formKey attribute of the startEvent element.
activiti:formKey='wf:submitAdhocTask'
This attribute tells Alfresco which form to display when the user selects a workflow in Workflow list displayed on the Start Workflow page in Alfresco Share. In jBPM this is achieved using a task element in a start-state element. You can see this difference between an Activiti process definition and a jBPM process definition my comparing adhoc.bpmn20.xml and adhoc_processdefinition.xml in webapps/alfresco/WEB-INF/classes/alfresco/workflow.
A task model is a content model as supported by the Data Dictionary.
For each task in the process definition the task model can associate a task description. The description specifies the information that may be attached to a task: properties (name and datatype) and associations (name and type of associated object). A user can view and edit this information in the My Tasks dashlet or the My Tasks page component on their dashboard in Alfresco Share. You can see more information on the My Tasks page component in the Alfresco Documentation.
To create a Task Model:
You can see the standard task model in workflowModel.xml in webapps/alfresco/WEB-INF/classes/alfresco/workflow.
Examining the file, you can see that the same underlying content model is shared by both jBPM and Activiti.
You will notice there is only one new type introduced by Activiti, activitiReviewTask. This defines a list of values for the task's transitions. This shows a difference between BPMN 2.0 and jPDL. In jPDL an explicit list of transitions are given from each task in the workflow. in BPMN 2.0 the route taken through the workflow is calculated differently, expressions use the values of variables in the workflow to decide which route to take. This is explained in more detail in Activiti Workflows with decision points.
You can use the workflowDeployer bean to deploy process definitions (refer to the following code snippet).
The bean must be in a file in the <extension> directory. Note the the engineId property must be set to activiti for BPMN 2.0 process definitions.
<bean id='myworkflows.workflowBootstrap' parent='workflowDeployer'>
<property name='workflowDefinitions'>
<list>
<props>
<prop key='engineId'>activiti</prop>
<prop key='location'>alfresco/workflow/adhoc.bpmn20.xml</prop>
<prop key='mimetype'>text/xml</prop>
</props>
</list>
</property>
</bean>
You can use one of two methods to deploy a task model:-
Both methods are described in the Alfresco Documentation.