Java Code Examples for org.flowable.task.api.Task#setCategory()

The following examples show how to use org.flowable.task.api.Task#setCategory() . 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: AsyncHistoryUpgradeTest.java    From flowable-engine with Apache License 2.0 6 votes vote down vote up
@Test
public void testSetTaskCategory() {
    Task task = startOneTaskprocess();
    assertThat(task.getCategory()).isNull();

    waitForHistoryJobExecutorToProcessAllJobs(7000L, 100L);
    HistoricTaskInstance historicTaskInstance = historyService.createHistoricTaskInstanceQuery().singleResult();
    assertThat(historicTaskInstance.getCategory()).isNull();

    removeRuntimeActivityInstances(task.getProcessInstanceId());

    task.setCategory("test category");
    taskService.saveTask(task);

    downgradeHistoryJobConfigurations();

    waitForHistoryJobExecutorToProcessAllJobs(7000L, 100L);
    historicTaskInstance = historyService.createHistoricTaskInstanceQuery().singleResult();
    assertThat(historicTaskInstance.getCategory()).isEqualTo("test category");

    finishOneTaskProcess(task);
}
 
Example 2
Source File: AsyncHistoryTest.java    From flowable-engine with Apache License 2.0 6 votes vote down vote up
@Test
public void testSetTaskCategory() {
    Task task = startOneTaskprocess();
    assertThat(task.getCategory()).isNull();

    waitForHistoryJobExecutorToProcessAllJobs(7000L, 100L);
    HistoricTaskInstance historicTaskInstance = historyService.createHistoricTaskInstanceQuery().singleResult();
    assertThat(historicTaskInstance.getCategory()).isNull();

    task.setCategory("test category");
    taskService.saveTask(task);

    waitForHistoryJobExecutorToProcessAllJobs(7000L, 100L);
    historicTaskInstance = historyService.createHistoricTaskInstanceQuery().singleResult();
    assertThat(historicTaskInstance.getCategory()).isEqualTo("test category");

    finishOneTaskProcess(task);
}
 
Example 3
Source File: TaskResource.java    From plumdo-work with Apache License 2.0 5 votes vote down vote up
@PutMapping(value = "/tasks/{taskId}", name = "任务修改")
public TaskResponse updateTask(@PathVariable String taskId, @RequestBody TaskEditRequest taskEditRequest) {
    Task task = getTaskFromRequest(taskId);
    task.setName(taskEditRequest.getName());
    task.setDescription(taskEditRequest.getDescription());
    task.setAssignee(taskEditRequest.getAssignee());
    task.setOwner(taskEditRequest.getOwner());
    task.setDueDate(taskEditRequest.getDueDate());
    task.setPriority(taskEditRequest.getPriority());
    task.setCategory(taskEditRequest.getCategory());
    taskService.saveTask(task);
    return restResponseFactory.createTaskResponse(task);
}
 
Example 4
Source File: TaskRepresentation.java    From flowable-engine with Apache License 2.0 5 votes vote down vote up
public void fillTask(Task task) {
    task.setName(name);
    task.setDescription(description);
    if (assignee != null && assignee.getId() != null) {
        task.setAssignee(String.valueOf(assignee.getId()));
    }
    task.setDueDate(dueDate);
    if (priority != null) {
        task.setPriority(priority);
    }
    task.setCategory(category);
}
 
Example 5
Source File: TaskBaseResource.java    From flowable-engine with Apache License 2.0 5 votes vote down vote up
/**
 * Populate the task based on the values that are present in the given {@link TaskRequest}.
 */
protected void populateTaskFromRequest(Task task, TaskRequest taskRequest) {
    if (taskRequest.isNameSet()) {
        task.setName(taskRequest.getName());
    }
    if (taskRequest.isAssigneeSet()) {
        task.setAssignee(taskRequest.getAssignee());
    }
    if (taskRequest.isDescriptionSet()) {
        task.setDescription(taskRequest.getDescription());
    }
    if (taskRequest.isDuedateSet()) {
        task.setDueDate(taskRequest.getDueDate());
    }
    if (taskRequest.isOwnerSet()) {
        task.setOwner(taskRequest.getOwner());
    }
    if (taskRequest.isParentTaskIdSet()) {
        task.setParentTaskId(taskRequest.getParentTaskId());
    }
    if (taskRequest.isPrioritySet()) {
        task.setPriority(taskRequest.getPriority());
    }
    if (taskRequest.isCategorySet()) {
        task.setCategory(taskRequest.getCategory());
    }
    if (taskRequest.isTenantIdSet()) {
        task.setTenantId(taskRequest.getTenantId());
    }
    if (taskRequest.isFormKeySet()) {
        task.setFormKey(taskRequest.getFormKey());
    }

    if (taskRequest.isDelegationStateSet()) {
        DelegationState delegationState = getDelegationState(taskRequest.getDelegationState());
        task.setDelegationState(delegationState);
    }
}
 
Example 6
Source File: TaskBaseResource.java    From flowable-engine with Apache License 2.0 5 votes vote down vote up
/**
 * Populate the task based on the values that are present in the given {@link TaskRequest}.
 */
protected void populateTaskFromRequest(Task task, TaskRequest taskRequest) {
    if (taskRequest.isNameSet()) {
        task.setName(taskRequest.getName());
    }
    if (taskRequest.isAssigneeSet()) {
        task.setAssignee(taskRequest.getAssignee());
    }
    if (taskRequest.isDescriptionSet()) {
        task.setDescription(taskRequest.getDescription());
    }
    if (taskRequest.isDuedateSet()) {
        task.setDueDate(taskRequest.getDueDate());
    }
    if (taskRequest.isOwnerSet()) {
        task.setOwner(taskRequest.getOwner());
    }
    if (taskRequest.isParentTaskIdSet()) {
        task.setParentTaskId(taskRequest.getParentTaskId());
    }
    if (taskRequest.isPrioritySet()) {
        task.setPriority(taskRequest.getPriority());
    }
    if (taskRequest.isCategorySet()) {
        task.setCategory(taskRequest.getCategory());
    }
    if (taskRequest.isTenantIdSet()) {
        task.setTenantId(taskRequest.getTenantId());
    }
    if (taskRequest.isFormKeySet()) {
        task.setFormKey(taskRequest.getFormKey());
    }

    if (taskRequest.isDelegationStateSet()) {
        DelegationState delegationState = getDelegationState(taskRequest.getDelegationState());
        task.setDelegationState(delegationState);
    }
}
 
Example 7
Source File: TaskServiceTest.java    From flowable-engine with Apache License 2.0 5 votes vote down vote up
@Test
@Deployment(resources = { "org/flowable/engine/test/api/oneTaskProcess.bpmn20.xml" })
public void saveUserTaskTest() {
    Map<String, Object> startMap = new HashMap<>();
    startMap.put("titleId", "testTitleId");
    startMap.put("otherVariable", "testOtherVariable");

    ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("oneTaskProcess", startMap);
    Task task = taskService.createTaskQuery().processInstanceId(processInstance.getId())
        .includeIdentityLinks()
        .singleResult();
    task.setDueDate(new Date());
    task.setCategory("main");
    taskService.saveTask(task);
}