use of org.apache.inlong.manager.workflow.WorkflowContext in project incubator-inlong by apache.
the class UserTaskProcessor method next.
@Override
public List<Element> next(UserTask userTask, WorkflowContext context) {
WorkflowContext.ActionContext actionContext = context.getActionContext();
if (userTask.isNeedAllApprove()) {
WorkflowTaskEntity workflowTaskEntity = actionContext.getTaskEntity();
int pendingCount = taskEntityMapper.countByStatus(workflowTaskEntity.getProcessId(), workflowTaskEntity.getName(), TaskStatus.PENDING);
if (pendingCount > 0) {
return Lists.newArrayList();
}
}
return super.next(userTask, context);
}
use of org.apache.inlong.manager.workflow.WorkflowContext in project incubator-inlong by apache.
the class UserTaskProcessor method create.
@Override
public void create(UserTask userTask, WorkflowContext context) {
List<String> approvers = userTask.getApproverAssign().assign(context);
Preconditions.checkNotEmpty(approvers, "cannot assign approvers for task: " + userTask.getDisplayName() + ", as the approvers was empty");
if (!userTask.isNeedAllApprove()) {
approvers = Collections.singletonList(StringUtils.join(approvers, WorkflowTaskEntity.APPROVERS_DELIMITER));
}
WorkflowProcessEntity processEntity = context.getProcessEntity();
approvers.stream().map(approver -> saveTaskEntity(userTask, processEntity, approver)).forEach(context.getNewTaskList()::add);
taskEventNotifier.notify(TaskEvent.CREATE, context);
}
use of org.apache.inlong.manager.workflow.WorkflowContext in project incubator-inlong by apache.
the class TaskServiceImpl method reject.
@Override
public WorkflowContext reject(Integer taskId, String remark, String operator) {
WorkflowContext context = contextBuilder.buildContextForTask(taskId, WorkflowAction.REJECT, remark, operator);
processorExecutor.executeComplete(context.getActionContext().getTask(), context);
return context;
}
use of org.apache.inlong.manager.workflow.WorkflowContext in project incubator-inlong by apache.
the class TaskServiceImpl method complete.
@Override
public WorkflowContext complete(Integer taskId, String remark, String operator) {
WorkflowContext context = contextBuilder.buildContextForTask(taskId, WorkflowAction.COMPLETE, remark, operator);
processorExecutor.executeComplete(context.getActionContext().getTask(), context);
return context;
}
use of org.apache.inlong.manager.workflow.WorkflowContext in project incubator-inlong by apache.
the class WorkflowContextBuilderImpl method buildContextForProcess.
@SneakyThrows
@Override
public WorkflowContext buildContextForProcess(Integer processId) {
WorkflowProcessEntity processEntity = processEntityMapper.selectById(processId);
Preconditions.checkNotNull(processEntity, "process not exist with id: " + processId);
WorkflowProcess process = definitionRepository.get(processEntity.getName()).clone();
return new WorkflowContext().setApplicant(processEntity.getApplicant()).setProcess(process).setProcessForm(WorkflowFormParserUtils.parseProcessForm(processEntity.getFormData(), process)).setProcessEntity(processEntity);
}
Aggregations