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:com.googlecode.markuputils.CssStyleUtils.java

public static String appendStyle(String style) {

    StringBuilder buffer = new StringBuilder();

    if (StringUtils.isNotBlank(style)) {
        buffer.append(style);//from   w  w w. j a  v  a2 s.c om
    }

    return buffer.toString();
}

From source file:com.bsb.intellij.plugins.xmlbeans.utils.ValidationUtils.java

public static boolean isPathExists(String relativePath, Module module) {
    String moduleDir = PathMacroUtil.getModuleDir(module.getModuleFilePath());
    return StringUtils.isNotBlank(relativePath) && new File(moduleDir, relativePath).exists();
}

From source file:com.redhat.victims.util.VictimsConfig.java

/**
 * Set configuration options for victims-lib
 *
 * @link https://github.com/victims/victims-lib-java#configuration-options
 */// www . j av  a2  s  .  co  m
public static void configureVictimsOptions() {

    Map<String, String> config = VictimsConfig.getProperties();

    for (String key : config.keySet()) {
        //only set from properties if no JVM option
        if (StringUtils.isBlank(System.getProperty(key)) && StringUtils.isNotBlank(config.get(key))) {
            System.setProperty(key, config.get(key));
        }
    }

}

From source file:com.ultrapower.eoms.common.plugin.ecside.filter.ExportFilterUtils.java

public static String getExportFileName(WebContext context) {
    String tableId = getTableId(context);

    if (StringUtils.isNotBlank(tableId)) {
        String exportFileNameStr = tableId + "_" + TableConstants.EXPORT_FILE_NAME;
        String exportFileName = context.getParameter(exportFileNameStr);

        if (logger.isDebugEnabled()) {
            logger.debug("eXtremeTable export file name [" + exportFileNameStr + "] is [" + exportFileName + "]");
        }/* ww w . ja v  a 2s . co  m*/

        return exportFileName;
    }

    return null;
}

From source file:ips1ap101.lib.core.CoreBundle.java

private static String getString(String key, TrimmedTo trimmedTo) {
    String string = key;//from  www.java2 s  . co  m
    if (StringUtils.isNotBlank(key)) {
        try {
            string = resourceBundle.getString(key);
        } catch (MissingResourceException e) {
            string = null;
        }
    }
    if (StringUtils.isNotBlank(string)) {
        return string.trim();
    }
    switch (trimmedTo) {
    case EMPTY:
        return StringUtils.EMPTY;
    case NULL:
        return null;
    default:
        return key;
    }
}

From source file:hudson.plugins.blazemeter.ProxyConfigurator.java

public static void updateProxySettings(ProxyConfiguration proxyConfiguration, boolean isSlave)
        throws Exception {
    if (isSlave && "true".equals(System.getProperty(PROXY_OVERRIDE))) {
        LOGGER.info("Override proxy setting for slave");
        LOGGER.info("Use proxy host: " + System.getProperty(PROXY_HOST));
        LOGGER.info("Use proxy port: " + System.getProperty(PROXY_PORT));
        return;//from  w ww . j  a va2s .  c om
    }

    if (proxyConfiguration != null) {
        if (StringUtils.isNotBlank(proxyConfiguration.name)) {
            LOGGER.info("Use proxy host: " + proxyConfiguration.name);
            System.setProperty(PROXY_HOST, proxyConfiguration.name);
        }

        if (StringUtils.isNotBlank(String.valueOf(proxyConfiguration.port))) {
            LOGGER.info("Use proxy port: " + proxyConfiguration.port);
            System.setProperty(PROXY_PORT, String.valueOf(proxyConfiguration.port));
        }

        if (StringUtils.isNotBlank(proxyConfiguration.getUserName())) {
            System.setProperty(PROXY_USER, proxyConfiguration.getUserName());
        }

        if (StringUtils.isNotBlank(proxyConfiguration.getPassword())) {
            System.setProperty(PROXY_PASS, proxyConfiguration.getPassword());
        }
    } else {
        LOGGER.info("Clear proxy configs");
        System.clearProperty(PROXY_HOST);
        System.clearProperty(PROXY_PORT);
        System.clearProperty(PROXY_USER);
        System.clearProperty(PROXY_PASS);
    }
}

From source file:com.mmj.app.web.webuser.MMJWebUserBuilder.java

