Example usage for org.springframework.util CollectionUtils isEmpty

List of usage examples for org.springframework.util CollectionUtils isEmpty

Introduction

In this page you can find the example usage for org.springframework.util CollectionUtils isEmpty.

Prototype

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

Source Link

Document

Return true if the supplied Map is null or empty.

Usage

From source file:org.ihtsdo.otf.refset.service.upload.SimpleRefsetProcessor.java

@Override
public Map<String, String> process(List<Rf2Record> rf2rLst, String refsetId, String user)
        throws RefsetServiceException, EntityNotFoundException {

    if (StringUtils.isEmpty(refsetId) || CollectionUtils.isEmpty(rf2rLst)) {

        throw new RefsetServiceException(
                "Not enough data to process. please check your request and imported file");
    }//from   w  w  w  .j av a2 s  .  c  o  m

    try {

        return gao.addMembers(rf2rLst, refsetId, user);

    } catch (RefsetGraphAccessException e) {

        throw new RefsetServiceException(e);
    }

}

From source file:com.inspiresoftware.lib.dto.geda.interceptor.impl.GeDAMethodMatcherPointcut.java

/** {@inheritDoc} */
public boolean matches(final Method method, final Class<?> targetClass, final Object[] args) {
    final Map<Occurrence, AdviceConfig> cfg = this.resolver.resolve(method, targetClass);
    return !CollectionUtils.isEmpty(cfg);
}

From source file:com.fredhopper.core.connector.index.generate.validator.ProductDataValidator.java

/**
 * @param product/*from   www.ja va2s . c om*/
 */
@Override
public List<Violation> validate(final FhProductData product) {
    Preconditions.checkArgument(product != null);
    final List<Violation> violations = new ArrayList<>();

    if (isValidProductId(product, violations)) {
        if (CollectionUtils.isEmpty(product.getCategories())) {
            violations.add(new Violation(FhProductData.class.toString(), product.getProductId(),
                    "The product is not assigned to any categories."));
        } else {
            hasValidCategoryIds(product, violations);
        }
    }
    return violations;
}

From source file:com.frank.search.solr.core.query.AbstractFunction.java

@Override
public boolean hasArguments() {
    return !CollectionUtils.isEmpty(arguments);
}

From source file:nc.noumea.mairie.organigramme.dto.ReturnMessageDto.java

public boolean hasErreurOuInfo() {
    return !(CollectionUtils.isEmpty(this.getErrors()) && CollectionUtils.isEmpty(this.getInfos()));
}

From source file:org.juiser.spring.security.authentication.ClaimsGrantedAuthoritiesResolver.java

@Override
public Collection<? extends GrantedAuthority> apply(Claims claims) {

    Collection<String> authorityStrings = authorityStringsResolver.apply(claims);

    if (CollectionUtils.isEmpty(authorityStrings)) {
        return Collections.emptyList();
    }/*from w w  w.j  a v  a2s.  com*/

    return AuthorityUtils.createAuthorityList(authorityStrings.toArray(new String[authorityStrings.size()]));
}

From source file:com.alibaba.otter.manager.biz.monitor.impl.DelayStatRuleMonitor.java

@Override
public void explore(List<AlarmRule> rules) {
    if (CollectionUtils.isEmpty(rules)) {
        return;/*from w w w  .  j a v a  2s .  c o m*/
    }

    // rulepipelineId?
    Long pipelineId = rules.get(0).getPipelineId();
    DelayStat delayStat = delayStatService.findRealtimeDelayStat(pipelineId);
    Long delayTime = 0L; // seconds
    Long delayUpdate = 0L;
    if (delayStat.getDelayTime() != null) {
        delayTime = delayStat.getDelayTime() / 1000;
    }
    if (delayStat.getGmtCreate() != null) {
        delayUpdate = (new Date().getTime() - delayStat.getGmtCreate().getTime()) / 1000;
    }

    boolean delayTimeFlag = false;
    boolean delayUpdateFlag = false;
    for (AlarmRule rule : rules) {
        if (rule.getMonitorName().isDelayTime()) {
            delayTimeFlag |= checkDelayTime(rule, delayTime);
            if (delayTimeFlag) { //?check??
                delayUpdateFlag |= checkDelayTime(rule, delayUpdate);//delay??delay
            }
        }
    }

    if (delayTimeFlag && !delayUpdateFlag) {
        logRecordAlarm(pipelineId, MonitorName.DELAYTIME,
                String.format(DELAY_TIME_MESSAGE, pipelineId, delayTime));
    } else if (delayTimeFlag && delayUpdateFlag) {
        logRecordAlarm(pipelineId, MonitorName.DELAYTIME,
                String.format(DELAY_TIME_UPDATE_MESSAGE, pipelineId, delayTime, delayUpdate));
    } else if (delayUpdateFlag) {
        logRecordAlarm(pipelineId, MonitorName.DELAYTIME,
                String.format(DELAY_UPDATE_MESSAGE, pipelineId, delayUpdate));
    }
}

From source file:com.consol.citrus.samples.kubernetes.TodoListIT.java

@Test
@CitrusTest//from www.  j a  va  2 s . c  o m
public void testDeploymentState() {
    kubernetes().client(k8sClient).pods().list().label("app=todo").validate("$..status.phase", "Running")
            .validate((pods, context) -> {
                Assert.assertFalse(CollectionUtils.isEmpty(pods.getResult().getItems()));
            });

    kubernetes().client(k8sClient).services().get("citrus-sample-todo-service").validate((service, context) -> {
        Assert.assertNotNull(service.getResult());
    });
}

From source file:org.openlmis.fulfillment.service.referencedata.ProgramReferenceDataService.java

/**
 * Finds programs by their ids.//from w  ww  . ja v  a 2s . com
 *
 * @param ids ids to look for.
 * @return a page of programs
 */
public Collection<ProgramDto> findByIds(Collection<UUID> ids) {
    if (CollectionUtils.isEmpty(ids)) {
        return Collections.emptyList();
    }
    return findAll("", RequestParameters.init().set("id", ids));
}

From source file:org.ff4j.services.PropertyStoreServices.java

public List<PropertyApiBean> getAllProperties() {
    List<PropertyApiBean> properties;
    Map<String, Property<?>> propertyMap = ff4j.getPropertiesStore().readAllProperties();
    if (CollectionUtils.isEmpty(propertyMap)) {
        properties = new ArrayList<>(0);
    } else {/*from  w  w w .  j av  a2 s.c o  m*/
        properties = new ArrayList<>(propertyMap.size());
        properties.addAll(propertyMap.values().stream().map(PropertyApiBean::new).collect(Collectors.toList()));
    }
    return properties;
}