use of org.kie.kogito.taskassigning.core.model.solver.realtime.TaskInfoChangeProblemFactChange in project kogito-apps by kiegroup.
the class SolutionChangesBuilder method addTaskChanges.
private void addTaskChanges(TaskAssignment taskAssignment, TaskData taskData) {
String taskState = taskData.getState();
if (READY.value().equals(taskState)) {
context.setTaskPublished(taskData.getId(), false);
releasedTasksChanges.add(new ReleaseTaskProblemFactChange(taskAssignment));
} else if (RESERVED.value().equals(taskState)) {
context.setTaskPublished(taskData.getId(), true);
if (!taskData.getActualOwner().equals(taskAssignment.getUser().getId()) || !taskAssignment.isPinned()) {
final User user = getUser(usersById.get(taskData.getActualOwner()), taskData.getActualOwner());
AssignTaskProblemFactChange change = new AssignTaskProblemFactChange(taskAssignment, user, true);
addChangeToUser(assignToUserChangesByUserId, change, user, -1, true);
}
} else if (TaskState.isTerminal(taskState)) {
removedTasksSet.add(taskAssignment);
}
if (!removedTasksSet.contains(taskAssignment)) {
Task updatedTask = fromTaskData(taskData);
if (!equalsByTaskInfoProperties(taskAssignment.getTask(), updatedTask)) {
processorRegistry.applyAttributesProcessor(updatedTask, updatedTask.getAttributes());
} else {
updatedTask.setAttributes(taskAssignment.getTask().getAttributes());
}
taskPropertyChanges.add(new TaskInfoChangeProblemFactChange(taskAssignment, updatedTask));
}
}
Aggregations