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

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

Introduction

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

Prototype

public static boolean isBlank(String str) 

Source Link

Document

Checks if a String is whitespace, empty ("") or null.

Usage

From source file:de.codesourcery.eve.skills.ui.components.AbstractEditorComponent.java

protected static boolean isBlank(JTextField textField) {
    return StringUtils.isBlank(textField.getText());
}

From source file:com.seajas.search.utilities.query.QueryParametersUtil.java

/**
 * Parse the given raw equivalent as a taxonomy ID list.
 * //from   w ww  . j a v a 2s  . c o m
 * Note that we assume that the rawEquivalent has been validated as being in the correct format.
 * 
 * @param rawEquivalent
 * @return List<Integer>
 */
public static List<Integer> parseTaxonomyIds(final String rawEquivalent) {
    List<Integer> result = new ArrayList<Integer>();

    String taxonomyIds = rawEquivalent.trim().replace("dcterms_coverage:", "");

    taxonomyIds = taxonomyIds.replace("(", "").replace(")", "");
    taxonomyIds = taxonomyIds.replace("'", "");
    taxonomyIds = taxonomyIds.replace(" ", ",");

    for (String taxonomyId : taxonomyIds.split(","))
        if (!StringUtils.isBlank(taxonomyId))
            try {
                result.add(Integer.valueOf(taxonomyId));
            } catch (NumberFormatException e) {
                logger.error("Could not parse taxonomy ID '" + taxonomyId + "' - skipping");
            }

    return result;
}

From source file:de.rinderle.softvis3d.dao.scm.ScmCommitCountCalculationService.java

/**
 * TODO: This is not the commit count but the line count!!!
 * FIX!/*from  www . j av a  2  s. c o m*/
 */
@Override
public int getNodeValue(final String scmCommitterString, final String scmTimeString) {
    if (StringUtils.isBlank(scmCommitterString)) {
        return 0;
    } else {
        final String[] resultCommitter = splitPlainScmInfo(scmCommitterString);
        return resultCommitter.length;
    }
}

From source file:com.evolveum.midpoint.prism.polystring.PrismDefaultPolyStringNormalizer.java

@Override
public String normalize(String orig) {
    if (orig == null) {
        return null;
    }//from w  w  w.j  a v  a 2 s .  c om
    String s = StringUtils.trim(orig);
    s = Normalizer.normalize(s, Normalizer.Form.NFKD);
    s = s.replaceAll("[^\\w\\s\\d]", "");
    s = s.replaceAll("\\s+", " ");
    if (StringUtils.isBlank(s)) {
        s = "";
    }
    return StringUtils.lowerCase(s);
}

From source file:edu.northwestern.bioinformatics.studycalendar.restlets.ValidatingForm.java

public ValidatingForm validatePresenceOf(FormParameters param) {
    String value = getFirstValue(param.attributeName());
    if (StringUtils.isBlank(value)) {
        addError("Missing required parameter %s", param.attributeName());
    }//from   w  ww  .  j av a  2  s .  c o m
    return this;
}

From source file:com.intuit.tank.vm.settings.CloudCredentials.java

/**
 * @return the keyId/*  w ww.  ja  va2 s.co  m*/
 */
public String getKeyId() {
    // first try userData
    String ret = AmazonUtil.getAWSKeyIdFromUserData();
    if (StringUtils.isBlank(ret)) {
        // try to get from property
        String key = config.getString("secret-key-id-property", "AWS_SECRET_KEY_ID");
        ret = System.getProperty(key);
        if (StringUtils.isBlank(ret)) {
            ret = System.getenv(key);
        }
        if (StringUtils.isBlank(ret)) {
            // finally get straight from config
            ret = config.getString("secret-key-id");
        }
    }

    return ret;
}

From source file:com.tesora.dve.common.PECryptoUtils.java

public static String encrypt(String str) throws PEException {
    if (StringUtils.isBlank(str))
        return str;

    try {// w  ww  . j  ava 2s .c om
        Cipher cipher = createCrypter(Cipher.ENCRYPT_MODE);

        byte[] enc = cipher.doFinal(str.getBytes("UTF8"));

        return new String(Base64.encodeBase64(enc));
    } catch (Exception e) {
        throw new PEException("Failed to encrypt '" + str + "'", e);
    }
}

From source file:com.ning.metrics.collector.events.parsing.EventExtractorUtilImpl.java

@Override
public Granularity granularityFromString(String granularityString) {
    if (StringUtils.isBlank(granularityString)) {
        return Granularity.HOURLY;
    }//from  w w w  .ja v a 2s  .com

    return Granularity.valueOf(granularityString.toUpperCase());
}

From source file:com.xidu.framework.common.util.CookieUtils.java

/**
 * set the name/value entry to the cookie
 * //from  www . j av  a 2s  .c o  m
 * @Date : 2011-3-23
 * @param req
 *            - HttpServletRequest's instance
 * @param res
 *            - HttpServletResponse's instance
 * @param domain
 *            - the domain of sites
 * @param name
 *            - cookie's entry name
 * @param value
 *            - cookie's entry value
 * @param expiry
 *            - cookie's expired time
 */
public static void setCookie(HttpServletRequest req, HttpServletResponse res, String domain, String name,
        String value, int expiry) {
    value = EnDecoderUtils.encode(value);
    if (StringUtils.isBlank(domain) || StringUtils.isBlank(name) || StringUtils.isBlank(value)) {
        return;
    }
    Cookie cookie = null;
    Cookie[] cookies = req.getCookies();
    boolean isNew = true;
    if (null != cookies) {
        for (int i = 0; i < cookies.length; i++) {
            cookie = cookies[i];
            if (name.equals(cookie.getName())) {
                isNew = false;
                setCookie(res, name, value, "/", domain, expiry);
            }
        }
    }
    if (isNew) {
        setCookie(res, name, value, "/", domain, expiry);
    }
}

From source file:com.activecq.api.plugins.form.SuccessPlugin.java

/**
 * Returns a URL (no scheme) to the success landing page (String path) with
 * success message/*from w  w  w  .j  a  v a 2  s  .  c om*/
 *
 * @param path
 * @param message
 * @return
 * @throws JSONException
 * @throws UnsupportedEncodingException
 */
public static String getRedirectPath(String path, String message) throws UnsupportedEncodingException {
    if (StringUtils.isBlank(message)) {
        return path;
    } else {
        message = StringEscapeUtils.escapeJavaScript(message);
        return path.concat("?").concat(ActiveForm.CQ_FORM_SUCCESS).concat("=").concat(message);
    }
}