当前位置: 首页>>代码示例>>Java>>正文


Java CollectionUtils.isEmpty方法代码示例

本文整理汇总了Java中org.apache.commons.collections.CollectionUtils.isEmpty方法的典型用法代码示例。如果您正苦于以下问题:Java CollectionUtils.isEmpty方法的具体用法?Java CollectionUtils.isEmpty怎么用?Java CollectionUtils.isEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.commons.collections.CollectionUtils的用法示例。


在下文中一共展示了CollectionUtils.isEmpty方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getLoginUserMenuList

import org.apache.commons.collections.CollectionUtils; //导入方法依赖的package包/类
/**
 * 获取当前登录者所能看见的菜单集合
 * @param request
 * @param response
 * @return
 */
@ResponseBody
@RequestMapping(value="/login/user/menus", method=GET, produces=APPLICATION_JSON)
public Object getLoginUserMenuList(HttpServletRequest request, HttpServletResponse response) {
	List<Map<String,Object>> dataList = new ArrayList<Map<String,Object>>();
	try {
		List<AdminResource> userMenuResources = new ArrayList<AdminResource>();
		AdminUserRealm realm = ShiroUtils.getRealm(AdminUserRealm.class);
		AuthorizationInfo authInfo = realm.getAuthorizationInfo(SecurityUtils.getSubject().getPrincipals());
		if(authInfo instanceof CustomAuthorizationInfo){
			CustomAuthorizationInfo<AdminResource> authorizationInfo = (CustomAuthorizationInfo<AdminResource>) authInfo;
			Set<AdminResource> userResources = authorizationInfo.getResources();
			if(!CollectionUtils.isEmpty(userResources)){
				for(AdminResource resource : userResources){
					if(AdminResourceActionTypeEnum.ADMIN_RESOURCE_ACTION_TYPE_MENU.getTypeCode().equals(resource.getActionType())){
						userMenuResources.add(resource);
					}
				}
				dataList = resourceTreeBuilder.buildObjectTree(GlobalConstants.DEFAULT_ADMIN_ROOT_RESOURCE_ID, userMenuResources, resourceNavMenuNodeConverter);
			}
		}
	} catch (Exception e) {
		logger.error(e.getMessage(), e);
	}
	return dataList;
}
 
开发者ID:penggle,项目名称:xproject,代码行数:32,代码来源:AdminController.java

示例2: invokeConfigItemPostProcessors

import org.apache.commons.collections.CollectionUtils; //导入方法依赖的package包/类
/**
 * 调用所有的{@link ConfigItemPostProcessor}进行配置项预处理
 *
 * @param versionPropertySource
 */
private void invokeConfigItemPostProcessors(VersionPropertySource<ConfigItemList> versionPropertySource) {
    if (versionPropertySource == null) {
        return;
    }
    List<ConfigItemPostProcessor> configItemPostProcessors = this.configItemPostProcessors;
    if (CollectionUtils.isEmpty(configItemPostProcessors)) {
        return;
    }

    long version = versionPropertySource.getVersion();
    EnumerablePropertySource<?> propertySource = versionPropertySource.getSource();
    if (propertySource == null) {
        return;
    }
    if (!(propertySource instanceof ConfigPropertySource)) {
        return;
    }

    ConfigPropertySource configPropertySource = (ConfigPropertySource) propertySource;

    for (ConfigItemPostProcessor postProcessor : configItemPostProcessors) {
        postProcessor.postProcessConfigItems(version, configPropertySource);
    }
}
 
开发者ID:zouzhirong,项目名称:configx,代码行数:30,代码来源:ConfigContext.java

示例3: newHiveConf

import org.apache.commons.collections.CollectionUtils; //导入方法依赖的package包/类
private HiveConf newHiveConf(TunnelMetastoreCatalog hiveCatalog, Configuration baseConf) {
  List<String> siteXml = hiveCatalog.getSiteXml();
  if (CollectionUtils.isEmpty(siteXml)) {
    LOG.info("No Hadoop site XML is defined for catalog {}.", hiveCatalog.getName());
  }
  Map<String, String> properties = new HashMap<>();
  for (Entry<String, String> entry : baseConf) {
    properties.put(entry.getKey(), entry.getValue());
  }
  if (hiveCatalog.getHiveMetastoreUris() != null) {
    properties.put(ConfVars.METASTOREURIS.varname, hiveCatalog.getHiveMetastoreUris());
  }
  configureMetastoreTunnel(hiveCatalog.getMetastoreTunnel(), properties);
  putConfigurationProperties(hiveCatalog.getConfigurationProperties(), properties);
  HiveConf hiveConf = new HiveConfFactory(siteXml, properties).newInstance();
  return hiveConf;
}
 
开发者ID:HotelsDotCom,项目名称:circus-train,代码行数:18,代码来源:CommonBeans.java

示例4: receiveServiceStatus

