use of org.apache.inlong.manager.common.pojo.workflow.TaskQuery in project incubator-inlong by apache.
the class WorkflowQueryServiceImpl method listApproveHistory.
@Override
public List<WorkflowTaskEntity> listApproveHistory(Integer processId) {
TaskQuery request = new TaskQuery();
request.setProcessId(processId);
request.setStatusSet(TaskStatus.COMPLETED_STATUS);
return taskEntityMapper.selectByQuery(request);
}
use of org.apache.inlong.manager.common.pojo.workflow.TaskQuery in project incubator-inlong by apache.
the class WorkflowServiceImpl method getTaskExecutorLogs.
private List<TaskExecutorLog> getTaskExecutorLogs(Integer processId, String taskType) {
TaskQuery taskQuery = new TaskQuery();
taskQuery.setProcessId(processId);
taskQuery.setType(taskType);
return queryService.listTaskEntity(taskQuery).stream().map(TaskExecutorLog::buildFromTaskInst).collect(Collectors.toList());
}
use of org.apache.inlong.manager.common.pojo.workflow.TaskQuery in project incubator-inlong by apache.
the class WorkflowServiceImpl method listProcess.
@Override
public PageInfo<ProcessResponse> listProcess(ProcessQuery query) {
PageHelper.startPage(query.getPageNum(), query.getPageSize());
Page<WorkflowProcessEntity> result = (Page<WorkflowProcessEntity>) queryService.listProcessEntity(query);
PageInfo<ProcessResponse> pageInfo = result.toPageInfo(entity -> {
ProcessResponse response = WorkflowBeanUtils.fromProcessEntity(entity);
if (query.getIncludeShowInList()) {
response.setShowInList(getShowInList(entity));
}
return response;
});
pageInfo.setTotal(result.getTotal());
if (query.getIncludeCurrentTask()) {
TaskQuery taskQuery = TaskQuery.builder().type(UserTask.class.getSimpleName()).statusSet(Collections.singleton(TaskStatus.PENDING)).build();
PageHelper.startPage(0, 100);
pageInfo.getList().forEach(this.addCurrentTask(taskQuery));
}
return pageInfo;
}
use of org.apache.inlong.manager.common.pojo.workflow.TaskQuery in project incubator-inlong by apache.
the class WorkflowServiceImpl method listTaskExecuteLogs.
@Override
public PageInfo<WorkflowExecuteLog> listTaskExecuteLogs(TaskExecuteLogQuery query) {
Preconditions.checkNotNull(query, "task execute log query params cannot be null");
String groupId = query.getInlongGroupId();
List<String> processNameList = query.getProcessNames();
Preconditions.checkNotEmpty(groupId, "inlong group id cannot be null");
Preconditions.checkNotEmpty(processNameList, "process name list cannot be null");
ProcessQuery processRequest = new ProcessQuery();
processRequest.setInlongGroupId(groupId);
processRequest.setNameList(processNameList);
processRequest.setHidden(1);
// Paging query process instance, construct process execution log
PageHelper.startPage(query.getPageNum(), query.getPageSize());
Page<WorkflowProcessEntity> entityPage = (Page<WorkflowProcessEntity>) queryService.listProcessEntity(processRequest);
PageInfo<WorkflowExecuteLog> pageInfo = entityPage.toPageInfo(inst -> WorkflowExecuteLog.builder().processId(inst.getId()).processDisplayName(inst.getDisplayName()).status(inst.getStatus()).startTime(inst.getStartTime()).endTime(inst.getEndTime()).build());
// According to the process execution log, query the execution log of each task in the process
for (WorkflowExecuteLog executeLog : pageInfo.getList()) {
TaskQuery taskQuery = new TaskQuery();
taskQuery.setProcessId(executeLog.getProcessId());
taskQuery.setType(taskQuery.getType());
List<TaskExecutorLog> executorLogs = queryService.listTaskEntity(taskQuery).stream().map(TaskExecutorLog::buildFromTaskInst).collect(Collectors.toList());
// Set the execution log of the task's listener
for (TaskExecutorLog taskExecutorLog : executorLogs) {
EventLogQuery eventLogQuery = new EventLogQuery();
eventLogQuery.setTaskId(taskExecutorLog.getTaskId());
List<ListenerExecutorLog> logs = queryService.listEventLog(eventLogQuery).stream().map(ListenerExecutorLog::fromEventLog).collect(Collectors.toList());
taskExecutorLog.setListenerExecutorLogs(logs);
}
executeLog.setTaskExecutorLogs(executorLogs);
}
LOGGER.info("success to page list task execute logs for " + query);
pageInfo.setTotal(entityPage.getTotal());
return pageInfo;
}
use of org.apache.inlong.manager.common.pojo.workflow.TaskQuery in project incubator-inlong by apache.
the class WorkflowQueryServiceImpl method getTaskNameStatusMap.
private Map<String, TaskStatus> getTaskNameStatusMap(WorkflowProcessEntity processEntity) {
TaskQuery request = TaskQuery.builder().processId(processEntity.getId()).build();
List<WorkflowTaskEntity> allTasks = taskEntityMapper.selectByQuery(request).stream().sorted(Comparator.comparing(WorkflowTaskEntity::getId).thenComparing(Comparator.nullsLast(Comparator.comparing(WorkflowTaskEntity::getEndTime)))).collect(Collectors.toList());
Map<String, TaskStatus> nameStatusMap = Maps.newHashMap();
allTasks.forEach(task -> nameStatusMap.put(task.getName(), TaskStatus.valueOf(task.getStatus())));
return nameStatusMap;
}
Aggregations