Search in sources :

Example 16 with WorkflowTaskEntity

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;
}
Also used : WorkflowContext(org.apache.inlong.manager.workflow.WorkflowContext) WorkflowTaskEntity(org.apache.inlong.manager.dao.entity.WorkflowTaskEntity)

Example 17 with WorkflowTaskEntity

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;
}
Also used : WorkflowContext(org.apache.inlong.manager.workflow.WorkflowContext) WorkflowTask(org.apache.inlong.manager.workflow.definition.WorkflowTask) WorkflowTaskEntity(org.apache.inlong.manager.dao.entity.WorkflowTaskEntity)

Aggregations

WorkflowTaskEntity (org.apache.inlong.manager.dao.entity.WorkflowTaskEntity)17 WorkflowProcessEntity (org.apache.inlong.manager.dao.entity.WorkflowProcessEntity)6 WorkflowContext (org.apache.inlong.manager.workflow.WorkflowContext)6 Date (java.util.Date)5 WorkflowProcess (org.apache.inlong.manager.workflow.definition.WorkflowProcess)3 WorkflowTask (org.apache.inlong.manager.workflow.definition.WorkflowTask)3 SneakyThrows (lombok.SneakyThrows)2 TaskStatus (org.apache.inlong.manager.common.enums.TaskStatus)2 WorkflowException (org.apache.inlong.manager.common.exceptions.WorkflowException)2 ProcessDetailResponse (org.apache.inlong.manager.common.pojo.workflow.ProcessDetailResponse)2 TaskResponse (org.apache.inlong.manager.common.pojo.workflow.TaskResponse)2 UserTask (org.apache.inlong.manager.workflow.definition.UserTask)2 TaskExecuteLogQuery (org.apache.inlong.manager.common.pojo.workflow.TaskExecuteLogQuery)1 TaskQuery (org.apache.inlong.manager.common.pojo.workflow.TaskQuery)1 WorkflowApproverQuery (org.apache.inlong.manager.common.pojo.workflow.WorkflowApproverQuery)1 WorkflowBriefDTO (org.apache.inlong.manager.common.pojo.workflow.WorkflowBriefDTO)1 ProcessForm (org.apache.inlong.manager.common.pojo.workflow.form.ProcessForm)1 TaskForm (org.apache.inlong.manager.common.pojo.workflow.form.TaskForm)1 WorkflowApproverEntity (org.apache.inlong.manager.dao.entity.WorkflowApproverEntity)1 ServiceBaseTest (org.apache.inlong.manager.service.ServiceBaseTest)1