Example usage for org.apache.commons.collections4 MapUtils isEmpty

List of usage examples for org.apache.commons.collections4 MapUtils isEmpty

Introduction

In this page you can find the example usage for org.apache.commons.collections4 MapUtils isEmpty.

Prototype

public static boolean isEmpty(final Map<?, ?> map) 

Source Link

Document

Null-safe check if the specified map is empty.

Usage

From source file:org.duniter.elasticsearch.user.service.GroupService.java

public Map<String, String> getTitlesByNames(Set<String> ids) {

    Map<String, Object> titles = client.getFieldByIds(recordDao.getIndex(), recordDao.getType(), ids,
            UserGroup.PROPERTY_TITLE);/*from  w w w.  j  a v  a 2s .  co  m*/
    if (MapUtils.isEmpty(titles))
        return null;
    Map<String, String> result = new HashMap<>();
    titles.entrySet().forEach((entry) -> result.put(entry.getKey(), entry.getValue().toString()));
    return result;
}

From source file:org.duniter.elasticsearch.user.service.UserService.java

public Map<String, String> getProfileTitles(Set<String> issuers) {

    Map<String, Object> titles = client.getFieldByIds(INDEX, PROFILE_TYPE, issuers, UserProfile.PROPERTY_TITLE);
    if (MapUtils.isEmpty(titles))
        return null;
    Map<String, String> result = new HashMap<>();
    titles.entrySet().forEach((entry) -> result.put(entry.getKey(), entry.getValue().toString()));
    return result;
}

From source file:org.duniter.elasticsearch.websocket.WebSocketChangesEndPoint.java

@Override
public Collection<ChangeSource> getChangeSources() {
    if (MapUtils.isEmpty(sources))
        return DEFAULT_SOURCES;
    return sources.values();
}

From source file:org.ethereum.db.ContractDetailsCacheImpl.java

@Override
public boolean isNullObject() {
    return origContract.isNullObject() && (MapUtils.isEmpty(storage));
}

From source file:org.kuali.coeus.sys.framework.persistence.FilterByMapDescriptorCustomizer.java

@Override
public final void customize(ClassDescriptor descriptor) throws Exception {
    if (StringUtils.isBlank(getAttributeName())) {
        throw new IllegalStateException("getAttributeName() must return a non-blank attribute name");
    }//  www  . jav a  2 s .  c o  m

    if (MapUtils.isEmpty(getFilterMap())) {
        throw new IllegalStateException("getFilterMap() must return a non-blank attribute name");
    }

    final DatabaseMapping dbMapping = descriptor.getMappingForAttributeName(getAttributeName());
    if (dbMapping instanceof ForeignReferenceMapping) {
        final ForeignReferenceMapping frMapping = (ForeignReferenceMapping) dbMapping;
        final Class<?> refClass = frMapping.getReferenceClass();
        final Expression curExpr = frMapping.getSelectionCriteria();
        frMapping.setSelectionCriteria(
                curExpr.and(createFilterExpressionForAttrFromMap(refClass, getFilterMap())));
    } else {
        throw new IllegalStateException(
                "this DescriptorCustomizer only works on reference attributes " + dbMapping != null
                        ? dbMapping.getClass().getName()
                        : "null");
    }
}

From source file:org.openecomp.core.utilities.file.FileContentHandler.java

public boolean isEmpty() {
    return MapUtils.isEmpty(this.files);
}

From source file:org.openecomp.sdc.enrichment.impl.tosca.CeilometerEnricher.java

private static void addCapability(NodeType nodeType, String capabilityId,
        CapabilityDefinition capabilityDefinition) {
    if (MapUtils.isEmpty(nodeType.getCapabilities())) {
        nodeType.setCapabilities(new HashMap<>());
    }/* ww w.ja v a  2 s .co  m*/
    //clean unnecessary info
    capabilityDefinition.setAttributes(null);
    capabilityDefinition.setOccurrences(null);

    nodeType.getCapabilities().put(capabilityId, capabilityDefinition);
}

From source file:org.openecomp.sdc.tosca.services.impl.ToscaAnalyzerServiceImpl.java

private Optional<Boolean> isNodeTypeExistInServiceTemplateHierarchy(String nodeTypeToMatch,
        String nodeTypeToSearch, ServiceTemplate serviceTemplate, ToscaServiceModel toscaServiceModel,
        Set<String> analyzedImportFiles) {
    Map<String, NodeType> searchableNodeTypes = serviceTemplate.getNode_types();
    if (!MapUtils.isEmpty(searchableNodeTypes)) {
        NodeType nodeType = searchableNodeTypes.get(nodeTypeToSearch);
        if (Objects.nonNull(nodeType)) {
            if (Objects.equals(nodeType.getDerived_from(), nodeTypeToMatch)) {
                return Optional.of(true);
            } else if (isNodeTypeIsToscaRoot(nodeType)) {
                return Optional.of(false);
            } else {
                return isNodeTypeExistInServiceTemplateHierarchy(nodeTypeToMatch, nodeType.getDerived_from(),
                        serviceTemplate, toscaServiceModel, null);
            }//from  w  w w  .  ja v  a  2 s . co m
        } else {
            return isNodeTypeExistInImports(nodeTypeToMatch, nodeTypeToSearch, serviceTemplate,
                    toscaServiceModel, analyzedImportFiles);
        }
    }
    return isNodeTypeExistInImports(nodeTypeToMatch, nodeTypeToSearch, serviceTemplate, toscaServiceModel,
            analyzedImportFiles);

}

From source file:org.openecomp.sdc.tosca.services.impl.ToscaAnalyzerServiceImpl.java

private void scanAnFlatEntity(ToscaElementTypes elementType, String typeId, Object entity,
        ServiceTemplate serviceTemplate, ToscaServiceModel toscaModel) {

    boolean entityFound = enrichEntityFromCurrentServiceTemplate(elementType, typeId, entity, serviceTemplate,
            toscaModel);/*w w w . ja  v a 2s . c  o  m*/
    if (!entityFound) {
        Map<String, Import> imports = serviceTemplate.getImports();
        if (MapUtils.isEmpty(imports)) {
            return;
        }
        for (Import importServiceTemplate : imports.values()) {
            ServiceTemplate template = toscaModel.getServiceTemplates().get(importServiceTemplate.getFile());
            scanAnFlatEntity(elementType, typeId, entity, template, toscaModel);
        }
    }

}

From source file:org.openecomp.sdc.translator.impl.heattotosca.HeatToToscaTranslatorImpl.java

@Override
public Map<String, List<ErrorMessage>> validate() {

    Map<String, List<ErrorMessage>> errors = new HashMap<>();
    if (translationContext.getManifest() == null) {
        ErrorMessage.ErrorMessageUtil.addMessage(AsdcCommon.MANIFEST_NAME, errors)
                .add(new ErrorMessage(ErrorLevel.ERROR, Messages.MANIFEST_NOT_EXIST.getErrorMessage()));
        return errors;
    }/*from   w w w .  jav  a  2s.  c  o m*/

    if (MapUtils.isEmpty(errors)) {
        errors = validationManager.validate();
    }
    if (MapUtils.isEmpty(errors)) {
        isValid = true;
    }
    return errors;
}