com.alibaba.dubbo.registry.common.domain.Weight Java Examples
The following examples show how to use
com.alibaba.dubbo.registry.common.domain.Weight.
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: OverrideUtils.java From dubbox with Apache License 2.0 | 6 votes |
public static List<Weight> overridesToWeights(List<Override> overrides){ List<Weight> weights = new ArrayList<Weight>(); if(overrides == null){ return weights; } for(Override o : overrides){ if(StringUtils.isEmpty(o.getParams())){ continue; }else{ Map<String,String> params = StringUtils.parseQueryString(o.getParams()); for(Map.Entry<String, String> entry : params.entrySet()){ if(entry.getKey().equals("weight")){ Weight weight = new Weight(); weight.setAddress(o.getAddress()); weight.setId(o.getId()); weight.setService(o.getService()); weight.setWeight(Integer.valueOf(entry.getValue())); weights.add(weight); } } } } return weights; }
Example #2
Source File: OverrideUtils.java From dubbox with Apache License 2.0 | 6 votes |
public static List<Weight> overridesToWeights(List<Override> overrides){ List<Weight> weights = new ArrayList<Weight>(); if(overrides == null){ return weights; } for(Override o : overrides){ if(StringUtils.isEmpty(o.getParams())){ continue; }else{ Map<String,String> params = StringUtils.parseQueryString(o.getParams()); for(Map.Entry<String, String> entry : params.entrySet()){ if(entry.getKey().equals("weight")){ Weight weight = new Weight(); weight.setAddress(o.getAddress()); weight.setId(o.getId()); weight.setService(o.getService()); weight.setWeight(Integer.valueOf(entry.getValue())); weights.add(weight); } } } } return weights; }
Example #3
Source File: OverrideUtils.java From dubbox with Apache License 2.0 | 6 votes |
public static List<Weight> overridesToWeights(List<Override> overrides){ List<Weight> weights = new ArrayList<Weight>(); if(overrides == null){ return weights; } for(Override o : overrides){ if(StringUtils.isEmpty(o.getParams())){ continue; }else{ Map<String,String> params = StringUtils.parseQueryString(o.getParams()); for(Map.Entry<String, String> entry : params.entrySet()){ if(entry.getKey().equals("weight")){ Weight weight = new Weight(); weight.setAddress(o.getAddress()); weight.setId(o.getId()); weight.setService(o.getService()); weight.setWeight(Integer.valueOf(entry.getValue())); weights.add(weight); } } } } return weights; }
Example #4
Source File: OverrideUtils.java From dubbox-hystrix with Apache License 2.0 | 6 votes |
public static List<Weight> overridesToWeights(List<Override> overrides){ List<Weight> weights = new ArrayList<Weight>(); if(overrides == null){ return weights; } for(Override o : overrides){ if(StringUtils.isEmpty(o.getParams())){ continue; }else{ Map<String,String> params = StringUtils.parseQueryString(o.getParams()); for(Map.Entry<String, String> entry : params.entrySet()){ if(entry.getKey().equals("weight")){ Weight weight = new Weight(); weight.setAddress(o.getAddress()); weight.setId(o.getId()); weight.setService(o.getService()); weight.setWeight(Integer.valueOf(entry.getValue())); weights.add(weight); } } } } return weights; }
Example #5
Source File: OverrideUtils.java From dubbo3 with Apache License 2.0 | 6 votes |
public static List<Weight> overridesToWeights(List<Override> overrides){ List<Weight> weights = new ArrayList<Weight>(); if(overrides == null){ return weights; } for(Override o : overrides){ if(StringUtils.isEmpty(o.getParams())){ continue; }else{ Map<String,String> params = StringUtils.parseQueryString(o.getParams()); for(Map.Entry<String, String> entry : params.entrySet()){ if(entry.getKey().equals("weight")){ Weight weight = new Weight(); weight.setAddress(o.getAddress()); weight.setId(o.getId()); weight.setService(o.getService()); weight.setWeight(Integer.valueOf(entry.getValue())); weights.add(weight); } } } } return weights; }
Example #6
Source File: OverrideUtils.java From dubbox with Apache License 2.0 | 5 votes |
public static Override weightToOverride(Weight weight){ Override override = new Override(); override.setId(weight.getId()); override.setAddress(weight.getAddress()); override.setEnabled(true); override.setParams("weight=" + weight.getWeight()); override.setService(weight.getService()); return override; }
Example #7
Source File: Weights.java From dubbox with Apache License 2.0 | 5 votes |
public void index(Map<String, Object> context) { final String service = StringUtils.trimToNull((String) context.get("service")); String address = (String) context.get("address"); address = Tool.getIP(address); List<Weight> weights; if (service != null && service.length() > 0) { weights = OverrideUtils.overridesToWeights(overrideService.findByService(service)); } else if (address != null && address.length() > 0) { weights = OverrideUtils.overridesToWeights(overrideService.findByAddress(address)); } else { weights = OverrideUtils.overridesToWeights(overrideService.findAll()); } context.put("weights", weights); }
Example #8
Source File: Weights.java From dubbox with Apache License 2.0 | 5 votes |
public boolean update(Weight weight, Map<String, Object> context) { if (!super.currentUser.hasServicePrivilege(weight.getService())) { context.put("message", getMessage("HaveNoServicePrivilege", weight.getService())); return false; } weight.setAddress(Tool.getIP(weight.getAddress())); overrideService.updateOverride(OverrideUtils.weightToOverride(weight)); return true; }
Example #9
Source File: Weights.java From dubbox with Apache License 2.0 | 5 votes |
public void index(Map<String, Object> context) { final String service = StringUtils.trimToNull((String) context.get("service")); String address = (String) context.get("address"); address = Tool.getIP(address); List<Weight> weights; if (service != null && service.length() > 0) { weights = OverrideUtils.overridesToWeights(overrideService.findByService(service)); } else if (address != null && address.length() > 0) { weights = OverrideUtils.overridesToWeights(overrideService.findByAddress(address)); } else { weights = OverrideUtils.overridesToWeights(overrideService.findAll()); } context.put("weights", weights); }
Example #10
Source File: OverrideUtils.java From dubbox with Apache License 2.0 | 5 votes |
public static Override weightToOverride(Weight weight){ Override override = new Override(); override.setId(weight.getId()); override.setAddress(weight.getAddress()); override.setEnabled(true); override.setParams("weight=" + weight.getWeight()); override.setService(weight.getService()); return override; }
Example #11
Source File: Weights.java From dubbox with Apache License 2.0 | 5 votes |
public boolean update(Weight weight, Map<String, Object> context) { if (!super.currentUser.hasServicePrivilege(weight.getService())) { context.put("message", getMessage("HaveNoServicePrivilege", weight.getService())); return false; } weight.setAddress(Tool.getIP(weight.getAddress())); overrideService.updateOverride(OverrideUtils.weightToOverride(weight)); return true; }
Example #12
Source File: Weights.java From dubbox with Apache License 2.0 | 5 votes |
public void index(Map<String, Object> context) { final String service = StringUtils.trimToNull((String) context.get("service")); String address = (String) context.get("address"); address = Tool.getIP(address); List<Weight> weights; if (service != null && service.length() > 0) { weights = OverrideUtils.overridesToWeights(overrideService.findByService(service)); } else if (address != null && address.length() > 0) { weights = OverrideUtils.overridesToWeights(overrideService.findByAddress(address)); } else { weights = OverrideUtils.overridesToWeights(overrideService.findAll()); } context.put("weights", weights); }
Example #13
Source File: OverrideUtils.java From dubbo3 with Apache License 2.0 | 5 votes |
public static Override weightToOverride(Weight weight){ Override override = new Override(); override.setId(weight.getId()); override.setAddress(weight.getAddress()); override.setEnabled(true); override.setParams("weight=" + weight.getWeight()); override.setService(weight.getService()); return override; }
Example #14
Source File: Weights.java From dubbo3 with Apache License 2.0 | 5 votes |
public boolean update(Weight weight, Map<String, Object> context) { if (!super.currentUser.hasServicePrivilege(weight.getService())) { context.put("message", getMessage("HaveNoServicePrivilege", weight.getService())); return false; } weight.setAddress(Tool.getIP(weight.getAddress())); overrideService.updateOverride(OverrideUtils.weightToOverride(weight)); return true; }
Example #15
Source File: Weights.java From dubbo3 with Apache License 2.0 | 5 votes |
public void index(Map<String, Object> context) { final String service = StringUtils.trimToNull((String) context.get("service")); String address = (String) context.get("address"); address = Tool.getIP(address); List<Weight> weights; if (service != null && service.length() > 0) { weights = OverrideUtils.overridesToWeights(overrideService.findByService(service)); } else if (address != null && address.length() > 0) { weights = OverrideUtils.overridesToWeights(overrideService.findByAddress(address)); } else { weights = OverrideUtils.overridesToWeights(overrideService.findAll()); } context.put("weights", weights); }
Example #16
Source File: OverrideUtils.java From dubbox-hystrix with Apache License 2.0 | 5 votes |
public static Override weightToOverride(Weight weight){ Override override = new Override(); override.setId(weight.getId()); override.setAddress(weight.getAddress()); override.setEnabled(true); override.setParams("weight=" + weight.getWeight()); override.setService(weight.getService()); return override; }
Example #17
Source File: Weights.java From dubbox-hystrix with Apache License 2.0 | 5 votes |
public boolean update(Weight weight, Map<String, Object> context) { if (!super.currentUser.hasServicePrivilege(weight.getService())) { context.put("message", getMessage("HaveNoServicePrivilege", weight.getService())); return false; } weight.setAddress(Tool.getIP(weight.getAddress())); overrideService.updateOverride(OverrideUtils.weightToOverride(weight)); return true; }
Example #18
Source File: Weights.java From dubbox-hystrix with Apache License 2.0 | 5 votes |
public void index(Map<String, Object> context) { final String service = StringUtils.trimToNull((String) context.get("service")); String address = (String) context.get("address"); address = Tool.getIP(address); List<Weight> weights; if (service != null && service.length() > 0) { weights = OverrideUtils.overridesToWeights(overrideService.findByService(service)); } else if (address != null && address.length() > 0) { weights = OverrideUtils.overridesToWeights(overrideService.findByAddress(address)); } else { weights = OverrideUtils.overridesToWeights(overrideService.findAll()); } context.put("weights", weights); }
Example #19
Source File: OverrideUtils.java From dubbox with Apache License 2.0 | 5 votes |
public static Override weightToOverride(Weight weight){ Override override = new Override(); override.setId(weight.getId()); override.setAddress(weight.getAddress()); override.setEnabled(true); override.setParams("weight=" + weight.getWeight()); override.setService(weight.getService()); return override; }
Example #20
Source File: Weights.java From dubbox with Apache License 2.0 | 5 votes |
public boolean update(Weight weight, Map<String, Object> context) { if (!super.currentUser.hasServicePrivilege(weight.getService())) { context.put("message", getMessage("HaveNoServicePrivilege", weight.getService())); return false; } weight.setAddress(Tool.getIP(weight.getAddress())); overrideService.updateOverride(OverrideUtils.weightToOverride(weight)); return true; }
Example #21
Source File: OverrideUtils.java From dubbo3 with Apache License 2.0 | 4 votes |
public static Weight overrideToWeight(Override override){ return overridesToWeights(Arrays.asList(override)).get(0); }
Example #22
Source File: OverrideUtils.java From dubbox-hystrix with Apache License 2.0 | 4 votes |
public static Weight overrideToWeight(Override override){ return overridesToWeights(Arrays.asList(override)).get(0); }
Example #23
Source File: OverrideUtils.java From dubbox with Apache License 2.0 | 4 votes |
public static Weight overrideToWeight(Override override){ return overridesToWeights(Arrays.asList(override)).get(0); }
Example #24
Source File: OverrideUtils.java From dubbox with Apache License 2.0 | 4 votes |
public static Weight overrideToWeight(Override override){ return overridesToWeights(Arrays.asList(override)).get(0); }
Example #25
Source File: OverrideUtils.java From dubbox with Apache License 2.0 | 4 votes |
public static Weight overrideToWeight(Override override){ return overridesToWeights(Arrays.asList(override)).get(0); }
Example #26
Source File: Weights.java From dubbo3 with Apache License 2.0 | 2 votes |
/** * load weight对象供编辑操作 * @param id * @param context */ public void show(Long id, Map<String, Object> context) { Weight weight = OverrideUtils.overrideToWeight(overrideService.findById(id)); context.put("weight", weight); }
Example #27
Source File: Weights.java From dubbox with Apache License 2.0 | 2 votes |
/** * load weight对象供编辑操作 * @param id * @param context */ public void show(Long id, Map<String, Object> context) { Weight weight = OverrideUtils.overrideToWeight(overrideService.findById(id)); context.put("weight", weight); }
Example #28
Source File: Weights.java From dubbox-hystrix with Apache License 2.0 | 2 votes |
/** * load weight对象供编辑操作 * @param id * @param context */ public void show(Long id, Map<String, Object> context) { Weight weight = OverrideUtils.overrideToWeight(overrideService.findById(id)); context.put("weight", weight); }
Example #29
Source File: Weights.java From dubbox with Apache License 2.0 | 2 votes |
/** * load weight对象供编辑操作 * @param id * @param context */ public void show(Long id, Map<String, Object> context) { Weight weight = OverrideUtils.overrideToWeight(overrideService.findById(id)); context.put("weight", weight); }
Example #30
Source File: Weights.java From dubbox with Apache License 2.0 | 2 votes |
/** * load weight对象供编辑操作 * @param id * @param context */ public void show(Long id, Map<String, Object> context) { Weight weight = OverrideUtils.overrideToWeight(overrideService.findById(id)); context.put("weight", weight); }