use of org.apache.inlong.manager.common.enums.TaskStatus in project incubator-inlong by apache.
the class WorkflowQueryServiceImpl method getBriefFromProcessEntity.
private WorkflowBriefDTO getBriefFromProcessEntity(WorkflowProcessEntity processEntity) {
WorkflowProcess process = definitionRepository.get(processEntity.getName());
if (process == null) {
return null;
}
Map<String, TaskStatus> nameStatusMap = this.getTaskNameStatusMap(processEntity);
ElementDTO elementDTO = new ElementDTO();
StartEvent startEvent = process.getStartEvent();
elementDTO.setName(startEvent.getName());
elementDTO.setDisplayName(startEvent.getDisplayName());
WorkflowContext context = WorkflowBeanUtils.buildContext(process, processEntity);
addNext(startEvent, elementDTO, context, nameStatusMap);
WorkflowBriefDTO briefDTO = new WorkflowBriefDTO();
briefDTO.setName(process.getName());
briefDTO.setDisplayName(process.getDisplayName());
briefDTO.setType(process.getType());
briefDTO.setStartEvent(elementDTO);
return briefDTO;
}
use of org.apache.inlong.manager.common.enums.TaskStatus in project incubator-inlong by apache.
the class UserTaskProcessor method completeTaskInstance.
private void completeTaskInstance(WorkflowContext.ActionContext actionContext) {
WorkflowTaskEntity taskEntity = actionContext.getTaskEntity();
TaskStatus taskStatus = toTaskState(actionContext.getAction());
taskEntity.setStatus(taskStatus.name());
taskEntity.setOperator(actionContext.getOperator());
taskEntity.setRemark(actionContext.getRemark());
UserTask userTask = (UserTask) actionContext.getTask();
if (needForm(userTask, actionContext.getAction())) {
Preconditions.checkNotNull(actionContext.getForm(), "form cannot be null");
Preconditions.checkTrue(actionContext.getForm().getClass().isAssignableFrom(userTask.getFormClass()), "form type not match, should be class " + userTask.getFormClass());
actionContext.getForm().validate();
taskEntity.setFormData(JsonUtils.toJson(actionContext.getForm()));
} else {
Preconditions.checkNull(actionContext.getForm(), "no form required");
}
taskEntity.setEndTime(new Date());
taskEntity.setExtParams(handlerExt(actionContext, taskEntity.getExtParams()));
taskEntityMapper.update(taskEntity);
}
use of org.apache.inlong.manager.common.enums.TaskStatus 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