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.tacitknowledge.util.migration.MigrationRunnerFactory.java

public static MigrationRunnerStrategy getMigrationRunnerStrategy(String strategy) {

    log.info("Strategy received '" + strategy + "'");

    if (StringUtils.isBlank(strategy)) {
        return new OrderedMigrationRunnerStrategy();

    }//from w w  w  .jav  a2  s  .  c o m

    try {
        Class c = Class.forName(strategy.trim());
        MigrationRunnerStrategy runnerStrategy = (MigrationRunnerStrategy) c.newInstance();
        return runnerStrategy;
    } catch (Exception e) {
        throw new IllegalArgumentException("Strategy selected " + strategy + " cannot be instantiated ", e);
    }

}

From source file:ch.entwine.weblounge.bridge.oaipmh.util.OsgiUtil.java

/**
 * Get a mandatory, non-blank value from a component context.
 * //from   ww  w . jav a  2 s  .  c  om
 * @throws RuntimeException
 *           key does not exist or its value is blank
 */
public static String getContextProperty(ComponentContext cc, String key) {
    String p = cc.getBundleContext().getProperty(key);
    if (StringUtils.isBlank(p))
        throw new RuntimeException("Please provide context property " + key);
    return p;
}

From source file:br.com.pontocontrol.controleponto.ControlePonto.java

public static void solicitarLogin() {
    String usuario;/*from   w w  w  .  j a  va2 s .c o  m*/
    do {
        usuario = JOptionPane.showInputDialog(null, "Informe seu usurio:", "Identificao",
                JOptionPane.INFORMATION_MESSAGE);
        if (StringUtils.isBlank(usuario)) {
            JOptionPane.showMessageDialog(null, "Informe um login de usurio.", "Validao falhou.",
                    JOptionPane.ERROR_MESSAGE);
        }
    } while (StringUtils.isBlank(usuario));
    switch (SessaoManager.getInstance().autenticar(usuario)) {
    case SessaoManager.LOGIN_STATUS.OK:

        break;
    case SessaoManager.LOGIN_STATUS.USUARIO_NAO_EXISTE:
        int opt = JOptionPane.showConfirmDialog(null,
                format("O usurio com o login informado \"%s\" no existe, deseja criar um novo usurio?",
                        usuario),
                "Usurio no encontrado.", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE);
        if (JOptionPane.YES_OPTION == opt) {
            ConfiguracoesUsuario configuracoesUsuario = new ConfiguracoesUsuario(usuario);
            SessaoManager.getInstance().criarUsuario(configuracoesUsuario);
            SessaoManager.getInstance().autenticar(usuario);
        }
        break;
    default:

        break;
    }
}

From source file:com.zxy.commons.codec.utils.MD5Utils.java

/**
 * 16?md5??8-24?//w  ww  . j  av  a2 s. c o  m
 * 
 * @param source source
 * @return 16?md5?
 */
public static String encode16(String source) {
    if (StringUtils.isBlank(source)) {
        return "";
    }
    return encode32(source).substring(8, 24);
}

From source file:biz.netcentric.cq.tools.actool.validators.Validators.java

public static boolean isValidAuthorizableId(final String name) {
    if (StringUtils.isBlank(name)) {
        return false;
    }//from   w w w .j a v  a2 s.co m
    boolean isValid = false;

    Matcher matcher = GROUP_ID_PATTERN.matcher(name);
    if (matcher.matches()) {
        isValid = true;
    }
    return isValid;
}

From source file:de.codesourcery.eve.skills.db.datamodel.AttributeType.java

public static AttributeType getByTypeId(String attributeName) {

    if (StringUtils.isBlank(attributeName)) {
        throw new IllegalArgumentException("attribute typeId cannot be blank / NULL");
    }/*from w w  w . j a v  a2 s .co m*/

    final AttributeType result = typeMap.get(attributeName.toLowerCase());
    if (result == null) {
        throw new IllegalArgumentException("Unknown attribute '" + attributeName + "'");
    }
    return result;
}

From source file:info.archinnov.achilles.internal.validation.Validator.java

public static void validateNotBlank(String arg, String message, Object... args) {
    if (StringUtils.isBlank(arg)) {
        throw new AchillesException(format(message, args));
    }/*from ww  w .j  a  va  2 s .com*/
}

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

public static boolean isEmpty(ForeignKey foreignKey) {
    if (foreignKey == null) {
        return true;
    }//  w  ww  .  j ava2 s  .c  om
    if (StringUtils.isBlank(foreignKey.getName()) && StringUtils.isBlank(foreignKey.getForeignKeyDefinition())
            && (foreignKey.getConstraintMode() == null
                    || foreignKey.getConstraintMode() == ConstraintMode.PROVIDER_DEFAULT)) {
        return true;
    }
    return false;
}

From source file:com.qp.basic.util.SysConstUtil.java

/**
 * ?????/*w w  w .  j  a  v  a 2 s  .  c  o m*/
* @Title: covertToRelativeUrl 
* @param realUrl
* @return
* @author ls
 */
public static String covertToRelativeUrl(String realUrl) {
    if (StringUtils.isBlank(realUrl)) {
        return "";
    }
    return realUrl.replace(HTTP_FILE_SYS_BASE_URL, "");
}

From source file:io.github.jeddict.jpa.spec.validator.table.JoinTableValidator.java

public static boolean isEmpty(JoinTable table) {
    JoinColumnValidator.filter(table.getJoinColumn());
    JoinColumnValidator.filter(table.getInverseJoinColumn());

    return StringUtils.isBlank(table.getName()) && StringUtils.isBlank(table.getSchema())
            && StringUtils.isBlank(table.getCatalog()) && table.getJoinColumn().isEmpty()
            && table.getInverseJoinColumn().isEmpty() && table.getIndex().isEmpty();
}