Example usage for org.apache.commons.lang3 StringUtils isNotEmpty

List of usage examples for org.apache.commons.lang3 StringUtils isNotEmpty

Introduction

In this page you can find the example usage for org.apache.commons.lang3 StringUtils isNotEmpty.

Prototype

public static boolean isNotEmpty(final CharSequence cs) 

Source Link

Document

Checks if a CharSequence is not empty ("") and not null.

 StringUtils.isNotEmpty(null)      = false StringUtils.isNotEmpty("")        = false StringUtils.isNotEmpty(" ")       = true StringUtils.isNotEmpty("bob")     = true StringUtils.isNotEmpty("  bob  ") = true 

Usage

From source file:cherry.example.web.basic.ex10.BasicEx10ServiceImpl.java

@Transactional
@Override//from w  w  w  .  j  a va  2s  .com
public Long create(BasicEx10Form form) {
    SQLInsertClause insert = qf.insert(et1);
    if (StringUtils.isNotEmpty(form.getText10())) {
        insert.set(et1.text10, form.getText10());
    }
    if (StringUtils.isNotEmpty(form.getText100())) {
        insert.set(et1.text100, form.getText100());
    }
    insert.set(et1.int64, form.getInt64());
    insert.set(et1.decimal1, form.getDecimal1());
    insert.set(et1.decimal3, form.getDecimal3());
    insert.set(et1.dt, form.getDt());
    insert.set(et1.tm, form.getTm());
    insert.set(et1.dtm, form.getDtm());
    return insert.executeWithKey(et1.id);
}

From source file:cherry.example.web.basic.ex20.BasicEx20ServiceImpl.java

@Transactional
@Override//from  w  ww. j av a  2  s .  c o  m
public Long create(BasicEx20Form form) {
    SQLInsertClause insert = qf.insert(et1);
    if (StringUtils.isNotEmpty(form.getText10())) {
        insert.set(et1.text10, form.getText10());
    }
    if (StringUtils.isNotEmpty(form.getText100())) {
        insert.set(et1.text100, form.getText100());
    }
    insert.set(et1.int64, form.getInt64());
    insert.set(et1.decimal1, form.getDecimal1());
    insert.set(et1.decimal3, form.getDecimal3());
    insert.set(et1.dt, form.getDt());
    insert.set(et1.tm, form.getTm());
    insert.set(et1.dtm, form.getDtm());
    return insert.executeWithKey(et1.id);
}

From source file:com.netflix.spinnaker.halyard.deploy.spinnaker.v1.profile.SamlConfig.java

public SamlConfig(Security security) {
    if (!security.getAuthn().getSaml().isEnabled()) {
        return;//  w w w.  j  a  v a2  s .c o  m
    }

    Saml saml = security.getAuthn().getSaml();

    this.enabled = saml.isEnabled();
    this.issuerId = saml.getIssuerId();
    this.metadataUrl = "file:" + saml.getMetadataLocal();
    if (StringUtils.isNotEmpty(saml.getMetadataRemote())) {
        this.metadataUrl = saml.getMetadataRemote();
    }

    this.keyStore = "file:" + saml.getKeyStore();
    this.keyStoreAliasName = saml.getKeyStoreAliasName();
    this.keyStorePassword = saml.getKeyStorePassword();

    URL u = saml.getServiceAddress();
    this.redirectProtocol = u.getProtocol();
    this.redirectHostname = u.getHost();
    if (u.getPort() != -1) {
        this.redirectHostname += ":" + u.getPort();
    }
    if (StringUtils.isNotEmpty(u.getPath())) {
        this.redirectBasePath = u.getPath();
    }
}

From source file:com.thruzero.common.jsf.renderer.html5.helper.TzInputTypeResponseWriter.java

public TzInputTypeResponseWriter(ResponseWriter delegate, UIComponent component, Renderer renderer,
        String defaultType) {/*from   ww w  .  j a  va2s . c om*/
    super(delegate, renderer);

    type = (String) component.getAttributes().get("type");

    if (StringUtils.isEmpty(type) && StringUtils.isNotEmpty(defaultType)) {
        type = defaultType;
    }
}

From source file:com.thruzero.common.jsf.components.html5.TzInputTextarea.java

public int getMaxLength() {
    int result = -1;
    String attributeValue = (String) getAttributes().get("maxlength");

    if (StringUtils.isNotEmpty(attributeValue)) {
        result = Integer.parseInt(attributeValue);
    }/*from w w  w.j ava2s.  c o m*/

    return result;
}

From source file:com.netflix.hystrix.contrib.javanica.command.CommandSetterBuilder.java

