Example usage for org.apache.commons.lang StringUtils isNotBlank

List of usage examples for org.apache.commons.lang StringUtils isNotBlank

Introduction

In this page you can find the example usage for org.apache.commons.lang StringUtils isNotBlank.

Prototype

public static boolean isNotBlank(String str) 

Source Link

Document

Checks if a String is not empty (""), not null and not whitespace only.

Usage

From source file:at.tuwien.ifs.somtoolbox.SOMToolboxMetaConstants.java

public static String getVersion() {
    if (StringUtils.isNotBlank(VERSION)) {
        return VERSION;
    } else {/*from w  w  w  .  jav  a2 s . com*/
        return "custom-build-" + new SimpleDateFormat("yyyy-MM-dd_HH:mm").format(new Date()) + "";
    }
}

From source file:com.adobe.acs.commons.dam.DAMFunctions.java

/**
 * Return the title or name of the asset, if the title is not defined.
 * //from   www  .  j  a va2  s.com
 * @param asset the asset
 * @return the asset title or name
 */
@Function
public static String getTitleOrName(Asset asset) {
    String title = asset.getMetadataValue(DamConstants.DC_TITLE);
    return StringUtils.isNotBlank(title) ? title : asset.getName();
}

From source file:com.zb.app.external.lucene.search.utils.ZuobianSolrQueryConvert.java

public static SolrQuery to(ProductSearchQuery query) {
    List<String> params = new ArrayList<String>();
    // ?//from  ww  w  .  j  av  a  2  s  . com
    if (Argument.isNotEmpty(query.getProducts())) {
        String q = StringUtils.join(query.getProducts().toArray(new String[0]), " ");
        if (StringUtils.isNotBlank(q)) {
            params.add(q.length() == 1 ? "lTile:*" + q + "*" : filterQuery(q));
        }
    }
    // ???
    if (query.getlGroupNumber() != null && query.getlGroupNumber() != "") {
        params.add("lGroupNumber:" + query.getlGroupNumber());
    }
    // ??
    if (query.getProduct() != null && query.getProduct() != "") {
        params.add("lProduct:" + query.getProduct());
    }

    // 
    List<String> fiter = new ArrayList<String>();
    // ?
    if (query.getlType() != null && query.getlGroupNumber() != "") {
        fiter.add("lType:" + query.getlType());
    }
    // ?
    if (query.getlDay() != null && query.getlDay() != 0) {
        fiter.add("lDay:" + query.getlDay());
    }
    // ?
    if (query.getzIds() != null) {
        String paramszid = "";
        for (Long zid : query.getzIds()) {
            paramszid += "zId:" + zid + " OR ";
        }
        fiter.add("(" + paramszid.substring(0, paramszid.length() - 4) + ")");
    }
    // ?
    if (query.getlArrivalCity() != null && query.getlArrivalCity() != "") {
        fiter.add("lArrivalCity:" + query.getlArrivalCity());
    }
    SolrQuery solrQuery = createSearchQuery(params, fiter, query);
    logger.debug("ZuobianSolrQueryConvert solr query: [{}]", solrQuery.toString());
    return solrQuery;
}

From source file:com.synnex.saas.platform.core.cache.CacheManager.java

public static synchronized void cacheAllTenants(List<Tenant> tenantList) {
    int size = tenantList.size();
    Tenant tenant = null;/*from   w ww  . j  a  v  a2 s  .co m*/
    for (int i = 0; i < size; i++) {
        tenant = tenantList.get(i);
        if (StringUtils.isNotBlank(tenant.getHost())) {
            TENANT_CACHE.put(tenant.getHost(), tenant);
        }
    }
}

From source file:com.smartitengineering.cms.binder.guice.Initializer.java

public static void init(String confSmartLocation) {
    if (StringUtils.isNotBlank(confSmartLocation)) {
        GuiceUtil.getInstance(confSmartLocation).register();
    } else if (StringUtils.isNotBlank(System.getProperty(DEFAULT_CONF_PROP))) {
        GuiceUtil.getInstance(System.getProperty(DEFAULT_CONF_PROP)).register();
    } else {//from w w  w .j a  v  a 2  s .c  om
        GuiceUtil.getInstance(DEFAULT_CONF).register();
    }
}

From source file:controllers.user.UserAvatarApp.java

/**
 * flash ?/*ww  w . j a v  a  2 s.c o  m*/
 * 
 * @return
 */
@Transactional
public static Result upload() {
    User current = null;
    String userId = request().getQueryString("userId");
    if (StringUtils.isNotBlank(userId)) {
        current = User.findById(new Long(userId));
    } else {
        current = User.getFromSession(session());
    }
    ObjectNodeResult result = new ObjectNodeResult();
    File avatarFile = request().body().asRaw().asFile();
    try {
        save(avatarFile, result, current);
    } catch (AvatarException e) {
        e.printStackTrace();
        result.errorkey("useravatar.error.upload");
        return ok(result.getObjectNode());
    }
    return ok(result.getObjectNode());
}

From source file:ddf.catalog.content.data.impl.ContentItemValidator.java

public static void validate(ContentItem item) throws IllegalArgumentException {
    if (StringUtils.isNotBlank(item.getQualifier())) {
        validateInput(item.getQualifier(), QUALIFIER_PATTERN);
    }// w ww . j  a va  2 s .  co  m

    if (StringUtils.isNotBlank(item.getUri())) {
        try {
            new URI(item.getUri());
        } catch (URISyntaxException e) {
            throw new IllegalArgumentException("Unable to create content URI.", e);
        }
    } else {
        throw new IllegalArgumentException("Cannot have an empty content URI.");
    }

}

From source file:com.googlecode.markuputils.CssStyleUtils.java

public static String appendProperty(String name, Object value) {

    StringBuilder buffer = new StringBuilder();

    String valueText = ObjectUtils.toString(value);

    if (StringUtils.isNotBlank(valueText)) {
        buffer.append(name).append(":").append(valueText).append(";");
    }/*from  w ww. j a v  a2s .  co  m*/

    return buffer.toString();
}

From source file:gr.abiss.calipso.wicket.form.FieldUtils.java

public static void appendFieldStyles(FieldConfig fieldConfig, final FormComponent newValueField) {
    if (fieldConfig != null) {
        if (StringUtils.isNotBlank(fieldConfig.getClassname())) {
            newValueField//ww  w . ja  v a  2 s.  c  o  m
                    .add(new AttributeAppender("class", new Model<String>(fieldConfig.getClassname()), " "));
        }
        if (StringUtils.isNotBlank(fieldConfig.getStyle())) {
            newValueField.add(new AttributeAppender("style", new Model<String>(fieldConfig.getStyle()), ";"));
        }
    }
}

From source file:com.mmj.app.lucene.search.utils.CustomSolrQueryConvert.java

public static SolrQuery to(UserSearchQuery query) {
    // ?//from   w w w . j a v  a2s . c o m
    List<String> params = new ArrayList<String>();
    // ?
    if (Argument.isNotEmpty(query.getWordList())) {
        String q = StringUtils.join(query.getWordList().toArray(new String[0]), " ");
        if (StringUtils.isNotBlank(q)) {
            if (q.length() == 1 || StringFormatter.matchsRegex(q, "^[a-zA-Z]+$")
                    || StringFormatter.matchsRegex(q, "^\\d+$")) {
                params.add("nick:*" + q + "*");
            } else {
                params.add(filterQuery(q));
            }
        }
    }
    // 
    List<String> fiter = new ArrayList<String>();

    return createSearchQuery(params, fiter, query);
}