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:ips1ap101.web.commons.assistants.ext.AsistentePaginaActualizacionRastroProcesoX.java

/**
 * campoFuncion1Boton2.onClick/*from  w  w w.j  av  a  2 s . c o  m*/
 */
@Override
public String getScriptCampoIdFuncion1Boton2() {
    String script = null;
    RowKey rowKey = bean.getGestor().getCurrentRowKey();
    if (bean.getRastroProcesoDataProvider().isRowAvailable(rowKey)) {
        String pagina = bean.getRastroProcesoDataProvider().getPaginaFuncion(rowKey);
        String urx = BaseBundle.getPage(pagina);
        if (StringUtils.isNotBlank(urx)) {
            Long funcion = bean.getRastroProcesoDataProvider().getIdFuncion(rowKey);
            Long recurso = bean.getRastroProcesoDataProvider().getRecursoValor(rowKey);
            ListaParametros rpl = new ListaParametros();
            rpl.addParametro(CPP.ID_FUNCION_REFERENCIA, funcion);
            if (recurso != null) {
                rpl.addParametro(CPP.ID_RECURSO, recurso);
            }
            script = JSF.getOpenWindowJavaScript(urx, rpl.toString());
        } else {
            script = getScriptCampoRecursoValor1Boton2();
        }
    }
    return script != null ? script : super.getScriptCampoIdFuncion1Boton2();
}

From source file:io.renren.modules.sys.service.impl.SysDictServiceImpl.java

@Override
public PageUtils queryPage(Map<String, Object> params) {
    String name = (String) params.get("name");

    Page<SysDictEntity> page = this.selectPage(new Query<SysDictEntity>(params).getPage(),
            new EntityWrapper<SysDictEntity>().like(StringUtils.isNotBlank(name), "name", name));

    return new PageUtils(page);
}

From source file:com.streamreduce.rest.dto.response.OutboundConfigurationResponseDTO.java

public OutboundConfigurationResponseDTO(OutboundConfiguration outboundConfiguration) {
    super(outboundConfiguration);
    ConnectionCredentials creds = outboundConfiguration.getCredentials();
    if (creds != null && StringUtils.isNotBlank(creds.getIdentity())) {
        this.identity = creds.getIdentity();
    }/*from  ww  w . j  a va2  s .c  o m*/
}

From source file:com.qualogy.qafe.business.resource.rdb.query.enhancer.SQLQueryEnhancer.java

public Query enhance(Query query, DatabaseMetaData databaseMetaData) throws EnhancementFailedException {
    SQLQuery sqlQuery = (SQLQuery) query;

    ResultSet resultSet = null;/*  ww w.  j  a v a 2 s  .c  o m*/

    try {
        if (StringUtils.isBlank(sqlQuery.getSqlAsAttribute()) && StringUtils.isBlank(sqlQuery.getSqlAsText())
                && StringUtils.isNotBlank(sqlQuery.getTable())) {
            // The Oracle database stores its table names as Upper-Case,
            // if you pass a table name in lowercase characters, it will not work.
            // MySQL database does not care if table name is uppercase/lowercase.
            //
            // TODO:check if there is a way to catch table data
            // TODO: dialect needed for upper/lowercase
            String userName = databaseMetaData.getUserName();
            resultSet = databaseMetaData.getTables(null, null, sqlQuery.getTable().toUpperCase(), null);

            String tableSchema = null;

            // Knowing schema name is not necessary but we gain performance
            // by using it during retrieving meta data.
            while (resultSet.next() && (null != userName)) {
                // some vendors like MySQL do not provide schema name
                // that's why we have to check whether the schema name is "null"
                if ((null != resultSet.getString("TABLE_SCHEM"))
                        && resultSet.getString("TABLE_SCHEM").equals(userName)) {
                    tableSchema = userName;

                    break;
                }

                // TABLE_TYPE
            }

            try {
                sqlQuery.getMetaData().setSupportsGetGeneratedKeys(databaseMetaData.supportsGetGeneratedKeys());
            } catch (AbstractMethodError e) {
                LOG.log(Level.WARNING,
                        "On the database driver there is no support for Metadata reading (sqlquery: "
                                + sqlQuery.getId() + ")",
                        e);
            }

            // if you pass null values for the first two parameters, then
            // it might take too long to return the result.
            resultSet = databaseMetaData.getPrimaryKeys(null, tableSchema, sqlQuery.getTable().toUpperCase());

            while (resultSet.next()) {
                sqlQuery.getMetaData().addPrimaryKey(resultSet.getString("COLUMN_NAME"));
            }

            // if no primarykeys found on a table, an update statement cannot be generated
            // so the query will be marked as error containing.
            sqlQuery.validate();
        }
    } catch (SQLException e) {
        throw new EnhancementFailedException(e);
    } finally {
        if (resultSet != null) {
            try {
                resultSet.close();
            } catch (SQLException e) {
                throw new EnhancementFailedException(e);
            }
        }
    }

    return sqlQuery;
}

From source file:com.doculibre.constellio.wicket.panels.results.WebSearchResultPanel.java

