use of org.kie.server.api.model.taskassigning.TaskData in project droolsjbpm-integration by kiegroup.
the class TaskAssigningRuntimeServiceQueryHelperTest method mockTasks.
private List<TaskData> mockTasks() {
TaskData task1 = mockTaskData(TASK1_ID, Status.Ready, false, CONTAINER_ID);
TaskData task2 = mockTaskData(TASK2_ID, Status.Reserved, true, CONTAINER_ID);
TaskData task3 = mockTaskData(TASK3_ID, Status.Completed, true, CONTAINER_ID);
TASK1_INPUTS.put(TASK1_PARAM1, TASK1_PARAM1_VALUE);
TASK1_INPUTS.put(TASK1_PARAM2, null);
TASK2_INPUTS.put(TASK2_PARAM1, TASK2_PARAM1_VALUE);
TASK2_INPUTS.put(TASK2_PARAM2, null);
TASK3_INPUTS.put(TASK3_PARAM1, TASK3_PARAM1_VALUE);
TASK3_INPUTS.put(TASK3_PARAM2, null);
TASK1_INPUTS_SANITIZED.put(TASK1_PARAM1, TASK1_PARAM1_VALUE);
TASK2_INPUTS_SANITIZED.put(TASK2_PARAM1, TASK2_PARAM1_VALUE);
TASK3_INPUTS_SANITIZED.put(TASK3_PARAM1, TASK3_PARAM1_VALUE);
when(userTaskService.getTaskInputContentByTaskId(any(), eq(TASK1_ID))).thenReturn(TASK1_INPUTS);
when(userTaskService.getTaskInputContentByTaskId(any(), eq(TASK2_ID))).thenReturn(TASK2_INPUTS);
when(userTaskService.getTaskInputContentByTaskId(any(), eq(TASK3_ID))).thenReturn(TASK3_INPUTS);
return Arrays.asList(task1, task2, task3);
}
use of org.kie.server.api.model.taskassigning.TaskData in project droolsjbpm-integration by kiegroup.
the class SolutionChangesBuilderTest method discardDuplicatedChanges.
@Test
public void discardDuplicatedChanges() {
TaskData taskData1 = mockTaskData(1, NAME, Ready, null);
TaskData taskData2 = mockTaskData(2, NAME, InProgress, null);
TaskData taskData3 = mockTaskData(3, NAME, Completed, null);
TaskData taskData4 = mockTaskData(4, NAME, Suspended, null);
Task task1 = mockTask(taskData1.getTaskId());
Task task2 = mockTask(taskData2.getTaskId());
Task task3 = mockTask(taskData3.getTaskId());
Task task4 = mockTask(taskData4.getTaskId());
List<TaskData> taskDataList = mockTaskDataList(taskData1, taskData2, taskData3, taskData4);
TaskAssigningSolution solution = mockSolution(Arrays.asList(task1, task2, task3, task4), Collections.emptyList());
taskDataList.forEach(taskData -> context.setTaskChangeTime(taskData.getTaskId(), taskData.getLastModificationDate()));
List<ProblemFactChange<TaskAssigningSolution>> result = SolutionChangesBuilder.create().withSolution(solution).withTasks(taskDataList).withUserSystem(userSystemService).withContext(context).build();
assertEquals(2, result.size());
assertChangeIsTheChangeSetId(result, 0);
assertChangeIsTheDummyTaskAssigned(result, ModelConstants.DUMMY_TASK_PLANNER_241, 1);
}
use of org.kie.server.api.model.taskassigning.TaskData in project droolsjbpm-integration by kiegroup.
the class LabelValueExtractorRegistryTest method applyTaskDataLabelValueExtractors.
@Test
public void applyTaskDataLabelValueExtractors() {
Map<String, Object> inputData = new HashMap<>();
inputData.put(SKILLS_ATTRIBUTE, null);
inputData.put(AFFINITIES_ATTRIBUTE, SOME_VALUE);
inputData.put(TestTaskDataLabelValueExtractor.TEST_LABEL, SOME_VALUE);
TaskData taskData = TaskData.builder().inputData(inputData).build();
Map<String, Set<Object>> result = new HashMap<>();
BiConsumer<String, Set<Object>> consumer = result::put;
LabelValueExtractorRegistry.getInstance().applyLabelValueExtractors(TaskData.class, taskData, consumer);
assertThat(result.get(DefaultLabels.SKILLS.name())).isEqualTo(Collections.EMPTY_SET);
assertThat(result.get(DefaultLabels.AFFINITIES.name())).isEqualTo(new HashSet<>(Collections.singleton(SOME_VALUE)));
assertThat(result.get(TestTaskDataLabelValueExtractor.TEST_LABEL)).isEqualTo(new HashSet<>(Collections.singleton(TestTaskDataLabelValueExtractorOverride.EXAMPLE_LABEL_VALUE2)));
}
use of org.kie.server.api.model.taskassigning.TaskData in project droolsjbpm-integration by kiegroup.
the class TaskAssigningTaskDataWithPotentialOwnersQueryMapperTest method assertTaskIsPresent.
protected void assertTaskIsPresent(List<TaskData> taskDataList, int index, Long taskId, Date createdOn, String actualOwner, String deploymentId, String taskName, Integer priority, String processId, Long processInstanceId, String status, Date lastModificationDate, PlanningTask planningTask, List<Pair<String, String>> potentialOwners) {
TaskData taskData = taskDataList.get(index);
Set<OrganizationalEntity> potentialOwnersSet = new HashSet<>();
potentialOwners.forEach(potentialOwner -> potentialOwnersSet.add(OrganizationalEntity.builder().name(potentialOwner.getLeft()).type(potentialOwner.getRight()).build()));
TaskData expectedTaskData = TaskData.builder().taskId(taskId).createdOn(createdOn != null ? LocalDateTime.ofInstant(createdOn.toInstant(), ZoneId.systemDefault()) : null).actualOwner(actualOwner).containerId(deploymentId).name(taskName).priority(priority).processId(processId).processInstanceId(processInstanceId).status(status).lastModificationDate(lastModificationDate != null ? LocalDateTime.ofInstant(lastModificationDate.toInstant(), ZoneId.systemDefault()) : null).planningTask(planningTask).potentialOwners(potentialOwnersSet).build();
assertNotNull(taskData);
assertEquals(expectedTaskData, taskData);
}
use of org.kie.server.api.model.taskassigning.TaskData in project droolsjbpm-integration by kiegroup.
the class TaskAssigningTaskDataSummaryQueryMapper method buildInstance.
@Override
protected TaskData buildInstance(DataSet dataSetResult, int index) {
TaskData row = createInstance();
final Long taskId = getColumnLongValue(dataSetResult, TASK_QUERY_COLUMN.TASK_ID.columnName(), index);
final String status = getColumnStringValue(dataSetResult, TASK_QUERY_COLUMN.STATUS.columnName(), index);
String actualOwner = getColumnStringValue(dataSetResult, TASK_QUERY_COLUMN.ACTUAL_OWNER.columnName(), index);
if (isEmpty(actualOwner)) {
actualOwner = null;
}
final String deploymentId = getColumnStringValue(dataSetResult, TASK_QUERY_COLUMN.DEPLOYMENT_ID.columnName(), index);
final Long ptTaskId = getColumnLongValue(dataSetResult, TASK_QUERY_COLUMN.PLANNING_TASK_TASK_ID.columnName(), index);
String assignedUser = null;
Integer taskIndex = null;
Integer published = null;
if (ptTaskId != null) {
assignedUser = getColumnStringValue(dataSetResult, TASK_QUERY_COLUMN.PLANNING_TASK_ASSIGNED_USER.columnName(), index);
if (isEmpty(assignedUser)) {
assignedUser = null;
}
taskIndex = getColumnIntValue(dataSetResult, TASK_QUERY_COLUMN.PLANNING_TASK_INDEX.columnName(), index);
published = getColumnIntValue(dataSetResult, TASK_QUERY_COLUMN.PLANNING_TASK_PUBLISHED.columnName(), index);
}
setInstanceValues(row, taskId, null, null, null, deploymentId, status, null, null, null, actualOwner, assignedUser, taskIndex, published);
return row;
}
Aggregations