use of com.baidu.disconf.web.service.app.bo.App in project disconf by knightliao.
the class AppMgrImpl method getByIds.
@Override
public Map<Long, App> getByIds(Set<Long> ids) {
if (ids.size() == 0) {
return new HashMap<Long, App>();
}
List<App> apps = appDao.get(ids);
Map<Long, App> map = new HashMap<Long, App>();
for (App app : apps) {
map.put(app.getId(), app);
}
return map;
}
use of com.baidu.disconf.web.service.app.bo.App in project disconf by knightliao.
the class AppMgrImpl method getAuthAppVoList.
/**
*
*/
@Override
public List<AppListVo> getAuthAppVoList() {
List<App> apps = appDao.getByIds(userInnerMgr.getVisitorAppIds());
List<AppListVo> appListVos = new ArrayList<AppListVo>();
for (App app : apps) {
AppListVo appListVo = new AppListVo();
appListVo.setId(app.getId());
appListVo.setName(app.getName());
appListVos.add(appListVo);
}
return appListVos;
}
use of com.baidu.disconf.web.service.app.bo.App in project disconf by knightliao.
the class ConfigMgrImpl method getConfVo.
/**
* 根据 配置ID获取配置返回
*/
@Override
public ConfListVo getConfVo(Long configId) {
Config config = configDao.get(configId);
App app = appMgr.getById(config.getAppId());
Env env = envMgr.getById(config.getEnvId());
return convert(config, app.getName(), env.getName(), null);
}
use of com.baidu.disconf.web.service.app.bo.App in project disconf by knightliao.
the class ConfigValidator method validateNew.
/**
* 校验新建 配置
*
* @param confNewForm
* @param disConfigTypeEnum
*/
public void validateNew(ConfNewItemForm confNewForm, DisConfigTypeEnum disConfigTypeEnum) {
//
// app
//
App app = appMgr.getById(confNewForm.getAppId());
if (app == null) {
throw new FieldException(ConfNewForm.APPID, "app.not.exist", null);
}
//
validateAppAuth(app.getId());
//
// env
//
Env env = envMgr.getById(confNewForm.getEnvId());
if (env == null) {
throw new FieldException(ConfNewForm.ENVID, "env.not.exist", null);
}
//
// key
//
Config config = configFetchMgr.getConfByParameter(app.getId(), env.getId(), confNewForm.getVersion(), confNewForm.getKey(), disConfigTypeEnum);
if (config != null) {
throw new FieldException(ConfNewItemForm.KEY, "key.exist", null);
}
}
use of com.baidu.disconf.web.service.app.bo.App in project disconf by knightliao.
the class ConfigValidator4Fetch method verifyConfForm.
/**
* 此接口是客户的接口,非常 重要,目前没有权限的控制
*
* @param confForm
*/
public ConfigFullModel verifyConfForm(ConfForm confForm, boolean unCheckKey) {
//
if (StringUtils.isEmpty(confForm.getApp())) {
throw new FieldException("app", "app is empty", null);
}
App app = appMgr.getByName(confForm.getApp());
if (app == null) {
throw new FieldException("app", "app " + confForm.getApp() + " doesn't exist in db.", null);
}
//
if (StringUtils.isEmpty(confForm.getEnv())) {
throw new FieldException("env", "env is empty", null);
}
Env env = envMgr.getByName(confForm.getEnv());
if (env == null) {
throw new FieldException("env", "env " + confForm.getEnv() + " doesn't exist in db.", null);
}
//
if (!unCheckKey && StringUtils.isEmpty(confForm.getKey())) {
throw new FieldException("key", "key is empty", null);
}
//
if (StringUtils.isEmpty(confForm.getVersion())) {
throw new FieldException("version", "version is empty", null);
}
return new ConfigFullModel(app, env, confForm.getVersion(), confForm.getKey());
}
Aggregations