本文整理汇总了Java中com.alibaba.dubbo.common.utils.CollectionUtils类的典型用法代码示例。如果您正苦于以下问题:Java CollectionUtils类的具体用法?Java CollectionUtils怎么用?Java CollectionUtils使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CollectionUtils类属于com.alibaba.dubbo.common.utils包,在下文中一共展示了CollectionUtils类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doExecute
import com.alibaba.dubbo.common.utils.CollectionUtils; //导入依赖的package包/类
@SuppressWarnings("unchecked")
protected String doExecute(Map<String,Object> context) throws Exception {
Map<String, String[]> params = request.getParameterMap();
if (params == null || params.size() == 0) {
throw new IllegalArgumentException("The url parameters is null! Usage: " + request.getRequestURL().toString() + "?com.xxx.XxxService=http://" + operatorAddress + "/xxxService");
}
for (Map.Entry<String, String[]> entry : params.entrySet()) {
if (entry.getKey() != null && entry.getKey().length() > 0
&& entry.getValue() != null && entry.getValue().length > 0
&& entry.getValue()[0] != null && entry.getValue()[0].length() > 0) {
if (! currentUser.hasServicePrivilege(entry.getKey())) {
throw new IllegalStateException("The user " + operator + " have no privilege of service " + entry.getKey());
}
for(Entry<String,String> e : CollectionUtils.split(Arrays.asList(entry.getValue()), "?").entrySet()){
Provider provider = providervice.findByServiceAndAddress(entry.getKey(), e.getKey());
if (provider != null) {
providervice.deleteStaticProvider(provider.getId());
}
}
}
}
return "Unregister " + params.size() + " services.";
}
示例2: add
import com.alibaba.dubbo.common.utils.CollectionUtils; //导入依赖的package包/类
/**
* load页面供新增操作
* @param context
*/
public void add(Map<String, Object> context) {
String service = (String)context.get("service");
if (service != null && service.length() > 0 && !service.contains("*")) {
List<Provider> providerList = providerService.findByService(service);
List<String> addressList = new ArrayList<String>();
for(Provider provider : providerList){
addressList.add(provider.getUrl().split("://")[1].split("/")[0]);
}
context.put("addressList", addressList);
context.put("service", service);
context.put("methods", CollectionUtils.sort(providerService.findMethodsByService(service)));
} else {
List<String> serviceList = Tool.sortSimpleName(providerService.findServices());
context.put("serviceList", serviceList);
}
if(context.get("input") != null) context.put("input", context.get("input"));
}
示例3: add
import com.alibaba.dubbo.common.utils.CollectionUtils; //导入依赖的package包/类
public void add(Map<String, Object> context){
List<String> serviceList = new ArrayList<String>();
List<String> applicationList = new ArrayList<String>();
String service = (String) context.get("service");
String application = (String) context.get("application");
if(StringUtils.isNotEmpty(application)){
serviceList.addAll(providerService.findServicesByApplication(application));
serviceList.addAll(consumerService.findServicesByApplication(application));
context.put("serviceList", serviceList);
}else if(StringUtils.isNotEmpty(service)){
applicationList.addAll(providerService.findApplicationsByServiceName(service));
applicationList.addAll(consumerService.findApplicationsByServiceName(service));
context.put("applicationList", applicationList);
}else{
serviceList.addAll(providerService.findServices());
serviceList.addAll(consumerService.findServices());
providerService.findServicesByApplication(application);
consumerService.findServicesByApplication(application);
}
context.put("serviceList", serviceList);
if (StringUtils.isNotEmpty(service) && !service.contains("*")) {
context.put("methods", CollectionUtils.sort(new ArrayList<String>(providerService.findMethodsByService(service))));
}
}
示例4: add
import com.alibaba.dubbo.common.utils.CollectionUtils; //导入依赖的package包/类
public void add(Map<String, Object> context) {
String service = (String)context.get("service");
if (service != null && service.length() > 0 && !service.contains("*")) {
List<Provider> providerList = providerService.findByService(service);
List<String> addressList = new ArrayList<String>();
for(Provider provider : providerList){
addressList.add(provider.getUrl().split("://")[1].split("/")[0]);
}
context.put("addressList", addressList);
context.put("service", service);
context.put("methods", CollectionUtils.sort(providerService.findMethodsByService(service)));
} else {
List<String> serviceList = Tool.sortSimpleName(providerService.findServices());
context.put("serviceList", serviceList);
}
if(context.get("input") != null) context.put("input", context.get("input"));
}
示例5: doExecute
import com.alibaba.dubbo.common.utils.CollectionUtils; //导入依赖的package包/类
@SuppressWarnings("unchecked")
protected String doExecute(Map<String, Object> context) throws Exception {
Map<String, String[]> params = request.getParameterMap();
if (params == null || params.size() == 0) {
throw new IllegalArgumentException("The url parameters is null! Usage: " + request.getRequestURL().toString() + "?com.xxx.XxxService=http://" + operatorAddress + "/xxxService");
}
for (Map.Entry<String, String[]> entry : params.entrySet()) {
if (entry.getKey() != null && entry.getKey().length() > 0
&& entry.getValue() != null && entry.getValue().length > 0
&& entry.getValue()[0] != null && entry.getValue()[0].length() > 0) {
if (!currentUser.hasServicePrivilege(entry.getKey())) {
throw new IllegalStateException("The user " + operator + " have no privilege of service " + entry.getKey());
}
for (Entry<String, String> e : CollectionUtils.split(Arrays.asList(entry.getValue()), "?").entrySet()) {
Provider provider = providervice.findByServiceAndAddress(entry.getKey(), e.getKey());
if (provider != null) {
providervice.deleteStaticProvider(provider.getId());
}
}
}
}
return "Unregister " + params.size() + " services.";
}
示例6: add
import com.alibaba.dubbo.common.utils.CollectionUtils; //导入依赖的package包/类
/**
* load页面供新增操作
*
* @param context
*/
public void add(Map<String, Object> context) {
String service = (String) context.get("service");
if (service != null && service.length() > 0 && !service.contains("*")) {
List<Provider> providerList = providerService.findByService(service);
List<String> addressList = new ArrayList<String>();
for (Provider provider : providerList) {
addressList.add(provider.getUrl().split("://")[1].split("/")[0]);
}
context.put("addressList", addressList);
context.put("service", service);
context.put("methods", CollectionUtils.sort(providerService.findMethodsByService(service)));
} else {
List<String> serviceList = Tool.sortSimpleName(providerService.findServices());
context.put("serviceList", serviceList);
}
if (context.get("input") != null) context.put("input", context.get("input"));
}
示例7: add
import com.alibaba.dubbo.common.utils.CollectionUtils; //导入依赖的package包/类
public void add(Map<String, Object> context) {
List<String> serviceList = new ArrayList<String>();
List<String> applicationList = new ArrayList<String>();
String service = (String) context.get("service");
String application = (String) context.get("application");
if (StringUtils.isNotEmpty(application)) {
serviceList.addAll(providerService.findServicesByApplication(application));
serviceList.addAll(consumerService.findServicesByApplication(application));
context.put("serviceList", serviceList);
} else if (StringUtils.isNotEmpty(service)) {
applicationList.addAll(providerService.findApplicationsByServiceName(service));
applicationList.addAll(consumerService.findApplicationsByServiceName(service));
context.put("applicationList", applicationList);
} else {
serviceList.addAll(providerService.findServices());
serviceList.addAll(consumerService.findServices());
providerService.findServicesByApplication(application);
consumerService.findServicesByApplication(application);
}
context.put("serviceList", serviceList);
if (StringUtils.isNotEmpty(service) && !service.contains("*")) {
context.put("methods", CollectionUtils.sort(new ArrayList<String>(providerService.findMethodsByService(service))));
}
}
示例8: add
import com.alibaba.dubbo.common.utils.CollectionUtils; //导入依赖的package包/类
public void add(Map<String, Object> context) {
String service = (String) context.get("service");
if (service != null && service.length() > 0 && !service.contains("*")) {
List<Provider> providerList = providerService.findByService(service);
List<String> addressList = new ArrayList<String>();
for (Provider provider : providerList) {
addressList.add(provider.getUrl().split("://")[1].split("/")[0]);
}
context.put("addressList", addressList);
context.put("service", service);
context.put("methods", CollectionUtils.sort(providerService.findMethodsByService(service)));
} else {
List<String> serviceList = Tool.sortSimpleName(providerService.findServices());
context.put("serviceList", serviceList);
}
if (context.get("input") != null) context.put("input", context.get("input"));
}