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:net.sourceforge.mavenhippo.gen.DefaultPackageGenerator.java

@Override
public String getFragment() {
    String result = "";
    String name = getPackageName();
    if (StringUtils.isNotBlank(name)) {
        result = "package " + name + ";";
    }//  ww  w  .  j a  v a2  s  .  com
    return result;
}

From source file:br.ufac.sion.inscricao.controller.RecuperaSenhaBean.java

public void inicializar() {
    if (FacesUtil.isNotPostback()) {
        if (StringUtils.isNotBlank(token)) {
            tokenRecuperacao = tokenRecuperacaoFacade.findByToken(token);
            if (tokenRecuperacao != null) {
                setExpirado(false);/*from   w ww  .j av a 2  s . com*/
            } else {
                setExpirado(true);
            }
        } else {
            setExpirado(true);
        }
    }
}

From source file:eu.jasha.demo.sbtfragments.CityDao.java

public void remove(String id) {
    if (StringUtils.isNotBlank(id)) {
        cities.removeIf(c -> c.getId().equals(id));
    }
}

From source file:ch.cyberduck.core.S3VersionIdProvider.java

@Override
public String getFileid(final Path file, final ListProgressListener listener) throws BackgroundException {
    if (StringUtils.isNotBlank(file.attributes().getVersionId())) {
        return file.attributes().getVersionId();
    }//from   w  w  w.j  a v a 2  s.  co m
    if (file.isRoot()) {
        return null;
    }
    return new S3AttributesFinderFeature(session).find(file).getVersionId();
}

From source file:com.ufukuzun.myth.dialect.util.ExpressionUtils.java

public static String[] splitRenderFragmentAndUpdates(String value) {
    String renderFragment = "";
    String updates = "";

    if (StringUtils.isNotBlank(value)) {
        Matcher matcher = RENDER_EXPRESSION_PATTERN.matcher(value);
        if (matcher.matches()) {
            renderFragment = matcher.group(1).trim();
            updates = matcher.group(2).trim();
        }/*  w  w w. j av  a 2  s . com*/
    }

    return new String[] { renderFragment, updates };
}

From source file:net.ceos.project.poi.annotated.core.CellFormulaConverter.java

/**
 * Calculate a dynamic formula based at the declared template.
 * // w  w w.  ja  v  a 2  s .  c o  m
 * @param configCriteria
 *            the {@link XConfigCriteria} object
 * @param position
 *            the {@link Cell} position to apply
 * @throws ConfigurationException
 */
protected static String calculateSimpleOrDynamicFormula(final XConfigCriteria configCriteria, int position)
        throws ElementException {

    String formula = null;
    if (StringUtils.isNotBlank(configCriteria.getElement().formula())) {

        validatePropagationWithFormula(configCriteria);

        if (PredicateFactory.isPropagationHorizontal.test(configCriteria.getPropagation())
                && configCriteria.getElement().formula().contains(Constants.DOLLAR)) {
            formula = configCriteria.getElement().formula().replace(Constants.DOLLAR, String.valueOf(position));

        } else if (PredicateFactory.isPropagationVertical.test(configCriteria.getPropagation())
                && configCriteria.getElement().formula().contains(Constants.DOLLAR)) {
            formula = configCriteria.getElement().formula().replace(Constants.DOLLAR,
                    String.valueOf(CellReference.convertNumToColString(position)));

        } else {
            formula = configCriteria.getElement().formula();
        }
    }
    return formula;
}

From source file:com.qq.tars.validate.ConfigFileNameValidator.java

@Override
public boolean isValid(String value, ConstraintValidatorContext context) {
    return StringUtils.isNotBlank(value) && StringUtils.isAlphanumeric(value)
            && CharUtils.isAsciiAlpha(value.charAt(0));
}

From source file:com.thinkbiganalytics.nifi.rest.support.NifiTemplateNameUtil.java

/**
 * Check to see if the incoming name includes a versioned timestamp
 *
 * @param name the process group name//  w  w w.  j a v a  2s.  co  m
 * @return {@code true} if the incoming name contains the version timestamp, {@code false} if the name is not versioned.
 */
public static boolean isVersionedProcessGroup(String name) {
    return StringUtils.isNotBlank(name) && name.matches(VERSION_NAME_REGEX);
}

From source file:com.green.modules.cms.service.CommentService.java

public Page<Comment> find(Page<Comment> page, Comment comment) {
    DetachedCriteria dc = commentDao.createDetachedCriteria();
    if (StringUtils.isNotBlank(comment.getContentId())) {
        dc.add(Restrictions.eq("contentId", comment.getContentId()));
    }//  www .j  av  a2 s .c  om
    if (StringUtils.isNotEmpty(comment.getTitle())) {
        dc.add(Restrictions.like("title", "%" + comment.getTitle() + "%"));
    }
    dc.add(Restrictions.eq(Comment.FIELD_DEL_FLAG, comment.getDelFlag()));
    dc.addOrder(Order.desc("id"));
    return commentDao.find(page, dc);
}

From source file:dao.SchemaHistoryDataRowMapper.java

@Override
public SchemaHistoryData mapRow(ResultSet rs, int rowNum) throws SQLException {
    String modified = rs.getString("modified_date");
    String schema = rs.getString("schema");
    int fieldCount = 0;
    if (StringUtils.isNotBlank(schema)) {
        try {/*from   w ww . j a va 2  s .co m*/
            JsonNode schemaNode = Json.parse(schema);
            fieldCount = utils.SchemaHistory.calculateFieldCount(schemaNode);
        } catch (Exception e) {
            Logger.error("SchemaHistoryDataRowMapper get field count parse schema failed");
            Logger.error("Exception = " + e.getMessage());
        }
    }
    SchemaHistoryData schemaHistoryData = new SchemaHistoryData();
    schemaHistoryData.modified = modified;
    schemaHistoryData.schema = schema;
    schemaHistoryData.fieldCount = fieldCount;
    return schemaHistoryData;
}