/**
 * webUser/* w w w.j  a va 2s.co m*/
 * 
 * @param cookieManager
 * @return
 */
public static MMJWebUser create(CookieManager cookieManager) {
    MMJWebUser webUser = new MMJWebUser();

    String name = cookieManager.get(CookieKeyEnum.member_name);
    String nick = cookieManager.get(CookieKeyEnum.member_nickname);
    Long uId = NumberUtils.toLong(cookieManager.get(CookieKeyEnum.member_id));
    Integer type = NumberUtils.toInt(cookieManager.get(CookieKeyEnum.member_type));
    Date lastLogin = new Date(NumberUtils.toLong(cookieManager.get(CookieKeyEnum.last_login_time)));

    webUser.setuId(uId);
    webUser.setType(UserTypeEnum.getEnum(type));
    webUser.setName(name);
    webUser.setNick(nick);
    webUser.setLastLogin(lastLogin);

    boolean hasLogin = (StringUtils.isNotBlank(nick) || StringUtils.isNotBlank(name)) && uId != null
            && uId != 0l && type != null && type != 0;
    webUser.setHasLogin(hasLogin);

    String cookieId = CookieIdBuilder.getCookieId(cookieManager);
    if (cookieId == null) {
        webUser.setFirstAccess(true);
        cookieId = CookieIdBuilder.createCookieId(cookieManager);
    } else {
        webUser.setFirstAccess(false);
    }
    webUser.setCookieId(cookieId);

    MMJWebUser.setCurrentUser(webUser);
    return MMJWebUser.getCurrentUser();
}

From source file:com.googlecode.jtiger.modules.ecside.core.bean.Td.java

public static String buildTd(Td tdBean, TableModel model) {
    HtmlBuilder html = new HtmlBuilder();
    if (tdBean.getType() != null && tdBean.getType().equalsIgnoreCase("blank")) {
        return html.toString();
    }//w ww . ja  va 2  s .  com
    html.td(1);
    html.id(tdBean.getId());
    html.name(tdBean.getName());
    if (tdBean.getColspan() > 1) {
        html.colSpan("" + tdBean.getColspan());
    }
    if (tdBean.getRowspan() > 1) {
        html.rowSpan("" + tdBean.getRowspan());
    }
    if (StringUtils.isNotBlank(tdBean.getNowrap())) {
        html.append(" nowrap=\"" + tdBean.getNowrap() + "\" ");
    }
    html.style(tdBean.getStyle());
    html.styleClass(tdBean.getStyleClass());
    html.width(tdBean.getWidth());
    html.height(tdBean.getHeight());
    html.align(tdBean.getAlign());
    html.valign(tdBean.getValign());
    html.onclick(tdBean.getOnclick());
    html.ondblclick(tdBean.getOndblclick());
    html.onmouseover(tdBean.getOnmouseover());
    html.onmouseout(tdBean.getOnmouseout());
    html.tagAttributes(tdBean.getTagAttributes());
    html.close();
    html.append(tdBean.getContent());
    html.tdEnd();
    return html.toString();
}

From source file:io.github.jeddict.jpa.spec.validator.column.PrimaryKeyJoinColumnValidator.java

public static boolean isEmpty(PrimaryKeyJoinColumn column) {
    boolean empty = false;
    if (StringUtils.isBlank(column.getName()) && StringUtils.isBlank(column.getReferencedColumnName())
            && StringUtils.isBlank(column.getColumnDefinition())
            && ForeignKeyValidator.isEmpty(column.getForeignKey())) {
        empty = true;/*from w  ww.j  a v  a  2s  .  c om*/
    }
    if (!empty && StringUtils.isBlank(column.getName()) && StringUtils.isNotBlank(column.getImplicitName())) {
        column.setName(column.getImplicitName());
        column.setImplicitName(null);
    }
    if (!empty && StringUtils.isBlank(column.getName())) {
        empty = true;
    }
    return empty;
}

From source file:io.sidecar.ModelUtils.java

public static boolean isValidDeviceId(String deviceId) {
    return StringUtils.isNotBlank(deviceId) && deviceId.length() >= 8 && deviceId.length() <= 40
            && ASCII_NO_WHITESPACE_OR_NON_PRINTING.matchesAllOf(deviceId);
}