06-04-2010 12:14 AM
<?xml version="1.0" encoding="UTF-8"?>
<process-definition xmlns="urn:jbpm.org:jpdl-3.1" name="wfl:lifecycleapproval">
<swimlane name="initiator" />
<start-state name="start">
<task name="wf:submitReviewTask" swimlane="initiator" />
<event type="node-leave">
<!– Call script once the workflow package exists i.e. on node-leave –>
<action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
<!– Apply the Workflow Lifecycle Aspect (wfl:status) if not set already. Note: The default wfl:status property is draft –>
<script>
for (var i = 0; i < bpm_package.children.length; i++)
{
if (!bpm_package.children[i].hasAspect("wfl:status"))
{
bpm_package.children[i].addAspect("wfl:status");
}
}
</script>
</action>
</event>
<transition name="" to="review" />
</start-state>
<swimlane name="reviewer">
<assignment class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
<actor>#{bpm_assignee}</actor>
</assignment>
</swimlane>
<swimlane name="senior-reviewer">
<assignment class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
<actor>#{bpm_assignee1}</actor>
</assignment>
</swimlane>
<task-node name="review">
<event type="node-enter">
<!– Update the status to In Review when we enter this task –>
<action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
<script>
for (var i = 0; i < bpm_package.children.length; i++)
{
bpm_package.children[i].properties["wfl:status"] = "In Review";
bpm_package.children[i].save();
}
</script>
</action>
</event>
<task name="wf:reviewTask" swimlane="reviewer">
<event type="task-create">
<script>
if (bpm_workflowDueDate != void) taskInstance.dueDate = bpm_workflowDueDate;
if (bpm_workflowPriority != void) taskInstance.priority = bpm_workflowPriority;
</script>
</event>
</task>
<timer name="thirdPartyTimer" duedate="2 minutes" transition="approve">
<action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
<script>
logger.log("Timer Expired");
</script>
</action>
</timer>
<transition name="reject" to="rejected"/>
<transition name="approve" to="senior-review"/>
</task-node>
<task-node name="senior-review">
<task name="wf:reviewTask" swimlane="senior-reviewer"/>
<transition name="approve" to="approved">
<action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
<script>
var departmentSpace = companyhome.childByNamePath("Employee/Old");
var department=departmentSpace.childByNamePath(bpm_id);
var dest=companyhome.childByNamePath("Employee/Old");
if (department==null)
{
bpm_context.move(dest);
}
</script>
</action>
</transition>
<transition name="reject" to="rejected"/>
</task-node>
<task-node name="rejected">
<event type="node-enter">
<!– Update the status to Draft when we enter this task –>
<action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
<script>
for (var i = 0; i < bpm_package.children.length; i++)
{
bpm_package.children[i].properties["wfl:status"] = "Draft";
bpm_package.children[i].save();
}
</script>
</action>
</event>
<task name="wf:rejectedTask" swimlane="initiator" />
<transition name="" to="end" />
</task-node>
<task-node name="approved">
<event type="node-enter">
<!– Update the status to Approved when we enter this task –>
<action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
<script>
for (var i = 0; i < bpm_package.children.length; i++)
{
bpm_package.children[i].properties["wfl:status"] = "Approved";
bpm_package.children[i].save();
}
</script>
</action>
</event>
<task name="wf:approvedTask" swimlane="initiator" />
<transition name="" to="end" />
</task-node>
<end-state name="end" />
<event type="process-end">
<action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
<script>
if (cancelled)
{
for (var i = 0; i < bpm_package.children.length; i++)
{
if (bpm_package.children[0].hasAspect("wfl:status"))
{
bpm_package.children[i].properties["wfl:status"] = "Draft";
bpm_package.children[i].save();
}
}
if (logger.isLoggingEnabled()) logger.log("Workflow cancelled, status reset to Draft");
}
else
{
if (logger.isLoggingEnabled()) logger.log("Workflow completed");
}
</script>
</action>
</event>
</process-definition>
06-16-2010 02:48 PM
06-16-2010 04:36 PM
<event type="task-create">
<action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
<script>
logger.log("record-completion::task-create");
token = taskInstance.token;
logger.log("Token is "
+ token);
lockOwner = token.lockOwner;
logger.log("Lock owner is " + lockOwner);
token.unlock(lockOwner);
logger.log("***
Token
unlocked ***");
taskInstance.end("finalize");
logger.log("*** Task ended ***");
</script>
</action>
</event>
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.