当前位置: 首页>>代码示例>>Java>>正文


Java Task.setDueDate方法代码示例

本文整理汇总了Java中org.camunda.bpm.engine.task.Task.setDueDate方法的典型用法代码示例。如果您正苦于以下问题:Java Task.setDueDate方法的具体用法?Java Task.setDueDate怎么用?Java Task.setDueDate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.camunda.bpm.engine.task.Task的用法示例。


在下文中一共展示了Task.setDueDate方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testTaskDueDate

import org.camunda.bpm.engine.task.Task; //导入方法依赖的package包/类
@Deployment(resources={"org/camunda/bpm/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());
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:26,代码来源:TaskQueryTest.java

示例2: testTaskDueDateCombinations

import org.camunda.bpm.engine.task.Task; //导入方法依赖的package包/类
@Deployment(resources={"org/camunda/bpm/engine/test/api/task/TaskQueryTest.testProcessDefinition.bpmn20.xml"})
public void testTaskDueDateCombinations() throws ParseException {
  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);

  Date oneHourAgo = new Date(dueDate.getTime() - 60 * 60 * 1000);
  Date oneHourLater = new Date(dueDate.getTime() + 60 * 60 * 1000);

  assertEquals(1, taskService.createTaskQuery()
      .dueAfter(oneHourAgo).dueDate(dueDate).dueBefore(oneHourLater).count());
  assertEquals(0, taskService.createTaskQuery()
      .dueAfter(oneHourLater).dueDate(dueDate).dueBefore(oneHourAgo).count());
  assertEquals(0, taskService.createTaskQuery()
      .dueAfter(oneHourLater).dueDate(dueDate).count());
  assertEquals(0, taskService.createTaskQuery()
      .dueDate(dueDate).dueBefore(oneHourAgo).count());
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:23,代码来源:TaskQueryTest.java

示例3: updateTask

import org.camunda.bpm.engine.task.Task; //导入方法依赖的package包/类
public void updateTask(Task task) {
  task.setName(getName());
  task.setDescription(getDescription());
  task.setPriority(getPriority());
  task.setAssignee(getAssignee());
  task.setOwner(getOwner());

  DelegationState state = null;
  if (getDelegationState() != null) {
    DelegationStateConverter converter = new DelegationStateConverter();
    state = converter.convertQueryParameterToType(getDelegationState());
  }
  task.setDelegationState(state);

  task.setDueDate(getDue());
  task.setFollowUpDate(getFollowUp());
  task.setParentTaskId(getParentTaskId());
  task.setCaseInstanceId(getCaseInstanceId());
  task.setTenantId(getTenantId());
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:21,代码来源:TaskDto.java

示例4: testTaskDueBefore

import org.camunda.bpm.engine.task.Task; //导入方法依赖的package包/类
@Deployment(resources={"org/camunda/bpm/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());
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:30,代码来源:TaskQueryTest.java

示例5: testTaskDueAfter

import org.camunda.bpm.engine.task.Task; //导入方法依赖的package包/类
@Deployment(resources={"org/camunda/bpm/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());
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:30,代码来源:TaskQueryTest.java

示例6: createTestTask

import org.camunda.bpm.engine.task.Task; //导入方法依赖的package包/类
protected Task createTestTask(String taskId) {
  Task task = taskService.newTask(taskId);
  task.setDueDate(task.getCreateTime());
  task.setFollowUpDate(task.getCreateTime());
  taskService.saveTask(task);
  return task;
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:8,代码来源:TaskQueryExpressionTest.java

示例7: createFollowUpAndDueDateTasks

import org.camunda.bpm.engine.task.Task; //导入方法依赖的package包/类
public HashMap<String, Date> createFollowUpAndDueDateTasks() throws ParseException {
  final Date date = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss").parse("27/07/2017 01:12:13"),
    oneHourAgo = new Date(date.getTime() - 60 * 60 * 1000),
    oneHourLater = new Date(date.getTime() + 60 * 60 * 1000);

  Task taskDueBefore = taskService.newTask();
  taskDueBefore.setFollowUpDate(new Date(oneHourAgo.getTime() - 1000));
  taskDueBefore.setDueDate(new Date(oneHourAgo.getTime() - 1000));
  taskService.saveTask(taskDueBefore);

  Task taskDueDate = taskService.newTask();
  taskDueDate.setFollowUpDate(date);
  taskDueDate.setDueDate(date);
  taskService.saveTask(taskDueDate);

  Task taskDueAfter = taskService.newTask();
  taskDueAfter.setFollowUpDate(new Date(oneHourLater.getTime() + 1000));
  taskDueAfter.setDueDate(new Date(oneHourLater.getTime() + 1000));
  taskService.saveTask(taskDueAfter);

  assertEquals(3, taskService.createTaskQuery().count());

  return new HashMap<String, Date>() {{
    put("date", date);
    put("oneHourAgo", oneHourAgo);
    put("oneHourLater", oneHourLater);
  }};
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:29,代码来源:TaskQueryOrTest.java

示例8: testQueryOr

import org.camunda.bpm.engine.task.Task; //导入方法依赖的package包/类
public void testQueryOr() {
  // given
  Date date = DateTimeUtil.now().plusDays(2).toDate();

  Task task1 = taskService.newTask();
  task1.setFollowUpDate(date);
  task1.setOwner("Luke Optim");
  task1.setName("taskForOr");
  taskService.saveTask(task1);

  Task task2 = taskService.newTask();
  task2.setDueDate(date);
  task2.setName("taskForOr");
  taskService.saveTask(task2);

  Task task3 = taskService.newTask();
  task3.setAssignee("John Munda");
  task3.setDueDate(date);
  task3.setName("taskForOr");
  taskService.saveTask(task3);

  Task task4 = taskService.newTask();
  task4.setName("taskForOr");
  taskService.saveTask(task4);

  // when
  List<Task> tasks = taskService.createTaskQuery()
    .taskName("taskForOr")
    .or()
      .followUpAfterExpression("${ now() }")
      .taskAssigneeLikeExpression("${ 'John%' }")
    .endOr()
    .or()
      .taskOwnerExpression("${ 'Luke Optim' }")
      .dueAfterExpression("${ now() }")
    .endOr()
    .list();

  // then
  assertEquals(2, tasks.size());
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:42,代码来源:TaskQueryExpressionTest.java

示例9: testHistoricTaskInstance

import org.camunda.bpm.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());

  assertNull(historicTaskInstance.getCaseDefinitionId());
  assertNull(historicTaskInstance.getCaseInstanceId());
  assertNull(historicTaskInstance.getCaseExecutionId());

  // the activity instance id is set
  assertEquals(((TaskEntity)runtimeTask).getExecution().getActivityInstanceId(), historicTaskInstance.getActivityInstanceId());

  runtimeService.setVariable(processInstanceId, "deadline", "yesterday");

  // move clock by 1 second
  Date now = ClockUtil.getCurrentTime();
  ClockUtil.setCurrentTime(new Date(now.getTime() + 1000));

  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());
  assertTrue(historicTaskInstance.getDurationInMillis() >= 1000);
  assertTrue(((HistoricTaskInstanceEntity)historicTaskInstance).getDurationRaw() >= 1000);

  assertNull(historicTaskInstance.getCaseDefinitionId());
  assertNull(historicTaskInstance.getCaseInstanceId());
  assertNull(historicTaskInstance.getCaseExecutionId());

  historyService.deleteHistoricTaskInstance(taskId);

  assertEquals(0, historyService.createHistoricTaskInstanceQuery().count());
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:69,代码来源:HistoricTaskInstanceTest.java


注:本文中的org.camunda.bpm.engine.task.Task.setDueDate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。