org.camunda.bpm.engine.task.Task.setFollowUpDate()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(17.7k)|赞(0)|评价(0)|浏览(102)

本文整理了Java中org.camunda.bpm.engine.task.Task.setFollowUpDate()方法的一些代码示例,展示了Task.setFollowUpDate()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Task.setFollowUpDate()方法的具体详情如下:
包路径:org.camunda.bpm.engine.task.Task
类名称:Task
方法名:setFollowUpDate

Task.setFollowUpDate介绍

[英]Change follow-up date of the task.
[中]更改任务的后续日期。

代码示例

代码示例来源:origin: camunda/camunda-bpm-platform

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);
 }};
}

代码示例来源:origin: camunda/camunda-bpm-platform

verify(newTask).setDelegationState(DelegationState.valueOf((String) json.get("delegationState")));
verify(newTask).setDueDate(any(Date.class));
verify(newTask).setFollowUpDate(any(Date.class));
verify(newTask).setParentTaskId((String) json.get("parentTaskId"));
verify(newTask).setCaseInstanceId((String) json.get("caseInstanceId"));

代码示例来源:origin: camunda/camunda-bpm-platform

verify(newTask).setDelegationState(null);
verify(newTask).setDueDate(any(Date.class));
verify(newTask).setFollowUpDate(null);
verify(newTask).setParentTaskId((String) json.get("parentTaskId"));
verify(newTask).setCaseInstanceId(null);

代码示例来源:origin: camunda/camunda-bpm-platform

verify(mockTask).setDelegationState(DelegationState.valueOf((String) json.get("delegationState")));
verify(mockTask).setDueDate(any(Date.class));
verify(mockTask).setFollowUpDate(any(Date.class));
verify(mockTask).setParentTaskId((String) json.get("parentTaskId"));
verify(mockTask).setCaseInstanceId((String) json.get("caseInstanceId"));

代码示例来源:origin: camunda/camunda-bpm-platform

verify(mockTask).setDelegationState(null);
verify(mockTask).setDueDate(any(Date.class));
verify(mockTask).setFollowUpDate(null);
verify(mockTask).setParentTaskId((String) json.get("parentTaskId"));
verify(mockTask).setCaseInstanceId(null);

代码示例来源:origin: camunda/camunda-bpm-platform

protected Task createTestTask(String taskId) {
 Task task = taskService.newTask(taskId);
 task.setDueDate(task.getCreateTime());
 task.setFollowUpDate(task.getCreateTime());
 taskService.saveTask(task);
 return task;
}

代码示例来源:origin: camunda/camunda-bpm-platform

@Deployment(resources={"org/camunda/bpm/engine/test/api/task/TaskQueryTest.testProcessDefinition.bpmn20.xml"})
public void testFollowUpDateCombinations() throws ParseException {
 ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("oneTaskProcess");
 Task task = taskService.createTaskQuery().processInstanceId(processInstance.getId()).singleResult();
 // Set follow-up date on task
 Date dueDate = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss").parse("01/02/2003 01:12:13");
 task.setFollowUpDate(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()
   .followUpAfter(oneHourAgo).followUpDate(dueDate).followUpBefore(oneHourLater).count());
 assertEquals(0, taskService.createTaskQuery()
   .followUpAfter(oneHourLater).followUpDate(dueDate).followUpBefore(oneHourAgo).count());
 assertEquals(0, taskService.createTaskQuery()
   .followUpAfter(oneHourLater).followUpDate(dueDate).count());
 assertEquals(0, taskService.createTaskQuery()
   .followUpDate(dueDate).followUpBefore(oneHourAgo).count());
}

代码示例来源:origin: camunda/camunda-bpm-platform

