Example usage for org.apache.commons.collections4 CollectionUtils isNotEmpty

List of usage examples for org.apache.commons.collections4 CollectionUtils isNotEmpty

Introduction

In this page you can find the example usage for org.apache.commons.collections4 CollectionUtils isNotEmpty.

Prototype

public static boolean isNotEmpty(final Collection<?> coll) 

Source Link

Document

Null-safe check if the specified collection is not empty.

Usage

From source file:com.chadekin.jadys.syntax.where.impl.WhereClauseExtendedBuilderImpl.java

private boolean isValidAlias(Set<String> aliases) {
    JadysSqlQueryBuilder builder = getParent();
    while (builder != null) {
        Set<String> parentAliases = builder.getAlias();
        if (CollectionUtils.isNotEmpty(parentAliases) && parentAliases.containsAll(aliases)) {
            return true;
        }//ww  w  .ja v  a2  s.c om
        builder = builder.getParent();
    }
    return false;
}

From source file:com.baifendian.swordfish.execserver.job.impexp.Args.PostgreWriterArg.java

public PostgreWriterArg(PostgreWriter postgreWriter) {
    ObjectNode connObject = JsonUtil.createObjectNode();

    List<String> tableList = Arrays.asList(postgreWriter.getTable());
    if (CollectionUtils.isNotEmpty(tableList)) {
        ArrayNode tableJsonList = connObject.putArray("table");
        for (String table : tableList) {
            tableJsonList.add(table);//from   w ww.j a  va 2  s .  c  om
        }
    }

    preSql = CommonUtil.sqlSplit(postgreWriter.getPreSql());
    postSql = CommonUtil.sqlSplit(postgreWriter.getPostSql());
    column = postgreWriter.getColumn();
    session = postgreWriter.getSession();
    batchSize = postgreWriter.getBatchSize();
    writeMode = postgreWriter.getWriteMode();

    connection.add(connObject);
}

From source file:com.mar.tmm.desktop.ui.view.impl.DefaultUnitPainter.java

protected List<ElementNode> paintUnitElements(final Unit unit) {
    final List<ElementNode> result = new ArrayList<>();
    if (CollectionUtils.isNotEmpty(unit.getElements())) {
        for (final UnitElement unitElement : unit.getElements()) {
            result.add(paintUnitElement(unit, unitElement));
        }//  w w w  . ja  v  a2s. c  o m
    }
    return result;
}

From source file:com.kildeen.visor.core.api.permission.DefaultPermissionConverter.java

@Override
public Set<Permission> deserializeAll(final Collection<String> deserialized) {
    if (CollectionUtils.isNotEmpty(deserialized)) {
        Set<Permission> deserializedPermissions = new ListOrderedSet<>();
        for (String permission : deserialized) {
            deserializedPermissions.add(deserialize(permission));
        }/*from  w w w.ja  v a2  s .c  om*/
        return deserializedPermissions;
    } else {
        return Collections.emptySet();
    }

}

From source file:com.jkoolcloud.tnt4j.streams.inputs.JavaInputStream.java

@Override
public void setProperties(Collection<Map.Entry<String, String>> props) {
    super.setProperties(props);

    if (CollectionUtils.isNotEmpty(props)) {
        for (Map.Entry<String, String> prop : props) {
            String name = prop.getKey();
            String value = prop.getValue();
            if (StreamProperties.PROP_INPUT_CLOSEABLE.equalsIgnoreCase(name)) {
                inputCloseable = Utils.toBoolean(value);
            }//from w w w. java 2s. co m
        }
    }
}

From source file:de.alpharogroup.user.service.UserTokensBusinessService.java

@Override
public boolean isValid(String token) {
    List<UserTokens> userTokens = null;
    UserTokens from = Torpedo.from(UserTokens.class);
    Torpedo.where(from.getToken()).eq(token);
    org.torpedoquery.jpa.Query<UserTokens> select = Torpedo.select(from);
    userTokens = select.list(getDao().getEntityManager());
    boolean valid = CollectionUtils.isNotEmpty(userTokens);
    return valid;
}

