本文整理汇总了Java中org.activiti.engine.task.Task.setDueDate方法的典型用法代码示例。如果您正苦于以下问题:Java Task.setDueDate方法的具体用法?Java Task.setDueDate怎么用?Java Task.setDueDate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.activiti.engine.task.Task
的用法示例。
在下文中一共展示了Task.setDueDate方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: testTaskDueDate
import org.activiti.engine.task.Task; //导入方法依赖的package包/类
@Deployment(resources={"org/activiti/engine/test/api/task/TaskQueryTest.testProcessDefinition.bpmn20.xml"})
public void testTaskDueDate() throws Exception {
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("oneTaskProcess");
Task task = taskService.createTaskQuery().processInstanceId(processInstance.getId()).singleResult();
// Set due-date on task
Date dueDate = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss").parse("01/02/2003 01:12:13");
task.setDueDate(dueDate);
taskService.saveTask(task);
assertEquals(1, taskService.createTaskQuery().dueDate(dueDate).count());
Calendar otherDate = Calendar.getInstance();
otherDate.add(Calendar.YEAR, 1);
assertEquals(0, taskService.createTaskQuery().dueDate(otherDate.getTime()).count());
Calendar priorDate = Calendar.getInstance();
priorDate.setTime(dueDate);
priorDate.roll(Calendar.YEAR, -1);
assertEquals(1, taskService.createTaskQuery().dueAfter(priorDate.getTime())
.count());
assertEquals(1, taskService.createTaskQuery()
.dueBefore(otherDate.getTime()).count());
}
示例3: handleTaskProperty
import org.activiti.engine.task.Task; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
protected Object handleTaskProperty(Task task, TypeDefinition type, QName key, Serializable value)
{
checkType(key, value, Date.class);
task.setDueDate((Date) value);
return DO_NOT_ADD;
}
示例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: testTaskDueBefore
import org.activiti.engine.task.Task; //导入方法依赖的package包/类
@Deployment(resources={"org/activiti/engine/test/api/task/TaskQueryTest.testProcessDefinition.bpmn20.xml"})
public void testTaskDueBefore() throws Exception {
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("oneTaskProcess");
Task task = taskService.createTaskQuery().processInstanceId(processInstance.getId()).singleResult();
// Set due-date on task
Calendar dueDateCal = Calendar.getInstance();
task.setDueDate(dueDateCal.getTime());
taskService.saveTask(task);
Calendar oneHourAgo = Calendar.getInstance();
oneHourAgo.setTime(dueDateCal.getTime());
oneHourAgo.add(Calendar.HOUR, -1);
Calendar oneHourLater = Calendar.getInstance();
oneHourLater.setTime(dueDateCal.getTime());
oneHourLater.add(Calendar.HOUR, 1);
assertEquals(1, taskService.createTaskQuery().dueBefore(oneHourLater.getTime()).count());
assertEquals(0, taskService.createTaskQuery().dueBefore(oneHourAgo.getTime()).count());
// Update due-date to null, shouldn't show up anymore in query that matched before
task = taskService.createTaskQuery().processInstanceId(processInstance.getId()).singleResult();
task.setDueDate(null);
taskService.saveTask(task);
assertEquals(0, taskService.createTaskQuery().dueBefore(oneHourLater.getTime()).count());
assertEquals(0, taskService.createTaskQuery().dueBefore(oneHourAgo.getTime()).count());
}
示例7: testTaskDueAfter
import org.activiti.engine.task.Task; //导入方法依赖的package包/类
@Deployment(resources={"org/activiti/engine/test/api/task/TaskQueryTest.testProcessDefinition.bpmn20.xml"})
public void testTaskDueAfter() throws Exception {
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("oneTaskProcess");
Task task = taskService.createTaskQuery().processInstanceId(processInstance.getId()).singleResult();
// Set due-date on task
Calendar dueDateCal = Calendar.getInstance();
task.setDueDate(dueDateCal.getTime());
taskService.saveTask(task);
Calendar oneHourAgo = Calendar.getInstance();
oneHourAgo.setTime(dueDateCal.getTime());
oneHourAgo.add(Calendar.HOUR, -1);
Calendar oneHourLater = Calendar.getInstance();
oneHourLater.setTime(dueDateCal.getTime());
oneHourLater.add(Calendar.HOUR, 1);
assertEquals(1, taskService.createTaskQuery().dueAfter(oneHourAgo.getTime()).count());
assertEquals(0, taskService.createTaskQuery().dueAfter(oneHourLater.getTime()).count());
// Update due-date to null, shouldn't show up anymore in query that matched before
task = taskService.createTaskQuery().processInstanceId(processInstance.getId()).singleResult();
task.setDueDate(null);
taskService.saveTask(task);
assertEquals(0, taskService.createTaskQuery().dueAfter(oneHourLater.getTime()).count());
assertEquals(0, taskService.createTaskQuery().dueAfter(oneHourAgo.getTime()).count());
}
示例8: 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);
}
示例9: testHistoricTaskInstance
import org.activiti.engine.task.Task; //导入方法依赖的package包/类
@Deployment
public void testHistoricTaskInstance() throws Exception {
String processInstanceId = runtimeService.startProcessInstanceByKey("HistoricTaskInstanceTest").getId();
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss");
// Set priority to non-default value
Task runtimeTask = taskService.createTaskQuery().processInstanceId(processInstanceId).singleResult();
runtimeTask.setPriority(1234);
// Set due-date
Date dueDate = sdf.parse("01/02/2003 04:05:06");
runtimeTask.setDueDate(dueDate);
taskService.saveTask(runtimeTask);
String taskId = runtimeTask.getId();
String taskDefinitionKey = runtimeTask.getTaskDefinitionKey();
HistoricTaskInstance historicTaskInstance = historyService.createHistoricTaskInstanceQuery().singleResult();
assertEquals(taskId, historicTaskInstance.getId());
assertEquals(1234, historicTaskInstance.getPriority());
assertEquals("Clean up", historicTaskInstance.getName());
assertEquals("Schedule an engineering meeting for next week with the new hire.", historicTaskInstance.getDescription());
assertEquals(dueDate, historicTaskInstance.getDueDate());
assertEquals("kermit", historicTaskInstance.getAssignee());
assertEquals(taskDefinitionKey, historicTaskInstance.getTaskDefinitionKey());
assertNull(historicTaskInstance.getEndTime());
assertNull(historicTaskInstance.getDurationInMillis());
runtimeService.setVariable(processInstanceId, "deadline", "yesterday");
taskService.complete(taskId);
assertEquals(1, historyService.createHistoricTaskInstanceQuery().count());
historicTaskInstance = historyService.createHistoricTaskInstanceQuery().singleResult();
assertEquals(taskId, historicTaskInstance.getId());
assertEquals(1234, historicTaskInstance.getPriority());
assertEquals("Clean up", historicTaskInstance.getName());
assertEquals("Schedule an engineering meeting for next week with the new hire.", historicTaskInstance.getDescription());
assertEquals(dueDate, historicTaskInstance.getDueDate());
assertEquals("kermit", historicTaskInstance.getAssignee());
assertEquals(TaskEntity.DELETE_REASON_COMPLETED, historicTaskInstance.getDeleteReason());
assertEquals(taskDefinitionKey, historicTaskInstance.getTaskDefinitionKey());
assertNotNull(historicTaskInstance.getEndTime());
assertNotNull(historicTaskInstance.getDurationInMillis());
historyService.deleteHistoricTaskInstance(taskId);
assertEquals(0, historyService.createHistoricTaskInstanceQuery().count());
}