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:com.switchfly.inputvalidation.sanitizer.ParameterNameSanitizer.java

@Override
public String execute(String content) {
    if (StringUtils.isBlank(content)) {
        return content;
    }/*from www .ja  v a 2s  . co m*/
    return PATTERN.matcher(content).replaceAll("");
}

From source file:grails.web.CamelCaseUrlConverter.java

public String toUrlElement(String propertyOrClassName) {
    if (StringUtils.isBlank(propertyOrClassName)) {
        return propertyOrClassName;
    }/* ww  w.j a  v a 2  s.  c om*/
    if (propertyOrClassName.length() > 1 && Character.isUpperCase(propertyOrClassName.charAt(0))
            && Character.isUpperCase(propertyOrClassName.charAt(1))) {
        return propertyOrClassName;
    }

    return propertyOrClassName.substring(0, 1).toLowerCase(Locale.ENGLISH) + propertyOrClassName.substring(1);
}

From source file:ips1ap101.lib.core.jsf.component.BotonVerDetalle.java

private boolean isRenderedToo() {
    String script = this.getOnClick();
    if (StringUtils.isBlank(script)) {
        return false;
    }/*from   w  ww . j  av a2  s . c o m*/
    WebuiInput sibling = getSibling();
    if (sibling instanceof CampoTexto) {
        CampoTexto campo = (CampoTexto) sibling;
        ComponenteComplementario sidekick = campo.getSidekick();
        if (sidekick != null) {
            return sidekick.isRendered();
        }
    }
    return true;
}

From source file:edu.northwestern.bioinformatics.studycalendar.xml.writers.StudySegmentDeltaXmlValidationTest.java

public void testValidteElement() {
    amendment.getDeltas().clear();/*from  w  w w.  j ava2  s. c o m*/
    assertFalse(StringUtils.isBlank(studySegmentDeltaXmlSerializer.validate(amendment, eStudySegment)));
    assertEquals(String.format(
            "\n released amendment present in the system does have  any delta matching with provied grid id %s and node id  %s of delta.\n",
            studySegmentDelta.getGridId(), studySegment1.getGridId()),
            studySegmentDeltaXmlSerializer.validate(amendment, eStudySegment).toString());

    amendment.addDelta(studySegmentDelta);
    assertTrue(StringUtils.isBlank(studySegmentDeltaXmlSerializer.validate(amendment, eStudySegment)));

}

From source file:ips1ap101.lib.core.jsf.component.ColumnaTabla.java

/**
 * {@inheritDoc}//ww  w .ja  v  a  2  s  .com
 */
@Override
public String getHeaderText() {
    String superstr = super.getHeaderText();
    if (StringUtils.isBlank(superstr)) {
        return superstr;
    } else if (superstr.startsWith("BundleParametros.")) {
        int i = superstr.indexOf('.');
        String key = superstr.substring(i + 1).trim();
        if (key.length() > 0) {
            return BundleParametros.getShortLabel(key);
        }
    } else if (getValueExpression("headerText") != null) {
        return superstr;
    }
    String webuistr = JSF.getWebuiString(this, "text");
    //      if (webuistr == null) {
    //          String prefix = "tableColumn";
    //          String thisid = StringUtils.trimToEmpty(this.getId());
    //          String altkey = thisid.startsWith(prefix) ? thisid.substring(prefix.length()) : null;
    //          String styles = StringUtils.trimToEmpty(this.getStyleClass());
    //          webuistr = StringUtils.lowerCase(JSF.getWebuiString(superstr, altkey, styles));
    //      }
    return webuistr == null ? superstr : webuistr;
}

From source file:com.baidu.rigel.biplatform.parser.RegisterFunction.java

/** 
 * register//from ww w. j a  va2s .  c o m
 * @param functionName
 * @param funClass
 * @return
 * @throws ClassNotFoundException
 * @throws RegisterFunctionException
 */
public static boolean register(String functionName, String funClass)
        throws ClassNotFoundException, RegisterFunctionException {
    if (functionNames.containsKey(functionName)) {
        return false;
    }
    if (StringUtils.isBlank(funClass)) {
        throw new IllegalArgumentException("function class can not be empty by function name:" + functionName);
    }

    Class<?> clazz = Class.forName(funClass);

    return register(functionName, clazz);
}

From source file:com.egt.core.jsf.component.ColumnaTabla.java

/**
 * {@inheritDoc}/*from  www .  j  a va2s .  co  m*/
 */
@Override
public String getHeaderText() {
    String superstr = super.getHeaderText();
    if (StringUtils.isBlank(superstr)) {
        return superstr;
    } else if (getValueExpression("headerText") != null) {
        return superstr;
    }
    String supertip = super.getToolTip();
    if (supertip != null && getValueExpression("toolTip") == null && supertip.startsWith("BundleParametros.")) {
        int i = supertip.indexOf('.');
        String key = supertip.substring(i + 1);
        String str = BundleParametros.getString(key, BundleParametros.TOOLTIP, true);
        if (str != null) {
            return str;
        }
    }
    String webuistr = JSF.getWebuiString(this, "text");
    if (webuistr == null) {
        String prefix = "tableColumn";
        String thisid = StringUtils.trimToEmpty(this.getId());
        String altkey = thisid.startsWith(prefix) ? thisid.substring(prefix.length()) : null;
        String styles = StringUtils.trimToEmpty(this.getStyleClass());
        //          boolean b = super.getSort() == null;
        webuistr = StringUtils.lowerCase(JSF.getWebuiString(superstr, altkey, styles));
    }
    return webuistr == null ? superstr : webuistr;
}

From source file:com.drunkendev.confluence.plugins.attachments.PurgeAttachmentsSettingsService.java

public void setSettings(String spaceKey, PurgeAttachmentSettings settings) {
    if (StringUtils.isBlank(spaceKey)) {
        // Global settings.
        bandanaManager.setValue(new ConfluenceBandanaContext(), KEY, settings);
    } else {//from  w  w w  .  j av a2 s  . co m
        // Space settings.
        bandanaManager.setValue(new ConfluenceBandanaContext(spaceKey), KEY, settings);
    }
}

From source file:eionet.cr.web.util.FactsheetObjectId.java

/**
 *
 * @param s/*from w ww .j  a va 2  s  . co m*/
 * @return
 */
public static ObjectDTO parse(String s) {

    if (StringUtils.isBlank(s)) {
        throw new IllegalArgumentException("Supplied string must not be blank");
    }

    String[] parts = StringUtils.split(s, SEPARATOR);
    if (parts.length != 4) {
        throw new IllegalArgumentException("Supplied string has wrong format");
    }

    long[] hashes = new long[4];
    for (int i = 0; i < parts.length; i++) {
        try {
            hashes[i] = Long.parseLong(parts[i]);
        } catch (NumberFormatException e) {
            throw new IllegalArgumentException("Supplied string has wrong format");
        }
    }

    return ObjectDTO.create(hashes[0], hashes[1], hashes[2], hashes[3]);
}

From source file:com.switchfly.inputvalidation.sanitizer.StripHtmlSanitizer.java

@Override
public String execute(String content) {
    if (StringUtils.isBlank(content)) {
        return content;
    }// w ww.  j a  v  a 2 s .com
    Document document = Jsoup.parse(content);
    document.outputSettings().escapeMode(Entities.EscapeMode.xhtml);
    for (Element element : document.select("script,link,iframe,style")) {
        element.remove();
    }
    return document.text();
}