本文整理汇总了Java中org.activiti.engine.task.Task.setOwner方法的典型用法代码示例。如果您正苦于以下问题:Java Task.setOwner方法的具体用法?Java Task.setOwner怎么用?Java Task.setOwner使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.activiti.engine.task.Task
的用法示例。
在下文中一共展示了Task.setOwner方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleFormSubmit
import org.activiti.engine.task.Task; //导入方法依赖的package包/类
protected void handleFormSubmit() {
try {
// Check for errors
form.commit(); // will throw exception in case validation is false
// Create task
Task task = taskService.newTask();
task.setName(nameField.getValue().toString());
task.setDescription(descriptionArea.getValue().toString());
task.setDueDate((Date) dueDateField.getValue());
task.setPriority(priorityComboBox.getPriority());
task.setOwner(ExplorerApp.get().getLoggedInUser().getId());
taskService.saveTask(task);
// close popup and navigate to new group
close();
ExplorerApp.get().getViewManager().showTasksPage(task.getId());
} catch (InvalidValueException e) {
// Do nothing: the Form component will render the errormsgs automatically
setHeight(350, UNITS_PIXELS);
}
}
示例2: testTaskOwner
import org.activiti.engine.task.Task; //导入方法依赖的package包/类
public void testTaskOwner() {
Task task = taskService.newTask();
task.setOwner("johndoe");
taskService.saveTask(task);
// Fetch the task again and update
task = taskService.createTaskQuery().taskId(task.getId()).singleResult();
assertEquals("johndoe", task.getOwner());
task.setOwner("joesmoe");
taskService.saveTask(task);
task = taskService.createTaskQuery().taskId(task.getId()).singleResult();
assertEquals("joesmoe", task.getOwner());
// Finally, delete task
taskService.deleteTask(task.getId(), true);
}
示例3: testTaskDelegationThroughServiceCall
import org.activiti.engine.task.Task; //导入方法依赖的package包/类
public void testTaskDelegationThroughServiceCall() {
Task task = taskService.newTask();
task.setOwner("johndoe");
taskService.saveTask(task);
String taskId = task.getId();
// Fetch the task again and update
task = taskService.createTaskQuery().taskId(taskId).singleResult();
taskService.delegateTask(taskId, "joesmoe");
task = taskService.createTaskQuery().taskId(taskId).singleResult();
assertEquals("johndoe", task.getOwner());
assertEquals("joesmoe", task.getAssignee());
assertEquals(DelegationState.PENDING, task.getDelegationState());
taskService.resolveTask(taskId);
task = taskService.createTaskQuery().taskId(taskId).singleResult();
assertEquals("johndoe", task.getOwner());
assertEquals("johndoe", task.getAssignee());
assertEquals(DelegationState.RESOLVED, task.getDelegationState());
// Finally, delete task
taskService.deleteTask(taskId, true);
}
示例4: addTask
import org.activiti.engine.task.Task; //导入方法依赖的package包/类
protected Task addTask(String name, int priority) {
TaskService taskService = processEngine.getTaskService();
Task task = taskService.newTask();
task.setName(name);
task.setPriority(priority);
task.setAssignee("john");
task.setCategory("testCategory");
task.setDueDate(new Date());
task.setOwner("jane");
task.setDescription("testDescription");
task.setTenantId("testTenant");
taskService.saveTask(task);
return task;
}
示例5: changeTaskProperty
import org.activiti.engine.task.Task; //导入方法依赖的package包/类
/**
* 更改任务属性
*
* @throws ParseException
*/
@RequestMapping("task/property/{taskId}")
@ResponseBody
public String changeTaskProperty(@PathVariable("taskId") String taskId, @RequestParam("propertyName") String propertyName, @RequestParam("value") String value)
throws ParseException {
Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
// 更改到期日
if (StringUtils.equals(propertyName, "dueDate")) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Date parse = sdf.parse(value);
task.setDueDate(parse);
taskService.saveTask(task);
} else if (StringUtils.equals(propertyName, "priority")) {
// 更改任务优先级
task.setPriority(Integer.parseInt(value));
taskService.saveTask(task);
} else if (StringUtils.equals(propertyName, "owner")) {
// 更改拥有人
task.setOwner(value);
taskService.saveTask(task);
} else if (StringUtils.equals(propertyName, "assignee")) {
// 更改办理人
task.setAssignee(value);
taskService.saveTask(task);
} else {
return "不支持[" + propertyName + "]属性!";
}
return "success";
}
示例6: 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;
}
示例7: testTaskComments
import org.activiti.engine.task.Task; //导入方法依赖的package包/类
public void testTaskComments() {
int historyLevel = processEngineConfiguration.getHistoryLevel();
if (historyLevel>ProcessEngineConfigurationImpl.HISTORYLEVEL_NONE) {
Task task = taskService.newTask();
task.setOwner("johndoe");
taskService.saveTask(task);
String taskId = task.getId();
identityService.setAuthenticatedUserId("johndoe");
// Fetch the task again and update
taskService.addComment(taskId, null, "look at this \n isn't this great? slkdjf sldkfjs ldkfjs ldkfjs ldkfj sldkfj sldkfj sldkjg laksfg sdfgsd;flgkj ksajdhf skjdfh ksjdhf skjdhf kalskjgh lskh dfialurhg kajsh dfuieqpgkja rzvkfnjviuqerhogiuvysbegkjz lkhf ais liasduh flaisduh ajiasudh vaisudhv nsfd");
Comment comment = taskService.getTaskComments(taskId).get(0);
assertEquals("johndoe", comment.getUserId());
assertEquals(taskId, comment.getTaskId());
assertNull(comment.getProcessInstanceId());
assertEquals("look at this isn't this great? slkdjf sldkfjs ldkfjs ldkfjs ldkfj sldkfj sldkfj sldkjg laksfg sdfgsd;flgkj ksajdhf skjdfh ksjdhf skjdhf kalskjgh lskh dfialurhg ...", ((Event)comment).getMessage());
assertEquals("look at this \n isn't this great? slkdjf sldkfjs ldkfjs ldkfjs ldkfj sldkfj sldkfj sldkjg laksfg sdfgsd;flgkj ksajdhf skjdfh ksjdhf skjdhf kalskjgh lskh dfialurhg kajsh dfuieqpgkja rzvkfnjviuqerhogiuvysbegkjz lkhf ais liasduh flaisduh ajiasudh vaisudhv nsfd", comment.getFullMessage());
assertNotNull(comment.getTime());
taskService.addComment(taskId, "pid", "one");
taskService.addComment(taskId, "pid", "two");
Set<String> expectedComments = new HashSet<String>();
expectedComments.add("one");
expectedComments.add("two");
Set<String> comments = new HashSet<String>();
for (Comment cmt: taskService.getProcessInstanceComments("pid")) {
comments.add(cmt.getFullMessage());
}
assertEquals(expectedComments, comments);
// Finally, delete task
taskService.deleteTask(taskId, true);
}
}
示例8: testTaskAttachments
import org.activiti.engine.task.Task; //导入方法依赖的package包/类
public void testTaskAttachments() {
int historyLevel = processEngineConfiguration.getHistoryLevel();
if (historyLevel>ProcessEngineConfigurationImpl.HISTORYLEVEL_NONE) {
Task task = taskService.newTask();
task.setOwner("johndoe");
taskService.saveTask(task);
String taskId = task.getId();
identityService.setAuthenticatedUserId("johndoe");
// Fetch the task again and update
taskService.createAttachment("web page", taskId, "someprocessinstanceid", "weatherforcast", "temperatures and more", "http://weather.com");
Attachment attachment = taskService.getTaskAttachments(taskId).get(0);
assertEquals("weatherforcast", attachment.getName());
assertEquals("temperatures and more", attachment.getDescription());
assertEquals("web page", attachment.getType());
assertEquals(taskId, attachment.getTaskId());
assertEquals("someprocessinstanceid", attachment.getProcessInstanceId());
assertEquals("http://weather.com", attachment.getUrl());
assertNull(taskService.getAttachmentContent(attachment.getId()));
// Finally, clean up
taskService.deleteTask(taskId);
assertEquals(0, taskService.getTaskComments(taskId).size());
assertEquals(1, historyService.createHistoricTaskInstanceQuery().taskId(taskId).list().size());
taskService.deleteTask(taskId, true);
}
}
示例9: testTaskDelegation
import org.activiti.engine.task.Task; //导入方法依赖的package包/类
public void testTaskDelegation() {
Task task = taskService.newTask();
task.setOwner("johndoe");
task.delegate("joesmoe");
taskService.saveTask(task);
String taskId = task.getId();
task = taskService.createTaskQuery().taskId(taskId).singleResult();
assertEquals("johndoe", task.getOwner());
assertEquals("joesmoe", task.getAssignee());
assertEquals(DelegationState.PENDING, task.getDelegationState());
taskService.resolveTask(taskId);
task = taskService.createTaskQuery().taskId(taskId).singleResult();
assertEquals("johndoe", task.getOwner());
assertEquals("johndoe", task.getAssignee());
assertEquals(DelegationState.RESOLVED, task.getDelegationState());
task.setAssignee(null);
task.setDelegationState(null);
taskService.saveTask(task);
task = taskService.createTaskQuery().taskId(taskId).singleResult();
assertEquals("johndoe", task.getOwner());
assertNull(task.getAssignee());
assertNull(task.getDelegationState());
task.setAssignee("jackblack");
task.setDelegationState(DelegationState.RESOLVED);
taskService.saveTask(task);
task = taskService.createTaskQuery().taskId(taskId).singleResult();
assertEquals("johndoe", task.getOwner());
assertEquals("jackblack", task.getAssignee());
assertEquals(DelegationState.RESOLVED, task.getDelegationState());
// Finally, delete task
taskService.deleteTask(taskId, true);
}
示例10: testSaveTaskUpdate
import org.activiti.engine.task.Task; //导入方法依赖的package包/类
public void testSaveTaskUpdate() throws Exception{
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss");
Task task = taskService.newTask();
task.setDescription("description");
task.setName("taskname");
task.setPriority(0);
task.setAssignee("taskassignee");
task.setOwner("taskowner");
Date dueDate = sdf.parse("01/02/2003 04:05:06");
task.setDueDate(dueDate);
taskService.saveTask(task);
// Fetch the task again and update
task = taskService.createTaskQuery().taskId(task.getId()).singleResult();
assertEquals("description", task.getDescription());
assertEquals("taskname", task.getName());
assertEquals("taskassignee", task.getAssignee());
assertEquals("taskowner", task.getOwner());
assertEquals(dueDate, task.getDueDate());
assertEquals(0, task.getPriority());
task.setName("updatedtaskname");
task.setDescription("updateddescription");
task.setPriority(1);
task.setAssignee("updatedassignee");
task.setOwner("updatedowner");
dueDate = sdf.parse("01/02/2003 04:05:06");
task.setDueDate(dueDate);
taskService.saveTask(task);
task = taskService.createTaskQuery().taskId(task.getId()).singleResult();
assertEquals("updatedtaskname", task.getName());
assertEquals("updateddescription", task.getDescription());
assertEquals("updatedassignee", task.getAssignee());
assertEquals("updatedowner", task.getOwner());
assertEquals(dueDate, task.getDueDate());
assertEquals(1, task.getPriority());
if (processEngineConfiguration.getHistoryLevel()>=ProcessEngineConfigurationImpl.HISTORYLEVEL_AUDIT) {
HistoricTaskInstance historicTaskInstance = historyService
.createHistoricTaskInstanceQuery()
.taskId(task.getId())
.singleResult();
assertEquals("updatedtaskname", historicTaskInstance.getName());
assertEquals("updateddescription", historicTaskInstance.getDescription());
assertEquals("updatedassignee", historicTaskInstance.getAssignee());
assertEquals("updatedowner", historicTaskInstance.getOwner());
assertEquals(dueDate, historicTaskInstance.getDueDate());
assertEquals(1, historicTaskInstance.getPriority());
}
// Finally, delete task
taskService.deleteTask(task.getId(), true);
}