Java Code Examples for org.camunda.bpm.engine.task.Task#setPriority()
The following examples show how to use
org.camunda.bpm.engine.task.Task#setPriority() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HistoricTaskInstanceUpdateTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Deployment public void testHistoricTaskInstanceUpdate() { runtimeService.startProcessInstanceByKey("HistoricTaskInstanceTest").getId(); Task task = taskService.createTaskQuery().singleResult(); // Update and save the task's fields before it is finished task.setPriority(12345); task.setDescription("Updated description"); task.setName("Updated name"); task.setAssignee("gonzo"); taskService.saveTask(task); taskService.complete(task.getId()); assertEquals(1, historyService.createHistoricTaskInstanceQuery().count()); HistoricTaskInstance historicTaskInstance = historyService.createHistoricTaskInstanceQuery().singleResult(); assertEquals("Updated name", historicTaskInstance.getName()); assertEquals("Updated description", historicTaskInstance.getDescription()); assertEquals("gonzo", historicTaskInstance.getAssignee()); assertEquals("task", historicTaskInstance.getTaskDefinitionKey()); }
Example 2
Source File: TaskDto.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
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()); }
Example 3
Source File: TaskQueryOrTest.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
@Test public void shouldReturnTasksWithMultipleOrCriteria() { // given Task task1 = taskService.newTask(); task1.setName("aTaskName"); taskService.saveTask(task1); Task task2 = taskService.newTask(); task2.setDescription("aTaskDescription"); taskService.saveTask(task2); Task task3 = taskService.newTask(); taskService.saveTask(task3); Task task4 = taskService.newTask(); task4.setPriority(5); taskService.saveTask(task4); Task task5 = taskService.newTask(); task5.setOwner("aTaskOwner"); taskService.saveTask(task5); // when List<Task> tasks = taskService.createTaskQuery() .or() .taskName("aTaskName") .taskDescription("aTaskDescription") .taskId(task3.getId()) .taskPriority(5) .taskOwner("aTaskOwner") .endOr() .list(); // then assertEquals(5, tasks.size()); }
Example 4
Source File: HistoricTaskInstanceQueryOrTest.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
@Test public void shouldReturnHistoricTasksWithMultipleOrCriteria() { // given Task task1 = taskService.newTask(); task1.setName("aTaskName"); taskService.saveTask(task1); Task task2 = taskService.newTask(); task2.setDescription("aTaskDescription"); taskService.saveTask(task2); Task task3 = taskService.newTask(); taskService.saveTask(task3); Task task4 = taskService.newTask(); task4.setPriority(5); taskService.saveTask(task4); Task task5 = taskService.newTask(); task5.setOwner("aTaskOwner"); taskService.saveTask(task5); // when List<HistoricTaskInstance> tasks = historyService.createHistoricTaskInstanceQuery() .or() .taskName("aTaskName") .taskDescription("aTaskDescription") .taskId(task3.getId()) .taskPriority(5) .taskOwner("aTaskOwner") .endOr() .list(); // then assertEquals(5, tasks.size()); }
Example 5
Source File: TaskQueryOrTest.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
@Test public void shouldReturnTasksFilteredByMultipleOrAndCriteria() { // given Task task1 = taskService.newTask(); task1.setPriority(4); taskService.saveTask(task1); Task task2 = taskService.newTask(); task2.setName("aTaskName"); task2.setOwner("aTaskOwner"); task2.setAssignee("aTaskAssignee"); task2.setPriority(4); taskService.saveTask(task2); Task task3 = taskService.newTask(); task3.setName("aTaskName"); task3.setOwner("aTaskOwner"); task3.setAssignee("aTaskAssignee"); task3.setPriority(4); task3.setDescription("aTaskDescription"); taskService.saveTask(task3); Task task4 = taskService.newTask(); task4.setOwner("aTaskOwner"); task4.setAssignee("aTaskAssignee"); task4.setPriority(4); task4.setDescription("aTaskDescription"); taskService.saveTask(task4); Task task5 = taskService.newTask(); task5.setDescription("aTaskDescription"); task5.setOwner("aTaskOwner"); taskService.saveTask(task5); // when List<Task> tasks = taskService.createTaskQuery() .or() .taskName("aTaskName") .taskDescription("aTaskDescription") .taskId(task3.getId()) .endOr() .taskOwner("aTaskOwner") .taskPriority(4) .taskAssignee("aTaskAssignee") .list(); // then assertEquals(3, tasks.size()); }
Example 6
Source File: TaskQueryOrTest.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
@Test public void shouldReturnTasksFilteredByMultipleOrQueries() { // given Task task1 = taskService.newTask(); task1.setName("aTaskName"); taskService.saveTask(task1); Task task2 = taskService.newTask(); task2.setName("aTaskName"); task2.setDescription("aTaskDescription"); taskService.saveTask(task2); Task task3 = taskService.newTask(); task3.setName("aTaskName"); task3.setDescription("aTaskDescription"); task3.setOwner("aTaskOwner"); taskService.saveTask(task3); Task task4 = taskService.newTask(); task4.setName("aTaskName"); task4.setDescription("aTaskDescription"); task4.setOwner("aTaskOwner"); task4.setAssignee("aTaskAssignee"); taskService.saveTask(task4); Task task5 = taskService.newTask(); task5.setName("aTaskName"); task5.setDescription("aTaskDescription"); task5.setOwner("aTaskOwner"); task5.setAssignee("aTaskAssignee"); task5.setPriority(4); taskService.saveTask(task5); Task task6 = taskService.newTask(); task6.setName("aTaskName"); task6.setDescription("aTaskDescription"); task6.setOwner("aTaskOwner"); task6.setAssignee("aTaskAssignee"); task6.setPriority(4); taskService.saveTask(task6); // when List<Task> tasks = taskService.createTaskQuery() .or() .taskName("aTaskName") .taskDescription("aTaskDescription") .endOr() .or() .taskName("aTaskName") .taskDescription("aTaskDescription") .taskAssignee("aTaskAssignee") .endOr() .or() .taskName("aTaskName") .taskDescription("aTaskDescription") .taskOwner("aTaskOwner") .taskAssignee("aTaskAssignee") .endOr() .or() .taskAssignee("aTaskAssignee") .taskPriority(4) .endOr() .list(); // then assertEquals(3, tasks.size()); }
Example 7
Source File: FilterTaskQueryTest.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
protected void createTasksForOrQueries() { Task task1 = taskService.newTask(); task1.setName("taskForOr"); task1.setDescription("aTaskDescription"); task1.setPriority(3); taskService.saveTask(task1); Task task2 = taskService.newTask(); task2.setName("taskForOr"); task2.setDescription("aTaskDescription"); task2.setAssignee("aTaskAssignee"); task2.setTenantId("aTenantId"); taskService.saveTask(task2); Task task3 = taskService.newTask(); task3.setName("taskForOr"); task3.setOwner("aTaskOwner"); taskService.saveTask(task3); Task task4 = taskService.newTask(); task4.setName("taskForOr"); task4.setOwner("aTaskOwner"); task4.setPriority(3); taskService.saveTask(task4); Task task5 = taskService.newTask(); task5.setDescription("aTaskDescription"); task5.setAssignee("aTaskAssignee"); taskService.saveTask(task5); Task task6 = taskService.newTask(); task6.setDescription("aTaskDescription"); task6.setAssignee("aTaskAssignee"); task6.setTenantId("aTenantId"); taskService.saveTask(task6); Task task7 = taskService.newTask(); task7.setTenantId("aTenantId"); task7.setOwner("aTaskOwner"); task7.setPriority(3); task7.setAssignee("aTaskAssignee"); taskService.saveTask(task7); }
Example 8
Source File: HistoricTaskInstanceQueryOrTest.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
@Test public void shouldReturnHistoricTasksFilteredByMultipleOrAndCriteria() { // given Task task1 = taskService.newTask(); task1.setPriority(4); taskService.saveTask(task1); Task task2 = taskService.newTask(); task2.setName("aTaskName"); task2.setOwner("aTaskOwner"); task2.setAssignee("aTaskAssignee"); task2.setPriority(4); taskService.saveTask(task2); Task task3 = taskService.newTask(); task3.setName("aTaskName"); task3.setOwner("aTaskOwner"); task3.setAssignee("aTaskAssignee"); task3.setPriority(4); task3.setDescription("aTaskDescription"); taskService.saveTask(task3); Task task4 = taskService.newTask(); task4.setOwner("aTaskOwner"); task4.setAssignee("aTaskAssignee"); task4.setPriority(4); task4.setDescription("aTaskDescription"); taskService.saveTask(task4); Task task5 = taskService.newTask(); task5.setDescription("aTaskDescription"); task5.setOwner("aTaskOwner"); taskService.saveTask(task5); // when List<HistoricTaskInstance> tasks = historyService.createHistoricTaskInstanceQuery() .or() .taskName("aTaskName") .taskDescription("aTaskDescription") .taskId(task3.getId()) .endOr() .taskOwner("aTaskOwner") .taskPriority(4) .taskAssignee("aTaskAssignee") .list(); // then assertEquals(3, tasks.size()); }
Example 9
Source File: HistoricTaskInstanceQueryOrTest.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
@Test public void shouldReturnHistoricTasksFilteredByMultipleOrQueries() { // given Task task1 = taskService.newTask(); task1.setName("aTaskName"); taskService.saveTask(task1); Task task2 = taskService.newTask(); task2.setName("aTaskName"); task2.setDescription("aTaskDescription"); taskService.saveTask(task2); Task task3 = taskService.newTask(); task3.setName("aTaskName"); task3.setDescription("aTaskDescription"); task3.setOwner("aTaskOwner"); taskService.saveTask(task3); Task task4 = taskService.newTask(); task4.setName("aTaskName"); task4.setDescription("aTaskDescription"); task4.setOwner("aTaskOwner"); task4.setAssignee("aTaskAssignee"); taskService.saveTask(task4); Task task5 = taskService.newTask(); task5.setName("aTaskName"); task5.setDescription("aTaskDescription"); task5.setOwner("aTaskOwner"); task5.setAssignee("aTaskAssignee"); task5.setPriority(4); taskService.saveTask(task5); Task task6 = taskService.newTask(); task6.setName("aTaskName"); task6.setDescription("aTaskDescription"); task6.setOwner("aTaskOwner"); task6.setAssignee("aTaskAssignee"); task6.setPriority(4); taskService.saveTask(task6); // when List<HistoricTaskInstance> tasks = historyService.createHistoricTaskInstanceQuery() .or() .taskName("aTaskName") .taskDescription("aTaskDescription") .endOr() .or() .taskName("aTaskName") .taskDescription("aTaskDescription") .taskAssignee("aTaskAssignee") .endOr() .or() .taskName("aTaskName") .taskDescription("aTaskDescription") .taskOwner("aTaskOwner") .taskAssignee("aTaskAssignee") .endOr() .or() .taskAssignee("aTaskAssignee") .taskPriority(4) .endOr() .list(); // then assertEquals(3, tasks.size()); }
Example 10
Source File: HistoricTaskInstanceTest.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
@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()); }