Search in sources :

Example 11 with ProcessForm

use of org.apache.inlong.manager.common.pojo.workflow.form.ProcessForm 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));
}
Also used : ProcessForm(org.apache.inlong.manager.common.pojo.workflow.form.ProcessForm) WorkflowProcessEntity(org.apache.inlong.manager.dao.entity.WorkflowProcessEntity) WorkflowProcess(org.apache.inlong.manager.workflow.definition.WorkflowProcess)

Example 12 with ProcessForm

use of org.apache.inlong.manager.common.pojo.workflow.form.ProcessForm in project incubator-inlong by apache.

the class SourceStopEventSelector method accept.

@Override
public boolean accept(WorkflowContext context) {
    ProcessForm processForm = context.getProcessForm();
    if (!(processForm instanceof UpdateGroupProcessForm)) {
        return false;
    }
    UpdateGroupProcessForm updateGroupProcessForm = (UpdateGroupProcessForm) processForm;
    return updateGroupProcessForm.getOperateType() == OperateType.SUSPEND;
}
Also used : UpdateGroupProcessForm(org.apache.inlong.manager.common.pojo.workflow.form.UpdateGroupProcessForm) ProcessForm(org.apache.inlong.manager.common.pojo.workflow.form.ProcessForm) UpdateGroupProcessForm(org.apache.inlong.manager.common.pojo.workflow.form.UpdateGroupProcessForm)

Example 13 with ProcessForm

use of org.apache.inlong.manager.common.pojo.workflow.form.ProcessForm in project incubator-inlong by apache.

the class SourceDeleteEventSelector method accept.

@Override
public boolean accept(WorkflowContext context) {
    ProcessForm processForm = context.getProcessForm();
    if (!(processForm instanceof UpdateGroupProcessForm)) {
        return false;
    }
    UpdateGroupProcessForm updateGroupProcessForm = (UpdateGroupProcessForm) processForm;
    return updateGroupProcessForm.getOperateType() == OperateType.DELETE;
}
Also used : UpdateGroupProcessForm(org.apache.inlong.manager.common.pojo.workflow.form.UpdateGroupProcessForm) ProcessForm(org.apache.inlong.manager.common.pojo.workflow.form.ProcessForm) UpdateGroupProcessForm(org.apache.inlong.manager.common.pojo.workflow.form.UpdateGroupProcessForm)

Aggregations

ProcessForm (org.apache.inlong.manager.common.pojo.workflow.form.ProcessForm)13 GroupResourceProcessForm (org.apache.inlong.manager.common.pojo.workflow.form.GroupResourceProcessForm)8 UpdateGroupProcessForm (org.apache.inlong.manager.common.pojo.workflow.form.UpdateGroupProcessForm)7 InlongGroupInfo (org.apache.inlong.manager.common.pojo.group.InlongGroupInfo)6 WorkflowContext (org.apache.inlong.manager.workflow.WorkflowContext)4 WorkflowProcess (org.apache.inlong.manager.workflow.definition.WorkflowProcess)4 WorkflowTask (org.apache.inlong.manager.workflow.definition.WorkflowTask)3 InlongStreamInfo (org.apache.inlong.manager.common.pojo.stream.InlongStreamInfo)2 ProcessResponse (org.apache.inlong.manager.common.pojo.workflow.ProcessResponse)2 WorkflowResult (org.apache.inlong.manager.common.pojo.workflow.WorkflowResult)2 WorkflowProcessEntity (org.apache.inlong.manager.dao.entity.WorkflowProcessEntity)2 WorkflowServiceImplTest (org.apache.inlong.manager.service.workflow.WorkflowServiceImplTest)2 ServiceTask (org.apache.inlong.manager.workflow.definition.ServiceTask)2 TaskEventListener (org.apache.inlong.manager.workflow.event.task.TaskEventListener)2 Test (org.junit.Test)2 Lists (com.google.common.collect.Lists)1 List (java.util.List)1 Map (java.util.Map)1 Collectors (java.util.stream.Collectors)1 SneakyThrows (lombok.SneakyThrows)1