本文整理汇总了Java中org.activiti.engine.task.Task.setParentTaskId方法的典型用法代码示例。如果您正苦于以下问题:Java Task.setParentTaskId方法的具体用法?Java Task.setParentTaskId怎么用?Java Task.setParentTaskId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.activiti.engine.task.Task
的用法示例。
在下文中一共展示了Task.setParentTaskId方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addSubTask
import org.activiti.engine.task.Task; //导入方法依赖的package包/类
/**
* 添加子任务
*/
@RequestMapping("task/subtask/add/{taskId}")
public String addSubTask(@PathVariable("taskId") String parentTaskId, @RequestParam("taskName") String taskName,
@RequestParam(value = "description", required = false) String description, HttpSession session) {
Task newTask = taskService.newTask();
newTask.setParentTaskId(parentTaskId);
String userId = UserUtil.getUserFromSession(session).getId();
newTask.setOwner(userId);
newTask.setAssignee(userId);
newTask.setName(taskName);
newTask.setDescription(description);
taskService.saveTask(newTask);
return "redirect:/chapter6/task/getform/" + parentTaskId;
}
示例2: testSubTask
import org.activiti.engine.task.Task; //导入方法依赖的package包/类
public void testSubTask() {
Task gonzoTask = taskService.newTask();
gonzoTask.setName("gonzoTask");
taskService.saveTask(gonzoTask);
Task subTaskOne = taskService.newTask();
subTaskOne.setName("subtask one");
String gonzoTaskId = gonzoTask.getId();
subTaskOne.setParentTaskId(gonzoTaskId);
taskService.saveTask(subTaskOne);
Task subTaskTwo = taskService.newTask();
subTaskTwo.setName("subtask two");
subTaskTwo.setParentTaskId(gonzoTaskId);
taskService.saveTask(subTaskTwo);
String subTaskId = subTaskOne.getId();
assertTrue(taskService.getSubTasks(subTaskId).isEmpty());
assertTrue(historyService
.createHistoricTaskInstanceQuery()
.taskParentTaskId(subTaskId)
.list()
.isEmpty());
List<Task> subTasks = taskService.getSubTasks(gonzoTaskId);
Set<String> subTaskNames = new HashSet<String>();
for (Task subTask: subTasks) {
subTaskNames.add(subTask.getName());
}
if (processEngineConfiguration.getHistoryLevel()>=ProcessEngineConfigurationImpl.HISTORYLEVEL_AUDIT) {
Set<String> expectedSubTaskNames = new HashSet<String>();
expectedSubTaskNames.add("subtask one");
expectedSubTaskNames.add("subtask two");
assertEquals(expectedSubTaskNames, subTaskNames);
List<HistoricTaskInstance> historicSubTasks = historyService
.createHistoricTaskInstanceQuery()
.taskParentTaskId(gonzoTaskId)
.list();
subTaskNames = new HashSet<String>();
for (HistoricTaskInstance historicSubTask: historicSubTasks) {
subTaskNames.add(historicSubTask.getName());
}
assertEquals(expectedSubTaskNames, subTaskNames);
}
taskService.deleteTask(gonzoTaskId, true);
}