import org.apache.commons.collections.CollectionUtils; //导入方法依赖的package包/类
private Map<String, String> receiveServiceStatus(List<ServiceInstance> instances) {
    if (CollectionUtils.isEmpty(instances)) {
        return Collections.emptyMap();
    }
    Map<String, String> instancesStatus = new HashMap<>();

    instances.stream()
        .filter(serviceInstance -> serviceInstance.getUri() != null)
        .forEach(instance -> {
            String uri = instance.getUri().toString();
            String status;
            try {
                Map body = restTemplate.exchange(
                    String.format("%s/management/health", uri),
                    HttpMethod.GET, null, Map.class).getBody();
                status = (String) body.get(STATUS);
            } catch (RestClientException e) {
                log.error("Error occurred while getting status of the microservice by URI {}",
                    uri, e);
                status = "DOWN";
            }
            instancesStatus.put(uri, status);
        });
    return instancesStatus;
}
 
开发者ID:xm-online,项目名称:xm-gate,代码行数:26,代码来源:GatewayResource.java

示例5: batchRemove

import org.apache.commons.collections.CollectionUtils; //导入方法依赖的package包/类
/**
 * 批量删除补偿事务信息
 *
 * @param ids             ids 事务id集合
 * @param applicationName 应用名称
 * @return true 成功
 */
@Override
public Boolean batchRemove(List<String> ids, String applicationName) {
    if (CollectionUtils.isEmpty(ids) || StringUtils.isBlank(applicationName)) {
        return Boolean.FALSE;
    }
    final String mongoTableName = RepositoryPathUtils.buildMongoTableName(applicationName);

    ids.forEach(id -> {
        Query query = new Query();
        query.addCriteria(new Criteria("transId").is(id));
        mongoTemplate.remove(query, mongoTableName);
    });

    return Boolean.TRUE;
}
 
开发者ID:yu199195,项目名称:happylifeplat-tcc,代码行数:23,代码来源:MongoCompensationServiceImpl.java

示例6: batchRemove

import org.apache.commons.collections.CollectionUtils; //导入方法依赖的package包/类
/**
 * 批量删除补偿事务信息
 *
 * @param ids             ids 事务id集合
 * @param applicationName 应用名称
 * @return true 成功
 */
@Override
public Boolean batchRemove(List<String> ids, String applicationName) {
    if (CollectionUtils.isEmpty(ids) || StringUtils.isBlank(applicationName)) {
        return Boolean.FALSE;
    }
    String keyPrefix = RepositoryPathUtils.buildRedisKeyPrefix(applicationName);
    final String[] keys = ids.stream()
            .map(id -> RepositoryPathUtils.buildRedisKey(keyPrefix,id)).toArray(String[]::new);

    jedisClient.del(keys);
    return Boolean.TRUE;
}
 
开发者ID:yu199195,项目名称:happylifeplat-tcc,代码行数:20,代码来源:RedisCompensationServiceImpl.java

示例7: convertToDTO

import org.apache.commons.collections.CollectionUtils; //导入方法依赖的package包/类
@Override
public Collection<VisitorOriginDTO> convertToDTO(Collection<Origin> origins) {
	if (CollectionUtils.isEmpty(origins)) {
		return null;
	}
	return origins.stream().filter(Objects::nonNull).map(origin -> convertToDTO(origin))
			.collect(Collectors.toList());
}
 
开发者ID:Zymr,项目名称:visitormanagement,代码行数:9,代码来源:OriginConverter.java

示例8: convertToDTO

import org.apache.commons.collections.CollectionUtils; //导入方法依赖的package包/类
@Override
public Collection<EmployeeDTO> convertToDTO(Collection<Employee> employees) {
	if (CollectionUtils.isEmpty(employees)) {
		return null;
	}
	return employees.stream().
			filter(Objects::nonNull).map(employee -> convertToDTO(employee))
			.collect(Collectors.toList());
}
 
开发者ID:Zymr,项目名称:visitormanagement,代码行数:10,代码来源:EmployeeConverter.java

示例9: batchRemove

import org.apache.commons.collections.CollectionUtils; //导入方法依赖的package包/类
/**
 * 批量删除补偿事务信息
 *
 * @param ids             ids 事务id集合
 * @param applicationName 应用名称
 * @return true 成功
 */
@Override
public Boolean batchRemove(List<String> ids, String applicationName) {
    if (CollectionUtils.isEmpty(ids) || StringUtils.isBlank(applicationName)) {
        return Boolean.FALSE;
    }

    final String rootPath = RepositoryPathUtils.buildZookeeperPath(applicationName);
    ids.stream().map(id -> {
        try {
            final String path = buildRootPath(rootPath, id);
            byte[] content = zooKeeper.getData(path,
                    false, new Stat());
            final TransactionRecoverAdapter adapter = objectSerializer.deSerialize(content, TransactionRecoverAdapter.class);
            zooKeeper.delete(path, adapter.getVersion());
            return 1;
        } catch (Exception e) {
            e.printStackTrace();
            return -1;
        }

    }).count();

    return Boolean.TRUE;
}
 
开发者ID:yu199195,项目名称:happylifeplat-transaction,代码行数:32,代码来源:ZookeeperRecoverTransactionServiceImpl.java

