@Override
    public ListenerResult listen(WorkflowContext context) throws WorkflowListenerException {
        ApplyGroupProcessForm form = (ApplyGroupProcessForm) context.getProcessForm();
        List<String> groupList = Arrays.asList(form.getInlongGroupId().split(InlongConstants.COMMA));
        for (String groupId : groupList) {
            log.info("begin to execute RejectApplyProcessListener for groupId={}", groupId);

            // only the [TO_BE_APPROVAL] status allowed the rejecting operation
            InlongGroupEntity entity = groupMapper.selectByGroupId(groupId);
            if (entity == null) {
                throw new WorkflowListenerException("inlong group not found with groupId=" + groupId);
            }
            if (!Objects.equals(GroupStatus.TO_BE_APPROVAL.getCode(), entity.getStatus())) {
                throw new WorkflowListenerException("current status was not allowed to reject inlong group");
            }

            // after reject, update InlongGroup status to [APPROVE_REJECTED]
            String username = context.getOperator();
            groupService.updateStatus(groupId, GroupStatus.APPROVE_REJECTED.getCode(), username);
        }
        return ListenerResult.success();
    }
The listener that rejects to apply for InlongGroup.
inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/listener/group/apply/RejectApplyProcessListener.java