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.bsb.cms.content.service.content.impl.ContContentPublisherServiceImpl.java

@Override
public PublishResult publishContent(List<String> contentIds) {
    // TODO Auto-generated method stub
    Assert.notEmpty(contentIds, "contentIds is empty");

    return null;/*from www.  j  a  v  a  2 s  .co m*/
}

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

/**
 * @throws Exception/*from  ww w  .java2s .  co  m*/
 * @see org.springframework.beans.factory.InitializingBean#afterPropertiesSet()
 */
public void afterPropertiesSet() throws Exception {
    Assert.notEmpty(getGroupList(), "The property groupList in class " + this.getClass().getSimpleName()
            + " must not be null and not empty.");

    this.setAsText(getGroupList());
}

From source file:org.devgateway.ocds.web.rest.controller.PercentageAmountAwardedController.java

@ApiOperation("Calculate percentage of awards awarded to a list of suppliers vs total awards. Filters by all"
        + " filters. Careful using supplierId filter here!"
        + " It has a different signification than for other endpoints.")
@RequestMapping(value = "/api/percentageAmountAwarded", method = { RequestMethod.POST,
        RequestMethod.GET }, produces = "application/json")
public List<DBObject> percentTendersCancelled(@ModelAttribute @Valid final YearFilterPagingRequest filter) {
    Assert.notEmpty(filter.getProcuringEntityId(), "Must provide at least one procuringEntity!");
    Assert.notEmpty(filter.getSupplierId(), "Must provide at least one supplierId!");
    Aggregation agg = newAggregation(// ww  w  .  j  a  va2 s  . c o  m
            getMatchYearDefaultFilterOperation(filter, MongoConstants.FieldNames.TENDER_PERIOD_START_DATE),
            match(where("tender.procuringEntity").exists(true).and("awards.suppliers.0").exists(true)
                    .andOperator(getProcuringEntityIdCriteria(filter))),
            unwind("awards"),
            match(where(MongoConstants.FieldNames.AWARDS_STATUS).is(Award.Status.active.toString())),
            facet().and(match(getSupplierIdCriteria(filter.awardFiltering())),
                    group().sum(MongoConstants.FieldNames.AWARDS_VALUE_AMOUNT).as("sum"))
                    .as("totalAwardedToSuppliers")
                    .and(group().sum(MongoConstants.FieldNames.AWARDS_VALUE_AMOUNT)
                            .as("sum"))
                    .as("totalAwarded"),
            unwind("totalAwardedToSuppliers"), unwind("totalAwarded"),
            new CustomProjectionOperation(new BasicDBObject("percentage",
                    getPercentageMongoOp("totalAwardedToSuppliers.sum", "totalAwarded.sum"))
                            .append("totalAwardedToSuppliers.sum", 1).append("totalAwarded.sum", 1)));

    return releaseAgg(agg);
}

From source file:com.developmentsprint.spring.breaker.annotations.AnnotationCircuitBreakerAttributeSource.java

/**
 * Create a custom AnnotationCircuitBreakerAttributeSource.
 * /*from   w  w w  .j  a v a  2 s  . c  o m*/
 * @param annotationParsers
 *            the CircuitBreakerAnnotationParsers to use
 */
public AnnotationCircuitBreakerAttributeSource(Set<CircuitBreakerAnnotationParser> annotationParsers) {
    this.publicMethodsOnly = true;
    Assert.notEmpty(annotationParsers, "At least one CircuitBreakerAnnotationParser needs to be specified");
    this.annotationParsers = annotationParsers;
}

From source file:com.expedia.seiso.domain.service.search.QueryFactory.java

public Query buildQuery(@NotEmpty String entityName, @NotNull EntityManager entityManager,
        @NotNull Set<String> fieldNames, @NotNull Set<String> searchTokens) {
    Query jpaQuery = null;//ww w.ja  va 2  s  . c  om

    Assert.notEmpty(fieldNames, "empty field names");
    Assert.notEmpty(searchTokens, "empty search tokens");

    StringBuilder queryStringBuilder = new StringBuilder();

    List<String> parameterNames = this.appendQueryString(queryStringBuilder, entityName, fieldNames,
            searchTokens);
    jpaQuery = entityManager.createQuery(queryStringBuilder.toString());
    this.setParameters(jpaQuery, parameterNames, searchTokens);

    return jpaQuery;
}

From source file:cz.jirutka.spring.unboundid.InMemoryDirectoryServerFactoryBean.java

public void afterPropertiesSet() {
    Assert.notEmpty(baseDNs, "At least one base DN must be provided.");
}

From source file:com.onedrive.api.OneDrive.java

public OneDrive(ClientCredential clientCredential, List<String> scopes, String redirectUri) {
    Assert.notEmpty(scopes, "At least one scope is required");
    this.clientCredential = clientCredential;
    this.scopes = scopes;
    this.redirectUri = redirectUri;
}

From source file:com.onedrive.api.internal.MultipartRelatedHttpMessageConverter.java

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

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

/**
 * @throws Exception/*from   w w w  .j a v a2s  . c om*/
 * @see org.springframework.beans.factory.InitializingBean#afterPropertiesSet()
 */
public void afterPropertiesSet() throws Exception {
    Assert.notEmpty(getValueList(), "The property valueList in class " + this.getClass().getSimpleName()
            + " must not be null and not empty.");
    Assert.hasLength(getUserAttribute(), "The property userAttribute in class "
            + this.getClass().getSimpleName() + " must not be null and not empty.");
    Assert.hasLength(getMode(), "The property mode in class " + this.getClass().getSimpleName()
            + " must not be null and not empty.");

    this.setAsText(getValueList(), getUserAttribute(), getMode());
}