Search in sources :

Example 1 with EndEvent

use of org.apache.inlong.manager.workflow.definition.EndEvent in project incubator-inlong by apache.

the class NewGroupWorkflowDefinition method defineProcess.

@Override
public WorkflowProcess defineProcess() {
    // Configuration process
    WorkflowProcess process = new WorkflowProcess();
    process.setType(getProcessName().getDisplayName());
    process.setName(getProcessName().name());
    process.setDisplayName(getProcessName().getDisplayName());
    process.setFormClass(NewGroupProcessForm.class);
    process.setVersion(1);
    // Set up the listener
    process.addListener(groupCancelProcessListener);
    process.addListener(approveRejectProcessListener);
    // Initiate the process of creating inlong group resources, and set the inlong group status
    // to [Configuration Successful]/[Configuration Failed] according to its completion
    process.addListener(startCreateGroupProcessListener);
    // Start node
    StartEvent startEvent = new StartEvent();
    process.setStartEvent(startEvent);
    // End node
    EndEvent endEvent = new EndEvent();
    process.setEndEvent(endEvent);
    // System administrator approval
    UserTask adminUserTask = new UserTask();
    adminUserTask.setName("ut_admin");
    adminUserTask.setDisplayName("System Administrator");
    adminUserTask.setFormClass(InlongGroupApproveForm.class);
    adminUserTask.setApproverAssign(context -> getTaskApprovers(adminUserTask.getName()));
    adminUserTask.addListener(groupPassTaskListener);
    process.addTask(adminUserTask);
    // Configuration order relationship
    startEvent.addNext(adminUserTask);
    // If you need another approval process, you can add it here
    adminUserTask.addNext(endEvent);
    return process;
}
Also used : StartEvent(org.apache.inlong.manager.workflow.definition.StartEvent) UserTask(org.apache.inlong.manager.workflow.definition.UserTask) EndEvent(org.apache.inlong.manager.workflow.definition.EndEvent) WorkflowProcess(org.apache.inlong.manager.workflow.definition.WorkflowProcess)

Example 2 with EndEvent

use of org.apache.inlong.manager.workflow.definition.EndEvent in project incubator-inlong by apache.

the class SuspendGroupWorkflowDefinition method defineProcess.

@Override
public WorkflowProcess defineProcess() {
    // Configuration process
    WorkflowProcess process = new WorkflowProcess();
    process.addListener(updateGroupListener);
    process.addListener(updateGroupCompleteListener);
    process.setType("Group Resource Suspend");
    process.setName(getProcessName().name());
    process.setDisplayName(getProcessName().getDisplayName());
    process.setFormClass(UpdateGroupProcessForm.class);
    process.setVersion(1);
    process.setHidden(1);
    // Start node
    StartEvent startEvent = new StartEvent();
    process.setStartEvent(startEvent);
    // stop datasource
    ServiceTask stopDataSourceTask = new ServiceTask();
    stopDataSourceTask.setName("stopSource");
    stopDataSourceTask.setDisplayName("Group-StopSource");
    stopDataSourceTask.addServiceTaskType(ServiceTaskType.STOP_SOURCE);
    stopDataSourceTask.addListenerProvider(serviceTaskListenerFactory);
    process.addTask(stopDataSourceTask);
    // stop sort
    ServiceTask stopSortTask = new ServiceTask();
    stopSortTask.setName("stopSort");
    stopSortTask.setDisplayName("Group-StopSort");
    stopSortTask.addServiceTaskType(ServiceTaskType.STOP_SORT);
    stopSortTask.addListenerProvider(serviceTaskListenerFactory);
    process.addTask(stopSortTask);
    // End node
    EndEvent endEvent = new EndEvent();
    process.setEndEvent(endEvent);
    startEvent.addNext(stopDataSourceTask);
    stopDataSourceTask.addNext(stopSortTask);
    stopSortTask.addNext(endEvent);
    return process;
}
Also used : ServiceTask(org.apache.inlong.manager.workflow.definition.ServiceTask) StartEvent(org.apache.inlong.manager.workflow.definition.StartEvent) EndEvent(org.apache.inlong.manager.workflow.definition.EndEvent) WorkflowProcess(org.apache.inlong.manager.workflow.definition.WorkflowProcess)

Example 3 with EndEvent

use of org.apache.inlong.manager.workflow.definition.EndEvent in project incubator-inlong by apache.

the class CreateGroupWorkflowDefinition method defineProcess.

@Override
public WorkflowProcess defineProcess() {
    // Configuration process
    WorkflowProcess process = new WorkflowProcess();
    process.addListener(initGroupListener);
    process.addListener(groupCompleteProcessListener);
    process.addListener(groupFailedProcessListener);
    process.setType("Group Resource Creation");
    process.setName(getProcessName().name());
    process.setDisplayName(getProcessName().getDisplayName());
    process.setFormClass(GroupResourceProcessForm.class);
    process.setVersion(1);
    process.setHidden(1);
    // Start node
    StartEvent startEvent = new StartEvent();
    process.setStartEvent(startEvent);
    // init DataSource
    ServiceTask initDataSourceTask = new ServiceTask();
    initDataSourceTask.setName("initSource");
    initDataSourceTask.setDisplayName("Group-InitSource");
    initDataSourceTask.addServiceTaskType(ServiceTaskType.INIT_SOURCE);
    initDataSourceTask.addListenerProvider(serviceTaskListenerFactory);
    process.addTask(initDataSourceTask);
    // init MQ resource
    ServiceTask initMQResourceTask = new ServiceTask();
    initMQResourceTask.setName("initMQ");
    initMQResourceTask.setDisplayName("Group-InitMQ");
    initMQResourceTask.addServiceTaskType(ServiceTaskType.INIT_MQ);
    initMQResourceTask.addListenerProvider(serviceTaskListenerFactory);
    process.addTask(initMQResourceTask);
    // init Sort resource
    ServiceTask initSortResourceTask = new ServiceTask();
    initSortResourceTask.setName("initSort");
    initSortResourceTask.setDisplayName("Group-InitSort");
    initSortResourceTask.addServiceTaskType(ServiceTaskType.INIT_SORT);
    initSortResourceTask.addListenerProvider(serviceTaskListenerFactory);
    process.addTask(initSortResourceTask);
    // init sink
    ServiceTask initSinkTask = new ServiceTask();
    initSinkTask.setName("initSink");
    initSinkTask.setDisplayName("Group-InitSink");
    initSinkTask.addServiceTaskType(ServiceTaskType.INIT_SINK);
    initSinkTask.addListenerProvider(serviceTaskListenerFactory);
    process.addTask(initSinkTask);
    // End node
    EndEvent endEvent = new EndEvent();
    process.setEndEvent(endEvent);
    startEvent.addNext(initDataSourceTask);
    initDataSourceTask.addNext(initMQResourceTask);
    initMQResourceTask.addNext(initSortResourceTask);
    initSortResourceTask.addNext(initSinkTask);
    initSinkTask.addNext(endEvent);
    return process;
}
Also used : ServiceTask(org.apache.inlong.manager.workflow.definition.ServiceTask) StartEvent(org.apache.inlong.manager.workflow.definition.StartEvent) EndEvent(org.apache.inlong.manager.workflow.definition.EndEvent) WorkflowProcess(org.apache.inlong.manager.workflow.definition.WorkflowProcess)

Example 4 with EndEvent

use of org.apache.inlong.manager.workflow.definition.EndEvent in project incubator-inlong by apache.

the class DeleteGroupWorkflowDefinition method defineProcess.

@Override
public WorkflowProcess defineProcess() {
    // Configuration process
    WorkflowProcess process = new WorkflowProcess();
    process.addListener(updateGroupListener);
    process.addListener(updateGroupCompleteListener);
    process.setType("Group Resource Delete");
    process.setName(getProcessName().name());
    process.setDisplayName(getProcessName().getDisplayName());
    process.setFormClass(UpdateGroupProcessForm.class);
    process.setVersion(1);
    process.setHidden(1);
    // Start node
    StartEvent startEvent = new StartEvent();
    process.setStartEvent(startEvent);
    // delete datasource
    ServiceTask deleteDataSourceTask = new ServiceTask();
    deleteDataSourceTask.setName("deleteSource");
    deleteDataSourceTask.setDisplayName("Group-DeleteSource");
    deleteDataSourceTask.addServiceTaskType(ServiceTaskType.DELETE_SOURCE);
    deleteDataSourceTask.addListenerProvider(serviceTaskListenerFactory);
    process.addTask(deleteDataSourceTask);
    // delete sort
    ServiceTask deleteSortTask = new ServiceTask();
    deleteSortTask.setName("deleteSort");
    deleteSortTask.setDisplayName("Group-DeleteSort");
    deleteSortTask.addServiceTaskType(ServiceTaskType.DELETE_SORT);
    deleteSortTask.addListenerProvider(serviceTaskListenerFactory);
    process.addTask(deleteSortTask);
    // End node
    EndEvent endEvent = new EndEvent();
    process.setEndEvent(endEvent);
    startEvent.addNext(deleteDataSourceTask);
    deleteDataSourceTask.addNext(deleteSortTask);
    deleteSortTask.addNext(endEvent);
    return process;
}
Also used : ServiceTask(org.apache.inlong.manager.workflow.definition.ServiceTask) StartEvent(org.apache.inlong.manager.workflow.definition.StartEvent) EndEvent(org.apache.inlong.manager.workflow.definition.EndEvent) WorkflowProcess(org.apache.inlong.manager.workflow.definition.WorkflowProcess)

