use of org.apache.inlong.manager.dao.entity.WorkflowProcessEntity in project incubator-inlong by apache.
the class AbstractTaskProcessor method skip.
@Override
public void skip(T task, WorkflowContext context) {
WorkflowProcessEntity workflowProcessEntity = context.getProcessEntity();
Date now = new Date();
String operators = Joiner.on(WorkflowTaskEntity.APPROVERS_DELIMITER).join(ApproverAssign.DEFAULT_SKIP_APPROVER.assign(context));
WorkflowTaskEntity taskEntity = new WorkflowTaskEntity();
taskEntity.setType(task.getClass().getSimpleName());
taskEntity.setProcessId(workflowProcessEntity.getId());
taskEntity.setProcessName(workflowProcessEntity.getName());
taskEntity.setProcessDisplayName(workflowProcessEntity.getDisplayName());
taskEntity.setApplicant(workflowProcessEntity.getApplicant());
taskEntity.setApprovers(operators);
taskEntity.setOperator(operators);
taskEntity.setName(task.getName());
taskEntity.setDisplayName(task.getDisplayName());
taskEntity.setStatus(TaskStatus.SKIPPED.name());
taskEntity.setRemark("auto skipped");
taskEntity.setStartTime(now);
taskEntity.setEndTime(now);
taskEntityMapper.insert(taskEntity);
Preconditions.checkNotNull(taskEntity.getId(), "task saved failed");
}
use of org.apache.inlong.manager.dao.entity.WorkflowProcessEntity in project incubator-inlong by apache.
the class ServiceTaskProcessor method saveTaskEntity.
private WorkflowTaskEntity saveTaskEntity(ServiceTask serviceTask, WorkflowContext context) {
WorkflowProcessEntity workflowProcessEntity = context.getProcessEntity();
List<String> approvers = ApproverAssign.DEFAULT_SYSTEM_APPROVER.assign(context);
WorkflowTaskEntity taskEntity = new WorkflowTaskEntity();
taskEntity.setType(ServiceTask.class.getSimpleName());
taskEntity.setProcessId(workflowProcessEntity.getId());
taskEntity.setProcessName(context.getProcess().getName());
taskEntity.setProcessDisplayName(context.getProcess().getDisplayName());
taskEntity.setName(serviceTask.getName());
taskEntity.setDisplayName(serviceTask.getDisplayName());
taskEntity.setApplicant(workflowProcessEntity.getApplicant());
taskEntity.setApprovers(StringUtils.join(approvers, WorkflowTaskEntity.APPROVERS_DELIMITER));
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.WorkflowProcessEntity in project incubator-inlong by apache.
the class StartEventProcessor method create.
@Override
public void create(StartEvent startEvent, WorkflowContext context) {
String applicant = context.getApplicant();
WorkflowProcess process = context.getProcess();
ProcessForm form = context.getProcessForm();
if (process.getFormClass() != null) {
Preconditions.checkNotNull(form, "form cannot be null");
Preconditions.checkTrue(form.getClass().isAssignableFrom(process.getFormClass()), "form type not match, should be class " + process.getFormClass());
form.validate();
} else {
Preconditions.checkNull(form, "no form required");
}
WorkflowProcessEntity processEntity = saveProcessEntity(applicant, process, form);
context.setProcessEntity(processEntity);
context.setActionContext(new WorkflowContext.ActionContext().setAction(WorkflowAction.START));
}
use of org.apache.inlong.manager.dao.entity.WorkflowProcessEntity in project incubator-inlong by apache.
the class LogableEventListener method buildEventLog.
protected WorkflowEventLogEntity buildEventLog(WorkflowContext context) {
WorkflowProcessEntity workflowProcessEntity = context.getProcessEntity();
Element currentElement = context.getCurrentElement();
WorkflowEventLogEntity logEntity = new WorkflowEventLogEntity();
logEntity.setProcessId(workflowProcessEntity.getId());
logEntity.setProcessName(workflowProcessEntity.getName());
logEntity.setProcessDisplayName(workflowProcessEntity.getDisplayName());
logEntity.setInlongGroupId(context.getProcessForm().getInlongGroupId());
logEntity.setElementName(currentElement.getName());
logEntity.setElementDisplayName(currentElement.getDisplayName());
logEntity.setEventType(event().getClass().getSimpleName());
logEntity.setEvent(event().name());
logEntity.setListener(eventListener.name());
logEntity.setStatus(EventStatus.EXECUTING.getStatus());
logEntity.setAsync(async() ? 1 : 0);
logEntity.setIp(NetworkUtils.getLocalIp());
logEntity.setStartTime(new Date());
return logEntity;
}
Aggregations