use of org.apache.inlong.manager.common.pojo.workflow.form.NewGroupProcessForm in project incubator-inlong by apache.
the class GroupCancelProcessListener method listen.
@Override
public ListenerResult listen(WorkflowContext context) throws WorkflowListenerException {
NewGroupProcessForm form = (NewGroupProcessForm) context.getProcessForm();
// After canceling the approval, the status becomes [Waiting to submit]
String groupId = form.getInlongGroupId();
// Only the [Wait approval] status allowed the canceling operation
InlongGroupEntity entity = groupMapper.selectByGroupId(groupId);
if (entity == null) {
throw new WorkflowListenerException("inlong group not found with group id=" + groupId);
}
if (!Objects.equals(GroupState.TO_BE_APPROVAL.getCode(), entity.getStatus())) {
throw new WorkflowListenerException("current status was not allowed to cancel business");
}
// After canceling the approval, the status becomes [Waiting to submit]
String username = context.getApplicant();
groupMapper.updateStatus(groupId, GroupState.TO_BE_SUBMIT.getCode(), username);
return ListenerResult.success();
}
use of org.apache.inlong.manager.common.pojo.workflow.form.NewGroupProcessForm in project incubator-inlong by apache.
the class GroupRejectProcessListener method listen.
@Override
public ListenerResult listen(WorkflowContext context) throws WorkflowListenerException {
NewGroupProcessForm form = (NewGroupProcessForm) context.getProcessForm();
// Only the [Wait approval] status allowed the rejecting operation
String groupId = form.getInlongGroupId();
InlongGroupEntity entity = groupMapper.selectByGroupId(groupId);
if (entity == null) {
throw new WorkflowListenerException("inlong group not found with group id=" + groupId);
}
if (!Objects.equals(GroupState.TO_BE_APPROVAL.getCode(), entity.getStatus())) {
throw new WorkflowListenerException("current status was not allowed to reject inlong group");
}
// After reject, update inlong group status to [GROUP_APPROVE_REJECT]
String username = context.getApplicant();
groupService.updateStatus(groupId, GroupState.APPROVE_REJECTED.getCode(), username);
return ListenerResult.success();
}
use of org.apache.inlong.manager.common.pojo.workflow.form.NewGroupProcessForm in project incubator-inlong by apache.
the class InlongGroupProcessOperation method genNewGroupProcessForm.
/**
* Generate the form of [New Group Workflow]
*/
public NewGroupProcessForm genNewGroupProcessForm(String groupId) {
NewGroupProcessForm form = new NewGroupProcessForm();
InlongGroupInfo groupInfo = groupService.get(groupId);
form.setGroupInfo(groupInfo);
List<StreamBriefResponse> infoList = streamService.getBriefList(groupInfo.getInlongGroupId());
form.setStreamInfoList(infoList);
return form;
}
use of org.apache.inlong.manager.common.pojo.workflow.form.NewGroupProcessForm in project incubator-inlong by apache.
the class InlongGroupProcessOperation method startProcess.
/**
* Allocate resource application groups for access services and initiate an approval process
*
* @param groupId Inlong group id
* @param operator Operator name
* @return Workflow result
*/
public WorkflowResult startProcess(String groupId, String operator) {
LOGGER.info("begin to start approve process, groupId = {}, operator = {}", groupId, operator);
groupService.updateStatus(groupId, GroupState.TO_BE_APPROVAL.getCode(), operator);
// Initiate the approval process
NewGroupProcessForm form = genNewGroupProcessForm(groupId);
return workflowService.start(ProcessName.NEW_GROUP_PROCESS, operator, form);
}
use of org.apache.inlong.manager.common.pojo.workflow.form.NewGroupProcessForm in project incubator-inlong by apache.
the class StartCreateGroupProcessListener method listen.
/**
* Initiate the process of creating inlong group resources after new inlong group access approved
*/
@Override
public ListenerResult listen(WorkflowContext context) throws WorkflowListenerException {
NewGroupProcessForm form = (NewGroupProcessForm) context.getProcessForm();
String groupId = form.getInlongGroupId();
GroupResourceProcessForm processForm = new GroupResourceProcessForm();
processForm.setGroupInfo(groupService.get(groupId));
String username = context.getApplicant();
List<InlongStreamEntity> inlongStreamEntityList = streamMapper.selectByGroupId(groupId);
List<InlongStreamInfo> inlongStreamInfoList = CommonBeanUtils.copyListProperties(inlongStreamEntityList, InlongStreamInfo::new);
processForm.setInlongStreamInfoList(inlongStreamInfoList);
workflowService.start(ProcessName.CREATE_GROUP_RESOURCE, username, processForm);
return ListenerResult.success();
}
Aggregations