public CommandSetterBuilder commandKey(String pCommandKey, String def) {
    this.commandKey = StringUtils.isNotEmpty(pCommandKey) ? pCommandKey : def;
    return this;
}

From source file:com.cognifide.qa.bb.mapper.field.PageObjectProviderHelper.java

private static By retrieveSelectorFromPageObject(Field field, boolean useGeneric) {
    String cssValue = useGeneric//from   w ww  .j  ava  2  s .  c o m
            ? PageObjectProviderHelper.getGenericType(field).getAnnotation(PageObject.class).css()
            : field.getType().getAnnotation(PageObject.class).css();
    if (StringUtils.isNotEmpty(cssValue)) {
        return By.cssSelector(cssValue);
    }
    String xpathValue = useGeneric
            ? PageObjectProviderHelper.getGenericType(field).getAnnotation(PageObject.class).xpath()
            : field.getType().getAnnotation(PageObject.class).xpath();
    if (StringUtils.isNotEmpty(xpathValue)) {
        return By.xpath(xpathValue);
    }
    throw new IllegalArgumentException(
            "PageObject has to have defined selector when used with FindPageObject annotation");
}

From source file:com.glaf.core.util.QueryUtils.java

public static SqlExecutor getMyBatisAndConditionSql(List<QueryCondition> conditions) {
    SqlExecutor se = new SqlExecutor();
    Map<String, Object> params = new LinkedHashMap<String, Object>();
    StringBuffer buffer = new StringBuffer(1000);
    if (conditions != null && !conditions.isEmpty()) {
        int index = 0;
        Iterator<QueryCondition> iter = conditions.iterator();
        while (iter.hasNext()) {
            index++;/*from  www.  j  av  a 2s  .co  m*/
            QueryCondition c = iter.next();
            buffer.append(FileUtils.newline);
            String column = c.getColumn();
            String filter = c.getFilter();
            String alias = c.getAlias();
            params.put("param_" + index, c.getValue());
            String operator = " = ";
            if (StringUtils.isNotEmpty(filter)) {
                if (SearchFilter.GREATER_THAN.equals(filter)) {
                    operator = SearchFilter.GREATER_THAN;
                } else if (SearchFilter.GREATER_THAN_OR_EQUAL.equals(filter)) {
                    operator = SearchFilter.GREATER_THAN_OR_EQUAL;
                } else if (SearchFilter.LESS_THAN.equals(filter)) {
                    operator = SearchFilter.LESS_THAN;
                } else if (SearchFilter.LESS_THAN_OR_EQUAL.equals(filter)) {
                    operator = SearchFilter.LESS_THAN_OR_EQUAL;
                } else if (SearchFilter.LIKE.equals(filter)) {
                    operator = SearchFilter.LIKE;
                } else if (SearchFilter.NOT_LIKE.equals(filter)) {
                    operator = SearchFilter.NOT_LIKE;
                } else if (SearchFilter.EQUALS.equals(filter)) {
                    operator = SearchFilter.EQUALS;
                } else if (SearchFilter.NOT_EQUALS.equals(filter)) {
                    operator = SearchFilter.NOT_EQUALS;
                } else {
                    operator = SearchFilter.EQUALS;
                }
            }
            if (StringUtils.isNotEmpty(alias)) {
                buffer.append(" and ").append(alias).append(".").append(column).append(" ").append(operator)
                        .append(" #{").append("param_" + index).append("} ");
            } else {
                buffer.append(" and ").append(column).append(" ").append(operator).append(" #{")
                        .append("param_" + index).append("} ");
            }
        }
    }

    se.setSql(buffer.toString());
    se.setParameter(params);

    return se;
}

From source file:com.vnet.demo.service.NoteService.java

public Note getNote(Long noteId) {
    Note note = noteDao.findById(noteId);
    if (StringUtils.isNotEmpty(note.getContext())) {
        note.setContext(getNoteContextFromStoragge(note.getContext()));
        note.getNotebook();//from  w ww . j  av  a  2s .c  om
    }
    note.getNotebook();
    return note;
}

From source file:com.newlandframework.rpc.parallel.NamedThreadFactory.java

public NamedThreadFactory(String prefix, boolean daemo) {
    this.prefix = StringUtils.isNotEmpty(prefix) ? prefix + "-thread-" : "";
    daemoThread = daemo;//from   w w  w  .  j  a  va 2  s  .c o m
    SecurityManager s = System.getSecurityManager();
    threadGroup = (s == null) ? Thread.currentThread().getThreadGroup() : s.getThreadGroup();
}