mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Workflow Notificatoins:
* Email notifications sent asynchronously * Activiti pooled tasks now work correctly git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@29812 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -142,6 +142,9 @@ public abstract class WorkflowNotificationUtils
|
||||
{
|
||||
notificationContext.addTo(assignedAuthority);
|
||||
}
|
||||
|
||||
// Indicate that we want to execute the notification asynchronously
|
||||
notificationContext.setAsyncNotification(true);
|
||||
|
||||
// Send email notification
|
||||
services.getNotificationService().sendNotification(EMailNotificationProvider.NAME, notificationContext);
|
||||
|
@@ -19,11 +19,15 @@
|
||||
|
||||
package org.alfresco.repo.workflow.activiti.tasklistener;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.activiti.engine.delegate.DelegateTask;
|
||||
import org.activiti.engine.delegate.TaskListener;
|
||||
import org.activiti.engine.form.FormData;
|
||||
import org.activiti.engine.impl.form.TaskFormHandler;
|
||||
import org.activiti.engine.impl.persistence.entity.ExecutionEntity;
|
||||
import org.activiti.engine.impl.persistence.entity.IdentityLinkEntity;
|
||||
import org.activiti.engine.impl.persistence.entity.TaskEntity;
|
||||
import org.alfresco.repo.workflow.WorkflowNotificationUtils;
|
||||
import org.alfresco.repo.workflow.activiti.ActivitiConstants;
|
||||
@@ -73,6 +77,7 @@ public class TaskCreateListener implements TaskListener
|
||||
Boolean value = (Boolean)executionEntity.getVariable(WorkflowNotificationUtils.PROP_SEND_EMAIL_NOTIFICATIONS);
|
||||
if (Boolean.TRUE.equals(value) == true)
|
||||
{
|
||||
// Get the workflow package node
|
||||
NodeRef workflowPackage = null;
|
||||
ActivitiScriptNode scriptNode = (ActivitiScriptNode)executionEntity.getVariable(WorkflowNotificationUtils.PROP_PACKAGE);
|
||||
if (scriptNode != null)
|
||||
@@ -80,6 +85,38 @@ public class TaskCreateListener implements TaskListener
|
||||
workflowPackage = scriptNode.getNodeRef();
|
||||
}
|
||||
|
||||
// Determine whether the task is pooled or not
|
||||
String[] authorities = null;
|
||||
boolean isPooled = false;
|
||||
if (task.getAssignee() == null)
|
||||
{
|
||||
// Task is pooled
|
||||
isPooled = true;
|
||||
|
||||
// Get the pool of user/groups for this task
|
||||
List<IdentityLinkEntity> identities = ((TaskEntity)task).getIdentityLinks();
|
||||
List<String> temp = new ArrayList<String>(identities.size());
|
||||
for (IdentityLinkEntity item : identities)
|
||||
{
|
||||
String group = item.getGroupId();
|
||||
if (group != null)
|
||||
{
|
||||
temp.add(group);
|
||||
}
|
||||
String user = item.getUserId();
|
||||
if (user != null)
|
||||
{
|
||||
temp.add(user);
|
||||
}
|
||||
}
|
||||
authorities = temp.toArray(new String[temp.size()]);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Get the assigned user or group
|
||||
authorities = new String[]{task.getAssignee()};
|
||||
}
|
||||
|
||||
// Send email notification
|
||||
WorkflowNotificationUtils.sendWorkflowAssignedNotificationEMail(
|
||||
services,
|
||||
@@ -89,8 +126,8 @@ public class TaskCreateListener implements TaskListener
|
||||
task.getDueDate(),
|
||||
Integer.valueOf(task.getPriority()),
|
||||
workflowPackage,
|
||||
new String[]{task.getAssignee()},
|
||||
(task.getAssignee() == null));
|
||||
authorities,
|
||||
isPooled);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user