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

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

Introduction

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

Prototype

public static boolean isNotBlank(final CharSequence cs) 

Source Link

Document

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

 StringUtils.isNotBlank(null)      = false StringUtils.isNotBlank("")        = false StringUtils.isNotBlank(" ")       = false StringUtils.isNotBlank("bob")     = true StringUtils.isNotBlank("  bob  ") = true 

Usage

From source file:com.kfpanda.redis.RedisUtil.java

public static void hdelForFields(String key, List<String> fields) {
    if (StringUtils.isNotBlank(key) && fields != null && fields.size() > 0) {
        Jedis jedis = RedisUtil.getResource();
        try {/*ww  w  . j av a  2 s.  c  o  m*/
            for (String field : fields) {
                long result = jedis.hdel(key, field);
                logger.debug("Redis.hdelForFields set: result({}).", result);
            }
        } catch (Exception e) {
            // redis
            pool.returnBrokenResource(jedis);
            e.printStackTrace();
        } finally {
            pool.returnResource(jedis);
        }
    }
}

From source file:com.thinkbiganalytics.nifi.provenance.util.ProvenanceEventUtil.java

public static boolean isFlowFileQueueEmptied(ProvenanceEventRecord event) {
    return (isEndingFlowFileEvent(event) && StringUtils.isNotBlank(event.getDetails())
            && event.getDetails().toLowerCase().startsWith(FLOWFILE_QUEUE_EMPTIED));
}

From source file:com.moviejukebox.model.scriptablescraper.ParseSS.java

public void setInput(String input) {
    if (StringUtils.isNotBlank(input)) {
        this.input = input;
    }
}

From source file:cherry.foundation.download.Rfc5987Encoder.java

@Override
public String apply(String input) {

    byte[] b = input.getBytes(charset);
    StringBuilder builder = new StringBuilder(b.length * 3);

    builder.append(charset.name()).append("'");
    if (StringUtils.isNotBlank(languageTag)) {
        builder.append(languageTag);/*from w w  w. j  a  va  2  s  .c  om*/
    }
    builder.append("'");

    for (int i = 0; i < b.length; i++) {
        if (isAttrChar((char) b[i])) {
            builder.append((char) b[i]);
        } else {
            builder.append('%');
            int c = 0xff & b[i];
            if (c < 0x10) {
                builder.append('0');
            }
            builder.append(Integer.toHexString(c));
        }
    }
    return builder.toString();
}

From source file:ext.translate.Translate.java

/**
 * ??// w  w  w  .  j  a v a 2 s  . c om
 * 
 * @param q
 */
public Translate(String q) {
    super();
    this.q = q;
    if (StringUtils.isNotBlank(this.q)) {
        String[] qsArr = this.q.split("\\n");
        this.qs = Arrays.asList(qsArr);
    }
}

From source file:mobile.vo.user.TopUser.java

public static TopUser create(TopExpert expert) {
    TopUser topUser = new TopUser();
    topUser.setAvatar_190(expert.getHeadUrl());

    topUser.setAverageScore(expert.getAverageScore());
    topUser.setCommentNum(expert.getCommentNum());
    topUser.setCountry(expert.getCountry());
    topUser.setGender(expert.getGender());
    topUser.setJob(expert.getJob());//  ww  w .  j  av  a 2  s  .  c  o m
    topUser.setOnlineState(UserService.getOnlineState(expert.getUserId()));
    topUser.setPayType(
            expert.getPayType() == null ? PayType.NEGOTIABLE.ordinal() : expert.getPayType().ordinal());
    topUser.setPersonalInfo(expert.getPersonalInfo());
    if (StringUtils.isNotBlank(expert.getSkillsTags())) {
        topUser.setSkillsTags(expert.getSkillsTags());
    }
    topUser.setUserId(expert.getUserId());
    topUser.setUserName(expert.getUserName());
    topUser.setExpenses(expert.getExpenses());

    return topUser;
}

From source file:com.apus.hades.admin.cache.ConfigCache.java

public static void put(String key, String value) {
    if (StringUtils.isNotBlank(key)) {
        caches.put(key, value);
    }
}

From source file:at.tfr.securefs.key.UiShare.java

public boolean hasRealShare() {
    return StringUtils.isNotBlank(realShare);
}

From source file:com.netflix.genie.common.dto.JobStatus.java

/**
 * Parse job status./*  w w  w  . ja  va2 s.com*/
 *
 * @param value string to parse/convert
 * @return INIT, RUNNING, SUCCEEDED, KILLED, FAILED if match
 * @throws GeniePreconditionException if invalid value passed in
 */
public static JobStatus parse(final String value) throws GeniePreconditionException {
    if (StringUtils.isNotBlank(value)) {
        for (final JobStatus status : JobStatus.values()) {
            if (value.equalsIgnoreCase(status.toString())) {
                return status;
            }
        }
    }
    throw new GeniePreconditionException(
            "Unacceptable job status. Must be one of {Init, Running, Succeeded, Killed, Failed, Invalid}");
}

From source file:de.micromata.genome.gwiki.page.gspt.PageReplacer.java

public String replace(ReplacerContext ctx, Map<String, String> attr, boolean isClosed) {
    String contentType = attr.get("contentType");
    String imports = attr.get("import");
    StringBuilder sb = new StringBuilder();
    // TODO test//from w  ww.j  av  a  2s.  co m
    if (StringUtils.isNotBlank(contentType) == true && StringUtils.isBlank(imports) == true) {
        sb.append("<% pageContext.getResponse().setContentType(\"" + contentType + "\"); %>");
        // uebernommen
    }

    if (StringUtils.isNotBlank(imports) == true) {
        List<String> imps = Converter.parseStringTokens(imports, ", ", false);
        sb.append("<%# ");
        for (String im : imps) {
            sb.append("  import ").append(im).append(";\n");
        }
        sb.append("%>");
    }
    String isELIgnored = attr.get("isELIgnored");
    if (StringUtils.isNotBlank(isELIgnored) == true) {
        sb.append("<% pageContext.setEvaluateTagAttributes(").append(isELIgnored).append(" == false); %>");
    }
    String useParentTagContext = attr.get("useParentTagContext");
    if (StringUtils.isNotBlank(useParentTagContext) == true) {
        sb.append("<% pageContext.setUseParentTagContext(").append(useParentTagContext).append("); %>");
    }
    return sb.toString();
}