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:
@@ -50,6 +50,7 @@ public class WorkflowDeployer implements ApplicationListener
|
||||
public static final String ENGINE_ID = "engineId";
|
||||
public static final String LOCATION = "location";
|
||||
public static final String MIMETYPE = "mimetype";
|
||||
public static final String REDEPLOY = "redeploy";
|
||||
|
||||
// Dependencies
|
||||
private TransactionService transactionService;
|
||||
@@ -139,13 +140,14 @@ public class WorkflowDeployer implements ApplicationListener
|
||||
{
|
||||
throw new WorkflowException("Workflow definition location must be provided");
|
||||
}
|
||||
Boolean redeploy = Boolean.valueOf(workflowDefinition.getProperty(REDEPLOY));
|
||||
String mimetype = workflowDefinition.getProperty(MIMETYPE);
|
||||
|
||||
// retrieve input stream on workflow definition
|
||||
ClassPathResource workflowResource = new ClassPathResource(location);
|
||||
|
||||
// deploy workflow definition
|
||||
if (workflowService.isDefinitionDeployed(engineId, workflowResource.getInputStream(), mimetype))
|
||||
if (!redeploy && workflowService.isDefinitionDeployed(engineId, workflowResource.getInputStream(), mimetype))
|
||||
{
|
||||
if (logger.isDebugEnabled())
|
||||
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.definition = createWorkflowDefinition(instance.getProcessDefinition());
|
||||
workflowInstance.active = !instance.hasEnded();
|
||||
workflowInstance.startDate = instance.getStart();
|
||||
workflowInstance.endDate = instance.getEnd();
|
||||
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;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
/**
|
||||
* Workflow Instance Data Object
|
||||
@@ -35,6 +37,15 @@ public class WorkflowInstance
|
||||
/** Workflow 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)
|
||||
* @see java.lang.Object#toString()
|
||||
*/
|
||||
|
Reference in New Issue
Block a user