/** * {@inheritDoc} */ @Override protected WorkflowTask getTypedItemForDecodedId(String itemId) { WorkflowTask task = workflowService.getTaskById(itemId); if (task == null) { String msg = "Workflow task does not exist: " + itemId; throw new IllegalArgumentException(msg); } return task; }
/** * {@inheritDoc} */ @Override protected WorkflowTask getTypedItemForDecodedId(String itemId) { WorkflowTask task = workflowService.getTaskById(itemId); if (task == null) { String msg = "Workflow task does not exist: " + itemId; throw new IllegalArgumentException(msg); } return task; }
public WorkflowTask update() { WorkflowTask task = workflowService.getTaskById(taskId); NodeRef packageNode = task.getPath().getInstance().getWorkflowPackage(); packageMgr.update(packageNode); WorkflowTask result = workflowService.updateTask(taskId, properties, add, remove); properties.clear(); add.clear(); remove.clear(); return result; }
public WorkflowTask update() { WorkflowTask task = workflowService.getTaskById(taskId); NodeRef packageNode = task.getPath().getInstance().getWorkflowPackage(); packageMgr.update(packageNode); WorkflowTask result = workflowService.updateTask(taskId, properties, add, remove); properties.clear(); add.clear(); remove.clear(); return result; }
/** * Return a single object representing a task of the given taskId for the current user * * @return WorkflowTaskItem bean object {@link WorkflowTaskItem} */ public WorkflowTaskItem getTaskById(String taskId) { // get the task corresponding to the given taskId WorkflowTask task = getWorkflowService().getTaskById(taskId); return new WorkflowTaskItem(this.services, getTemplateImageResolver(), task); }
/** * Get task by id * * @param id task id * @return the task (null if not found) */ public JscriptWorkflowTask getTask(String id) { WorkflowTask task = services.getWorkflowService().getTaskById(id); return task == null ? null : new JscriptWorkflowTask(task, services, this.getScope()); }
/** * Return a single object representing a task of the given taskId for the current user * * @return WorkflowTaskItem bean object {@link WorkflowTaskItem} */ public WorkflowTaskItem getTaskById(String taskId) { // get the task corresponding to the given taskId WorkflowTask task = getWorkflowService().getTaskById(taskId); return new WorkflowTaskItem(this.services, getTemplateImageResolver(), task); }
/** * Get task by id * * @param id task id * @return the task (null if not found) */ public JscriptWorkflowTask getTask(String id) { WorkflowTask task = services.getWorkflowService().getTaskById(id); return task == null ? null : new JscriptWorkflowTask(task, services, this.getScope()); }
/** * Send workflow assigned email notification. * * @param taskId workflow global task id * @param taskType task type * @param assignedAuthorites assigned authorities * @param pooled true if pooled task, false otherwise */ public void sendWorkflowAssignedNotificationEMail(String taskId, String taskType, String[] assignedAuthorites, boolean pooled) { // Get the workflow task WorkflowTask workflowTask = workflowService.getTaskById(taskId); // Get the workflow properties Map<QName, Serializable> props = workflowTask.getProperties(); // Get the title and description String title = taskType == null ? workflowTask.getTitle() : taskType + ".title"; String description = (String)props.get(WorkflowModel.PROP_DESCRIPTION); // Get the duedate, priority and workflow package Date dueDate = (Date)props.get(WorkflowModel.PROP_DUE_DATE); Integer priority = (Integer)props.get(WorkflowModel.PROP_PRIORITY); NodeRef workflowPackage = workflowTask.getPath().getInstance().getWorkflowPackage(); // Send notification sendWorkflowAssignedNotificationEMail(taskId, title, description, dueDate, priority, workflowPackage, assignedAuthorites, pooled); }
/** * Send workflow assigned email notification. * * @param taskId workflow global task id * @param taskType task type * @param assignedAuthorites assigned authorities * @param pooled true if pooled task, false otherwise */ public void sendWorkflowAssignedNotificationEMail(String taskId, String taskType, String[] assignedAuthorites, boolean pooled) { // Get the workflow task WorkflowTask workflowTask = workflowService.getTaskById(taskId); // Get the workflow properties Map<QName, Serializable> props = workflowTask.getProperties(); // Get the title and description String title = taskType == null ? workflowTask.getTitle() : taskType + ".title"; String description = (String)props.get(WorkflowModel.PROP_DESCRIPTION); // Get the duedate, priority and workflow package Date dueDate = (Date)props.get(WorkflowModel.PROP_DUE_DATE); Integer priority = (Integer)props.get(WorkflowModel.PROP_PRIORITY); NodeRef workflowPackage = workflowTask.getPath().getInstance().getWorkflowPackage(); // Send notification sendWorkflowAssignedNotificationEMail(taskId, title, description, dueDate, priority, workflowPackage, assignedAuthorites, pooled); }
WorkflowTask taskToUpdate = workflowService.getTaskById(taskId); if (isInitiatorOrAssignee(taskToUpdate, currentUser))
WorkflowTask taskToUpdate = workflowService.getTaskById(taskId); if (isInitiatorOrAssignee(taskToUpdate, currentUser))
when(service.getTaskById(anyString())).thenAnswer(new Answer<WorkflowTask>()
private void checkSaveTask(String defName) { WorkflowTask task = getWorkflowTask(defName); QName descName = WorkflowModel.PROP_DESCRIPTION; Serializable initialDesc = task.getProperties().get(descName); String testDesc = "Foo-Bar-Test-String"; assertFalse(testDesc.equals(initialDesc)); Item item = new Item("task", task.getId()); FormData data = new FormData(); String descFieldName = FormFieldConstants.PROP_DATA_PREFIX + descName.toPrefixString(namespaceService).replace(":", "_"); data.addFieldData(descFieldName, testDesc, true); formService.saveForm(item, data); WorkflowTask newTask = workflowService.getTaskById(task.getId()); assertEquals(testDesc, newTask.getProperties().get(descName)); }
/** * Test for MNT-11247 */ @Test public void testAssignmentListener() { WorkflowDefinition definition = deployDefinition(getAssignmentListenerDefinitionPath()); Map<QName, Serializable> params = new HashMap<QName, Serializable>(); params.put(ContentModel.PROP_OWNER, USER1); NodeRef assignee = personManager.get(USER1); params.put(WorkflowModel.ASSOC_ASSIGNEE, assignee); WorkflowPath path = workflowService.startWorkflow(definition.getId(), params); // end start task List<WorkflowTask> tasks = workflowService.getTasksForWorkflowPath(path.getId()); workflowService.endTask(tasks.get(0).getId(), null); // end user task 1 tasks = workflowService.getTasksForWorkflowPath(path.getId()); workflowService.updateTask(tasks.get(0).getId(), params, null, null); workflowService.endTask(tasks.get(0).getId(), null); WorkflowTask result = workflowService.getTaskById(tasks.get(0).getId()); Map<QName, Serializable> props = result.getProperties(); Double create1 = (Double) props.get(QName.createQName("http://www.alfresco.org/model/bpm/1.0", "create1")); assertEquals("Create listener was not triggered", new Double(1), create1); Double complete1 = (Double) props.get(QName.createQName("http://www.alfresco.org/model/bpm/1.0", "complete1")); assertEquals("Complete listener was not triggered", new Double(1), complete1); Double assignment1 = (Double) props.get(QName.createQName("http://www.alfresco.org/model/bpm/1.0", "assignment1")); assertEquals("Assign listener was not triggered", new Double(1), assignment1); }
private void checkTransitionTask(String defName, String transitionId, String expOutcome) { WorkflowTask task = getWorkflowTask(defName); QName descName = WorkflowModel.PROP_DESCRIPTION; Serializable initialDesc = task.getProperties().get(descName); String testDesc = "Foo-Bar-Test-String"; assertFalse(testDesc.equals(initialDesc)); Item item = new Item("task", task.getId()); FormData data = new FormData(); String descFieldName = FormFieldConstants.PROP_DATA_PREFIX + descName.toPrefixString(namespaceService).replace(":", "_"); data.addFieldData(descFieldName, testDesc, true); String reviewOutcomeFieldName = FormFieldConstants.PROP_DATA_PREFIX + "wf_reviewOutcome"; data.addFieldData(reviewOutcomeFieldName, "Approve", true); String transitionDataKey = FormFieldConstants.PROP_DATA_PREFIX + TransitionFieldProcessor.KEY; data.addFieldData(transitionDataKey, transitionId); formService.saveForm(item, data); WorkflowTask newTask = workflowService.getTaskById(task.getId()); assertEquals("The description should have been updated!", testDesc, newTask.getProperties().get(descName)); // Check the task is completed assertEquals("The task should have been completed!", WorkflowTaskState.COMPLETED, newTask.getState()); Serializable outcome = newTask.getProperties().get(WorkflowModel.PROP_OUTCOME); assertEquals("The transition is wrong!", expOutcome, outcome); }
WorkflowTask task = workflowService.getTaskById(startTask.getId()); Map<QName, Serializable> props = task.getProperties(); assertEquals(dueDate, props.get(WorkflowModel.PROP_DUE_DATE));
WorkflowTask task = workflowService.getTaskById(taskId); String taskComment = (String)task.getProperties().get(WorkflowModel.PROP_COMMENT); assertEquals(comment, taskComment);
startTask = workflowService.getTaskById(startTask.getId()); assertNotNull(startTask); workflowService.getTaskById(startTask.getId()); fail("AccessDeniedException expected");
startTask = workflowService.getTaskById(startTaskId); assertNotNull(startTask); assertEquals(startTask.getState(), WorkflowTaskState.COMPLETED);