/** * Gets the value of the <code>id</code> property * * @return the id */ public String getId() { return task.getId(); }
/** * Gets the value of the <code>id</code> property * * @return the id */ public String getId() { return task.getId(); }
/** * {@inheritDoc} */ @Override protected String getItemURI(WorkflowTask item) { return "api/task-instances/" + item.getId(); }
/** * {@inheritDoc} */ @Override protected String getItemURI(WorkflowTask item) { return "api/task-instances/" + item.getId(); }
List<WorkflowTask> tasks = workflowService.getTasksForWorkflowPath(startTask.getPath().getId()); if(tasks.size()==1) { WorkflowTask task = tasks.get(0); if(taskTypeMatches(task, taskTypes)) { if(properties != null) { workflowService.updateTask(task.getId(), properties, null, null); } workflowService.endTask(task.getId(), transition); return; } }
/** * End the task * * @param transitionId * transition to end the task for */ public void endTask(String transitionId) { workflowService.endTask(task.getId(), transitionId); }
/** * End the task * * @param transitionId * transition to end the task for */ public void endTask(String transitionId) { workflowService.endTask(task.getId(), transitionId); }
private boolean isStartTaskOfProcessInvolvedIn(WorkflowTask wt, String userName) { return wt.getId().contains(ActivitiConstants.START_TASK_PREFIX) && isUserPartOfProcess(wt, userName); }
private boolean isStartTaskOfProcessInvolvedIn(WorkflowTask wt, String userName) { return wt.getId().contains(ActivitiConstants.START_TASK_PREFIX) && isUserPartOfProcess(wt, userName); }
/** * @param task WorkflowTask * @return Object */ private Object getPackageItemValues(WorkflowTask task) { List<NodeRef> items = workflowService.getPackageContents(task.getId()); ArrayList<String> results = new ArrayList<String>(items.size()); for (NodeRef item : items) { results.add(item.toString()); } return results; }
/** * @param task WorkflowTask * @return Object */ private Object getPackageItemValues(WorkflowTask task) { List<NodeRef> items = workflowService.getPackageContents(task.getId()); ArrayList<String> results = new ArrayList<String>(items.size()); for (NodeRef item : items) { results.add(item.toString()); } return results; }
/** * Sets the properties on the underlying {@link WorkflowTask}. * * @param properties * the properties to set */ public void setProperties(ScriptableQNameMap<String, Serializable> properties) { Map<QName, Serializable> qNameProps = properties.getMapOfQNames(); this.task = workflowService.updateTask(task.getId(), qNameProps, null, null); }
/** * Sets the properties on the underlying {@link WorkflowTask}. * * @param properties * the properties to set */ public void setProperties(ScriptableQNameMap<String, Serializable> properties) { Map<QName, Serializable> qNameProps = properties.getMapOfQNames(); this.task = workflowService.updateTask(task.getId(), qNameProps, null, null); }
private void signalStartTask(WorkflowPath path) { List<WorkflowTask> tasks = workflowService.getTasksForWorkflowPath(path.getId()); if (tasks.size() == 1) { WorkflowTask startTask = tasks.get(0); workflowService.endTask(startTask.getId(), null); } else { throw new WorkflowException("Start task not found! Expected 1 task but found: " + tasks.size()); } } }
protected void checkTaskQueryTaskCompleted(String workflowInstanceId, WorkflowTask theTask, WorkflowTask startTask) { List<String> expectedTasks = Arrays.asList(theTask.getId(), startTask.getId()); checkProcessIdQuery(workflowInstanceId, expectedTasks, WorkflowTaskState.COMPLETED); // Adhoc task should only be returned QName taskName = QName.createQName(NamespaceService.WORKFLOW_MODEL_1_0_URI, "adhocTask"); checkTaskNameQuery(taskName, Arrays.asList(theTask.getId()), WorkflowTaskState.COMPLETED, workflowInstanceId); // Completed adhocTask is assigned to USER2 checkActorIdQuery(USER2, Arrays.asList(theTask.getId()), WorkflowTaskState.COMPLETED, null); // Workflow is still active, both tasks will be returned checkIsActiveQuery(expectedTasks, WorkflowTaskState.COMPLETED, workflowInstanceId); // Both tasks have custom property set checkTaskPropsQuery(expectedTasks, WorkflowTaskState.COMPLETED, null); }
protected void checkTasksFoundUsingQuery(List<String> taskIds, WorkflowTaskQuery workflowTaskQuery) { List<WorkflowTask> tasks = workflowService.queryTasks(workflowTaskQuery); assertNotNull(tasks); assertEquals(taskIds.size(), tasks.size()); for (WorkflowTask task : tasks) { assertTrue(taskIds.contains(task.getId())); } }
private void assertTaskPresent(WorkflowTaskQuery taskQuery, String taskId) { List<WorkflowTask> tasks = workflowEngine.queryTasks(taskQuery); Assert.assertNotNull(tasks); Assert.assertEquals(1, tasks.size()); Assert.assertEquals(taskId, tasks.get(0).getId()); }
protected void checkTaskQueryStartTaskCompleted(String workflowInstanceId, WorkflowTask startTask) { List<String> expectedTasks = Arrays.asList(startTask.getId()); checkProcessIdQuery(workflowInstanceId, expectedTasks, WorkflowTaskState.COMPLETED); checkTaskIdQuery(startTask.getId(), WorkflowTaskState.COMPLETED); QName startTaskName = QName.createQName(NamespaceService.WORKFLOW_MODEL_1_0_URI, "submitAdhocTask"); checkTaskNameQuery(startTaskName, expectedTasks, WorkflowTaskState.COMPLETED, null); checkActorIdQuery(USER1, expectedTasks, WorkflowTaskState.COMPLETED, null); checkIsActiveQuery(expectedTasks, WorkflowTaskState.COMPLETED, workflowInstanceId); checkTaskPropsQuery(expectedTasks, WorkflowTaskState.COMPLETED, null); }
@Override protected void checkTaskQueryStartTaskCompleted(String workflowInstanceId, WorkflowTask startTask) { // In activiti, start-tasks only show up when the taskId or workflowInstanceId is passed in. List<String> expectedTasks = Arrays.asList(startTask.getId()); checkProcessIdQuery(workflowInstanceId, expectedTasks, WorkflowTaskState.COMPLETED); checkTaskIdQuery(startTask.getId(), WorkflowTaskState.COMPLETED); // Check additional filtering, when workflowInstanceId is passed QName startTaskName = QName.createQName(NamespaceService.WORKFLOW_MODEL_1_0_URI, "submitAdhocTask"); checkTaskNameQuery(startTaskName, expectedTasks, WorkflowTaskState.COMPLETED, workflowInstanceId); checkActorIdQuery(USER1, expectedTasks, WorkflowTaskState.COMPLETED, workflowInstanceId); checkIsActiveQuery(expectedTasks, WorkflowTaskState.COMPLETED, workflowInstanceId); checkTaskPropsQuery(expectedTasks, WorkflowTaskState.COMPLETED, workflowInstanceId); }
protected void checkTaskQueryInProgress(String workflowInstanceId, WorkflowTask expectedTask, String workflowInstanceId2) { List<String> expectedTasks = Arrays.asList(expectedTask.getId()); checkProcessIdQuery(workflowInstanceId, expectedTasks, WorkflowTaskState.IN_PROGRESS); checkTaskIdQuery(expectedTask.getId(), WorkflowTaskState.IN_PROGRESS); QName taskName = QName.createQName(NamespaceService.WORKFLOW_MODEL_1_0_URI, "adhocTask"); checkTaskNameQuery(taskName, expectedTasks, WorkflowTaskState.IN_PROGRESS, null); checkActorIdQuery(USER2, expectedTasks, WorkflowTaskState.IN_PROGRESS, null); checkIsActiveQuery(expectedTasks, WorkflowTaskState.IN_PROGRESS, workflowInstanceId); checkTaskPropsQuery(expectedTasks, WorkflowTaskState.IN_PROGRESS, null); checkProcessPropsQuery(expectedTasks, WorkflowTaskState.IN_PROGRESS); }