@Deployment(resources={"org/camunda/bpm/engine/test/api/task/TaskQueryTest.testProcessDefinition.bpmn20.xml"})
public void testFollowUpDate() throws Exception {
 Calendar otherDate = Calendar.getInstance();
 ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("oneTaskProcess");
 // do not find any task instances with follow up date
 assertEquals(0, taskService.createTaskQuery().followUpDate(otherDate.getTime()).count());
 assertEquals(1, taskService.createTaskQuery().processInstanceId(processInstance.getId())
   // we might have tasks from other test cases - so we limit to the current PI
   .followUpBeforeOrNotExistent(otherDate.getTime()).count());
 Task task = taskService.createTaskQuery().processInstanceId(processInstance.getId()).singleResult();
 // set follow-up date on task
 Date followUpDate = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss").parse("01/02/2003 01:12:13");
 task.setFollowUpDate(followUpDate);
 taskService.saveTask(task);
 assertEquals(followUpDate, taskService.createTaskQuery().taskId(task.getId()).singleResult().getFollowUpDate());
 assertEquals(1, taskService.createTaskQuery().followUpDate(followUpDate).count());
 otherDate.setTime(followUpDate);
 otherDate.add(Calendar.YEAR, 1);
 assertEquals(0, taskService.createTaskQuery().followUpDate(otherDate.getTime()).count());
 assertEquals(1, taskService.createTaskQuery().followUpBefore(otherDate.getTime()).count());
 assertEquals(1, taskService.createTaskQuery().processInstanceId(processInstance.getId()) //
   .followUpBeforeOrNotExistent(otherDate.getTime()).count());
 assertEquals(0, taskService.createTaskQuery().followUpAfter(otherDate.getTime()).count());
 otherDate.add(Calendar.YEAR, -2);
 assertEquals(1, taskService.createTaskQuery().followUpAfter(otherDate.getTime()).count());
 assertEquals(0, taskService.createTaskQuery().followUpBefore(otherDate.getTime()).count());
 assertEquals(0, taskService.createTaskQuery().processInstanceId(processInstance.getId()) //
   .followUpBeforeOrNotExistent(otherDate.getTime()).count());
 taskService.complete(task.getId());
}

代码示例来源:origin: camunda/camunda-bpm-platform

@Deployment(resources={"org/camunda/bpm/engine/test/history/HistoricTaskInstanceTest.testHistoricTaskInstance.bpmn20.xml"})
public void testHistoricTaskInstanceQueryByFollowUpDate() throws Exception {
 Calendar otherDate = Calendar.getInstance();
 runtimeService.startProcessInstanceByKey("HistoricTaskInstanceTest");
 // do not find any task instances with follow up date
 assertEquals(0, taskService.createTaskQuery().followUpDate(otherDate.getTime()).count());
 Task task = taskService.createTaskQuery().singleResult();
 // set follow-up date on task
 Date followUpDate = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss").parse("01/02/2003 01:12:13");
 task.setFollowUpDate(followUpDate);
 taskService.saveTask(task);
 // test that follow-up date was written to historic database
 assertEquals(followUpDate, historyService.createHistoricTaskInstanceQuery().taskId(task.getId()).singleResult().getFollowUpDate());
 assertEquals(1, historyService.createHistoricTaskInstanceQuery().taskFollowUpDate(followUpDate).count());
 otherDate.setTime(followUpDate);
 otherDate.add(Calendar.YEAR, 1);
 assertEquals(0, historyService.createHistoricTaskInstanceQuery().taskFollowUpDate(otherDate.getTime()).count());
 assertEquals(1, historyService.createHistoricTaskInstanceQuery().taskFollowUpBefore(otherDate.getTime()).count());
 assertEquals(0, historyService.createHistoricTaskInstanceQuery().taskFollowUpAfter(otherDate.getTime()).count());
 assertEquals(0, historyService.createHistoricTaskInstanceQuery().taskFollowUpAfter(otherDate.getTime()).taskFollowUpDate(followUpDate).count());
 otherDate.add(Calendar.YEAR, -2);
 assertEquals(1, historyService.createHistoricTaskInstanceQuery().taskFollowUpAfter(otherDate.getTime()).count());
 assertEquals(0, historyService.createHistoricTaskInstanceQuery().taskFollowUpBefore(otherDate.getTime()).count());
 assertEquals(followUpDate, historyService.createHistoricTaskInstanceQuery().taskId(task.getId()).singleResult().getFollowUpDate());
 assertEquals(0, historyService.createHistoricTaskInstanceQuery().taskFollowUpBefore(otherDate.getTime()).taskFollowUpDate(followUpDate).count());
 taskService.complete(task.getId());
 assertEquals(followUpDate, historyService.createHistoricTaskInstanceQuery().taskId(task.getId()).singleResult().getFollowUpDate());
 assertEquals(1, historyService.createHistoricTaskInstanceQuery().taskFollowUpDate(followUpDate).count());
}