From source file:co.runrightfast.vertx.orientdb.impl.embedded.EmbeddedOrientDBServiceConfig.java

public void validate() {
    checkArgument(CollectionUtils.isNotEmpty(handlers), MUST_NOT_BE_EMPTY, "handlers");
    checkArgument(CollectionUtils.isNotEmpty(users), MUST_NOT_BE_EMPTY, "users");
    if (Files.exists(orientDBRootDir)) {
        checkOrientDBRootDir();//w w w .j  a  v a  2  s  . c  om
    } else {
        try {
            Files.createDirectories(orientDBRootDir);
        } catch (final IOException ex) {
            throw new RuntimeException("Failed to create OrientDB root dir: " + orientDBRootDir, ex);
        }
        checkOrientDBRootDir();
    }
}

From source file:com.jkoolcloud.tnt4j.streams.filters.GroovyExpressionFilter.java

@Override
public boolean doFilter(Object value, ActivityInfo ai) throws FilterException {
    Bindings bindings = new SimpleBindings();
    bindings.put(StreamsScriptingUtils.FIELD_VALUE_VARIABLE_EXPR, value);

    if (ai != null && CollectionUtils.isNotEmpty(exprVars)) {
        for (String eVar : exprVars) {
            Property eKV = resolveFieldKeyAndValue(eVar, ai);

            bindings.put(eKV.getKey(), eKV.getValue());
        }/*from  w  w w . ja  v a  2 s  .  c  o m*/
    }

    try {
        boolean match = (boolean) script.eval(bindings);

        logEvaluationResult(bindings, match);

        return isFilteredOut(getHandleType(), match);
    } catch (Exception exc) {
        throw new FilterException(StreamsResources.getStringFormatted(StreamsResources.RESOURCE_BUNDLE_NAME,
                "ExpressionFilter.filtering.failed", filterExpression), exc);
    }
}

From source file:com.jkoolcloud.tnt4j.streams.utils.StreamsCache.java

/**
 * Sets cache configuration properties collection.
 *
 * @param props/*from   w  w w  .j  a  v  a2  s .c om*/
 *            configuration properties to set
 *
 * @see #initialize()
 */
public static void setProperties(Collection<Map.Entry<String, String>> props) {
    if (CollectionUtils.isNotEmpty(props)) {
        for (Map.Entry<String, String> prop : props) {
            String name = prop.getKey();
            String value = prop.getValue();
            if (CacheProperties.PROP_MAX_SIZE.equalsIgnoreCase(name)) {
                maxSize = Long.parseLong(value);
            } else if (CacheProperties.PROP_EXPIRE_DURATION.equalsIgnoreCase(name)) {
                expireDuration = Long.parseLong(value);
            } else if (CacheProperties.PROP_PERSISTED.equalsIgnoreCase(name)) {
                persistenceOn = Utils.toBoolean(value);
            }
        }
    }

    initialize();
}

From source file:com.jkoolcloud.tnt4j.streams.transform.JavaScriptTransformation.java

@Override
public Object transform(Object value, ActivityInfo ai) throws TransformationException {
    Bindings bindings = new SimpleBindings();
    bindings.put(StreamsScriptingUtils.FIELD_VALUE_VARIABLE_EXPR, value);

    if (ai != null && CollectionUtils.isNotEmpty(exprVars)) {
        for (String eVar : exprVars) {
            Property eKV = resolveFieldKeyAndValue(eVar, ai);

            bindings.put(eKV.getKey(), eKV.getValue());
        }/*from   w ww  .jav a  2  s .co m*/
    }

    try {
        Object tValue = script.eval(bindings);

        logEvaluationResult(bindings, tValue);

        return tValue;
    } catch (Exception exc) {
        throw new TransformationException(
                StreamsResources.getStringFormatted(StreamsResources.RESOURCE_BUNDLE_NAME,
                        "ValueTransformation.transformation.failed", getName(), getPhase()),
                exc);
    }
}