Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
io.vertx.up.uca.jooq.UxJooq Maven / Gradle / Ivy
package io.vertx.up.uca.jooq;
import io.vertx.core.Future;
import io.vertx.core.json.JsonArray;
import io.vertx.core.json.JsonObject;
import io.vertx.tp.plugin.jooq.JooqDsl;
import io.vertx.up.eon.Strings;
import io.vertx.up.eon.Values;
import io.vertx.up.eon.em.Format;
import io.vertx.up.log.Annal;
import io.vertx.up.uca.jooq.util.JqFlow;
import io.vertx.up.uca.jooq.util.JqTool;
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.Set;
import java.util.concurrent.ConcurrentMap;
import java.util.function.BiPredicate;
@SuppressWarnings("all")
public final class UxJooq {
private static final Annal LOGGER = Annal.get(UxJooq.class);
private transient final Class> clazz;
/* Analyzer */
private transient final JqAnalyzer analyzer;
/* Aggre */
private transient final JqAggregator aggregator;
/* Writer */
private transient final JqWriter writer;
/* Reader */
private transient final JqReader reader;
/*
* New Structure for usage
*/
private transient final JqFlow workflow;
private transient Format format = Format.JSON;
public UxJooq(final Class clazz, final JooqDsl dsl) {
/* New exception to avoid programming missing */
this.clazz = clazz;
/* Analyzing column for Jooq */
this.analyzer = JqAnalyzer.create(dsl);
this.aggregator = JqAggregator.create(this.analyzer);
/* Reader connect Analayzer */
this.reader = JqReader.create(this.analyzer);
/* Writer connect Reader */
this.writer = JqWriter.create(this.analyzer);
/* New Structure */
this.workflow = JqFlow.create(this.analyzer);
}
// -------------------- Bind Config --------------------
/*
* Bind configuration range here
* Pojo mode of complex processing
*/
public UxJooq on(final String pojo) {
this.analyzer.on(pojo, this.clazz);
/*
* Because the JqAnalyzer has been changed here, instead we should
* re-create the workflow component.
*
* This feature is used in old system of previous version,
* 1) The entity is correct in our system and no error here.
* 2) There exists `pojo` file that bind to this entity for data conversation
* 3) The `pojo` will impact all the interface API that contains `pojo` parameters
*/
this.workflow.on(this.analyzer);
return this;
}
public UxJooq on(final Format format) {
this.format = format;
return this;
}
public JqAnalyzer analyzer() {
return this.analyzer;
}
public Set columns() {
return this.analyzer.columns().keySet();
}
public String table() {
return this.analyzer.table().getName();
}
private JsonObject andOr(final JsonObject criteria) {
if (!criteria.containsKey(Strings.EMPTY)) {
criteria.put(Strings.EMPTY, Boolean.TRUE);
}
return criteria;
}
// -------------------- INSERT --------------------
/*
* Async Only
* Disabled increament primary key processing, this method is not used in our system once,
* In distributed system environment, it's no usage.
*
* public Future insertReturningPrimaryAsync(final T entity, final Consumer consumer) {
* return this.writer.insertReturningPrimaryAsync(entity, consumer);
* }
*/
/*
* insertAsync(T)
* <-- insertAsync(JsonObject)
* <-- insertAsync(JsonObject,pojo)
* <-- insertJAsync(T)
* <-- insertJAsync(JsonObject, pojo)
* <-- insertJAsync(JsonObject)
* */
public Future insertAsync(final T entity) {
return this.writer.insertAsync(entity);
}
public Future insertAsync(final JsonObject data) {
return this.workflow.inputAsync(data).compose(this::insertAsync);
}
public Future insertAsync(final JsonObject data, final String pojo) {
return JqFlow.create(this.analyzer, pojo).inputAsync(data).compose(this::insertAsync);
}
public Future insertJAsync(final T entity) {
return this.insertAsync(entity).compose(this.workflow::outputAsync);
}
public Future insertJAsync(final JsonObject data) {
return this.workflow.inputAsync(data).compose(this::insertAsync).compose(this.workflow::outputAsync);
}
public Future insertJAsync(final JsonObject data, final String pojo) {
final JqFlow flow = JqFlow.create(this.analyzer, pojo);
return flow.inputAsync(data).compose(this::insertAsync).compose(flow::outputAsync);
}
/*
* insert(T)
* <-- insert(JsonObject)
* <-- insert(JsonObject, pojo)
* <-- insertJ(T)
* <-- insertJ(JsonObject)
* <-- insertJ(JsonObject, pojo)
* */
public T insert(final T entity) {
return this.writer.insert(entity);
}
public T insert(final JsonObject data) {
return this.insert((T) this.workflow.input(data));
}
public T insert(final JsonObject data, final String pojo) {
return this.insert((T) JqFlow.create(this.analyzer, pojo).input(data));
}
public JsonObject insertJ(final T entity) {
return this.workflow.output(this.insert(entity));
}
public JsonObject insertJ(final JsonObject data) {
return this.workflow.output(this.insert((T) this.workflow.input(data))); // T & List Diff
}
public JsonObject insertJ(final JsonObject data, final String pojo) {
final JqFlow flow = JqFlow.create(this.analyzer, pojo);
return flow.output(this.insert((T) flow.input(data))); // T & List Diff
}
/*
* insertAsync(List)
* <-- insertAsync(JsonArray)
* <-- insertAsync(JsonArray, pojo)
* <-- insertJAsync(List)
* <-- insertJAsync(JsonArray)
* <-- insertJAsync(JsonArray, pojo)
*/
public Future> insertAsync(final List entities) {
return this.writer.insertAsync(entities);
}
public Future> insertAsync(final JsonArray input) {
return this.workflow.inputAsync(input).compose(this::insertAsync); // --> `insertAsync(List)`
}
public Future> insertAsync(final JsonArray input, final String pojo) {
return JqFlow.create(this.analyzer, pojo).inputAsync(input).compose(this::insertAsync); // --> `insertAsync(List)`
}
public Future insertJAsync(final List list) {
return this.insertAsync(list).compose(this.workflow::outputAsync);
}
public Future insertJAsync(final JsonArray input) {
return this.workflow.inputAsync(input).compose(this::insertAsync).compose(this.workflow::outputAsync);
}
public Future insertJAsync(final JsonArray input, final String pojo) {
final JqFlow flow = JqFlow.create(this.analyzer, pojo);
return flow.inputAsync(input).compose(this::insertAsync).compose(flow::outputAsync);
}
/*
* insert(List)
* <-- insert(JsonArray)
* <-- insert(JsonArray,pojo)
* <-- insertJ(List)
* <-- insertJ(JsonArray)
* <-- insertJ(JsonArray, pojo)
*/
public List insert(final List entities) {
return this.writer.insert(entities);
}
public List insert(final JsonArray data) {
return this.insert(this.workflow.input(data));
}
public List insert(final JsonArray data, final String pojo) {
final JqFlow flow = JqFlow.create(this.analyzer, pojo);
return this.insert(flow.input(data));
}
public JsonArray insertJ(final List list) {
return this.workflow.output(this.insert(list));
}
public JsonArray insertJ(final JsonArray data) {
return this.workflow.output(this.insert(this.workflow.input(data)));
}
public JsonArray insertJ(final JsonArray data, final String pojo) {
final JqFlow flow = JqFlow.create(this.analyzer, pojo);
return flow.output(this.insert(flow.input(data)));
}
// -------------------- Search Operation -----------
/*
* searchAsync(JsonObject, pojo)
* searchAsync(JsonObject)
* search(JsonObject, pojo)
* search(JsonObject)
*/
public Future searchAsync(final JsonObject params, final String pojo) {
return this.reader.searchAsync(params, JqFlow.create(this.analyzer, pojo));
}
public Future searchAsync(final JsonObject params) {
return this.reader.searchAsync(params, this.workflow);
}
public JsonObject search(final JsonObject params, final String pojo) {
return this.reader.search(params, JqFlow.create(this.analyzer, pojo));
}
public JsonObject search(final JsonObject params) {
return this.reader.search(params, this.workflow);
}
// -------------------- Fetch List -------------------
/*
* fetchAllAsync()
* <-- fetchJAllAsync()
* <-- fetchJAllAsync(pojo)
*
* fetchAll()
* <-- fetchJAll()
* <-- fetchJAll(pojo)
*
* fetchAsync(String, Object)
* <-- fetchJAsync(String, Object)
* <-- fetchInAsync(String, Object...)
* <-- fetchInAsync(String, Collection)
* <-- fetchInAsync(String, JsonArray)
* <-- fetchJInAsync(String, Object...)
* <-- fetchJInAsync(String, Collection)
* <-- fetchJInAsync(String, JsonArray)
* fetch(String, Object)
* <-- fetchJ(String, Object)
* <-- fetchIn(String, Object...)
* <-- fetchIn(String, Collection)
* <-- fetchIn(String, JsonArray)
* <-- fetchJIn(String, Object...)
* <-- fetchJIn(String, Collection)
* <-- fetchJIn(String, JsonArray)
*
* fetchAsync(JsonObject)
* <-- fetchJAsync(JsonObject)
* <-- fetchAndAsync(JsonObject)
* <-- fetchJAndAsync(JsonObject)
* <-- fetchOrAsync(JsonObject)
* <-- fetchJOrAsync(JsonObject)
*
* fetchAsync(JsonObject, pojo)
* <-- fetchJAsync(JsonObject, pojo)
* <-- fetchAndAsync(JsonObject, pojo)
* <-- fetchJAndAsync(JsonObject, pojo)
* <-- fetchOrAsync(JsonObject, pojo)
* <-- fetchJOrAsync(JsonObject, pojo)
*
* fetch(JsonObject)
* <-- fetchJ(JsonObject)
* <-- fetchAnd(JsonObject)
* <-- fetchJAnd(JsonObject)
* <-- fetchOr(JsonObject)
* <-- fetchJOr(JsonObject)
*
* fetch(JsonObject, pojo)
* <-- fetchJ(JsonObject, pojo)
* <-- fetchAnd(JsonObject, pojo)
* <-- fetchJAnd(JsonObject, pojo)
* <-- fetchOr(JsonObject, pojo)
* <-- fetchJOr(JsonObject, pojo)
*/
/* fetchAllAsync() */
public Future> fetchAllAsync() {
return this.reader.fetchAllAsync();
}
public Future fetchJAllAsync() {
return this.fetchAllAsync().compose(this.workflow::outputAsync);
}
public Future fetchJAllAsync(final String pojo) {
return this.fetchAllAsync().compose(JqFlow.create(this.analyzer, pojo)::outputAsync);
}
/* fetchAll() */
public List fetchAll() {
return this.reader.fetchAll();
}
public JsonArray fetchJAll() {
return this.workflow.output(this.fetchAll());
}
public JsonArray fetchJAll(final String pojo) {
return JqFlow.create(this.analyzer, pojo).output(this.fetchAll());
}
/* fetchAsync(String, Object) */
public Future> fetchAsync(final String field, final Object value) {
return this.reader.fetchAsync(field, value);
}
public Future> fetchInAsync(final String field, final Object... value) {
return this.fetchAsync(field, Arrays.asList(value));
}
public Future> fetchInAsync(final String field, final JsonArray values) {
return this.fetchAsync(field, values.getList());
}
public Future> fetchInAsync(final String field, final Collection collection) {
return this.fetchAsync(field, collection);
}
public Future fetchJAsync(final String field, final Object value) {
return this.fetchAsync(field, value).compose(this.workflow::outputAsync);
}
public Future fetchJInAsync(final String field, final Object... value) {
return this.fetchAsync(field, Arrays.asList(value)).compose(this.workflow::outputAsync);
}
public Future fetchJInAsync(final String field, final JsonArray values) {
return this.fetchAsync(field, values.getList()).compose(this.workflow::outputAsync);
}
public Future fetchJInAsync(final String field, final Collection collection) {
return this.fetchAsync(field, collection).compose(this.workflow::outputAsync);
}
/* fetch(String, Object) */
public List fetch(final String field, final Object value) {
return this.reader.fetch(field, value);
}
public List fetchIn(final String field, final Object... values) {
return this.fetch(field, Arrays.asList(values));
}
public List fetchIn(final String field, final JsonArray values) {
return this.fetch(field, values.getList());
}
public List fetchIn(final String field, final Collection collection) {
return this.fetch(field, collection);
}
public JsonArray fetchJ(final String field, final Object value) {
return this.workflow.output(this.fetch(field, value));
}
public JsonArray fetchJIn(final String field, final Object... values) {
return this.workflow.output(this.fetch(field, Arrays.asList(values)));
}
public JsonArray fetchJIn(final String field, final JsonArray values) {
return this.workflow.output(this.fetch(field, values.getList()));
}
public JsonArray fetchJIn(final String field, final Collection collection) {
return this.workflow.output(this.fetch(field, collection));
}
/* fetchAsync(JsonObject) */
public Future> fetchAsync(final JsonObject criteria) {
return this.workflow.inputQrJAsync(criteria).compose(this.reader::fetchAsync);
}
public Future> fetchAndAsync(final JsonObject criteria) {
return this.fetchAsync(criteria.put(Strings.EMPTY, Boolean.TRUE));
}
public Future> fetchOrAsync(final JsonObject criteria) {
return this.fetchAsync(criteria.put(Strings.EMPTY, Boolean.FALSE));
}
public Future fetchJAsync(final JsonObject criteria) {
return this.fetchAsync(criteria).compose(this.workflow::outputAsync);
}
public Future fetchJAndAsync(final JsonObject criteria) {
return this.fetchAsync(criteria.put(Strings.EMPTY, Boolean.TRUE)).compose(this.workflow::outputAsync);
}
public Future fetchJOrAsync(final JsonObject criteria) {
return this.fetchAsync(criteria.put(Strings.EMPTY, Boolean.FALSE)).compose(this.workflow::outputAsync);
}
/* fetch(JsonObject) */
public List fetch(final JsonObject criteria) {
return this.reader.fetch(this.workflow.inputQrJ(criteria));
}
public List fetchAnd(final JsonObject criteria) {
return this.fetch(criteria.put(Strings.EMPTY, Boolean.TRUE));
}
public List fetchOr(final JsonObject criteria) {
return this.fetch(criteria.put(Strings.EMPTY, Boolean.FALSE));
}
public JsonArray fetchJ(final JsonObject criteria) {
return this.workflow.output(this.fetch(criteria));
}
public JsonArray fetchJAnd(final JsonObject criteria) {
return this.workflow.output(this.fetch(criteria.put(Strings.EMPTY, Boolean.TRUE)));
}
public JsonArray fetchJOr(final JsonObject criteria) {
return this.workflow.output(this.fetch(criteria.put(Strings.EMPTY, Boolean.FALSE)));
}
/* fetchAsync(JsonObject, pojo) */
public Future> fetchAsync(final JsonObject criteria, final String pojo) {
return JqFlow.create(this.analyzer, pojo).inputQrJAsync(criteria).compose(this.reader::fetchAsync);
}
public Future> fetchAndAsync(final JsonObject criteria, final String pojo) {
return this.fetchAsync(criteria.put(Strings.EMPTY, Boolean.TRUE), pojo);
}
public Future> fetchOrAsync(final JsonObject criteria, final String pojo) {
return this.fetchAsync(criteria.put(Strings.EMPTY, Boolean.FALSE), pojo);
}
public Future fetchJAsync(final JsonObject criteria, final String pojo) {
return this.fetchAsync(criteria, pojo).compose(JqFlow.create(this.analyzer, pojo)::outputAsync);
}
public Future fetchJAndAsync(final JsonObject criteria, final String pojo) {
return this.fetchAsync(criteria.put(Strings.EMPTY, Boolean.TRUE), pojo).compose(JqFlow.create(this.analyzer, pojo)::outputAsync);
}
public Future fetchJOrAsync(final JsonObject criteria, final String pojo) {
return this.fetchAsync(criteria.put(Strings.EMPTY, Boolean.FALSE), pojo).compose(JqFlow.create(this.analyzer, pojo)::outputAsync);
}
/* fetch(JsonObject, pojo) */
public List fetch(final JsonObject criteria, final String pojo) {
return this.reader.fetch(JqFlow.create(this.analyzer, pojo).inputQrJ(criteria));
}
public List fetchAnd(final JsonObject criteria, final String pojo) {
return this.fetch(criteria.put(Strings.EMPTY, Boolean.TRUE), pojo);
}
public List fetchOr(final JsonObject criteria, final String pojo) {
return this.fetch(criteria.put(Strings.EMPTY, Boolean.FALSE), pojo);
}
public JsonArray fetchJ(final JsonObject criteria, final String pojo) {
return JqFlow.create(this.analyzer, pojo).output(this.fetch(criteria, pojo));
}
public JsonArray fetchJAnd(final JsonObject criteria, final String pojo) {
return JqFlow.create(this.analyzer, pojo).output(this.fetch(criteria.put(Strings.EMPTY, Boolean.TRUE), pojo));
}
// -------------------- Fetch One/All --------------------
public JsonArray fetchJOr(final JsonObject criteria, final String pojo) {
return JqFlow.create(this.analyzer, pojo).output(this.fetch(criteria.put(Strings.EMPTY, Boolean.FALSE), pojo));
}
/*
* fetchByIdAsync(Object)
* <-- fetchJByIdAsync(Object)
*
* fetchById(Object)
* <-- fetchJById(Object)
*
* fetchOneAsync(String, Object)
* <-- fetchJOneAsync(String, Object)
*
* fetchOne(String, Object)
* <-- fetchJOne(String, Object)
*
* fetchOneAsync(JsonObject)
* <-- fetchJOneAsync(JsonObject)
*
* fetchOne(JsonObject)
* <-- fetchJOne(JsonObject)
*
* fetchOneAsync(JsonObject, pojo)
* <-- fetchJOneAsync(JsonObject, pojo)
*
* fetchOne(JsonObject, pojo)
* <-- fetchJOne(JsonObject, pojo)
*/
public Future fetchByIdAsync(final Object id) {
return this.reader.fetchByIdAsync(id);
}
public Future fetchJByIdAsync(final Object id) {
return this.fetchByIdAsync(id).compose(this.workflow::outputAsync);
}
public T fetchById(final Object id) {
return this.reader.fetchById(id);
}
public JsonObject fetchJById(final Object id) {
return this.workflow.output((T) this.fetchById(id));
}
public Future fetchOneAsync(final String field, final Object value) {
return this.reader.fetchOneAsync(field, value);
}
public Future fetchJOneAsync(final String field, final Object value) {
return this.fetchOneAsync(field, value).compose(this.workflow::outputAsync);
}
public T fetchOne(final String field, final Object value) {
return this.reader.fetchOne(field, value);
}
public JsonObject fetchJOne(final String field, final Object value) {
return this.workflow.output((T) this.fetchOne(field, value));
}
public Future fetchOneAsync(final JsonObject criteria) {
criteria.put(Strings.EMPTY, Boolean.TRUE); // Unique Forced
return this.workflow.inputQrJAsync(criteria).compose(this.reader::fetchOneAsync);
}
public Future fetchJOneAsync(final JsonObject criteria) {
return this.fetchOneAsync(criteria).compose(this.workflow::outputAsync);
}
public T fetchOne(final JsonObject criteria) {
criteria.put(Strings.EMPTY, Boolean.TRUE); // Unique Forced
return this.reader.fetchOne(this.workflow.inputQrJ(criteria));
}
public JsonObject fetchJOne(final JsonObject criteria) {
return this.workflow.output((T) this.fetchOne(criteria));
}
public Future fetchOneAsync(final JsonObject criteria, final String pojo) {
criteria.put(Strings.EMPTY, Boolean.TRUE); // Unique Forced
return JqFlow.create(this.analyzer, pojo).inputQrJAsync(criteria).compose(this.reader::fetchOneAsync);
}
public Future fetchJOneAsync(final JsonObject criteria, final String pojo) {
return this.fetchOneAsync(criteria, pojo).compose(JqFlow.create(this.analyzer, pojo)::outputAsync);
}
public T fetchOne(final JsonObject criteria, final String pojo) {
criteria.put(Strings.EMPTY, Boolean.TRUE); // Unique Forced
return this.reader.fetchOne(JqFlow.create(this.analyzer, pojo).inputQrJ(criteria));
}
public JsonObject fetchJOne(final JsonObject criteria, final String pojo) {
return JqFlow.create(this.analyzer, pojo).output((T) this.fetchOne(criteria, pojo));
}
// -------------------- Fetch Record -------------------
/*
* update(T)
* <-- update(JsonObject)
* <-- update(JsonObject, pojo)
* <-- updateJ(T)
* <-- updateJ(JsonObject)
* <-- updateJ(JsonObject, pojo)
*/
public T update(final T entity) {
return this.writer.update(entity);
}
public T update(final JsonObject data) {
return this.update((T) this.workflow.input(data));
}
public T update(final JsonObject data, final String pojo) {
return this.update((T) JqFlow.create(this.analyzer, pojo).input(data));
}
public JsonObject updateJ(final T entity) {
return this.workflow.output(this.update(entity));
}
public JsonObject updateJ(final JsonObject data) {
return this.workflow.output(this.update((T) this.workflow.input(data)));
}
public JsonObject updateJ(final JsonObject data, final String pojo) {
final JqFlow flow = JqFlow.create(this.analyzer, pojo);
return flow.output(this.update((T) flow.input(data)));
}
/*
* updateAsync(T)
* <-- updateAsync(JsonObject)
* <-- updateAsync(JsonObject, pojo)
* <-- updateAsyncJ(T)
* <-- updateAsyncJ(JsonObject)
* <-- updateAsyncJ(JsonObject, pojo)
*/
public Future updateAsync(final T entity) {
return this.writer.updateAsync(entity);
}
public Future updateAsync(final JsonObject data) {
return this.workflow.inputAsync(data).compose(this::updateAsync);
}
public Future updateAsync(final JsonObject data, final String pojo) {
return JqFlow.create(this.analyzer, pojo).inputAsync(data).compose(this::updateAsync);
}
public Future updateAsyncJ(final T entity) {
return this.updateAsync(entity).compose(this.workflow::outputAsync);
}
public Future updateAsyncJ(final JsonObject data) {
return this.workflow.inputAsync(data).compose(this::updateAsync).compose(this.workflow::outputAsync);
}
public Future updateAsyncJ(final JsonObject data, final String pojo) {
final JqFlow flow = JqFlow.create(this.analyzer, pojo);
return flow.inputAsync(data).compose(this::updateAsync).compose(flow::outputAsync);
}
/*
* update(List)
* <-- update(JsonArray)
* <-- update(JsonArray, pojo)
* <-- updateJ(T)
* <-- updateJ(JsonArray)
* <-- updateJ(JsonArray, pojo)
*/
public List update(final List entities) {
return this.writer.update(entities);
}
public List update(final JsonArray data) {
return this.update(this.workflow.input(data));
}
public List update(final JsonArray data, final String pojo) {
return this.update(JqFlow.create(this.analyzer, pojo).input(data));
}
public JsonArray updateJ(final List entities) {
return this.workflow.output(this.update(entities));
}
public JsonArray updateJ(final JsonArray data) {
return this.workflow.output(this.update(this.workflow.input(data)));
}
public JsonArray updateJ(final JsonArray data, final String pojo) {
final JqFlow flow = JqFlow.create(this.analyzer, pojo);
return flow.output(this.update(flow.input(data)));
}
/*
* updateAsync(List)
* <-- updateAsync(JsonArray)
* <-- updateAsync(JsonArray, pojo)
* <-- updateJAsync(List)
* <-- updateJAsync(JsonArray)
* <-- updateJAsync(JsonArray, pojo)
*/
public Future> updateAsync(final List entities) {
return this.writer.updateAsync(entities);
}
public Future> updateAsync(final JsonArray data) {
return this.workflow.inputAsync(data).compose(this::updateAsync);
}
public Future> updateAsync(final JsonArray data, final String pojo) {
return JqFlow.create(this.analyzer, pojo).inputAsync(data).compose(this::updateAsync);
}
public Future updateAsyncJ(final List entities) {
return this.updateAsync(entities).compose(this.workflow::outputAsync);
}
public Future updateAsyncJ(final JsonArray input) {
return this.workflow.inputAsync(input).compose(this::updateAsync).compose(this.workflow::outputAsync);
}
public Future updateAsyncJ(final JsonArray input, final String pojo) {
final JqFlow flow = JqFlow.create(this.analyzer, pojo);
return flow.inputAsync(input).compose(this::updateAsync).compose(flow::outputAsync);
}
/*
* update(id, T)
* <-- update(id, JsonObject)
* <-- update(id, JsonObject, pojo)
* <-- updateJ(id, T)
* <-- updateJ(id, JsonObject)
* <-- updateJ(id, JsonObject, pojo)
*/
public T update(final Object id, final T updated) {
return this.writer.update(id, updated);
}
public T update(final Object id, final JsonObject data) {
return this.update(id, (T) this.workflow.input(data));
}
public T update(final Object id, final JsonObject data, final String pojo) {
return this.update(id, (T) JqFlow.create(this.analyzer, pojo).input(data));
}
public JsonObject updateJ(final Object id, final T updated) {
return this.workflow.output(this.update(id, updated));
}
public JsonObject updateJ(final Object id, final JsonObject data) {
return this.workflow.output(this.update(id, (T) this.workflow.input(data)));
}
public JsonObject updateJ(final Object id, final JsonObject data, final String pojo) {
final JqFlow flow = JqFlow.create(this.analyzer, pojo);
return flow.output(this.update(id, (T) flow.input(data)));
}
/*
* updateAsync(id, T)
* <-- updateAsync(id, JsonObject)
* <-- updateAsync(id, JsonObject, pojo)
* <-- updateJAsync(id, T)
* <-- updateJAsync(id, JsonObject)
* <-- updateJAsync(id, JsonObject, pojo)
*/
public Future updateAsync(final ID id, final T updated) {
return this.writer.updateAsync(id, updated);
}
public Future updateAsync(final ID id, final JsonObject data) {
return this.workflow.inputAsync(data).compose(entity -> this.updateAsync(id, entity));
}
public Future updateAsync(final ID id, final JsonObject data, final String pojo) {
return JqFlow.create(this.analyzer, pojo).inputAsync(data).compose(entity -> this.updateAsync(id, entity));
}
public Future updateJAsync(final ID id, final T updated) {
return this.updateAsync(id, updated).compose(this.workflow::outputAsync);
}
public Future updateJAsync(final ID id, final JsonObject data) {
return this.workflow.inputAsync(data).compose(entity -> this.updateAsync(id, entity)).compose(this.workflow::outputAsync);
}
public Future updateJAsync(final ID id, final JsonObject data, final String pojo) {
final JqFlow flow = JqFlow.create(this.analyzer, pojo);
return flow.inputAsync(data).compose(entity -> this.updateAsync(id, entity)).compose(flow::outputAsync);
}
/*
* update(criteria, T)
* <-- update(criteria, JsonObject)
* <-- updateJ(criteria, T)
* <-- updateJ(criteria, JsonObject)
* update(criteria, T, pojo)
* <-- update(criteria, JsonObject, pojo)
* <-- updateJ(criteria, T, pojo)
* <-- updateJ(criteria, JsonObject, pojo)
*/
public T update(final JsonObject criteria, final T updated) {
criteria.put(Strings.EMPTY, Boolean.TRUE); // Unique Forced
return this.writer.update(this.workflow.inputQrJ(criteria), updated);
}
public T update(final JsonObject criteria, final JsonObject data) {
return this.update(criteria, (T) this.workflow.input(data));
}
public JsonObject updateJ(final JsonObject criteria, final T updated) {
return this.workflow.output(this.update(criteria, updated));
}
public JsonObject updateJ(final JsonObject criteria, final JsonObject data) {
return this.workflow.output(this.update(criteria, (T) this.workflow.input(data)));
}
public T update(final JsonObject criteria, final T updated, final String pojo) {
criteria.put(Strings.EMPTY, Boolean.TRUE); // Unique Forced
return this.writer.update(JqFlow.create(this.analyzer, pojo).inputQrJ(criteria), updated);
}
public T update(final JsonObject criteria, final JsonObject data, final String pojo) {
return this.update(criteria, (T) JqFlow.create(this.analyzer, pojo).input(data), pojo);
}
public JsonObject updateJ(final JsonObject criteria, final T updated, final String pojo) {
return this.workflow.output(this.update(criteria, updated, pojo));
}
public JsonObject updateJ(final JsonObject criteria, final JsonObject data, final String pojo) {
final JqFlow flow = JqFlow.create(this.analyzer, pojo);
return flow.output(this.update(criteria, (T) flow.input(data), pojo));
}
/*
* updateAsync(criteria, T)
* <-- updateAsync(criteria, JsonObject)
* <-- updateJAsync(criteria, T)
* <-- updateJAsync(criteria, JsonObject)
* updateAsync(criteria, T, pojo)
* <-- updateAsync(criteria, JsonObject, pojo)
* <-- updateJAsync(criteria, T, pojo)
* <-- updateJAsync(criteria, JsonObject, pojo)
*/
public Future updateAsync(final JsonObject criteria, final T updated) {
criteria.put(Strings.EMPTY, Boolean.TRUE); // Unique Forced
return this.workflow.inputQrJAsync(criteria).compose(normalized -> this.writer.updateAsync(normalized, updated));
}
public Future updateAsync(final JsonObject criteria, final JsonObject data) {
return JqTool.joinAsync(criteria, data, this.workflow)
.compose(response -> this.updateAsync(response.resultAt(Values.IDX), (T) response.resultAt(Values.ONE)));
}
public Future updateJAsync(final JsonObject criteria, final T updated) {
return this.updateAsync(criteria, updated).compose(this.workflow::outputAsync);
}
public Future updateJAsync(final JsonObject criteria, final JsonObject data) {
return JqTool.joinAsync(criteria, data, this.workflow)
.compose(response -> this.updateAsync(response.resultAt(Values.IDX), (T) response.resultAt(Values.ONE)))
.compose(this.workflow::outputAsync);
}
public Future updateAsync(final JsonObject criteria, final T updated, final String pojo) {
criteria.put(Strings.EMPTY, Boolean.TRUE); // Unique Forced
return JqFlow.create(this.analyzer, pojo).inputQrJAsync(criteria).compose(normalized -> this.writer.updateAsync(normalized, updated));
}
public Future updateAsync(final JsonObject criteria, final JsonObject data, final String pojo) {
return JqTool.joinAsync(criteria, data, JqFlow.create(this.analyzer, pojo))
.compose(response -> this.updateAsync(response.resultAt(Values.IDX), (T) response.resultAt(Values.ONE), pojo));
}
public Future updateJAsync(final JsonObject criteria, final T updated, final String pojo) {
return this.updateAsync(criteria, updated, pojo).compose(JqFlow.create(this.analyzer, pojo)::outputAsync);
}
public Future updateJAsync(final JsonObject criteria, final JsonObject data, final String pojo) {
final JqFlow flow = JqFlow.create(this.analyzer, pojo);
return JqTool.joinAsync(criteria, data, flow)
.compose(response -> this.updateAsync(response.resultAt(Values.IDX), (T) response.resultAt(Values.ONE), pojo))
.compose(flow::outputAsync);
}
// -------------------- Upsert Operation ( INSERT / UPDATE ) ---------
/*
* upsert(id, T)
* <-- upsert(id, JsonObject)
* <-- upsert(id, JsonObject, pojo)
* <-- upsertJ(id, T)
* <-- upsertJ(id, JsonObject)
* <-- upsertJ(id, JsonObject, pojo)
*/
public T upsert(final Object id, final T updated) {
return this.writer.upsert(id, updated);
}
public T upsert(final Object id, final JsonObject data) {
return this.upsert(id, (T) this.workflow.input(data));
}
public