代码示例来源:origin: camunda/camunda-bpm-platform

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());
}

代码示例来源:origin: camunda/camunda-bpm-platform

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());
}

代码示例来源:origin: camunda/camunda-bpm-platform

task1.setFollowUpDate(date);
task1.setOwner("Luke Optim");
task1.setName("taskForOr");

代码示例来源:origin: org.camunda.bpm/camunda-engine

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);
 }};
}

代码示例来源:origin: org.camunda.bpm/camunda-engine

protected Task createTestTask(String taskId) {
 Task task = taskService.newTask(taskId);
 task.setDueDate(task.getCreateTime());
 task.setFollowUpDate(task.getCreateTime());
 taskService.saveTask(task);
 return task;
}

代码示例来源:origin: org.camunda.bpm/camunda-engine

@Deployment(resources={"org/camunda/bpm/engine/test/api/task/TaskQueryTest.testProcessDefinition.bpmn20.xml"})
public void testFollowUpDateCombinations() throws ParseException {
 ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("oneTaskProcess");
 Task task = taskService.createTaskQuery().processInstanceId(processInstance.getId()).singleResult();
 // Set follow-up date on task
 Date dueDate = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss").parse("01/02/2003 01:12:13");
 task.setFollowUpDate(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()
   .followUpAfter(oneHourAgo).followUpDate(dueDate).followUpBefore(oneHourLater).count());
 assertEquals(0, taskService.createTaskQuery()
   .followUpAfter(oneHourLater).followUpDate(dueDate).followUpBefore(oneHourAgo).count());
 assertEquals(0, taskService.createTaskQuery()
   .followUpAfter(oneHourLater).followUpDate(dueDate).count());
 assertEquals(0, taskService.createTaskQuery()
   .followUpDate(dueDate).followUpBefore(oneHourAgo).count());
}

代码示例来源:origin: org.camunda.bpm/camunda-engine

@Deployment(resources={"org/camunda/bpm/engine/test/api/task/TaskQueryTest.testProcessDefinition.bpmn20.xml"})
public void testFollowUpDate() throws Exception {
 Calendar otherDate = Calendar.getInstance();
 ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("oneTaskProcess");
 // do not find any task instances with follow up date
 assertEquals(0, taskService.createTaskQuery().followUpDate(otherDate.getTime()).count());
 assertEquals(1, taskService.createTaskQuery().processInstanceId(processInstance.getId())
   // we might have tasks from other test cases - so we limit to the current PI
   .followUpBeforeOrNotExistent(otherDate.getTime()).count());
 Task task = taskService.createTaskQuery().processInstanceId(processInstance.getId()).singleResult();
 // set follow-up date on task
 Date followUpDate = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss").parse("01/02/2003 01:12:13");
 task.setFollowUpDate(followUpDate);
 taskService.saveTask(task);
 assertEquals(followUpDate, taskService.createTaskQuery().taskId(task.getId()).singleResult().getFollowUpDate());
 assertEquals(1, taskService.createTaskQuery().followUpDate(followUpDate).count());
 otherDate.setTime(followUpDate);
 otherDate.add(Calendar.YEAR, 1);
 assertEquals(0, taskService.createTaskQuery().followUpDate(otherDate.getTime()).count());
 assertEquals(1, taskService.createTaskQuery().followUpBefore(otherDate.getTime()).count());
 assertEquals(1, taskService.createTaskQuery().processInstanceId(processInstance.getId()) //
   .followUpBeforeOrNotExistent(otherDate.getTime()).count());
 assertEquals(0, taskService.createTaskQuery().followUpAfter(otherDate.getTime()).count());
 otherDate.add(Calendar.YEAR, -2);
 assertEquals(1, taskService.createTaskQuery().followUpAfter(otherDate.getTime()).count());
 assertEquals(0, taskService.createTaskQuery().followUpBefore(otherDate.getTime()).count());
 assertEquals(0, taskService.createTaskQuery().processInstanceId(processInstance.getId()) //
   .followUpBeforeOrNotExistent(otherDate.getTime()).count());
 taskService.complete(task.getId());
}

