Search in sources :

Example 1 with NewGroupProcessForm

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();
}
Also used : InlongGroupEntity(org.apache.inlong.manager.dao.entity.InlongGroupEntity) NewGroupProcessForm(org.apache.inlong.manager.common.pojo.workflow.form.NewGroupProcessForm) WorkflowListenerException(org.apache.inlong.manager.common.exceptions.WorkflowListenerException)

Example 2 with NewGroupProcessForm

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();
}
Also used : InlongGroupEntity(org.apache.inlong.manager.dao.entity.InlongGroupEntity) NewGroupProcessForm(org.apache.inlong.manager.common.pojo.workflow.form.NewGroupProcessForm) WorkflowListenerException(org.apache.inlong.manager.common.exceptions.WorkflowListenerException)

Example 3 with NewGroupProcessForm

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;
}
Also used : StreamBriefResponse(org.apache.inlong.manager.common.pojo.stream.StreamBriefResponse) NewGroupProcessForm(org.apache.inlong.manager.common.pojo.workflow.form.NewGroupProcessForm) InlongGroupInfo(org.apache.inlong.manager.common.pojo.group.InlongGroupInfo)

Example 4 with NewGroupProcessForm

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);
}
Also used : NewGroupProcessForm(org.apache.inlong.manager.common.pojo.workflow.form.NewGroupProcessForm)

Example 5 with NewGroupProcessForm

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();
}
Also used : InlongStreamEntity(org.apache.inlong.manager.dao.entity.InlongStreamEntity) NewGroupProcessForm(org.apache.inlong.manager.common.pojo.workflow.form.NewGroupProcessForm) GroupResourceProcessForm(org.apache.inlong.manager.common.pojo.workflow.form.GroupResourceProcessForm) InlongStreamInfo(org.apache.inlong.manager.common.pojo.stream.InlongStreamInfo)

Aggregations

NewGroupProcessForm (org.apache.inlong.manager.common.pojo.workflow.form.NewGroupProcessForm)5 WorkflowListenerException (org.apache.inlong.manager.common.exceptions.WorkflowListenerException)2 InlongGroupEntity (org.apache.inlong.manager.dao.entity.InlongGroupEntity)2 InlongGroupInfo (org.apache.inlong.manager.common.pojo.group.InlongGroupInfo)1 InlongStreamInfo (org.apache.inlong.manager.common.pojo.stream.InlongStreamInfo)1 StreamBriefResponse (org.apache.inlong.manager.common.pojo.stream.StreamBriefResponse)1 GroupResourceProcessForm (org.apache.inlong.manager.common.pojo.workflow.form.GroupResourceProcessForm)1 InlongStreamEntity (org.apache.inlong.manager.dao.entity.InlongStreamEntity)1