public String logStoreParamValid()

in ozhera-log/log-manager/src/main/java/org/apache/ozhera/log/manager/common/validation/StoreValidation.java [73:131]


    public String logStoreParamValid(LogStoreParam storeParam) {
        if (StringUtils.equals("true", tpcDevMode)) {
            return "";
        }
        if (null == MoneUserContext.getCurrentUser()) {
            throw new MilogManageException("please go to login");
        }
        List<String> errorInfos = Lists.newArrayList();
        if (null == storeParam.getSpaceId()) {
            errorInfos.add("Space information cannot be empty");
        }
        if (null == storeParam || StringUtils.isBlank(storeParam.getLogstoreName())) {
            errorInfos.add("logStore  cannot be empty");
        }
        if (StringUtils.isEmpty(storeParam.getMachineRoom())) {
            errorInfos.add("Computer room information  cannot be empty");
            return errorInfos.stream().collect(Collectors.joining(SYMBOL_COMMA));
        }
        if (null == storeParam.getLogType()) {
            errorInfos.add("Log type  cannot be empty");
        }
        if (StringUtils.isEmpty(storeParam.getKeyList())) {
            errorInfos.add("Index columns  cannot be empty");
        }
        List<String> duplicatedKeyList = getDuplicatedKeys(storeParam.getKeyList());
        if (!duplicatedKeyList.isEmpty()) {
            errorInfos.add("Index column fields are duplicated, remove the duplicate fields:" + duplicatedKeyList);
        }
        // Additional field inspection
        if (storeExtensionService.storeInfoCheck(storeParam)) {
            return errorInfos.stream().collect(Collectors.joining(SYMBOL_COMMA));
        }
        if (null == storeParam.getMqResourceId() || null == storeParam.getEsResourceId()) {
            //Verify whether the department to which the current user belongs initializes the resource
            ResourceUserSimple resourceUserSimple = milogMiddlewareConfigService.userResourceList(storeParam.getMachineRoom(), storeParam.getLogType());
            if (!resourceUserSimple.getInitializedFlag()) {
                errorInfos.add(resourceUserSimple.getNotInitializedMsg());
            }
            boolean resourceChosen = null == storeParam.getMqResourceId() || null == storeParam.getEsResourceId();
            if (resourceUserSimple.getInitializedFlag() &&
                    resourceUserSimple.getShowFlag() && resourceChosen) {
                errorInfos.add("Please select the required resource information first");
            }
        } else {
            if (null != storeParam.getMqResourceId()) {
                MilogMiddlewareConfig milogMiddlewareConfig = milogMiddlewareConfigDao.queryById(storeParam.getMqResourceId());
                if (null == milogMiddlewareConfig) {
                    errorInfos.add("MQ resource information cannot be empty");
                }
            }
            if (null != storeParam.getEsResourceId()) {
                MilogEsClusterDO esClusterDO = esCluster.getById(storeParam.getEsResourceId());
                if (null == esClusterDO) {
                    errorInfos.add("ES resource information cannot be empty");
                }
            }
        }
        return errorInfos.stream().collect(Collectors.joining(SYMBOL_COMMA));
    }