Search in sources :

Example 6 with ConfigFullModel

use of com.baidu.disconf.web.web.config.dto.ConfigFullModel in project disconf by knightliao.

the class ZkDeployValidator method verify.

/**
     * @param zkDeployForm
     *
     * @return
     */
public ConfigFullModel verify(ZkDeployForm zkDeployForm) {
    //
    if (zkDeployForm.getAppId() == null) {
        throw new FieldException("app is empty", null);
    }
    App app = appMgr.getById(zkDeployForm.getAppId());
    if (app == null) {
        throw new FieldException("app " + zkDeployForm.getAppId() + " doesn't exist in db.", null);
    }
    //
    if (zkDeployForm.getEnvId() == null) {
        throw new FieldException("app is empty", null);
    }
    Env env = envMgr.getById(zkDeployForm.getEnvId());
    if (env == null) {
        throw new FieldException("env " + zkDeployForm.getEnvId() + " doesn't exist in db.", null);
    }
    //
    if (StringUtils.isEmpty(zkDeployForm.getVersion())) {
        throw new FieldException("version is empty", null);
    }
    return new ConfigFullModel(app, env, zkDeployForm.getVersion(), "");
}
Also used : App(com.baidu.disconf.web.service.app.bo.App) FieldException(com.baidu.dsp.common.exception.FieldException) ConfigFullModel(com.baidu.disconf.web.web.config.dto.ConfigFullModel) Env(com.baidu.disconf.web.service.env.bo.Env)

Aggregations

ConfigFullModel (com.baidu.disconf.web.web.config.dto.ConfigFullModel)6 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)3 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)3 App (com.baidu.disconf.web.service.app.bo.App)2 Config (com.baidu.disconf.web.service.config.bo.Config)2 Env (com.baidu.disconf.web.service.env.bo.Env)2 NoAuth (com.baidu.dsp.common.annotation.NoAuth)2 DocumentNotFoundException (com.baidu.dsp.common.exception.DocumentNotFoundException)2 FieldException (com.baidu.dsp.common.exception.FieldException)2 UnsupportedEncodingException (java.io.UnsupportedEncodingException)2