示例10: assertExistTenants

import org.apache.commons.collections.CollectionUtils; //导入方法依赖的package包/类
private void assertExistTenants(Set<TenantState> tenantKeys) {
    if (CollectionUtils.isEmpty(tenantKeys)) {
        final String error = "Tenant list for " + applicationName + " empty. Check tenants-list.json.";
        log.error(error);
        throw new IllegalStateException(error);
    }
}
 
开发者ID:xm-online,项目名称:xm-commons,代码行数:8,代码来源:TenantListRepository.java

示例11: recordMailReceiver

import org.apache.commons.collections.CollectionUtils; //导入方法依赖的package包/类
private boolean recordMailReceiver(int taskGroupId,
        List<Integer> mailReceiverIdList) {
    if (CollectionUtils.isEmpty(mailReceiverIdList)) {
        return false;
    }
    return true;
}
 
开发者ID:wittyLuzhishen,项目名称:EasyPackage,代码行数:8,代码来源:TaskBiz.java

示例12: getResources

import org.apache.commons.collections.CollectionUtils; //导入方法依赖的package包/类
@Override
@Transactional(readOnly = true)
public List<BaseResource> getResources() {
    ZoneEntity zone = this.zoneResolver.getZoneEntityOrFail();

    List<BaseResource> resources = new ArrayList<>();
    List<ResourceEntity> resourceEntities = this.resourceRepository.findByZone(zone);

    if (!CollectionUtils.isEmpty(resourceEntities)) {
        for (ResourceEntity resourceEntity : resourceEntities) {
            resources.add(this.privilegeConverter.toResource(resourceEntity));
        }
    }
    return resources;
}
 
开发者ID:eclipse,项目名称:keti,代码行数:16,代码来源:PrivilegeManagementServiceImpl.java

示例13: getFullPieceMd5s

import org.apache.commons.collections.CollectionUtils; //导入方法依赖的package包/类
private List<String> getFullPieceMd5s(Task task, FileMetaData metaData) {
    List<String> pieceMd5s = taskService.getFullPieceMd5sByTask(task);
    if (CollectionUtils.isEmpty(pieceMd5s)) {
        pieceMd5s = fileMetaDataService.readPieceMd5(task.getTaskId(), metaData.getRealMd5());
    }
    return pieceMd5s;
}
 
开发者ID:alibaba,项目名称:Dragonfly,代码行数:8,代码来源:CacheDetectorImpl.java

示例14: isValid

import org.apache.commons.collections.CollectionUtils; //导入方法依赖的package包/类
public static boolean isValid(Object... objs) {
    if (objs == null || objs.length < 1) {
        return false;
    }

    for (Object obj : objs) {
        if (obj instanceof Short) {
            if (isNull(obj)) {
                return false;
            }
        } else if (obj instanceof Integer) {
            if (isInvalidInteger((Integer) obj)) {
                return false;
            }
        } else if (obj instanceof Long) {
            if (isInvalidLong((Long) obj)) {
                return false;
            }
        } else if (obj instanceof String) {
            if (isInvalidString(obj.toString())) {
                return false;
            }
        } else if (obj instanceof List) {
            if (CollectionUtils.isEmpty((List) obj)) {
                return false;
            }
        } else if (obj instanceof Map) {
            if (isNull(obj) || ((Map) obj).isEmpty()) {
                return false;
            }
        } else {
            if (isNull(obj)) {
                return false;
            }
        }
    }
    return true;
}
 
开发者ID:jmdhappy,项目名称:xxpay-master,代码行数:39,代码来源:ObjectValidUtil.java

示例15: determineLifecycleStatus

import org.apache.commons.collections.CollectionUtils; //导入方法依赖的package包/类
public ProcessingLifecycleStatus determineLifecycleStatus(RawLines rawLines) {
    ProcessingLifecycleStatus status = ProcessingLifecycleStatus.UNKNOWN;
    List<List<RawWord>> lines = rawLines.getRawLines();

    if(CollectionUtils.isEmpty(lines)) {
        return status;
    }

    for(List<RawWord> line : lines) {
        if(status != ProcessingLifecycleStatus.UNKNOWN) {
            break;
        }

        for(RawWord word : line) {
            if(word.getWord().contains("Forgot") || word.getWord().contains("Password")) {
                status = ProcessingLifecycleStatus.LOGIN_READY;
                break;
            } else if(word.getWord().contains("Welcome")) {
                status = ProcessingLifecycleStatus.APPLICATION_READY;
                break;
            } else if(word.getWord().contains("Trade")) {
                status = ProcessingLifecycleStatus.TRADE_PARTNER;
            } else if(word.getWord().contains("SOFTWARE")) {
                status = ProcessingLifecycleStatus.ACCEPT_TOS_EULA_READY;
            }
        }
    }

    return status;
}
 
开发者ID:corydissinger,项目名称:mtgo-best-bot,代码行数:31,代码来源:RawLinesProcessor.java


注:本文中的org.apache.commons.collections.CollectionUtils.isEmpty方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。