Java Code Examples for com.alibaba.dubbo.registry.common.domain.Config#setUsername()
The following examples show how to use
com.alibaba.dubbo.registry.common.domain.Config#setUsername() .
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: Configs.java From dubbox with Apache License 2.0 | 4 votes |
public boolean update(Map<String, Object> context) { @SuppressWarnings("unchecked") Map<String, String[]> all = request.getParameterMap();; if (all != null && all.size() > 0) { if (! User.ROOT.equals(currentUser.getRole())) { context.put("message", getMessage("HaveNoRootPrivilege")); return false; } List<Config> configs = new ArrayList<Config>(); for (Map.Entry<String, String[]> entry : all.entrySet()) { String key = entry.getKey(); String[] values = entry.getValue(); if (key != null && key.length() > 0 && ! key.startsWith("_")) { String value = ""; if (values != null && values.length > 0 && values[0] != null && values[0].length() > 0) { value = values[0]; } Config config = new Config(); config.setKey(key); config.setUsername(currentUser.getUsername()); config.setOperatorAddress((String) context.get("operatorAddress")); config.setValue(value); configs.add(config); } } if (configs.size() > 0) { configDAO.update(configs); Set<String> usernames = new HashSet<String>(); usernames.add(currentUser.getName()); Map<String, Object> params = new HashMap<String, Object>(); params.put("configs", configs); } return true; } else { context.put("message", getMessage("MissRequestParameters", "configKey,configValue")); return false; } }
Example 2
Source File: Configs.java From dubbox-hystrix with Apache License 2.0 | 4 votes |
public boolean update(Map<String, Object> context) { @SuppressWarnings("unchecked") Map<String, String[]> all = request.getParameterMap();; if (all != null && all.size() > 0) { if (! User.ROOT.equals(currentUser.getRole())) { context.put("message", getMessage("HaveNoRootPrivilege")); return false; } List<Config> configs = new ArrayList<Config>(); for (Map.Entry<String, String[]> entry : all.entrySet()) { String key = entry.getKey(); String[] values = entry.getValue(); if (key != null && key.length() > 0 && ! key.startsWith("_")) { String value = ""; if (values != null && values.length > 0 && values[0] != null && values[0].length() > 0) { value = values[0]; } Config config = new Config(); config.setKey(key); config.setUsername(currentUser.getUsername()); config.setOperatorAddress((String) context.get("operatorAddress")); config.setValue(value); configs.add(config); } } if (configs.size() > 0) { configDAO.update(configs); Set<String> usernames = new HashSet<String>(); usernames.add(currentUser.getName()); Map<String, Object> params = new HashMap<String, Object>(); params.put("configs", configs); } return true; } else { context.put("message", getMessage("MissRequestParameters", "configKey,configValue")); return false; } }
Example 3
Source File: Configs.java From dubbo3 with Apache License 2.0 | 4 votes |
public boolean update(Map<String, Object> context) { @SuppressWarnings("unchecked") Map<String, String[]> all = request.getParameterMap();; if (all != null && all.size() > 0) { if (! User.ROOT.equals(currentUser.getRole())) { context.put("message", getMessage("HaveNoRootPrivilege")); return false; } List<Config> configs = new ArrayList<Config>(); for (Map.Entry<String, String[]> entry : all.entrySet()) { String key = entry.getKey(); String[] values = entry.getValue(); if (key != null && key.length() > 0 && ! key.startsWith("_")) { String value = ""; if (values != null && values.length > 0 && values[0] != null && values[0].length() > 0) { value = values[0]; } Config config = new Config(); config.setKey(key); config.setUsername(currentUser.getUsername()); config.setOperatorAddress((String) context.get("operatorAddress")); config.setValue(value); configs.add(config); } } if (configs.size() > 0) { configDAO.update(configs); Set<String> usernames = new HashSet<String>(); usernames.add(currentUser.getName()); Map<String, Object> params = new HashMap<String, Object>(); params.put("configs", configs); } return true; } else { context.put("message", getMessage("MissRequestParameters", "configKey,configValue")); return false; } }
Example 4
Source File: Configs.java From dubbox with Apache License 2.0 | 4 votes |
public boolean update(Map<String, Object> context) { @SuppressWarnings("unchecked") Map<String, String[]> all = request.getParameterMap();; if (all != null && all.size() > 0) { if (! User.ROOT.equals(currentUser.getRole())) { context.put("message", getMessage("HaveNoRootPrivilege")); return false; } List<Config> configs = new ArrayList<Config>(); for (Map.Entry<String, String[]> entry : all.entrySet()) { String key = entry.getKey(); String[] values = entry.getValue(); if (key != null && key.length() > 0 && ! key.startsWith("_")) { String value = ""; if (values != null && values.length > 0 && values[0] != null && values[0].length() > 0) { value = values[0]; } Config config = new Config(); config.setKey(key); config.setUsername(currentUser.getUsername()); config.setOperatorAddress((String) context.get("operatorAddress")); config.setValue(value); configs.add(config); } } if (configs.size() > 0) { configDAO.update(configs); Set<String> usernames = new HashSet<String>(); usernames.add(currentUser.getName()); Map<String, Object> params = new HashMap<String, Object>(); params.put("configs", configs); } return true; } else { context.put("message", getMessage("MissRequestParameters", "configKey,configValue")); return false; } }
Example 5
Source File: Configs.java From dubbox with Apache License 2.0 | 4 votes |
public boolean update(Map<String, Object> context) { @SuppressWarnings("unchecked") Map<String, String[]> all = request.getParameterMap();; if (all != null && all.size() > 0) { if (! User.ROOT.equals(currentUser.getRole())) { context.put("message", getMessage("HaveNoRootPrivilege")); return false; } List<Config> configs = new ArrayList<Config>(); for (Map.Entry<String, String[]> entry : all.entrySet()) { String key = entry.getKey(); String[] values = entry.getValue(); if (key != null && key.length() > 0 && ! key.startsWith("_")) { String value = ""; if (values != null && values.length > 0 && values[0] != null && values[0].length() > 0) { value = values[0]; } Config config = new Config(); config.setKey(key); config.setUsername(currentUser.getUsername()); config.setOperatorAddress((String) context.get("operatorAddress")); config.setValue(value); configs.add(config); } } if (configs.size() > 0) { configDAO.update(configs); Set<String> usernames = new HashSet<String>(); usernames.add(currentUser.getName()); Map<String, Object> params = new HashMap<String, Object>(); params.put("configs", configs); } return true; } else { context.put("message", getMessage("MissRequestParameters", "configKey,configValue")); return false; } }