mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
Workflow:
- Addition of start date and end date to Workflow Instance API Object - Support redeploy (force if already there) of process definition in WorkflowDeployer bean - Addition of Ad-hoc Task Workflow example definition for Workflow Administration WIKI page git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@3604 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -124,20 +124,6 @@
|
|||||||
</property>
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<!-- Workflow Deployment -->
|
|
||||||
|
|
||||||
<bean id="workflowBootstrap" parent="workflowDeployer">
|
|
||||||
<property name="workflowDefinitions">
|
|
||||||
<list>
|
|
||||||
<props>
|
|
||||||
<prop key="engineId">jbpm</prop>
|
|
||||||
<prop key="location">org/alfresco/repo/workflow/jbpm/review_and_approve_processdefinition.xml</prop>
|
|
||||||
<prop key="mimetype">text/xml</prop>
|
|
||||||
</props>
|
|
||||||
</list>
|
|
||||||
</property>
|
|
||||||
</bean>
|
|
||||||
|
|
||||||
<!-- Descriptor Service -->
|
<!-- Descriptor Service -->
|
||||||
|
|
||||||
<bean id="descriptorComponent" class="org.alfresco.repo.descriptor.DescriptorServiceImpl">
|
<bean id="descriptorComponent" class="org.alfresco.repo.descriptor.DescriptorServiceImpl">
|
||||||
|
@@ -41,3 +41,28 @@ wf_review.task.wf_approvedTask.title=Approved
|
|||||||
wf_review.task.wf_approvedTask.description=Approved
|
wf_review.task.wf_approvedTask.description=Approved
|
||||||
wf_review.node.end.title=End
|
wf_review.node.end.title=End
|
||||||
wf_review.node.end.description=End
|
wf_review.node.end.description=End
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# Adhoc Task Workflow
|
||||||
|
#
|
||||||
|
|
||||||
|
wf_adhoc.workflow.title=Adhoc Task
|
||||||
|
wf_adhoc.workflow.description=Assign task to colleague
|
||||||
|
|
||||||
|
# Adhoc Task Definitions
|
||||||
|
|
||||||
|
wf_workflowmodel.type.wf_submitAdhocTask.title=Submit Adhoc Task
|
||||||
|
wf_workflowmodel.type.wf_submitAdhocTask.description=Allocate task to colleague
|
||||||
|
wf_workflowmodel.property.wf_adhocDescription.title=Task Description
|
||||||
|
wf_workflowmodel.property.wf_adhocDescription.description=Description of what needs to be achieved
|
||||||
|
wf_workflowmodel.property.wf_adhocDueDate.description=Task Due Date
|
||||||
|
wf_workflowmodel.property.wf_adhocPriority.title=Task Priority
|
||||||
|
wf_workflowmodel.property.wf_notifyMe.title=Notify Me
|
||||||
|
wf_workflowmodel.property.wf_notifyMe.description=Notify me when task is complete
|
||||||
|
wf_workflowmodel.association.wf_assignee.title=Assignee
|
||||||
|
wf_workflowmodel.association.wf_assignee.description=Who's doing the task
|
||||||
|
wf_workflowmodel.type.wf_adhocTask.title=Adhoc Task
|
||||||
|
wf_workflowmodel.type.wf_adhocTask.description=Adhoc Task allocated by colleague
|
||||||
|
wf_workflowmodel.type.wf_completedTask.title=Adhoc Task Completed
|
||||||
|
wf_workflowmodel.type.wf_completedTask.description=Adhoc Task Completed
|
||||||
|
@@ -2,10 +2,6 @@
|
|||||||
|
|
||||||
<model name="wf:workflowmodel" xmlns="http://www.alfresco.org/model/dictionary/1.0">
|
<model name="wf:workflowmodel" xmlns="http://www.alfresco.org/model/dictionary/1.0">
|
||||||
|
|
||||||
<description>Content-oriented Workflows Model</description>
|
|
||||||
<author>Alfresco</author>
|
|
||||||
<version>0.1</version>
|
|
||||||
|
|
||||||
<imports>
|
<imports>
|
||||||
<import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d"/>
|
<import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d"/>
|
||||||
<import uri="http://www.alfresco.org/model/content/1.0" prefix="cm"/>
|
<import uri="http://www.alfresco.org/model/content/1.0" prefix="cm"/>
|
||||||
@@ -76,10 +72,6 @@
|
|||||||
</type>
|
</type>
|
||||||
|
|
||||||
|
|
||||||
<!-- -->
|
|
||||||
<!-- Basic Review & Approve Tasks -->
|
|
||||||
<!-- -->
|
|
||||||
|
|
||||||
<type name="wf:reviewTask">
|
<type name="wf:reviewTask">
|
||||||
<title>Review Task</title>
|
<title>Review Task</title>
|
||||||
<parent>bpm:workflowTask</parent>
|
<parent>bpm:workflowTask</parent>
|
||||||
@@ -94,6 +86,75 @@
|
|||||||
|
|
||||||
</type>
|
</type>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- -->
|
||||||
|
<!-- Adhoc Tasks -->
|
||||||
|
<!-- -->
|
||||||
|
|
||||||
|
|
||||||
|
<type name="wf:baseAdhocTask">
|
||||||
|
<parent>bpm:workflowTask</parent>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<property name="wf:adhocDescription">
|
||||||
|
<title>Description</title>
|
||||||
|
<type>d:text</type>
|
||||||
|
</property>
|
||||||
|
</properties>
|
||||||
|
</type>
|
||||||
|
|
||||||
|
<type name="wf:submitAdhocTask">
|
||||||
|
<title>Submit Adhoc Task</title>
|
||||||
|
<parent>wf:baseAdhocTask</parent>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<property name="wf:adhocDueDate">
|
||||||
|
<title>Due Date</title>
|
||||||
|
<type>d:date</type>
|
||||||
|
</property>
|
||||||
|
|
||||||
|
<property name="wf:adhocPriority">
|
||||||
|
<title>Priority</title>
|
||||||
|
<type>d:int</type>
|
||||||
|
<default>2</default>
|
||||||
|
<constraints>
|
||||||
|
<constraint ref="bpm:allowedPriority"/>
|
||||||
|
</constraints>
|
||||||
|
</property>
|
||||||
|
|
||||||
|
<property name="wf:notifyMe">
|
||||||
|
<title>Email Notification</title>
|
||||||
|
<type>d:boolean</type>
|
||||||
|
</property>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<associations>
|
||||||
|
<association name="wf:assignee">
|
||||||
|
<title>Assignee</title>
|
||||||
|
<source>
|
||||||
|
<mandatory>false</mandatory>
|
||||||
|
<many>false</many>
|
||||||
|
</source>
|
||||||
|
<target>
|
||||||
|
<class>cm:person</class>
|
||||||
|
<mandatory>true</mandatory>
|
||||||
|
<many>false</many>
|
||||||
|
</target>
|
||||||
|
</association>
|
||||||
|
</associations>
|
||||||
|
</type>
|
||||||
|
|
||||||
|
<type name="wf:adhocTask">
|
||||||
|
<title>Adhoc Task</title>
|
||||||
|
<parent>wf:baseAdhocTask</parent>
|
||||||
|
</type>
|
||||||
|
|
||||||
|
<type name="wf:completedTask">
|
||||||
|
<title>Completed Adhoc Task</title>
|
||||||
|
<parent>wf:baseAdhocTask</parent>
|
||||||
|
</type>
|
||||||
|
|
||||||
</types>
|
</types>
|
||||||
|
|
||||||
</model>
|
</model>
|
@@ -7,6 +7,25 @@
|
|||||||
<!-- Workflow Definitions -->
|
<!-- Workflow Definitions -->
|
||||||
<!-- -->
|
<!-- -->
|
||||||
|
|
||||||
|
<bean id="workflow.workflowBootstrap" parent="workflowDeployer">
|
||||||
|
<property name="workflowDefinitions">
|
||||||
|
<list>
|
||||||
|
<props>
|
||||||
|
<prop key="engineId">jbpm</prop>
|
||||||
|
<prop key="location">org/alfresco/repo/workflow/jbpm/review_and_approve_processdefinition.xml</prop>
|
||||||
|
<prop key="mimetype">text/xml</prop>
|
||||||
|
<prop key="redeploy">false</prop>
|
||||||
|
</props>
|
||||||
|
<props>
|
||||||
|
<prop key="engineId">jbpm</prop>
|
||||||
|
<prop key="location">org/alfresco/repo/workflow/jbpm/adhoc_task_processdefinition.xml</prop>
|
||||||
|
<prop key="mimetype">text/xml</prop>
|
||||||
|
<prop key="redeploy">false</prop>
|
||||||
|
</props>
|
||||||
|
</list>
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
|
||||||
<bean id="workflow.dictionaryBootstrap" parent="dictionaryModelBootstrap" depends-on="dictionaryBootstrap">
|
<bean id="workflow.dictionaryBootstrap" parent="dictionaryModelBootstrap" depends-on="dictionaryBootstrap">
|
||||||
<property name="models">
|
<property name="models">
|
||||||
<list>
|
<list>
|
||||||
@@ -22,16 +41,16 @@
|
|||||||
</property>
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
|
<!-- -->
|
||||||
|
<!-- Workflow Service Implementation -->
|
||||||
|
<!-- -->
|
||||||
|
|
||||||
<bean id="workflowDeployer" class="org.alfresco.repo.workflow.WorkflowDeployer" abstract="true">
|
<bean id="workflowDeployer" class="org.alfresco.repo.workflow.WorkflowDeployer" abstract="true">
|
||||||
<property name="transactionService" ref="transactionComponent"/>
|
<property name="transactionService" ref="transactionComponent"/>
|
||||||
<property name="authenticationComponent" ref="authenticationComponent" />
|
<property name="authenticationComponent" ref="authenticationComponent" />
|
||||||
<property name="workflowService" ref="WorkflowService" />
|
<property name="workflowService" ref="WorkflowService" />
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<!-- -->
|
|
||||||
<!-- Workflow Service Implementation -->
|
|
||||||
<!-- -->
|
|
||||||
|
|
||||||
<bean id="workflowServiceImpl" class="org.alfresco.repo.workflow.WorkflowServiceImpl">
|
<bean id="workflowServiceImpl" class="org.alfresco.repo.workflow.WorkflowServiceImpl">
|
||||||
<property name="BPMEngineRegistry" ref="bpm_engineRegistry"/>
|
<property name="BPMEngineRegistry" ref="bpm_engineRegistry"/>
|
||||||
<property name="workflowPackageComponent" ref="workflowPackageImpl"/>
|
<property name="workflowPackageComponent" ref="workflowPackageImpl"/>
|
||||||
|
@@ -50,6 +50,7 @@ public class WorkflowDeployer implements ApplicationListener
|
|||||||
public static final String ENGINE_ID = "engineId";
|
public static final String ENGINE_ID = "engineId";
|
||||||
public static final String LOCATION = "location";
|
public static final String LOCATION = "location";
|
||||||
public static final String MIMETYPE = "mimetype";
|
public static final String MIMETYPE = "mimetype";
|
||||||
|
public static final String REDEPLOY = "redeploy";
|
||||||
|
|
||||||
// Dependencies
|
// Dependencies
|
||||||
private TransactionService transactionService;
|
private TransactionService transactionService;
|
||||||
@@ -139,13 +140,14 @@ public class WorkflowDeployer implements ApplicationListener
|
|||||||
{
|
{
|
||||||
throw new WorkflowException("Workflow definition location must be provided");
|
throw new WorkflowException("Workflow definition location must be provided");
|
||||||
}
|
}
|
||||||
|
Boolean redeploy = Boolean.valueOf(workflowDefinition.getProperty(REDEPLOY));
|
||||||
String mimetype = workflowDefinition.getProperty(MIMETYPE);
|
String mimetype = workflowDefinition.getProperty(MIMETYPE);
|
||||||
|
|
||||||
// retrieve input stream on workflow definition
|
// retrieve input stream on workflow definition
|
||||||
ClassPathResource workflowResource = new ClassPathResource(location);
|
ClassPathResource workflowResource = new ClassPathResource(location);
|
||||||
|
|
||||||
// deploy workflow definition
|
// deploy workflow definition
|
||||||
if (workflowService.isDefinitionDeployed(engineId, workflowResource.getInputStream(), mimetype))
|
if (!redeploy && workflowService.isDefinitionDeployed(engineId, workflowResource.getInputStream(), mimetype))
|
||||||
{
|
{
|
||||||
if (logger.isDebugEnabled())
|
if (logger.isDebugEnabled())
|
||||||
logger.debug("Workflow deployer: Definition '" + location + "' already deployed");
|
logger.debug("Workflow deployer: Definition '" + location + "' already deployed");
|
||||||
|
@@ -1507,6 +1507,8 @@ public class JBPMEngine extends BPMEngine
|
|||||||
workflowInstance.id = createGlobalId(new Long(instance.getId()).toString());
|
workflowInstance.id = createGlobalId(new Long(instance.getId()).toString());
|
||||||
workflowInstance.definition = createWorkflowDefinition(instance.getProcessDefinition());
|
workflowInstance.definition = createWorkflowDefinition(instance.getProcessDefinition());
|
||||||
workflowInstance.active = !instance.hasEnded();
|
workflowInstance.active = !instance.hasEnded();
|
||||||
|
workflowInstance.startDate = instance.getStart();
|
||||||
|
workflowInstance.endDate = instance.getEnd();
|
||||||
return workflowInstance;
|
return workflowInstance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -0,0 +1,66 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<process-definition xmlns="urn:jbpm.org:jpdl-3.1" name="wf:adhoc">
|
||||||
|
|
||||||
|
<swimlane name="initiator"/>
|
||||||
|
|
||||||
|
<start-state name="start">
|
||||||
|
<task name="wf:submitAdhocTask" swimlane="initiator">
|
||||||
|
<controller>
|
||||||
|
<variable name="assignee" access="write" mapped-name="wf:assignee"/>
|
||||||
|
<variable name="adhocduedate" access="write" mapped-name="wf:adhocDueDate"/>
|
||||||
|
<variable name="adhocpriority" access="write" mapped-name="wf:adhocPriority"/>
|
||||||
|
<variable name="adhocdescription" access="write" mapped-name="wf:adhocDescription"/>
|
||||||
|
<variable name="notify" access="write" mapped-name="wf:notifyMe"/>
|
||||||
|
<variable name="package" access="write" mapped-name="bpm:package"/>
|
||||||
|
<variable name="context" access="write" mapped-name="bpm:context"/>
|
||||||
|
</controller>
|
||||||
|
</task>
|
||||||
|
<transition name="" to="adhoc"/>
|
||||||
|
</start-state>
|
||||||
|
|
||||||
|
<swimlane name="assignee">
|
||||||
|
<assignment actor-id="#{assignee.properties['cm:userName']}"/>
|
||||||
|
</swimlane>
|
||||||
|
|
||||||
|
<task-node name="adhoc">
|
||||||
|
<event type="task-create">
|
||||||
|
<script>
|
||||||
|
taskInstance.dueDate = adhocduedate;
|
||||||
|
taskInstance.priority = adhocpriority;
|
||||||
|
</script>
|
||||||
|
</event>
|
||||||
|
<task name="wf:adhocTask" swimlane="assignee">
|
||||||
|
<controller>
|
||||||
|
<variable name="adhocdescription" access="read" mapped-name="wf:adhocDescription"/>
|
||||||
|
</controller>
|
||||||
|
</task>
|
||||||
|
<transition name="" to="completed">
|
||||||
|
<action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
|
||||||
|
<script>
|
||||||
|
if (notify)
|
||||||
|
{
|
||||||
|
var mail = actions.create("mail");
|
||||||
|
mail.parameters.to = initiator.properties["cm:email"];
|
||||||
|
mail.parameters.subject = "Adhoc Task " + adhocDescription;
|
||||||
|
mail.parameters.from = assignee.properties["cm:email"];
|
||||||
|
mail.parameters.text = "It's done";
|
||||||
|
mail.execute(package);
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</action>
|
||||||
|
</transition>
|
||||||
|
</task-node>
|
||||||
|
|
||||||
|
<task-node name="completed">
|
||||||
|
<task name="wf:completedTask" swimlane="initiator">
|
||||||
|
<controller>
|
||||||
|
<variable name="adhocdescription" access="read" mapped-name="wf:adhocDescription"/>
|
||||||
|
</controller>
|
||||||
|
</task>
|
||||||
|
<transition name="" to="end"/>
|
||||||
|
</task-node>
|
||||||
|
|
||||||
|
<end-state name="end"/>
|
||||||
|
|
||||||
|
</process-definition>
|
@@ -16,6 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.alfresco.service.cmr.workflow;
|
package org.alfresco.service.cmr.workflow;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Workflow Instance Data Object
|
* Workflow Instance Data Object
|
||||||
@@ -35,6 +37,15 @@ public class WorkflowInstance
|
|||||||
/** Workflow Definition */
|
/** Workflow Definition */
|
||||||
public WorkflowDefinition definition;
|
public WorkflowDefinition definition;
|
||||||
|
|
||||||
|
/** Start Task Instance (optional) */
|
||||||
|
public WorkflowTask startTask;
|
||||||
|
|
||||||
|
/** Workflow Start Date */
|
||||||
|
public Date startDate;
|
||||||
|
|
||||||
|
/** Workflow End Date */
|
||||||
|
public Date endDate;
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see java.lang.Object#toString()
|
* @see java.lang.Object#toString()
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user