public WebSearchResultPanel(String id, SolrDocument doc, final SearchResultsDataProvider dataProvider) {
    super(id, doc, dataProvider);

    String contentLength = (String) doc.getFieldValue("contentLength");
    String type = (String) doc.getFieldValue("subType");

    String contentLengthKBStr;/*  w  w w . jav  a2 s  .co m*/
    if (StringUtils.isNotBlank(contentLength)) {
        long contentLengthBytes;
        try {
            contentLengthBytes = Long.valueOf(contentLength);
        } catch (NumberFormatException e) {
            contentLengthBytes = -1;
        }
        double contentLengthKB = (double) contentLengthBytes / 1000;
        DecimalFormat contentLengthKBFormatter = new DecimalFormat();
        contentLengthKBFormatter.setMinimumFractionDigits(0);
        contentLengthKBFormatter.setMaximumFractionDigits(0);
        contentLengthKBStr = contentLengthKBFormatter.format(contentLengthKB);
        if ("0".equals(contentLengthKBStr)) {
            contentLengthKBStr = null;
        }
    } else {
        contentLengthKBStr = null;
    }

    add(new Label("contentLength", contentLengthKBStr + " KB").setVisible(contentLengthKBStr != null));
    add(new Label("type", type).setVisible(StringUtils.isNotBlank(type)));
}

From source file:com.pedra.storefront.forms.validation.PaymentDetailsValidator.java

@Override
public void validate(final Object object, final Errors errors) {
    final PaymentDetailsForm form = (PaymentDetailsForm) object;

    final Calendar start = parseDate(form.getStartMonth(), form.getStartYear());
    final Calendar expiration = parseDate(form.getExpiryMonth(), form.getExpiryYear());

    if (start != null && expiration != null && start.after(expiration)) {
        errors.rejectValue("startMonth", "payment.startDate.invalid");
    }//from  w  w w  . j a  v  a 2 s  .c o m

    final boolean editMode = StringUtils.isNotBlank(form.getPaymentId());
    if (editMode || Boolean.TRUE.equals(form.getNewBillingAddress())) {
        ValidationUtils.rejectIfEmptyOrWhitespace(errors, "billingAddress.titleCode", "address.title.invalid");
        ValidationUtils.rejectIfEmptyOrWhitespace(errors, "billingAddress.firstName",
                "address.firstName.invalid");
        ValidationUtils.rejectIfEmptyOrWhitespace(errors, "billingAddress.lastName",
                "address.lastName.invalid");
        ValidationUtils.rejectIfEmptyOrWhitespace(errors, "billingAddress.line1", "address.line1.invalid");
        ValidationUtils.rejectIfEmptyOrWhitespace(errors, "billingAddress.townCity",
                "address.townCity.invalid");
        ValidationUtils.rejectIfEmptyOrWhitespace(errors, "billingAddress.postcode",
                "address.postcode.invalid");
        ValidationUtils.rejectIfEmptyOrWhitespace(errors, "billingAddress.countryIso",
                "address.country.invalid");
        // ValidationUtils.rejectIfEmptyOrWhitespace(errors, "billingAddress.line2", "address.line2.invalid"); // for some addresses this field is required by cybersource
    }
}

From source file:ips1ap101.web.commons.assistants.ext.AsistentePaginaActualizacionRastroFuncionParX.java

/**
 * campoPaginaRecurso1Boton3.onClick//from   w  w  w .j  a v a 2  s  . c  om
 */
@Override
public String getScriptCampoPaginaRecurso1Boton3() {
    RowKey rowKey = bean.getGestor().getCurrentRowKey();
    if (bean.getRastroFuncionParDataProvider().isRowAvailable(rowKey)) {
        String pagina = bean.getRastroFuncionParDataProvider().getPaginaRecurso(rowKey);
        String urx = BaseBundle.getPage(pagina);
        if (StringUtils.isNotBlank(urx)) {
            String recurso = bean.getRastroFuncionParDataProvider().getValorParametro(rowKey);
            if (recurso != null && recurso.matches("^[0-9]*$")) {
                ListaParametros rpl = new ListaParametros();
                rpl.addParametro(CPP.ID_RECURSO, recurso);
                String script = JSF.getOpenWindowJavaScript(urx, rpl.toString());
                return script;
            }
        }
    }
    return null;
}

From source file:com.migo.oss.CloudStorageService.java

/**
 * // www  .ja  v a  2 s  .  c  o m
 * @param prefix ?
 * @return 
 */
public String getPath(String prefix) {
    //?uuid
    String uuid = UUID.randomUUID().toString().replaceAll("-", "");
    //
    String path = DateUtils.format(new Date(), "yyyyMMdd") + "/" + uuid;

    if (StringUtils.isNotBlank(prefix)) {
        path = prefix + "/" + path;
    }

    return path;
}

From source file:com.edmunds.autotest.ClassResolver.java

public ClassResolver(ClassLoader classLoader, String rootPackageName) {
    assert StringUtils.isNotBlank(rootPackageName) : "Root package is blank";

    this.classLoader = classLoader != null ? classLoader : getClass().getClassLoader();
    this.rootPackageName = rootPackageName.replace('.', '/');
    this.pathResolver = new PathMatchingResourcePatternResolver();

    assert packageExists(this.rootPackageName) : "Root Package does not exists: " + rootPackageName;
}

From source file:com.googlecode.jtiger.modules.ecside.view.html.ColumnBuilder.java

public void cellEdit() {
    String cellValue = column.getPropertyValueAsString();

    if (StringUtils.isNotBlank(cellValue)) {
        html.append(" cellValue=\"").append(cellValue.replaceAll("\"", "\\\"")).append("\" ");
    }/*from w  w  w  .  ja  v  a  2  s  .c  o  m*/

    //      
    html.attribute(column.getEditEvent(), ECSideConstants.UTIL_FUNCTION_NAME + ".editCell(this,'"
            + column.getModel().getTable().getTableId() + "')");

    //      if (StringUtils.isNotBlank(cellName)){
    //         html.append(" cellName=\"").append(cellName).append("\" ");
    //      }

}