Search in sources :

Example 1 with StartEvent

use of org.apache.inlong.manager.workflow.definition.StartEvent 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 StartEvent

use of org.apache.inlong.manager.workflow.definition.StartEvent 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 StartEvent

use of org.apache.inlong.manager.workflow.definition.StartEvent 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 StartEvent

use of org.apache.inlong.manager.workflow.definition.StartEvent 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 StartEvent

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

the class WorkflowQueryServiceImpl method getBriefFromProcessEntity.

private WorkflowBriefDTO getBriefFromProcessEntity(WorkflowProcessEntity processEntity) {
    WorkflowProcess process = definitionRepository.get(processEntity.getName());
    if (process == null) {
        return null;
    }
    Map<String, TaskStatus> nameStatusMap = this.getTaskNameStatusMap(processEntity);
    ElementDTO elementDTO = new ElementDTO();
    StartEvent startEvent = process.getStartEvent();
    elementDTO.setName(startEvent.getName());
    elementDTO.setDisplayName(startEvent.getDisplayName());
    WorkflowContext context = WorkflowBeanUtils.buildContext(process, processEntity);
    addNext(startEvent, elementDTO, context, nameStatusMap);
    WorkflowBriefDTO briefDTO = new WorkflowBriefDTO();
    briefDTO.setName(process.getName());
    briefDTO.setDisplayName(process.getDisplayName());
    briefDTO.setType(process.getType());
    briefDTO.setStartEvent(elementDTO);
    return briefDTO;
}
Also used : WorkflowBriefDTO(org.apache.inlong.manager.common.pojo.workflow.WorkflowBriefDTO) ElementDTO(org.apache.inlong.manager.common.pojo.workflow.ElementDTO) WorkflowContext(org.apache.inlong.manager.workflow.WorkflowContext) StartEvent(org.apache.inlong.manager.workflow.definition.StartEvent) TaskStatus(org.apache.inlong.manager.common.enums.TaskStatus) WorkflowProcess(org.apache.inlong.manager.workflow.definition.WorkflowProcess)

Aggregations

StartEvent (org.apache.inlong.manager.workflow.definition.StartEvent)8 WorkflowProcess (org.apache.inlong.manager.workflow.definition.WorkflowProcess)8 EndEvent (org.apache.inlong.manager.workflow.definition.EndEvent)7 ServiceTask (org.apache.inlong.manager.workflow.definition.ServiceTask)5 UserTask (org.apache.inlong.manager.workflow.definition.UserTask)2 TaskStatus (org.apache.inlong.manager.common.enums.TaskStatus)1 ElementDTO (org.apache.inlong.manager.common.pojo.workflow.ElementDTO)1 WorkflowBriefDTO (org.apache.inlong.manager.common.pojo.workflow.WorkflowBriefDTO)1 GroupResourceProcessForm (org.apache.inlong.manager.common.pojo.workflow.form.GroupResourceProcessForm)1 WorkflowContext (org.apache.inlong.manager.workflow.WorkflowContext)1