05-19-2012 06:41 PM
<userTask id="reviewTask" name="Review Task"
activiti:formKey="wf:activitiReviewTask">
<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.dueDate = bpm_workflowDueDate
if (typeof bpm_workflowPriority != 'undefined') task.priority = bpm_workflowPriority;
</activiti:string>
</activiti:field>
</activiti:taskListener>
<activiti:taskListener event="complete" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
<activiti:field name="script">
<activiti:string>
if(task.getVariableLocal('wf_reviewOutcome') == 'Approve') {
var newApprovedCount = wf_approveCount + 1;
var newApprovedPercentage = (newApprovedCount / wf_reviewerCount) * 100;
execution.setVariable('wf_approveCount', newApprovedCount);
execution.setVariable('wf_actualPercent', newApprovedPercentage);
}
</activiti:string>
</activiti:field>
</activiti:taskListener>
</extensionElements>
<humanPerformer>
<resourceAssignmentExpression>
<formalExpression>${reviewAssignee.properties.userName}</formalExpression>
</resourceAssignmentExpression>
</humanPerformer>
<!– For each assignee, task is created –>
<multiInstanceLoopCharacteristics isSequential="false">
<loopDataInputRef>bpm_assignees</loopDataInputRef>
<inputDataItem name="reviewAssignee" />
<completionCondition>${wf_actualPercent >= wf_requiredApprovePercent}</completionCondition>
</multiInstanceLoopCharacteristics>
</userTask>
@Override
protected Map<String, Object> executeImpl(WebScriptRequest req, Status status) {
Map<String, Object> model = new HashMap<String, Object>();
// Original version of parallel review task
String workflowDefinitionId = "activiti$activitiParallelReview:1:16";
// Copy of parallel review task but now in SomeCo namespace.
//String workflowDefinitionId = "activiti$activitiParallelReview:2:4310";
// Look up the id in the workflow console.
WorkflowDefinition definition = workflowService.getDefinitionById(workflowDefinitionId);
if (definition != null) {
List<WorkflowTaskDefinition> tasks = workflowService.getTaskDefinitions(definition.getId());
List<String> taskIds = new LinkedList<String>();
for (WorkflowTaskDefinition task : tasks) {
taskIds.add(task.getId());
}
model.put("taskIds", taskIds);
}
return model;
}
<#escape x as jsonUtils.encodeJSONString(x)>
{
"tasks":
[
<#list taskIds as taskId>
"${taskId}"<#if taskId_has_next>,</#if>
</#list>
]
}
</#escape>
{
"tasks":
[
"wf:submitParallelReviewTask",
"reviewTask",
"wf:approvedParallelTask",
"wf:rejectedParallelTask"
]
}
05-22-2012 03:25 AM
05-22-2012 12:44 PM
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.