Example usage for org.springframework.util Assert notEmpty

List of usage examples for org.springframework.util Assert notEmpty

Introduction

In this page you can find the example usage for org.springframework.util Assert notEmpty.

Prototype

public static void notEmpty(@Nullable Map<?, ?> map, Supplier<String> messageSupplier) 

Source Link

Document

Assert that a Map contains entries; that is, it must not be null and must contain at least one entry.

Usage

From source file:grails.plugin.springsecurity.acl.access.method.ProxyAwareDelegatingMethodSecurityMetadataSource.java

/**
 * {@inheritDoc}/*from  w w  w .ja  v a 2  s.c o m*/
 * @see org.springframework.beans.factory.InitializingBean#afterPropertiesSet()
 */
public void afterPropertiesSet() {
    Assert.notEmpty(methodSecurityMetadataSources, "A list of MethodSecurityMetadataSources is required");
}

From source file:org.esco.portlet.accueil.services.UserAgentInspector.java

/**
 * @see org.springframework.beans.factory.InitializingBean#afterPropertiesSet()
 *//*  www .  ja  va2s .co  m*/
public void afterPropertiesSet() {
    Assert.notEmpty(userAgentAutorized,
            "Il est ncessaire de spcifier une liste de navigateurs compatibles !");
    Assert.notEmpty(userAgentNotSecure,
            "Il est ncessaire de spcifier une liste de navigateurs non scure !");
    // Compile our patterns
    for (String userAgent : userAgentAutorized) {
        patternsUAA.add(Pattern.compile(userAgent.toLowerCase()));
    }
    for (String userAgent : userAgentNotSecure) {
        patternsUAS.add(Pattern.compile(userAgent.toLowerCase()));
    }
}

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

@SuppressWarnings("unchecked")
public final <T extends Query> T addProjectionOnFields(Field... fields) {
    Assert.notEmpty(fields, "Cannot add projection on null/empty field list.");
    for (Field field : fields) {
        addProjectionOnField(field);//  w  w  w.  ja v  a  2 s.com
    }
    return (T) this;
}

From source file:com.project.framework.dao.GenericDao.java

/**
 * ?//from  ww w  . ja  va 2 s. co  m
 * 
 * @param entitys ??
 * @param flushSize ORM?????
 */
public void save(final List<T> entitys, int flushSize) {
    Assert.notNull(entitys, "entitys Can not NULL");
    Assert.notEmpty(entitys, "entitys Can not EMPTY");

    Session session = getSession();
    int count = 1;
    for (T entity : entitys) {
        session.saveOrUpdate(entity);

        if (count++ % flushSize == 0) {
            session.flush();
            session.clear();
        }
    }
    logger.debug("batch save {}, number of rows affected: {}", entityClass.getSimpleName(), count - 1);
}

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

@SuppressWarnings("unchecked")
public final <T extends Query> T addProjectionOnFields(String... fieldnames) {
    Assert.notEmpty(fieldnames, "Cannot add projection on null/empty field list.");
    for (String fieldname : fieldnames) {
        addProjectionOnField(fieldname);
    }/*from  w w  w. j a v  a  2s .c  om*/
    return (T) this;
}

From source file:org.esupportail.portlet.filemanager.services.evaluators.GroupEvaluator.java

/**
 * @see org.springframework.beans.factory.InitializingBean#afterPropertiesSet()
 *///from  ww w  .j  a  v a 2  s .c  o  m
public void afterPropertiesSet() throws Exception {
    Assert.notNull(type, "The type of evaluator should not be null, values are [OR, AND, NOT]!");
    Assert.notEmpty(evaluators, "The evaluator list can't be null or empty !");
    Assert.isTrue(
            (evaluators.size() > 1 && !Type.NOT.equals(type))
                    || (Type.NOT.equals(type) && evaluators.size() == 1),
            "You need to set more than one evaluator when operator type != NOT or You need to set only one evaluator when operator type = NOT !");
}

From source file:jails.http.converter.FormHttpMessageConverter.java

/**
 * Set the message body converters to use. These converters are used to convert objects to MIME parts.
 *///from   ww  w  . j av a 2 s  .c o m
public final void setPartConverters(List<HttpMessageConverter<?>> partConverters) {
    Assert.notEmpty(partConverters, "'partConverters' must not be empty");
    this.partConverters = partConverters;
}

From source file:io.isoft.system.service.SysUserServiceImpl.java

@Override
public SysUser getSysUser(Map<String, String> params) {
    // TODO Auto-generated method stub

    String userCode = params.get("userCode");
    Assert.notNull(userCode, Constant.USER_CODE_NOT_NULL);
    SysUser user = sysUserRepository.findByUserCode(userCode);
    Assert.notNull(user, Constant.USER_CODE_NOT_EXIST);
    Assert.notEmpty(user.getRoles(), Constant.USER_HASNT_ROLES);
    String roleCode = params.get("roleCode");
    if (roleCode == null)
        return user;

    String password = params.get("password");
    if (password != null & !"".equals(password)) {
        String _pwd = user.getPassword();
        Assert.notNull(_pwd, Constant.USER_HASNT_PWD);
        String pwd = SupSafe.getEncrypt(password);
        Assert.isTrue(pwd.equals(_pwd), Constant.USER_PWD_ERROR);
        //?roleCode ??
        List<SysRole> roles = user.getRoles();
        roles = roles.stream().filter(r -> r.getRoleCode().equals(roleCode)).collect(Collectors.toList());
        user.setUserRoles(roles);/*w w  w.  j a  v  a2  s.  com*/
        return user;
    }
    //?
    return null;
}

From source file:us.swcraft.springframework.store.persistence.AerospikeTemplate.java

@Override
public void persist(final String key, final Set<Bin> bins) {
    Assert.notNull(key, "key can't be null");
    final Key recordKey = new Key(namespace, setname, key);
    Assert.notNull(bins, "bins can't be null");
    Assert.notEmpty(bins, "bins should have data to store");
    getAerospikeClient().put(writePolicyUpdate, recordKey, bins.toArray(BIN_ARRAY_TYPE));
}

From source file:fr.mby.saml2.sp.opensaml.query.engine.OpenSaml2QueryProcessorFactory.java

@Override
public void afterPropertiesSet() throws Exception {
    Assert.notEmpty(this.processorConfiguration, "Query Processors not configured !");
    Assert.notEmpty(this.bindingConfiguration, "Bindings not configured !");
    Assert.notNull(this.samlMessageDecoders, "No SAML message decoders configured !");
    Assert.notNull(this.signatureValidator, "No signature validator configured !");

    // TODO MBD: what to do with this ?
    final StorageService<String, ReplayCacheEntry> storageEngine = new MapBasedStorageService<String, ReplayCacheEntry>();
    final ReplayCache replayCache = new ReplayCache(storageEngine, 60 * 1000 * this.replayMinutes);
    this.rule = new MessageReplayRule(replayCache);

    Assert.notNull(this.samlMessageDecoders, "No SAML message decoders provided for this IdP connector !");
    for (final SamlBindingEnum binding : SamlBindingEnum.values()) {
        Assert.notNull(this.samlMessageDecoders.get(binding), String
                .format("No SAML message decoder provided for the binding [%s] !", binding.getDescription()));
    }//from   w  w  w .  j  a  v a  2s .co  m

}