use of org.apache.inlong.manager.dao.entity.WorkflowTaskEntity in project incubator-inlong by apache.
the class UserTaskProcessor method complete.
@Override
public boolean complete(WorkflowContext context) {
WorkflowContext.ActionContext actionContext = context.getActionContext();
Preconditions.checkTrue(SUPPORT_ACTIONS.contains(actionContext.getAction()), "UserTask not support action:" + actionContext.getAction());
WorkflowTaskEntity workflowTaskEntity = actionContext.getTaskEntity();
Preconditions.checkTrue(TaskStatus.PENDING.name().equalsIgnoreCase(workflowTaskEntity.getStatus()), "task status should be pending");
checkOperator(actionContext);
completeTaskInstance(actionContext);
this.taskEventNotifier.notify(toTaskEvent(actionContext.getAction()), context);
return true;
}
use of org.apache.inlong.manager.dao.entity.WorkflowTaskEntity in project incubator-inlong by apache.
the class ProcessServiceImpl method cancel.
@Override
public WorkflowContext cancel(Integer processId, String operator, String remark) {
Preconditions.checkNotEmpty(operator, "operator cannot be null");
Preconditions.checkNotNull(processId, "processId cannot be null");
WorkflowContext context = workflowContextBuilder.buildContextForProcess(processId);
List<WorkflowTaskEntity> pendingTasks = taskEntityMapper.selectByProcess(processId, TaskStatus.PENDING);
for (WorkflowTaskEntity taskEntity : pendingTasks) {
WorkflowTask task = context.getProcess().getTaskByName(taskEntity.getName());
context.setActionContext(new WorkflowContext.ActionContext().setAction(WorkflowAction.CANCEL).setTaskEntity(taskEntity).setOperator(operator).setRemark(remark).setTask(task));
this.processorExecutor.executeComplete(task, context);
}
return context;
}
Aggregations