use of org.apache.inlong.manager.workflow.definition.WorkflowProcess 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;
}
use of org.apache.inlong.manager.workflow.definition.WorkflowProcess 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;
}
use of org.apache.inlong.manager.workflow.definition.WorkflowProcess 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;
}
use of org.apache.inlong.manager.workflow.definition.WorkflowProcess 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;
}
use of org.apache.inlong.manager.workflow.definition.WorkflowProcess in project incubator-inlong by apache.
the class WorkflowApproverServiceImpl method list.
@Override
public List<WorkflowApprover> list(WorkflowApproverQuery query) {
List<WorkflowApproverEntity> entityList = workflowApproverMapper.selectByQuery(query);
List<WorkflowApprover> approverList = CommonBeanUtils.copyListProperties(entityList, WorkflowApprover::new);
approverList.forEach(config -> {
WorkflowProcess process = workflowEngine.processDefinitionService().getByName(config.getProcessName());
if (process != null) {
config.setProcessDisplayName(process.getDisplayName());
config.setTaskDisplayName(Optional.ofNullable(process.getTaskByName(config.getTaskName())).map(WorkflowTask::getDisplayName).orElse(null));
}
});
return approverList;
}
Aggregations