Search in sources :

Example 36 with TaskData

use of org.kie.server.api.model.taskassigning.TaskData in project droolsjbpm-integration by kiegroup.

the class SolutionSynchronizer method recoverSolution.

private TaskAssigningSolution recoverSolution() {
    final TaskAssigningRuntimeDelegate.FindTasksResult result = delegate.findTasks(Arrays.asList(Ready, Reserved, InProgress, Suspended), null, TaskInputVariablesReadMode.READ_FOR_ALL);
    final LocalDateTime nextQueryTime = context.shiftQueryTime(trimMillis(result.getQueryTime()));
    final LocalDateTime adjustedFirstQueryTime = context.shiftQueryTime(nextQueryTime);
    context.setPreviousQueryTime(adjustedFirstQueryTime);
    context.setNextQueryTime(nextQueryTime);
    context.clearTaskChangeTimes();
    final List<TaskData> taskDataList = result.getTasks();
    LOGGER.debug("{} tasks where loaded for solution recovery, with result.queryTime: {}", taskDataList.size(), result.getQueryTime());
    final List<User> externalUsers = userSystemService.findAllUsers();
    return buildSolution(taskDataList, externalUsers);
}
Also used : LocalDateTime(java.time.LocalDateTime) User(org.kie.server.services.taskassigning.user.system.api.User) TaskData(org.kie.server.api.model.taskassigning.TaskData)

Example 37 with TaskData

use of org.kie.server.api.model.taskassigning.TaskData in project droolsjbpm-integration by kiegroup.

the class SolutionBuilderTest method buildAndCheckReservedTaskWithUnChangedPlanningTaskPublishedWasProcessedCorrect.

@Test
public void buildAndCheckReservedTaskWithUnChangedPlanningTaskPublishedWasProcessedCorrect() {
    PlanningTask planningTask = PlanningTask.builder().taskId(1L).assignedUser(USER1).published(true).index(1).build();
    TaskData taskData = mockTaskData(1L, Reserved, planningTask.getAssignedUser());
    buildAndCheckTaskWithPlanningTaskWasProcessedCorrect(taskData, planningTask, planningTask.getAssignedUser(), true);
}
Also used : PlanningTask(org.kie.server.api.model.taskassigning.PlanningTask) TaskData(org.kie.server.api.model.taskassigning.TaskData) Test(org.junit.Test)

Example 38 with TaskData

use of org.kie.server.api.model.taskassigning.TaskData in project droolsjbpm-integration by kiegroup.

the class SolutionBuilderTest method mockTaskData.

private TaskData mockTaskData(Long taskId, Status status, String actualOwner) {
    TaskData taskData = new TaskData();
    taskData.setTaskId(taskId);
    taskData.setActualOwner(actualOwner);
    taskData.setStatus(convertToString(status));
    taskData.setPriority(0);
    taskData.setProcessInstanceId(1L);
    taskData.setLastModificationDate(LocalDateTime.now());
    return taskData;
}
Also used : TaskData(org.kie.server.api.model.taskassigning.TaskData)

Example 39 with TaskData

use of org.kie.server.api.model.taskassigning.TaskData in project droolsjbpm-integration by kiegroup.

the class SolutionBuilderTest method buildAndCheckReservedForPlanningUserTaskWithModifiedPlanningTaskPublishedWasProcessedCorrect.

@Test
public void buildAndCheckReservedForPlanningUserTaskWithModifiedPlanningTaskPublishedWasProcessedCorrect() {
    PlanningTask planningTask = PlanningTask.builder().taskId(1L).assignedUser(USER1).published(true).index(1).build();
    TaskData taskData = mockTaskData(1L, Reserved, PLANNING_USER_ID);
    buildAndCheckTaskWithPlanningTaskWasProcessedCorrect(taskData, planningTask, taskData.getActualOwner(), false);
}
Also used : PlanningTask(org.kie.server.api.model.taskassigning.PlanningTask) TaskData(org.kie.server.api.model.taskassigning.TaskData) Test(org.junit.Test)

Example 40 with TaskData

use of org.kie.server.api.model.taskassigning.TaskData in project droolsjbpm-integration by kiegroup.

the class SolutionBuilderTest method buildAndCheckInProgressTaskWithModifiedPlanningTaskPublishedWasProcessedCorrect.

@Test
public void buildAndCheckInProgressTaskWithModifiedPlanningTaskPublishedWasProcessedCorrect() {
    PlanningTask planningTask = PlanningTask.builder().taskId(1L).assignedUser(USER1).published(true).index(1).build();
    TaskData taskData = mockTaskData(1L, InProgress, USER2);
    buildAndCheckTaskWithPlanningTaskWasProcessedCorrect(taskData, planningTask, taskData.getActualOwner(), true);
}
Also used : PlanningTask(org.kie.server.api.model.taskassigning.PlanningTask) TaskData(org.kie.server.api.model.taskassigning.TaskData) Test(org.junit.Test)

Aggregations

TaskData (org.kie.server.api.model.taskassigning.TaskData)55 Test (org.junit.Test)30 PlanningTask (org.kie.server.api.model.taskassigning.PlanningTask)26 TaskAssigningSolution (org.kie.server.services.taskassigning.core.model.TaskAssigningSolution)14 TaskUtil.fromTaskData (org.kie.server.services.taskassigning.planning.util.TaskUtil.fromTaskData)13 PlanningExecutionResult (org.kie.server.api.model.taskassigning.PlanningExecutionResult)10 PlanningItemList (org.kie.server.api.model.taskassigning.PlanningItemList)10 Task (org.kie.server.services.taskassigning.core.model.Task)10 AddTaskProblemFactChange (org.kie.server.services.taskassigning.core.model.solver.realtime.AddTaskProblemFactChange)10 AddUserProblemFactChange (org.kie.server.services.taskassigning.core.model.solver.realtime.AddUserProblemFactChange)10 AssignTaskProblemFactChange (org.kie.server.services.taskassigning.core.model.solver.realtime.AssignTaskProblemFactChange)10 DisableUserProblemFactChange (org.kie.server.services.taskassigning.core.model.solver.realtime.DisableUserProblemFactChange)10 ReleaseTaskProblemFactChange (org.kie.server.services.taskassigning.core.model.solver.realtime.ReleaseTaskProblemFactChange)10 RemoveTaskProblemFactChange (org.kie.server.services.taskassigning.core.model.solver.realtime.RemoveTaskProblemFactChange)10 RemoveUserProblemFactChange (org.kie.server.services.taskassigning.core.model.solver.realtime.RemoveUserProblemFactChange)10 TaskPropertyChangeProblemFactChange (org.kie.server.services.taskassigning.core.model.solver.realtime.TaskPropertyChangeProblemFactChange)10 UserPropertyChangeProblemFactChange (org.kie.server.services.taskassigning.core.model.solver.realtime.UserPropertyChangeProblemFactChange)10 ProblemFactChange (org.optaplanner.core.impl.solver.ProblemFactChange)10 PlanningItem (org.kie.server.api.model.taskassigning.PlanningItem)9 ArrayList (java.util.ArrayList)8