com.akaxin.proto.core.ConfigProto.ConfigKey Java Examples
The following examples show how to use
com.akaxin.proto.core.ConfigProto.ConfigKey.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FilePathUtils.java From wind-im with Apache License 2.0 | 5 votes |
/** * * @return */ public static String getPicPath() { if (filePath == null) { filePath = SiteConfig.getConfig(ConfigKey.PIC_PATH_VALUE); } if (StringUtils.isNotBlank(filePath)) { if (filePath.endsWith("/")) { return filePath + DEFAULT_FILE_PATH; } return filePath + "/" + DEFAULT_FILE_PATH; } return DEFAULT_FILE_PATH; }
Example #2
Source File: SiteConfigDao.java From openzaly with Apache License 2.0 | 5 votes |
public String getDefaultUserGroups() { try { return siteConfigDao.getSiteConfigValue(ConfigKey.DEFAULT_USER_GROUPS_VALUE); } catch (SQLException e) { logger.error("get site official group default error.", e); } return null; }
Example #3
Source File: SiteConfigDao.java From openzaly with Apache License 2.0 | 5 votes |
public String getDefaultUserFriends() { try { return siteConfigDao.getSiteConfigValue(ConfigKey.DEFAULT_USER_FRIENDS_VALUE); } catch (SQLException e) { logger.error("get site default user friends error.", e); } return null; }
Example #4
Source File: SiteConfigDao.java From openzaly with Apache License 2.0 | 5 votes |
public String getSiteManagers() { try { return siteConfigDao.getSiteConfigValue(ConfigKey.SITE_MANAGER_VALUE); } catch (SQLException e) { logger.error("get site user managers error.", e); } return null; }
Example #5
Source File: FilePathUtils.java From openzaly with Apache License 2.0 | 5 votes |
/** * * @return */ public static String getPicPath() { if (filePath == null) { filePath = SiteConfig.getConfig(ConfigKey.PIC_PATH_VALUE); } if (StringUtils.isNotBlank(filePath)) { if (filePath.endsWith("/")) { return filePath + DEFAULT_FILE_PATH; } return filePath + "/" + DEFAULT_FILE_PATH; } return DEFAULT_FILE_PATH; }
Example #6
Source File: SiteConfigDao.java From openzaly with Apache License 2.0 | 5 votes |
public String getDefaultUserGroups() { try { return siteConfigDao.getSiteConfigValue(ConfigKey.DEFAULT_USER_GROUPS_VALUE); } catch (SQLException e) { logger.error("get site official group default error.", e); } return null; }
Example #7
Source File: SiteConfigDao.java From openzaly with Apache License 2.0 | 5 votes |
public String getDefaultUserFriends() { try { return siteConfigDao.getSiteConfigValue(ConfigKey.DEFAULT_USER_FRIENDS_VALUE); } catch (SQLException e) { logger.error("get site default user friends error.", e); } return null; }
Example #8
Source File: SiteConfigDao.java From openzaly with Apache License 2.0 | 5 votes |
public String getSiteManagers() { try { return siteConfigDao.getSiteConfigValue(ConfigKey.SITE_MANAGER_VALUE); } catch (SQLException e) { logger.error("get site user managers error.", e); } return null; }
Example #9
Source File: FilePathUtils.java From openzaly with Apache License 2.0 | 5 votes |
/** * * @return */ public static String getPicPath() { if (filePath == null) { filePath = SiteConfig.getConfig(ConfigKey.PIC_PATH_VALUE); } if (StringUtils.isNotBlank(filePath)) { if (filePath.endsWith("/")) { return filePath + DEFAULT_FILE_PATH; } return filePath + "/" + DEFAULT_FILE_PATH; } return DEFAULT_FILE_PATH; }
Example #10
Source File: SiteConfigDao.java From wind-im with Apache License 2.0 | 5 votes |
public String getDefaultUserGroups() { try { return siteConfigDao.getSiteConfigValue(ConfigKey.DEFAULT_USER_GROUPS_VALUE); } catch (SQLException e) { logger.error("get site official group default error.", e); } return null; }
Example #11
Source File: SiteConfigDao.java From wind-im with Apache License 2.0 | 5 votes |
public String getDefaultUserFriends() { try { return siteConfigDao.getSiteConfigValue(ConfigKey.DEFAULT_USER_FRIENDS_VALUE); } catch (SQLException e) { logger.error("get site default user friends error.", e); } return null; }
Example #12
Source File: SiteConfigDao.java From wind-im with Apache License 2.0 | 5 votes |
public String getSiteManagers() { try { return siteConfigDao.getSiteConfigValue(ConfigKey.SITE_MANAGER_VALUE); } catch (SQLException e) { logger.error("get site user managers error.", e); } return null; }
Example #13
Source File: ConfigManageController.java From openzaly with Apache License 2.0 | 4 votes |
@SuppressWarnings("unchecked") @RequestMapping(method = RequestMethod.POST, value = "/updateConfig") @ResponseBody public String updateSiteConfig(HttpServletRequest request, @RequestBody byte[] bodyParam) { try { PluginProto.ProxyPluginPackage pluginPackage = PluginProto.ProxyPluginPackage.parseFrom(bodyParam); String siteUserId = getRequestSiteUserId(pluginPackage); if (!isManager(siteUserId)) { throw new UserPermissionException("Current user is not a manager"); } Map<String, String> dataMap = GsonUtils.fromJson(pluginPackage.getData(), Map.class); logger.info("siteUserId={} update config={}", siteUserId, dataMap); Map<Integer, String> configMap = new HashMap<Integer, String>(); if (StringUtils.isNotEmpty(trim(dataMap.get("site_name")))) { configMap.put(ConfigProto.ConfigKey.SITE_NAME_VALUE, trim(dataMap.get("site_name"))); } if (StringUtils.isNotEmpty(trim(dataMap.get("site_address")))) { configMap.put(ConfigProto.ConfigKey.SITE_ADDRESS_VALUE, trim(dataMap.get("site_address"))); } if (StringUtils.isNotEmpty(trim(dataMap.get("site_port")))) { configMap.put(ConfigProto.ConfigKey.SITE_PORT_VALUE, trim(dataMap.get("site_port"))); } if (StringUtils.isNotEmpty(trim(dataMap.get("group_members_count")))) { configMap.put(ConfigProto.ConfigKey.GROUP_MEMBERS_COUNT_VALUE, trim(dataMap.get("group_members_count"))); } if (StringUtils.isNotEmpty(trim(dataMap.get("pic_path")))) { configMap.put(ConfigProto.ConfigKey.PIC_PATH_VALUE, trim(dataMap.get("pic_path"))); } if (StringUtils.isNotEmpty(dataMap.get("site_logo"))) { configMap.put(ConfigProto.ConfigKey.SITE_LOGO_VALUE, dataMap.get("site_logo")); } if (StringUtils.isNotEmpty(dataMap.get("uic_status"))) { configMap.put(ConfigProto.ConfigKey.INVITE_CODE_STATUS_VALUE, dataMap.get("uic_status")); } if (StringUtils.isNotEmpty(dataMap.get("realName_status"))) { configMap.put(ConfigProto.ConfigKey.REALNAME_STATUS_VALUE, dataMap.get("realName_status")); } if (StringUtils.isNotEmpty(dataMap.get("u2_encryption_status"))) { configMap.put(ConfigProto.ConfigKey.U2_ENCRYPTION_STATUS_VALUE, dataMap.get("u2_encryption_status")); } if (StringUtils.isNotEmpty(dataMap.get("add_friends_status"))) { configMap.put(ConfigProto.ConfigKey.CONFIG_FRIEND_REQUEST_VALUE, dataMap.get("add_friends_status")); } if (StringUtils.isNotEmpty(dataMap.get("create_groups_status"))) { configMap.put(ConfigProto.ConfigKey.CONFIG_CREATE_GROUP_VALUE, dataMap.get("create_groups_status")); } if (StringUtils.isNotEmpty(dataMap.get("group_qrcode_expire_time"))) { configMap.put(ConfigProto.ConfigKey.GROUP_QR_EXPIRE_TIME_VALUE, dataMap.get("group_qrcode_expire_time")); } if (StringUtils.isNotEmpty(dataMap.get("push_client_status"))) { configMap.put(ConfigProto.ConfigKey.PUSH_CLIENT_STATUS_VALUE, dataMap.get("push_client_status")); } if (StringUtils.isNotEmpty(dataMap.get("log_level"))) { String logLevel = dataMap.get("log_level"); configMap.put(ConfigProto.ConfigKey.LOG_LEVEL_VALUE, logLevel); Level level = Level.INFO; if ("DEBUG".equalsIgnoreCase(logLevel)) { level = Level.DEBUG; } else if ("ERROR".equalsIgnoreCase(logLevel)) { level = Level.ERROR; } // 更新日志级别 AkxLog4jManager.setLogLevel(level); } // 普通管理员无权限 if (isAdmin(siteUserId) && StringUtils.isNotEmpty(trim(dataMap.get("site_manager")))) { configMap.put(ConfigProto.ConfigKey.SITE_MANAGER_VALUE, trim(dataMap.get("site_manager"))); } if (configManageService.updateSiteConfig(siteUserId, configMap)) { return SUCCESS; } } catch (InvalidProtocolBufferException e) { logger.error("update site config error", e); } catch (UserPermissionException u) { logger.error("update site config error : " + u.getMessage()); return NO_PERMISSION; } return ERROR; }
Example #14
Source File: SiteConfigDao.java From wind-im with Apache License 2.0 | 4 votes |
public boolean updateDefaultUserGroups(String defaultGroupIds) { return updateSiteConfig(ConfigKey.DEFAULT_USER_GROUPS_VALUE, defaultGroupIds); }
Example #15
Source File: SiteConfigDao.java From openzaly with Apache License 2.0 | 4 votes |
public boolean updateSiteManagers(String userManagers) { return updateSiteConfig(ConfigKey.SITE_MANAGER_VALUE, userManagers); }
Example #16
Source File: SiteConfigDao.java From openzaly with Apache License 2.0 | 4 votes |
public boolean updateDefaultUserFriends(String defaultFriends) { return updateSiteConfig(ConfigKey.DEFAULT_USER_FRIENDS_VALUE, defaultFriends); }
Example #17
Source File: SiteConfigDao.java From wind-im with Apache License 2.0 | 4 votes |
public boolean updateDefaultUserFriends(String defaultFriends) { return updateSiteConfig(ConfigKey.DEFAULT_USER_FRIENDS_VALUE, defaultFriends); }
Example #18
Source File: SiteConfigDao.java From openzaly with Apache License 2.0 | 4 votes |
public boolean updateDefaultUserGroups(String defaultGroupIds) { return updateSiteConfig(ConfigKey.DEFAULT_USER_GROUPS_VALUE, defaultGroupIds); }
Example #19
Source File: ConfigManageController.java From openzaly with Apache License 2.0 | 4 votes |
@RequestMapping("/basicConfig") public ModelAndView toSiteConfigPage(@RequestBody byte[] bodyParam) { ModelAndView modelAndView = new ModelAndView("basic/config"); Map<String, Object> model = modelAndView.getModel(); // 设置默认属性 PluginProto.ProxyPluginPackage pluginPackage = null; try { pluginPackage = PluginProto.ProxyPluginPackage.parseFrom(bodyParam); String siteUserId = getRequestSiteUserId(pluginPackage); if (!isManager(siteUserId)) { throw new UserPermissionException("Current user is not a manager"); } if (isAdmin(siteUserId)) { model.put("manager_type", "admin"); } else if (isManager(siteUserId)) { model.put("manager_type", "site_manager"); } model.put("uic_status", "0"); model.put("pic_size", "1"); model.put("pic_path", "/akaxin"); model.put("group_members_count", "100"); model.put("u2_encryption_status", "1"); model.put("push_client_status", "0"); model.put("log_level", "INFO"); Map<Integer, String> map = configManageService.getSiteConfig(); Set<Integer> integers = map.keySet(); String site_prot = ""; String site_address = ""; String http_prot = ""; String http_address = ""; for (Integer integer : integers) { String res = map.get(integer); switch (integer) { case ConfigKey.SITE_NAME_VALUE: model.put("site_name", res); break; case ConfigKey.SITE_ADDRESS_VALUE: site_address = res; break; case ConfigKey.SITE_PORT_VALUE: site_prot = res; break; case ConfigKey.SITE_HTTP_ADDRESS_VALUE: http_address = res; break; case ConfigKey.SITE_HTTP_PORT_VALUE: http_prot = res; break; case ConfigKey.SITE_LOGO_VALUE: model.put("site_logo", res); break; case ConfigKey.SITE_INTRODUCTION_VALUE: model.put("site_desc", res); break; case ConfigKey.REALNAME_STATUS_VALUE: model.put("realName_status", res); break; case ConfigKey.INVITE_CODE_STATUS_VALUE: model.put("uic_status", res); break; case ConfigKey.PIC_SIZE_VALUE: model.put("pic_size", res); break; case ConfigKey.PIC_PATH_VALUE: model.put("pic_path", res); break; case ConfigKey.GROUP_MEMBERS_COUNT_VALUE: model.put("group_members_count", res); break; case ConfigKey.U2_ENCRYPTION_STATUS_VALUE: model.put("u2_encryption_status", res); break; case ConfigKey.PUSH_CLIENT_STATUS_VALUE: model.put("push_client_status", res); break; case ConfigKey.LOG_LEVEL_VALUE: model.put("log_level", res); break; case ConfigKey.SITE_MANAGER_VALUE: model.put("subgenus_admin", res); break; } } model.put("siteAddressAndPort", site_address + ":" + site_prot); model.put("httpAddressAndPort", http_address + ":" + http_prot); return modelAndView; } catch (InvalidProtocolBufferException e) { logger.error("to basic config page error", e); } catch (UserPermissionException u) { logger.error("to basic config page error : " + u.getMessage()); } return new ModelAndView("error"); }
Example #20
Source File: ConfigManageController.java From openzaly with Apache License 2.0 | 4 votes |
@SuppressWarnings("unchecked") @RequestMapping(method = RequestMethod.POST, value = "/updateConfig") @ResponseBody public String updateSiteConfig(HttpServletRequest request, @RequestBody byte[] bodyParam) { try { PluginProto.ProxyPluginPackage pluginPackage = PluginProto.ProxyPluginPackage.parseFrom(bodyParam); String siteUserId = getRequestSiteUserId(pluginPackage); if (!isManager(siteUserId)) { throw new UserPermissionException("Current user is not a manager"); } Map<String, String> dataMap = GsonUtils.fromJson(pluginPackage.getData(), Map.class); logger.info("siteUserId={} update config={}", siteUserId, dataMap); Map<Integer, String> configMap = new HashMap<Integer, String>(); if (StringUtils.isNotEmpty(trim(dataMap.get("site_name")))) { configMap.put(ConfigProto.ConfigKey.SITE_NAME_VALUE, trim(dataMap.get("site_name"))); } if (StringUtils.isNotEmpty(trim(dataMap.get("site_address")))) { configMap.put(ConfigProto.ConfigKey.SITE_ADDRESS_VALUE, trim(dataMap.get("site_address"))); } if (StringUtils.isNotEmpty(trim(dataMap.get("site_port")))) { configMap.put(ConfigProto.ConfigKey.SITE_PORT_VALUE, trim(dataMap.get("site_port"))); } if (StringUtils.isNotEmpty(trim(dataMap.get("group_members_count")))) { configMap.put(ConfigProto.ConfigKey.GROUP_MEMBERS_COUNT_VALUE, trim(dataMap.get("group_members_count"))); } if (StringUtils.isNotEmpty(trim(dataMap.get("pic_path")))) { configMap.put(ConfigProto.ConfigKey.PIC_PATH_VALUE, trim(dataMap.get("pic_path"))); } if (StringUtils.isNotEmpty(dataMap.get("site_logo"))) { configMap.put(ConfigProto.ConfigKey.SITE_LOGO_VALUE, dataMap.get("site_logo")); } if (StringUtils.isNotEmpty(dataMap.get("uic_status"))) { configMap.put(ConfigProto.ConfigKey.INVITE_CODE_STATUS_VALUE, dataMap.get("uic_status")); } if (StringUtils.isNotEmpty(dataMap.get("realName_status"))) { configMap.put(ConfigProto.ConfigKey.REALNAME_STATUS_VALUE, dataMap.get("realName_status")); } if (StringUtils.isNotEmpty(dataMap.get("u2_encryption_status"))) { configMap.put(ConfigProto.ConfigKey.U2_ENCRYPTION_STATUS_VALUE, dataMap.get("u2_encryption_status")); } if (StringUtils.isNotEmpty(dataMap.get("push_client_status"))) { configMap.put(ConfigProto.ConfigKey.PUSH_CLIENT_STATUS_VALUE, dataMap.get("push_client_status")); } if (StringUtils.isNotEmpty(dataMap.get("log_level"))) { String logLevel = dataMap.get("log_level"); configMap.put(ConfigProto.ConfigKey.LOG_LEVEL_VALUE, logLevel); Level level = Level.INFO; if ("DEBUG".equalsIgnoreCase(logLevel)) { level = Level.DEBUG; } else if ("ERROR".equalsIgnoreCase(logLevel)) { level = Level.ERROR; } // 更新日志级别 AkxLog4jManager.setLogLevel(level); } // 普通管理员无权限 if (isAdmin(siteUserId) && StringUtils.isNotEmpty(trim(dataMap.get("site_manager")))) { configMap.put(ConfigProto.ConfigKey.SITE_MANAGER_VALUE, trim(dataMap.get("site_manager"))); } if (configManageService.updateSiteConfig(siteUserId, configMap)) { return SUCCESS; } } catch (InvalidProtocolBufferException e) { logger.error("update site config error", e); } catch (UserPermissionException u) { logger.error("update site config error : " + u.getMessage()); return NO_PERMISSION; } return ERROR; }
Example #21
Source File: SiteConfigDao.java From wind-im with Apache License 2.0 | 4 votes |
public boolean updateSiteManagers(String userManagers) { return updateSiteConfig(ConfigKey.SITE_MANAGER_VALUE, userManagers); }
Example #22
Source File: SiteConfigDao.java From openzaly with Apache License 2.0 | 4 votes |
public boolean updateSiteManagers(String userManagers) { return updateSiteConfig(ConfigKey.SITE_MANAGER_VALUE, userManagers); }
Example #23
Source File: SiteConfigDao.java From openzaly with Apache License 2.0 | 4 votes |
public boolean updateDefaultUserFriends(String defaultFriends) { return updateSiteConfig(ConfigKey.DEFAULT_USER_FRIENDS_VALUE, defaultFriends); }
Example #24
Source File: ConfigManageController.java From wind-im with Apache License 2.0 | 4 votes |
@SuppressWarnings("unchecked") @RequestMapping(method = RequestMethod.POST, value = "/updateConfig") @ResponseBody public String updateSiteConfig(HttpServletRequest request, @RequestBody byte[] bodyParam) { try { PluginProto.ProxyPluginPackage pluginPackage = PluginProto.ProxyPluginPackage.parseFrom(bodyParam); String siteUserId = getRequestSiteUserId(pluginPackage); if (!isManager(siteUserId)) { throw new UserPermissionException("Current user is not a manager"); } Map<String, String> dataMap = GsonUtils.fromJson(pluginPackage.getData(), Map.class); logger.info("siteUserId={} update config={}", siteUserId, dataMap); Map<Integer, String> configMap = new HashMap<Integer, String>(); if (StringUtils.isNotEmpty(trim(dataMap.get("site_name")))) { configMap.put(ConfigProto.ConfigKey.SITE_NAME_VALUE, trim(dataMap.get("site_name"))); } if (StringUtils.isNotEmpty(trim(dataMap.get("site_address")))) { configMap.put(ConfigProto.ConfigKey.SITE_ADDRESS_VALUE, trim(dataMap.get("site_address"))); } if (StringUtils.isNotEmpty(trim(dataMap.get("site_port")))) { configMap.put(ConfigProto.ConfigKey.SITE_PORT_VALUE, trim(dataMap.get("site_port"))); } if (StringUtils.isNotEmpty(trim(dataMap.get("group_members_count")))) { configMap.put(ConfigProto.ConfigKey.GROUP_MEMBERS_COUNT_VALUE, trim(dataMap.get("group_members_count"))); } if (StringUtils.isNotEmpty(trim(dataMap.get("pic_path")))) { configMap.put(ConfigProto.ConfigKey.PIC_PATH_VALUE, trim(dataMap.get("pic_path"))); } if (StringUtils.isNotEmpty(dataMap.get("site_logo"))) { configMap.put(ConfigProto.ConfigKey.SITE_LOGO_VALUE, dataMap.get("site_logo")); } if (StringUtils.isNotEmpty(dataMap.get("uic_status"))) { configMap.put(ConfigProto.ConfigKey.INVITE_CODE_STATUS_VALUE, dataMap.get("uic_status")); } if (StringUtils.isNotEmpty(dataMap.get("realName_status"))) { configMap.put(ConfigProto.ConfigKey.REALNAME_STATUS_VALUE, dataMap.get("realName_status")); } if (StringUtils.isNotEmpty(dataMap.get("u2_encryption_status"))) { configMap.put(ConfigProto.ConfigKey.U2_ENCRYPTION_STATUS_VALUE, dataMap.get("u2_encryption_status")); } if (StringUtils.isNotEmpty(dataMap.get("add_friends_status"))) { configMap.put(ConfigProto.ConfigKey.CONFIG_FRIEND_REQUEST_VALUE, dataMap.get("add_friends_status")); } if (StringUtils.isNotEmpty(dataMap.get("create_groups_status"))) { configMap.put(ConfigProto.ConfigKey.CONFIG_CREATE_GROUP_VALUE, dataMap.get("create_groups_status")); } if (StringUtils.isNotEmpty(dataMap.get("group_qrcode_expire_time"))) { configMap.put(ConfigProto.ConfigKey.GROUP_QR_EXPIRE_TIME_VALUE, dataMap.get("group_qrcode_expire_time")); } if (StringUtils.isNotEmpty(dataMap.get("push_client_status"))) { configMap.put(ConfigProto.ConfigKey.PUSH_CLIENT_STATUS_VALUE, dataMap.get("push_client_status")); } if (StringUtils.isNotEmpty(dataMap.get("log_level"))) { String logLevel = dataMap.get("log_level"); configMap.put(ConfigProto.ConfigKey.LOG_LEVEL_VALUE, logLevel); Level level = Level.INFO; if ("DEBUG".equalsIgnoreCase(logLevel)) { level = Level.DEBUG; } else if ("ERROR".equalsIgnoreCase(logLevel)) { level = Level.ERROR; } // 更新日志级别 AkxLog4jManager.setLogLevel(level); } // 普通管理员无权限 if (isAdmin(siteUserId) && StringUtils.isNotEmpty(trim(dataMap.get("site_manager")))) { configMap.put(ConfigProto.ConfigKey.SITE_MANAGER_VALUE, trim(dataMap.get("site_manager"))); } if (configManageService.updateSiteConfig(siteUserId, configMap)) { return SUCCESS; } } catch (InvalidProtocolBufferException e) { logger.error("update site config error", e); } catch (UserPermissionException u) { logger.error("update site config error : " + u.getMessage()); return NO_PERMISSION; } return ERROR; }
Example #25
Source File: SiteConfigDao.java From openzaly with Apache License 2.0 | 4 votes |
public boolean updateDefaultUserGroups(String defaultGroupIds) { return updateSiteConfig(ConfigKey.DEFAULT_USER_GROUPS_VALUE, defaultGroupIds); }