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.egt.core.jsf.component.HipervinculoVerDetalle.java

private boolean isRenderedToo() {
    Object object = this.getText();
    return object != null && StringUtils.isNotBlank(object.toString());
}

From source file:com.ultrapower.eoms.common.plugin.ecside.table.cell.DateCell.java

 @Override
protected String getCellValue(TableModel model, Column column) {
     String value = column.getPropertyValueAsString();
     if (StringUtils.isNotBlank(value)) {
         Locale locale = model.getLocale();
         value = ExtremeUtils.formatDate(column.getParse(), column.getFormat(), column.getPropertyValue(), locale);
     }//from  w w  w .  j a v a  2  s . c  om

     return value;
 }

From source file:com.ms.scombiz.solr.utils.BaseSolrQueryConvert.java

protected static SolrQuery setQuery(List<String> params, SearchQuery searchQuery) {
    SolrQuery solrQuery = new SolrQuery();
    String query = null;//from  w w w  . j a v a 2s.  c  o m
    if (params.isEmpty()) {
        query = ("*:*");
    } else {
        query = StringUtils.join(params, " AND ");
    }
    solrQuery.setQuery(query);
    solrQuery.setStart(searchQuery.getStart());
    solrQuery.setRows(searchQuery.getRows());
    if (StringUtils.isNotBlank(searchQuery.getSortFiled())) {
        solrQuery.addSort(searchQuery.getSortFiled(), searchQuery.getOrderBy());
    }
    return solrQuery;
}

From source file:com.mobileman.projecth.web.util.UserUtils.java

public static void changePassword(User user, HttpServletRequest request, Model model, UserService service,
        ConfigurationService configurationService) {

    try {//from   www .j a v  a2s.  c  o m
        //String oldPassword = request.getParameter("oldpassword");
        String password = request.getParameter("password");
        String password2 = request.getParameter("password2");
        if (StringUtils.isNotBlank(password)) {
            if (!password.equals(password2)) {
                model.addAttribute("passwordnotsame", true);
            } else {
                service.changePassword(user.getId(), password);
                model.addAttribute("passwordchanged", true);
            }
        }
    } catch (LoginException lex) {
        switch (lex.getReason()) {
        case PASSWORD_TOO_LONG:
            model.addAttribute("errorpassword_too_long", Boolean.TRUE);
            model.addAttribute("max_password_length", configurationService.getMaxPasswordLength());
            break;
        case PASSWORD_TOO_SHORT:
            model.addAttribute("errorpassword_too_short", Boolean.TRUE);
            model.addAttribute("min_password_length", configurationService.getMinPasswordLength());
            break;
        default:
            model.addAttribute("passworderror", true);
        }
    } catch (Exception ex) {
        model.addAttribute("passworderror", true);
    }
}

From source file:com.qpark.eip.core.AbstractMapper.java

public boolean hasValue(final Object o) {
    if (o instanceof String) {
        return StringUtils.isNotBlank((String) o);
    }/*from  w w w. j  ava  2  s  .com*/
    return o != null;
}

From source file:biblivre3.marcutils.Indexer.java

public static String listIsbn(Record record) {
    String retorno = "";

    DataField dataField = MarcUtils.getDataField(record, MarcConstants.ISBN);
    if (dataField != null) {
        Subfield subField = dataField.getSubfield('a');
        String isbn = subField != null ? subField.getData() : null;
        if (StringUtils.isNotBlank(isbn)) {
            if (Character.isDigit(isbn.charAt(0)) && (isbn.length() >= 10)) {
                retorno = isbn;/* w w w  . ja  v  a  2s . co m*/
            }
        }
    }

    return retorno;
}

From source file:com.ultrapower.eoms.common.plugin.ecside.table.cell.NumberCell.java

 @Override
protected String getCellValue(TableModel model, Column column) {
     String value = column.getPropertyValueAsString();
     if (StringUtils.isNotBlank(value)) {
         Locale locale = model.getLocale();
         value = ExtremeUtils.formatNumber(column.getFormat(), value, locale);
     }//  w  w  w.ja va 2  s  . c om

     return value;
 }

From source file:ar.com.zauber.commons.dao.resources.ClasspathResource.java

/** @param resourcePath full path to the resource */
public ClasspathResource(final String resourcePath) {
    Validate.isTrue(StringUtils.isNotBlank(resourcePath));

    this.resourcePath = resourcePath;
}

From source file:com.mirth.connect.server.builders.ErrorMessageBuilder.java

public String buildErrorMessage(String errorType, String customMessage, Throwable e) {
    String errorSourceLine = null;

    // if the exception occured during execution of the script, get the
    // line of code that caused the error
    if (e instanceof RhinoException) {
        errorSourceLine = ((RhinoException) e).lineSource();
    }/*from w ww .  j a  v  a 2 s  . c  om*/

    // construct the error message
    StringBuilder builder = new StringBuilder();
    String stackTrace = new String();

    if (e != null) {
        stackTrace = ExceptionUtils.getStackTrace(e);
    }

    builder.append(errorType + LINE_SEPARATOR);

    if (StringUtils.isNotBlank(errorSourceLine)) {
        builder.append("ERROR SOURCE:\t");
        builder.append(errorSourceLine + LINE_SEPARATOR);
    }

    if (StringUtils.isNotBlank(customMessage)) {
        builder.append("ERROR MESSAGE:\t");
        builder.append(customMessage + LINE_SEPARATOR);
        builder.append(stackTrace + LINE_SEPARATOR);
    } else {
        builder.append(stackTrace + LINE_SEPARATOR);
    }

    return builder.toString();
}

From source file:io.kahu.hawaii.domain.validation.OptionalPropertyValidator.java

@Override
public boolean isValid(ValueHolder value, ConstraintValidatorContext context) {
    if (value != null && StringUtils.isNotBlank(key) && !value.isEmpty()) {
        if (value instanceof ValidatableDomainProperty) {
            if (!((ValidatableDomainProperty) value).validate()) {
                context.disableDefaultConstraintViolation();
                context.buildConstraintViolationWithTemplate("INVALID").addConstraintViolation();
                return false;
            }/* w  w w.  ja va 2 s . com*/
        }
    }
    return true;
}