All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.vertx.up.uca.jooq.ActionCheck Maven / Gradle / Ivy

There is a newer version: 0.9.0
Show newest version
package io.vertx.up.uca.jooq;

import io.vertx.core.Future;
import io.vertx.core.json.JsonObject;

import java.util.List;
import java.util.Objects;

/**
 * @author Lang
 */
@SuppressWarnings("all")
class ActionCheck extends AbstractAction {

    private transient ActionFetch fetch;

    ActionCheck(final JqAnalyzer analyzer) {
        super(analyzer);
        // Criteria Processing
        this.fetch = new ActionFetch(analyzer);
    }

    Boolean existById(final Object id) {
        return Objects.nonNull(this.fetch.fetchById(id));
    }

    Future existByIdAsync(final Object id) {
        return this.fetch.fetchByIdAsync(id)
            .compose(queried -> Future.succeededFuture(Objects.nonNull(queried)));
    }

     Boolean exist(final JsonObject criteria) {
        final List list = this.fetch.fetch(criteria);
        return !list.isEmpty();
    }

     Future existAsync(final JsonObject criteria) {
        return this.fetch.fetchAsync(criteria)
            .compose(list -> Future.succeededFuture(!list.isEmpty()));
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy