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:dao.DatasetColumnCommentRowMapper.java

@Override
public DatasetColumnComment mapRow(ResultSet rs, int rowNum) throws SQLException {
    Long id = rs.getLong(ID_COLUMN);
    String author = rs.getString(AUTHOR_COLUMN);
    String text = rs.getString(TEXT_COLUMN);
    String created = rs.getString(CREATED_TIME_COLUMN);
    String modified = rs.getString(MODIFIED_TIME_COLUMN);
    Long columnId = rs.getLong(FIELD_ID_COLUMN);
    String strIsDefault = rs.getString(IS_DEFAULT_COLUMN);
    boolean isDefault = false;
    if (StringUtils.isNotBlank(strIsDefault) && strIsDefault == "Y") {
        isDefault = true;//from   w ww.  ja  v a  2  s.com
    }
    DatasetColumnComment datasetColumnComment = new DatasetColumnComment();

    datasetColumnComment.id = id;
    datasetColumnComment.author = author;
    datasetColumnComment.text = text;
    datasetColumnComment.created = created;
    datasetColumnComment.modified = modified;
    datasetColumnComment.columnId = columnId;
    datasetColumnComment.isDefault = isDefault;

    return datasetColumnComment;
}

From source file:ch.cyberduck.core.s3.S3PresignedUrlProvider.java

/**
 * Generates a signed URL string that will grant access to an S3 resource (bucket or object)
 * to whoever uses the URL up until the time specified.
 *
 * @param host   Hostname/*from  ww  w.ja  va  2s.  c o m*/
 * @param bucket the name of the bucket to include in the URL, must be a valid bucket name.
 * @param key    the name of the object to include in the URL, if null only the bucket name is used.
 * @param expiry Milliseconds
 * @return a URL signed in such a way as to grant access to an S3 resource to whoever uses it.
 */
public String create(final Host host, final String user, final String secret, final String bucket,
        final String region, final String key, final long expiry) {
    final String requestSignatureVersion;
    if (StringUtils.isNotBlank(region)) {
        requestSignatureVersion = S3Protocol.AuthenticationHeaderSignatureVersion.AWS4HMACSHA256.toString();
    } else {
        requestSignatureVersion = S3Protocol.AuthenticationHeaderSignatureVersion.AWS2.toString();
    }
    return new RestS3Service(new AWSCredentials(StringUtils.strip(user), StringUtils.strip(secret))) {
        @Override
        public String getEndpoint() {
            return host.getHostname();
        }
    }.createSignedUrlUsingSignatureVersion(requestSignatureVersion, region, "GET", bucket, key, null, null,
            expiry / 1000, false, true, false);
}

From source file:br.com.sementesdoamanha.repository.Servidores.java

public List<Servidor> filtrados(ServidorFilter filtro) {
    //select, from, where, like... --> select(), from(), where()
    //JPQL: from Servidor

    //JPQL: select s from Servidor s where c.nome like = 'Joo%' and c.cpf = like '046.244.901-77'
    CriteriaBuilder builder = manager.getCriteriaBuilder();
    CriteriaQuery<Servidor> criteriaQuery = builder.createQuery(Servidor.class);
    Root<Servidor> s = criteriaQuery.from(Servidor.class);
    criteriaQuery.select(s);/*ww w. j a  v a2  s  . c  o  m*/

    List<Predicate> predicates = new ArrayList<>();

    if (StringUtils.isNotBlank(filtro.getCpf())) {
        predicates.add(builder.equal(s.<String>get("cpf"), filtro.getCpf()));
    }
    if (StringUtils.isNotBlank(filtro.getNome())) {
        predicates
                .add(builder.like(builder.upper(s.<String>get("nome")), filtro.getNome().toUpperCase() + "%"));

    }

    criteriaQuery.where(predicates.toArray(new Predicate[0]));
    TypedQuery<Servidor> query = manager.createQuery(criteriaQuery);
    return query.getResultList();

}

From source file:com.haoocai.jscheduler.core.app.AppServiceImpl.java

@Override
public void create(String namespace, String app) throws NamespaceNotExistException, AppExistException {
    Preconditions.checkArgument(StringUtils.isNotBlank(namespace) && StringUtils.isNotBlank(app));

    if (!zkAccessor.checkNodeExist("/" + namespace)) {
        throw new NamespaceNotExistException();
    }//w  w w . jav a2s  .  c  om

    if (zkAccessor.checkNodeExist("/" + namespace + "/" + app)) {
        throw new AppExistException();
    }

    zkAccessor.create("/" + namespace + "/" + app, new byte[0]);
}

