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

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

Introduction

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

Prototype

public static boolean isNoneEmpty(final CharSequence... css) 

Source Link

Document

Checks if none of the CharSequences are empty ("") or null.

 StringUtils.isNoneEmpty(null)             = false StringUtils.isNoneEmpty(null, "foo")      = false StringUtils.isNoneEmpty("", "bar")        = false StringUtils.isNoneEmpty("bob", "")        = false StringUtils.isNoneEmpty("  bob  ", null)  = false StringUtils.isNoneEmpty(" ", "bar")       = true StringUtils.isNoneEmpty("foo", "bar")     = true 

Usage

From source file:com.uimirror.core.framework.rest.auth.BearerTokenExtractor.java

/**
 * Extract the OAuth bearer token from a header.
 * @param header header from where token will be extracted
 * @return extracted token else <code>null</code>
 *///from   ww w. ja v  a2s .  c om
protected static String extractHeaderToken(String header) {
    if (StringUtils.isNoneEmpty(header)) {
        String authHeaderValue = header.substring(BEARER.length()).trim();
        int commaIndex = authHeaderValue.indexOf(',');
        if (commaIndex > 0) {
            authHeaderValue = authHeaderValue.substring(0, commaIndex);
        }
        return authHeaderValue;
    }
    return null;
}

From source file:io.cloudslang.content.database.services.databases.SybaseDatabase.java

@Override
public List<String> setUp(@NotNull final SQLInputs sqlInputs) {
    loadClassForName("net.sourceforge.jtds.jdbc.Driver");

    final String host = SQLUtils.getIPv4OrIPv6WithSquareBracketsHost(sqlInputs.getDbServer());
    final StringBuilder connectionSb = new StringBuilder(
            String.format("jdbc:jtds:sybase://%s:%d", host, sqlInputs.getDbPort()));
    if (StringUtils.isNoneEmpty(sqlInputs.getDbName())) {
        connectionSb.append(FORWARD_SLASH).append(sqlInputs.getDbName());
    }/*from w  w  w . j a v  a  2s  .c o m*/
    connectionSb.append(";prepareSQL=1;useLOBs=false;TDS=4.2;");

    final List<String> dbUrls = getDbUrls(sqlInputs.getDbUrl());
    dbUrls.add(connectionSb.toString());

    return dbUrls;

}

From source file:io.cloudslang.content.database.services.databases.DB2Database.java

@Override
public List<String> setUp(@NotNull final SQLInputs sqlInputs) {
    loadClassForName("com.ibm.db2.jcc.DB2Driver");

    final String host = SQLUtils.getIPv4OrIPv6WithSquareBracketsHost(sqlInputs.getDbServer());
    final StringBuilder connectionSb = new StringBuilder("jdbc:db2://").append(host).append(COLON)
            .append(sqlInputs.getDbPort());
    if (StringUtils.isNoneEmpty(sqlInputs.getDbName())) {
        connectionSb.append(FORWARD_SLASH).append(sqlInputs.getDbName());
    }//from   w ww  .ja  v a2  s  .c om

    final List<String> dbUrls = getDbUrls(sqlInputs.getDbUrl());
    dbUrls.add(connectionSb.toString());

    return dbUrls;

}

From source file:io.cloudslang.content.database.services.databases.NetcoolDatabase.java

@Override
public List<String> setUp(@NotNull final SQLInputs sqlInputs) {
    //Attempt to load jconn3 driver first, then jconn2 driver
    try {//from w w  w  .  j a v  a2s  .  c  om
        Class.forName("com.sybase.jdbc3.jdbc.SybDriver");
    } catch (Exception e) {
        try {
            Class.forName("com.sybase.jdbc2.jdbc.SybDriver");
        } catch (ClassNotFoundException ex) {
            throw new RuntimeException(
                    "Could not locate either jconn2.jar or jconn3.jar file in the classpath!");
        }
    }
    final StringBuilder connectionSb = new StringBuilder(
            String.format("jdbc:sybase:Tds:%s:%d", sqlInputs.getDbServer(), sqlInputs.getDbPort()));
    if (StringUtils.isNoneEmpty(sqlInputs.getDbName())) {
        connectionSb.append(FORWARD_SLASH).append(sqlInputs.getDbName());
    }
    final List<String> dbUrls = getDbUrls(sqlInputs.getDbUrl());
    dbUrls.add(connectionSb.toString());

    return dbUrls;
}