代码示例来源:origin: org.camunda.bpm/camunda-engine

@Deployment(resources={"org/camunda/bpm/engine/test/history/HistoricTaskInstanceTest.testHistoricTaskInstance.bpmn20.xml"})
public void testHistoricTaskInstanceQueryByFollowUpDate() throws Exception {
 Calendar otherDate = Calendar.getInstance();
 runtimeService.startProcessInstanceByKey("HistoricTaskInstanceTest");
 // do not find any task instances with follow up date
 assertEquals(0, taskService.createTaskQuery().followUpDate(otherDate.getTime()).count());
 Task task = taskService.createTaskQuery().singleResult();
 // set follow-up date on task
 Date followUpDate = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss").parse("01/02/2003 01:12:13");
 task.setFollowUpDate(followUpDate);
 taskService.saveTask(task);
 // test that follow-up date was written to historic database
 assertEquals(followUpDate, historyService.createHistoricTaskInstanceQuery().taskId(task.getId()).singleResult().getFollowUpDate());
 assertEquals(1, historyService.createHistoricTaskInstanceQuery().taskFollowUpDate(followUpDate).count());
 otherDate.setTime(followUpDate);
 otherDate.add(Calendar.YEAR, 1);
 assertEquals(0, historyService.createHistoricTaskInstanceQuery().taskFollowUpDate(otherDate.getTime()).count());
 assertEquals(1, historyService.createHistoricTaskInstanceQuery().taskFollowUpBefore(otherDate.getTime()).count());
 assertEquals(0, historyService.createHistoricTaskInstanceQuery().taskFollowUpAfter(otherDate.getTime()).count());
 assertEquals(0, historyService.createHistoricTaskInstanceQuery().taskFollowUpAfter(otherDate.getTime()).taskFollowUpDate(followUpDate).count());
 otherDate.add(Calendar.YEAR, -2);
 assertEquals(1, historyService.createHistoricTaskInstanceQuery().taskFollowUpAfter(otherDate.getTime()).count());
 assertEquals(0, historyService.createHistoricTaskInstanceQuery().taskFollowUpBefore(otherDate.getTime()).count());
 assertEquals(followUpDate, historyService.createHistoricTaskInstanceQuery().taskId(task.getId()).singleResult().getFollowUpDate());
 assertEquals(0, historyService.createHistoricTaskInstanceQuery().taskFollowUpBefore(otherDate.getTime()).taskFollowUpDate(followUpDate).count());
 taskService.complete(task.getId());
 assertEquals(followUpDate, historyService.createHistoricTaskInstanceQuery().taskId(task.getId()).singleResult().getFollowUpDate());
 assertEquals(1, historyService.createHistoricTaskInstanceQuery().taskFollowUpDate(followUpDate).count());
}

代码示例来源:origin: org.camunda.bpm/camunda-engine-rest-jaxrs2

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());
}

代码示例来源:origin: org.camunda.bpm/camunda-engine

task1.setFollowUpDate(date);
task1.setOwner("Luke Optim");
task1.setName("taskForOr");

相关文章