From source file:com.cognifide.qa.bb.aem.dialog.classic.field.AemRadioOption.java

/**
 * Support for both widgets (xtype=radiogroup) and (xtype=selection, type=radio). Depends on which widget
 * is used the first or second label is filled.
 *
 * @return label of element or "" in case of no label
 *//*from   www. j av  a2  s . c o m*/
public String getLabel() {
    for (WebElement element : labels) {
        String label = getUnescapedText(element.getText());
        if (StringUtils.isNotBlank(label)) {
            return label;
        }
    }
    return "";
}

From source file:com.yevster.spdxtra.Validate.java

public static void baseUrl(String baseUrl) {
    boolean valid = (StringUtils.isNotBlank(baseUrl) && !StringUtils.containsAny(baseUrl, '#'));
    if (!valid)//from   w  ww .  j av a  2 s.  c o  m
        throw exceptionFactory.apply("Illegal namespace URL :" + baseUrl);
}

From source file:gov.nih.nci.caintegrator.web.action.study.management.ViewStudyLogAction.java

/**
 * {@inheritDoc}/*from  w w  w  . j av a  2s  . c o  m*/
 */
@Override
public void prepare() {
    super.prepare();
    displayableLogEntries.clear();
    if (getStudy() != null) {
        for (LogEntry logEntry : getStudy().getStudyConfiguration().getLogEntries()) {
            if (StringUtils.isNotBlank(logEntry.getDescription())) {
                displayableLogEntries
                        .add(new DisplayableLogEntry(getWorkspaceService().getRefreshedEntity(logEntry)));
            }
        }
    }
    Collections.sort(displayableLogEntries);
}

From source file:de.micromata.genome.logging.ValMessageLogAttribute.java

protected String renderMessages() {
    StringBuilder sb = new StringBuilder();
    boolean first = true;
    for (ValMessage vm : messages) {
        if (first == true) {
            first = false;/*from  www  .  ja  v  a  2 s . c  om*/
        } else {
            sb.append("\n");
        }
        sb.append(vm.getValState().name()).append(": ");
        if (vm.getReference() != null) {
            sb.append(vm.getReference().getClass().getName());
        }
        if (vm.getReference() != null && StringUtils.isNotBlank(vm.getProperty()) == true) {
            sb.append(".");
        }
        if (StringUtils.isNotBlank(vm.getProperty()) == true) {
            sb.append(vm.getProperty());
        }
        sb.append(": ");
        if (StringUtils.isNotBlank(vm.getI18nkey()) == true) {
            sb.append(vm.getI18nkey());
        }
        if (StringUtils.isNotBlank(vm.getMessage()) == true) {
            sb.append("; ").append(vm.getMessage());
        }
    }
    return sb.toString();
}

From source file:gov.gtas.parsers.pnrgov.segment.LTS.java

public LTS(List<Composite> composites) {
    super(LTS.class.getSimpleName(), composites);
    Composite c = getComposite(0);
    if (c != null) {
        this.theText = c.getElement(0);
        if (StringUtils.isNotBlank(theText)) {
            if (theText.contains(CTCT)) {
                isAgency = true;//from  w  w w .  ja va2 s. c  om
            } else if (theText.contains(CTCE) || theText.contains(APE)) {
                isEmail = true;
            } else if (theText.contains(APM)) {
                isPhone = true;
            } else if (theText.contains(FQTV)) {
                isFrequentFlyer = true;
            } else if (theText.contains(SEAT)) {
                isSeat = true;
            } else if (theText.contains(FP)) {
                isFormPayment = true;
                for (int i = 1; i < getComposites().size(); i++) {
                    c = getComposite(i);
                    if (c != null) {
                        if (theText.contains("CASH")) {
                            isCashPayment = true;
                            theText = c.getElement(0);
                        }
                    }
                }
            }
        }
    }
}

From source file:com.beginner.core.utils.Tools.java

/**
 * ??(null,"","null")/*  www  .  j  av  a  2s  .c  om*/
 * @param str       ??
 * @return boolean    true?false
 * @since          1.0.0
 */
public static boolean isNotEmpty(String str) {
    return StringUtils.isNotBlank(str) && !"null".equalsIgnoreCase(str);
}