use of org.apache.inlong.manager.dao.entity.WorkflowTaskEntity in project incubator-inlong by apache.
the class WorkflowQueryServiceImpl method getProcessDetail.
private ProcessDetailResponse getProcessDetail(Integer processId, WorkflowProcessEntity processEntity) {
List<WorkflowTaskEntity> taskList = this.listApproveHistory(processId);
List<TaskResponse> history = taskList.stream().map(WorkflowBeanUtils::fromTaskEntity).collect(Collectors.toList());
WorkflowBriefDTO workflowDTO = this.getBriefFromProcessEntity(processEntity);
ProcessDetailResponse processDetail = new ProcessDetailResponse();
processDetail.setProcessInfo(WorkflowBeanUtils.fromProcessEntity(processEntity));
processDetail.setTaskHistory(history);
processDetail.setWorkflow(workflowDTO);
return processDetail;
}
use of org.apache.inlong.manager.dao.entity.WorkflowTaskEntity in project incubator-inlong by apache.
the class UserTaskProcessor method saveTaskEntity.
private WorkflowTaskEntity saveTaskEntity(UserTask task, WorkflowProcessEntity processEntity, String approvers) {
WorkflowTaskEntity taskEntity = new WorkflowTaskEntity();
taskEntity.setType(UserTask.class.getSimpleName());
taskEntity.setProcessId(processEntity.getId());
taskEntity.setProcessName(processEntity.getName());
taskEntity.setProcessDisplayName(processEntity.getDisplayName());
taskEntity.setApplicant(processEntity.getApplicant());
taskEntity.setName(task.getName());
taskEntity.setDisplayName(task.getDisplayName());
taskEntity.setApprovers(approvers);
taskEntity.setStatus(TaskStatus.PENDING.name());
taskEntity.setStartTime(new Date());
taskEntityMapper.insert(taskEntity);
Preconditions.checkNotNull(taskEntity.getId(), "task saved failed");
return taskEntity;
}
use of org.apache.inlong.manager.dao.entity.WorkflowTaskEntity in project incubator-inlong by apache.
the class EndEventProcessor method complete.
@Override
public boolean complete(WorkflowContext context) {
WorkflowProcessEntity processEntity = context.getProcessEntity();
List<WorkflowTaskEntity> tasks = taskEntityMapper.selectByProcess(processEntity.getId(), TaskStatus.PENDING);
// If there are unfinished tasks, the process cannot be ended
if (!CollectionUtils.isEmpty(tasks)) {
log.warn("have pending task, end event not execute");
return true;
}
WorkflowContext.ActionContext actionContext = context.getActionContext();
processEntity.setStatus(getProcessStatus(actionContext.getAction()).name());
processEntity.setEndTime(new Date());
processEntityMapper.update(processEntity);
processEventNotifier.notify(mapToEvent(actionContext.getAction()), context);
return true;
}
use of org.apache.inlong.manager.dao.entity.WorkflowTaskEntity in project incubator-inlong by apache.
the class ServiceTaskProcessor method complete.
@Override
public boolean complete(WorkflowContext context) {
WorkflowContext.ActionContext actionContext = context.getActionContext();
Preconditions.checkTrue(SUPPORT_ACTIONS.contains(actionContext.getAction()), "serviceTask not support action: " + actionContext.getAction());
WorkflowTaskEntity workflowTaskEntity = actionContext.getTaskEntity();
Preconditions.checkTrue(ALLOW_COMPLETE_STATE.contains(TaskStatus.valueOf(workflowTaskEntity.getStatus())), "task status should allow complete");
try {
this.taskEventNotifier.notify(TaskEvent.COMPLETE, context);
completeTaskEntity(actionContext, workflowTaskEntity, TaskStatus.COMPLETED);
return true;
} catch (Exception e) {
completeTaskEntity(actionContext, workflowTaskEntity, TaskStatus.FAILED);
this.taskEventNotifier.notify(TaskEvent.FAIL, context);
this.processEventNotifier.notify(ProcessEvent.FAIL, context);
return false;
}
}
use of org.apache.inlong.manager.dao.entity.WorkflowTaskEntity in project incubator-inlong by apache.
the class ServiceTaskProcessor method create.
@Override
public void create(ServiceTask serviceTask, WorkflowContext context) {
WorkflowTaskEntity workflowTaskEntity = saveTaskEntity(serviceTask, context);
context.getNewTaskList().add(workflowTaskEntity);
serviceTask.initListeners(context);
this.taskEventNotifier.notify(TaskEvent.CREATE, context);
}
Aggregations