public static void notifyRecipients(CoreSession documentManager, Task task, DocumentModel document, String initiator, String event) throws NuxeoException { NuxeoPrincipal principal = (NuxeoPrincipal) documentManager.getPrincipal(); Map<String, Serializable> eventProperties = new HashMap<String, Serializable>(); ArrayList<String> notificationRecipients = new ArrayList<String>(); if (initiator != null) { notificationRecipients.add(initiator); } notificationRecipients.addAll(task.getActors()); eventProperties.put(NotificationConstants.RECIPIENTS_KEY, notificationRecipients.toArray(new String[notificationRecipients.size()])); TaskEventNotificationHelper.notifyEvent(documentManager, document, principal, task, event, eventProperties, null, null); }
@Override public void grantPermissionToTaskAssignees(CoreSession session, String permission, List<DocumentModel> docs, Task task) { setAclForActors(session, getRoutingACLName(task), permission, docs, task.getActors()); }
List<String> users = task.getActors(); if (checkDelegatedActors) { users.addAll(task.getDelegatedActors());
ArrayList<String> notificationRecipients = new ArrayList<>(); notificationRecipients.add(task.getInitiator()); notificationRecipients.addAll(task.getActors()); eventProperties.put(NotificationConstants.RECIPIENTS_KEY, notificationRecipients); if (extraEventProperties != null) {
/** * @since 7.4 */ @Override public List<Task> createTaskForProcess(CoreSession coreSession, NuxeoPrincipal principal, List<DocumentModel> documents, String taskDocumentType, String taskName, String taskType, String processId, String processName, List<String> actorIds, boolean createOneTaskPerActor, String directive, String comment, Date dueDate, Map<String, String> taskVariables, String parentPath, Map<String, Serializable> eventInfo) { if (StringUtils.isBlank(parentPath)) { parentPath = getTaskRootParentPath(coreSession); } CreateTaskUnrestricted runner = new CreateTaskUnrestricted(coreSession, principal, documents, taskDocumentType, taskName, taskType, processId, processName, actorIds, createOneTaskPerActor, directive, comment, dueDate, taskVariables, parentPath); runner.runUnrestricted(); List<Task> tasks = runner.getTasks(); for (Task task : tasks) { // notify notifyEvent(coreSession, task, documents, TaskEventNames.WORKFLOW_TASK_ASSIGNED, eventInfo, comment, principal, task.getActors()); } return tasks; } }
throw new NuxeoException("Invalid taskId: " + taskId); List<String> currentAssignees = task.getActors(); List<String> currentActors = new ArrayList<>(); for (String currentAssignee : currentAssignees) {
actors = task.getActors();
writeActors(item.getActors(), isFetchActors, jg); jg.writeEndArray();
@OperationMethod public DocumentModelList getAllTasks(DocumentModel doc) { DocumentModelList taskDocs = new DocumentModelListImpl(); List<Task> tasks; if (nodeId == null && processId == null) { NuxeoPrincipal principal = username != null ? userManager.getPrincipal(username) : null; tasks = taskService.getTaskInstances(doc, principal, session); for (Task task : tasks) { taskDocs.add(task.getDocument()); } return taskDocs; } if (nodeId == null || processId == null) { throw new NuxeoException("Need both nodeId and processId to invoke the operation with parameters"); } tasks = taskService.getAllTaskInstances(processId, nodeId, session); for (Task task : tasks) { if (task.getTargetDocumentsIds().contains(doc.getId())) { if (username == null || task.getActors().contains(username)) { taskDocs.add(task.getDocument()); } } } return taskDocs; }