From source file:io.github.hebra.elasticsearch.beat.meterbeat.service.ElasticSearchOutputService.java

@Override
public boolean isConfigured() {
    return jestClient != null && StringUtils.isNoneEmpty(index);
}

From source file:io.cloudslang.content.database.services.databases.PostgreSqlDatabase.java

private String getConnectionString(final SQLInputs sqlInputs) {
    final Address address = new Address(sqlInputs.getDbServer());
    final StringBuilder connectionSb = new StringBuilder("jdbc:postgresql://");
    if (address.isIPV6Literal()) {//the host is an IPv6 literal
        connectionSb.append(String.format("[host=%s]:%d", sqlInputs.getDbServer(), sqlInputs.getDbPort()));
    } else {/*from w  w  w  . j a v  a  2s.co m*/
        connectionSb.append(String.format("%s:%d", sqlInputs.getDbServer(), sqlInputs.getDbPort()));
    }
    if (StringUtils.isNoneEmpty(sqlInputs.getDbName())) {
        connectionSb.append(FORWARD_SLASH).append(sqlInputs.getDbName());
    }
    //the host is an IPv4 literal or a Host Name
    return connectionSb.toString();
}

From source file:com.axibase.tsd.driver.jdbc.content.ContentMetadata.java

public ContentMetadata(String scheme, String sql, String connectionId, int statementId)
        throws AtsdException, IOException {
    metadataList = StringUtils.isNoneEmpty(scheme) ? buildMetadataList(scheme)
            : Collections.<ColumnMetaData>emptyList();
    sign = new Signature(metadataList, sql, Collections.<AvaticaParameter>emptyList(), null, CursorFactory.LIST,
            StatementType.SELECT);/*from  www.  j av  a  2 s  .  co  m*/
    list = Collections.unmodifiableList(
            Collections.singletonList(MetaResultSet.create(connectionId, statementId, false, sign, null)));
}

From source file:io.cloudslang.content.database.services.databases.MySqlDatabase.java

private String getConnectionString(final SQLInputs sqlInputs) {
    final Address address = new Address(sqlInputs.getDbServer());
    final StringBuilder connectionSb = new StringBuilder("jdbc:mysql://");
    if (address.isIPV6Literal()) {//the host is an IPv6 literal
        connectionSb.append(String.format("address=(protocol=tcp)(host=%s)(port=%d)", sqlInputs.getDbServer(),
                sqlInputs.getDbPort()));
    } else { //the host is an IPv4 literal or a Host Name
        connectionSb.append(String.format("%s:%d", sqlInputs.getDbServer(), sqlInputs.getDbPort()));
    }/*from  w ww  .  j av a2s.  c o  m*/
    if (StringUtils.isNoneEmpty(sqlInputs.getDbName())) {
        connectionSb.append(FORWARD_SLASH).append(sqlInputs.getDbName());
    }
    return connectionSb.toString();
}

From source file:io.github.hebra.elasticsearch.beat.meterbeat.output.JestClientBean.java

@Bean
public JestClient jestClient() {
    final JestClientFactory factory = new JestClientFactory();

    final HttpClientConfig.Builder configBuilder = new HttpClientConfig.Builder(hosts)
            .connTimeout(timeout * 1000).readTimeout(timeout * 1000);

    if (StringUtils.isNoneEmpty(username)) {
        configBuilder.defaultCredentials(username, password);
    }//w  ww. j  a va2 s.com

    factory.setHttpClientConfig(configBuilder.multiThreaded(true).build());

    return factory.getObject();
}

From source file:com.smapley.vehicle.activity.SetActivity.java

private void getData() {
    RequestParams params = new RequestParams(Constant.URL_GETSHEZHI);
    params.addBodyParameter("ukey", (String) SP.getUser(Constant.SP_UKEY));
    x.http().post(params, new BaseCallback<Set>() {
        @Override/*w ww.j a va2s.com*/
        public void success(Set result) {
            keyboardUtil.setData(result.getCp());
            if (StringUtils.isNoneEmpty(result.getPic()))
                x.image().bind(image, Constant.URL_IMG + result.getPic(), circleImage);
        }
    });
}