Example 5 with EndEvent

use of org.apache.inlong.manager.workflow.definition.EndEvent in project incubator-inlong by apache.

the class NewConsumptionWorkflowDefinition method defineProcess.

@Override
public WorkflowProcess defineProcess() {
    // Define process information
    WorkflowProcess process = new WorkflowProcess();
    process.setType("Data Consumption Resource Creation");
    process.setName(getProcessName().name());
    process.setDisplayName(getProcessName().getDisplayName());
    process.setFormClass(NewConsumptionProcessForm.class);
    process.setVersion(1);
    process.setProcessDetailHandler(newConsumptionProcessDetailHandler);
    // Start node
    StartEvent startEvent = new StartEvent();
    process.setStartEvent(startEvent);
    // End node
    EndEvent endEvent = new EndEvent();
    process.setEndEvent(endEvent);
    // Group approval tasks
    UserTask groupOwnerUserTask = new UserTask();
    groupOwnerUserTask.setName(UT_GROUP_OWNER_NAME);
    groupOwnerUserTask.setDisplayName("Group Approval");
    groupOwnerUserTask.setApproverAssign(this::bizOwnerUserTaskApprover);
    process.addTask(groupOwnerUserTask);
    // System administrator approval
    UserTask adminUserTask = new UserTask();
    adminUserTask.setName(UT_ADMINT_NAME);
    adminUserTask.setDisplayName("System Administrator");
    adminUserTask.setFormClass(ConsumptionApproveForm.class);
    adminUserTask.setApproverAssign(this::adminUserTaskApprover);
    adminUserTask.addListener(consumptionPassTaskListener);
    process.addTask(adminUserTask);
    // Set order relationship
    startEvent.addNext(groupOwnerUserTask);
    groupOwnerUserTask.addNext(adminUserTask);
    adminUserTask.addNext(endEvent);
    // Set up the listener
    process.addListener(consumptionCompleteProcessListener);
    process.addListener(consumptionRejectProcessListener);
    process.addListener(consumptionCancelProcessListener);
    return process;
}
Also used : StartEvent(org.apache.inlong.manager.workflow.definition.StartEvent) UserTask(org.apache.inlong.manager.workflow.definition.UserTask) EndEvent(org.apache.inlong.manager.workflow.definition.EndEvent) WorkflowProcess(org.apache.inlong.manager.workflow.definition.WorkflowProcess)

Aggregations

EndEvent (org.apache.inlong.manager.workflow.definition.EndEvent)8 StartEvent (org.apache.inlong.manager.workflow.definition.StartEvent)7 WorkflowProcess (org.apache.inlong.manager.workflow.definition.WorkflowProcess)7 ServiceTask (org.apache.inlong.manager.workflow.definition.ServiceTask)5 UserTask (org.apache.inlong.manager.workflow.definition.UserTask)2 Collections (java.util.Collections)1 List (java.util.List)1 Collectors (java.util.stream.Collectors)1 WorkflowException (org.apache.inlong.manager.common.exceptions.WorkflowException)1 GroupResourceProcessForm (org.apache.inlong.manager.common.pojo.workflow.form.GroupResourceProcessForm)1 Preconditions (org.apache.inlong.manager.common.util.Preconditions)1 WorkflowContext (org.apache.inlong.manager.workflow.WorkflowContext)1 Element (org.apache.inlong.manager.workflow.definition.Element)1 NextableElement (org.apache.inlong.manager.workflow.definition.NextableElement)1 CollectionUtils (org.springframework.util.CollectionUtils)1