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:com.azaptree.services.security.impl.SecurityCredentialsServiceImpl.java

/**
 * //from   w ww .j  a  v a2 s.c om
 * @param credentialToByteSourceConverters
 *            makes a copy of the supplied Map
 */
public SecurityCredentialsServiceImpl(
        final Map<String, CredentialToByteSourceConverter<?>> credentialToByteSourceConverters) {
    Assert.notEmpty(credentialToByteSourceConverters, "credentialToByteSourceConverters are required");
    this.credentialToByteSourceConverters = ImmutableMap.<String, CredentialToByteSourceConverter<?>>builder()
            .putAll(credentialToByteSourceConverters).build();

    final Logger log = LoggerFactory.getLogger(SecurityCredentialsService.class);
    if (log.isInfoEnabled()) {
        final StringWriter sw = new StringWriter(256);
        final PrintWriter pw = new PrintWriter(sw);
        pw.println("credentialToByteSourceConverters:");
        for (Map.Entry<String, CredentialToByteSourceConverter<?>> entry : credentialToByteSourceConverters
                .entrySet()) {
            pw.print(entry.getKey());
            pw.print(" -> ");
            pw.println(entry.getValue().getClass().getName());
        }

        log.info(sw.toString());
    }
}

From source file:org.esco.portlet.flashinfo.dao.util.EscoHostnameVerifier.java

@Override
public void afterPropertiesSet() throws Exception {
    Assert.notEmpty(trustedDomains, "The list of trusted domains isn't initialized !");
    if (defaultHostnameVerifier == null) {
        defaultHostnameVerifier = SSLConnectionSocketFactory.getDefaultHostnameVerifier();
    }//from  ww  w  .j  a  v  a2s.c o m
    log.debug("Trusted Domain configured are {}", this.trustedDomains);
}

From source file:at.porscheinformatik.common.spring.web.extended.expression.ScriptExpressionHandler.java

private String buildDevelopmentScripts(String stackName) {
    List<String> scriptNames = scriptConfig.getResourceNamesForStack(stackName);

    Assert.notEmpty(scriptNames, "No script defined in stack " + stackName);

    StringBuilder builder = new StringBuilder();

    for (String styleName : scriptNames) {
        builder.append(HtmlUtils.buildScriptLink(generateUrl("script/single", stackName, styleName)))
                .append("\n");
    }/*w w  w . jav a  2 s  . c  o m*/

    return builder.toString();
}

From source file:fr.mby.saml2.sp.impl.config.WayfConfig.java

/**
 * IdPs configuration ordered list.//from   w  ww.  jav a2 s.c o m
 * 
 * @param idpConfigs IdPs configuration ordered list
 */
public void setConfig(final List<IIdpConfig> idpConfigs) {
    Assert.notEmpty(idpConfigs, "IdP config ordered list is empty !");
    this.idpConfigsList = idpConfigs;
    this.idpConfigs = new HashMap<String, IIdpConfig>();
    for (IIdpConfig config : idpConfigs) {
        IIdpConfig previous = this.idpConfigs.put(config.getId(), config);
        Assert.isNull(previous, String.format("Two IdP configs owned the same unique Id: [%s] !", previous));
        config.registerWayfConfig(this);
    }
}

From source file:fr.acxio.tools.agia.transform.FieldSetFieldFilterProcessor.java

public void afterPropertiesSet() {
    Assert.hasText(fieldName, "You must provide a field name.");
    Assert.notEmpty(fieldValues, "You must provide at least one value.");
}

From source file:org.hdiv.config.annotation.ExclusionRegistry.java

public ParamExclusionRegistration addParamExclusions(String... parameterPatterns) {
    Assert.notEmpty(parameterPatterns, "Parameter patterns are required");
    ParamExclusionRegistration registration = new ParamExclusionRegistration(parameterPatterns);
    paramRegistrations.add(registration);
    return registration;
}

From source file:org.openwms.core.module.ModuleServiceImpl.java

/**
 * {@inheritDoc}//from   w  w  w  .j  av a2 s  .c  o m
 * <p>
 * It is expected that the list of {@link Module}s is already ordered by their startup order. Each {@link Module}'s
 * {@code startupOrder} is synchronized with the persistence storage.
 *
 * @throws org.ameba.exception.ServiceLayerException when {@code modules} is {@literal null}
 */
@Override
public void saveStartupOrder(List<Module> modules) {
    Assert.notEmpty(modules, ExceptionCodes.MODULE_SAVE_STARTUP_ORDER_NOT_BE_NULL);
    for (Module module : modules) {
        Module toSave = moduleDao.findOne(module.getPk());
        if (toSave == null) {
            throw new NotFoundException(String.format("Module with if [%s] not found", module.getPk()));
        }
        toSave.setStartupOrder(module.getStartupOrder());
        save(toSave);
    }
}

From source file:com.autentia.wuija.security.impl.hibernate.HibernateUserDetailsServiceHelper.java

/**
 * @see UserDetailsServiceHelper#loadUsersByRoles(String...)
 *//*from   w  w w.ja  v  a2s .  co  m*/
public List<UserDetails> loadUsersByRoles(String... roles) {
    Assert.notEmpty(roles, "The array of roles must have elements");

    final StringBuilder hql = new StringBuilder(userDetailsHqlProvider.getUsersByRoleHql());
    for (int i = 1; i < roles.length; i++) {
        hql.append(" or a.role = ? or ga.role = ?");
    }
    hql.append(userDetailsHqlProvider.getUsersByRoleHqlOrderBy());

    if (log.isDebugEnabled()) {
        log.debug("Loading user with roles: " + ToStringBuilder.reflectionToString(roles) + ", query: " + hql);
    }

    return dao.find(hql.toString(), (Object[]) repeatArrayElements(roles));
}

From source file:org.spring.data.gemfire.app.main.SpringGemFireCacheServerLauncher.java

public SpringGemFireCacheServerLauncher(final String[] configLocations) {
    Assert.notEmpty(configLocations,
            "At least 1 location to a Spring GemFire ApplicationContext configuration file must be provided!");
    this.configLocations = configLocations;
}

From source file:org.codehaus.groovy.grails.plugins.searchable.compass.search.DefaultSearchMethod.java

public Object invoke(Object[] args) {
    Assert.notNull(args, "args cannot be null");
    Assert.notEmpty(args, "args cannot be empty");

    final Object query = getQuery(args);
    Assert.notNull(query,//from w ww.  j ava2s  .c  o m
            "No query String or Closure argument given to " + getMethodName() + "(): you must supply one");
    final Map options = SearchableMethodUtils.getOptionsArgument(args, getDefaultOptions());

    SearchCompassCallback searchCallback = new SearchCompassCallback(options, query);
    searchCallback.setGrailsApplication(grailsApplication);
    searchCallback.setCompassQueryBuilder(compassQueryBuilder);
    searchCallback.setHitCollector(hitCollector);
    searchCallback.setSearchResultFactory(searchResultFactory);
    return doInCompass(searchCallback);
}