private StringBuilder buildOldQueryResult(StringBuilder sBuffer,
            Map<String, List<TopicDeployEntity>> topicDeployInfoMap) {
        // build query result
        int totalCnt = 0;
        int itemCount = 0;
        int condStatusId = 1;
        int maxMsgSizeInMB = 0;
        int totalCfgNumPartCount = 0;
        int totalRunNumPartCount = 0;
        boolean enableAuthCtrl;
        boolean isSrvAcceptPublish = false;
        boolean isSrvAcceptSubscribe = false;
        String strManageStatus;
        TopicCtrlEntity ctrlEntity;
        BrokerConfEntity brokerConfEntity;
        List<GroupConsumeCtrlEntity> groupCtrlInfoLst;
        Tuple3<Boolean, Boolean, TopicInfo> topicInfoTuple = new Tuple3<>();
        BrokerRunManager brokerRunManager = master.getBrokerRunManager();
        ClusterSettingEntity defSetting = defMetaDataService.getClusterDefSetting(false);
        WebParameterUtils.buildSuccessWithDataRetBegin(sBuffer);
        for (Map.Entry<String, List<TopicDeployEntity>> entry : topicDeployInfoMap.entrySet()) {
            totalCfgNumPartCount = 0;
            totalRunNumPartCount = 0;
            isSrvAcceptPublish = false;
            isSrvAcceptSubscribe = false;
            ctrlEntity = defMetaDataService.getTopicCtrlByTopicName(entry.getKey());
            if (ctrlEntity == null) {
                continue;
            }
            if (totalCnt++ > 0) {
                sBuffer.append(",");
            }
            maxMsgSizeInMB = defSetting.getMaxMsgSizeInMB();
            if (ctrlEntity.getMaxMsgSizeInMB() != TBaseConstants.META_VALUE_UNDEFINED) {
                maxMsgSizeInMB = ctrlEntity.getMaxMsgSizeInMB();
            }
            enableAuthCtrl = ctrlEntity.getAuthCtrlStatus().isEnable();
            sBuffer.append("{\"topicName\":\"").append(entry.getKey())
                    .append("\",\"maxMsgSizeInMB\":").append(maxMsgSizeInMB)
                    .append(",\"topicInfo\":[");
            itemCount = 0;
            for (TopicDeployEntity entity : entry.getValue()) {
                if (itemCount++ > 0) {
                    sBuffer.append(",");
                }
                totalCfgNumPartCount += entity.getNumPartitions() * entity.getNumTopicStores();
                entity.toWebJsonStr(sBuffer, true, false);
                sBuffer.append(",\"runInfo\":{");
                strManageStatus = "-";
                brokerConfEntity =
                        defMetaDataService.getBrokerConfByBrokerId(entity.getBrokerId());
                if (brokerConfEntity != null) {
                    strManageStatus = brokerConfEntity.getManageStatus().getDescription();
                }
                brokerRunManager.getPubBrokerTopicInfo(
                        entity.getBrokerId(), entity.getTopicName(), topicInfoTuple);
                if (topicInfoTuple.getF2() == null) {
                    sBuffer.append("\"acceptPublish\":\"-\"").append(",\"acceptSubscribe\":\"-\"")
                            .append(",\"numPartitions\":\"-\"").append(",\"brokerManageStatus\":\"-\"");
                } else {
                    if (topicInfoTuple.getF0()) {
                        sBuffer.append("\"acceptPublish\":")
                                .append(topicInfoTuple.getF2().isAcceptPublish());
                        if (topicInfoTuple.getF2().isAcceptPublish()) {
                            isSrvAcceptPublish = true;
                        }
                    } else {
                        sBuffer.append("\"acceptPublish\":false");
                    }
                    if (topicInfoTuple.getF1()) {
                        sBuffer.append(",\"acceptSubscribe\":")
                                .append(topicInfoTuple.getF2().isAcceptSubscribe());
                        if (topicInfoTuple.getF2().isAcceptSubscribe()) {
                            isSrvAcceptSubscribe = true;
                        }
                    } else {
                        sBuffer.append(",\"acceptSubscribe\":false");
                    }
                    totalRunNumPartCount +=
                            topicInfoTuple.getF2().getPartitionNum() * topicInfoTuple.getF2().getTopicStoreNum();
                    sBuffer.append(",\"numPartitions\":")
                            .append(topicInfoTuple.getF2().getPartitionNum())
                            .append(",\"numTopicStores\":")
                            .append(topicInfoTuple.getF2().getTopicStoreNum())
                            .append(",\"brokerManageStatus\":\"").append(strManageStatus).append("\"");
                }
                sBuffer.append("}}");
            }
            sBuffer.append("],\"infoCount\":").append(itemCount)
                    .append(",\"totalCfgNumPart\":").append(totalCfgNumPartCount)
                    .append(",\"isSrvAcceptPublish\":").append(isSrvAcceptPublish)
                    .append(",\"isSrvAcceptSubscribe\":").append(isSrvAcceptSubscribe)
                    .append(",\"totalRunNumPartCount\":").append(totalRunNumPartCount)
                    .append(",\"authData\":{");
            if (enableAuthCtrl) {
                sBuffer.append("\"enableAuthControl\":").append(enableAuthCtrl)
                        .append(",\"createUser\":\"").append(ctrlEntity.getModifyUser())
                        .append("\",\"createDate\":\"").append(ctrlEntity.getModifyDateStr())
                        .append("\",\"authConsumeGroup\":[");
                itemCount = 0;
                groupCtrlInfoLst = defMetaDataService.getConsumeCtrlByTopic(entry.getKey());
                for (GroupConsumeCtrlEntity groupEntity : groupCtrlInfoLst) {
                    if (itemCount++ > 0) {
                        sBuffer.append(",");
                    }
                    sBuffer.append("{\"groupName\":\"").append(groupEntity.getGroupName())
                            .append("\",\"createUser\":\"").append(groupEntity.getCreateUser())
                            .append("\",\"createDate\":\"").append(groupEntity.getCreateDateStr())
                            .append("\",\"modifyUser\":\"").append(groupEntity.getModifyUser())
                            .append("\",\"modifyDate\":\"").append(groupEntity.getModifyDateStr())
                            .append("\"}");
                }
                sBuffer.append("],\"groupCount\":").append(itemCount).append(",\"authFilterCondSet\":[");
                itemCount = 0;
                for (GroupConsumeCtrlEntity groupEntity : groupCtrlInfoLst) {
                    if (itemCount++ > 0) {
                        sBuffer.append(",");
                    }
                    condStatusId = 0;
                    if (groupEntity.getFilterEnable().isEnable()) {
                        condStatusId = 2;
                    }
                    sBuffer.append("{\"groupName\":\"").append(groupEntity.getGroupName())
                            .append("\",\"condStatus\":").append(condStatusId);
                    if (!groupEntity.getFilterEnable().isEnable()) {
                        sBuffer.append(",\"filterConds\":\"\"");
                    } else {
                        sBuffer.append(",\"filterConds\":\"")
                                .append(groupEntity.getFilterCondStr()).append("\"");
                    }
                    sBuffer.append(",\"createDate\":\"").append(groupEntity.getCreateDateStr())
                            .append("\",\"modifyUser\":\"").append(groupEntity.getModifyUser())
                            .append("\",\"modifyDate\":\"").append(groupEntity.getModifyDateStr())
                            .append("\"}");
                }
                sBuffer.append("],\"filterCount\":").append(itemCount);
            }
            sBuffer.append("}}");
        }
        WebParameterUtils.buildSuccessWithDataRetEnd(sBuffer, totalCnt);
        return sBuffer;
    }
Query topic info

@param req       Http Servlet Request
@param sBuffer   string buffer
@param result    process result
@return    process result
inlong-tubemq/tubemq-server/src/main/java/org/apache/inlong/tubemq/server/master/web/handler/WebTopicDeployHandler.java