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

net.binis.codegen.spring.query.executor.QueryOrderer Maven / Gradle / Ivy

There is a newer version: 1.2.22
Show newest version
package net.binis.codegen.spring.query.executor;

/*-
 * #%L
 * code-generator-spring
 * %%
 * Copyright (C) 2021 Binis Belev
 * %%
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * #L%
 */

import net.binis.codegen.spring.query.*;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;

import javax.persistence.FlushModeType;
import javax.persistence.LockModeType;
import javax.persistence.Tuple;
import java.util.List;
import java.util.Optional;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.IntSupplier;

public class QueryOrderer implements QueryAccessor, QueryExecute, QueryOrderOperation, QueryJoinAggregateOperation {

    protected final QueryExecutor executor;
    protected final Function func;

    public QueryOrderer(QueryExecutor executor, Function func) {
        this.executor = executor;
        this.func = func;
    }

    @Override
    public R ensure() {
        return executor.ensure();
    }

    @Override
    public Optional reference() {
        return executor.reference();
    }

    @Override
    public Optional get() {
        return executor.get();
    }

    @Override
    public  Optional get(Class cls) {
        return executor.get(cls);
    }

    @Override
    public List list() {
        return executor.list();
    }

    @Override
    public List references() {
        return executor.references();
    }

    @Override
    public  List list(Class cls) {
        return executor.list(cls);
    }

    @Override
    public long count() {
        return executor.count();
    }

    @Override
    public Optional top() {
        return executor.top();
    }

    @Override
    public  Optional top(Class cls) {
        return executor.top(cls);
    }

    @Override
    public List top(long records) {
        return executor.top(records);
    }

    @Override
    public  List top(long records, Class cls) {
        return executor.top(records, cls);
    }

    @Override
    public Page page(Pageable pageable) {
        return executor.page(pageable);
    }

    @Override
    public  Page page(Pageable pageable, Class cls) {
        return executor.page(pageable, cls);
    }

    @Override
    public Page page(long pageSize) {
        return executor.page(pageSize);
    }

    @Override
    public  Page page(long pageSize, Class cls) {
        return executor.page(pageSize, cls);
    }

    @Override
    public void paginated(long pageSize, Consumer consumer) {
        executor.paginated(pageSize, consumer);
    }

    @Override
    public void paginated(Pageable pageable, Consumer consumer) {
        executor.paginated(pageable, consumer);
    }

    @Override
    public  void paginated(long pageSize, Class cls, Consumer consumer) {
        executor.paginated(pageSize, cls, consumer);
    }

    @Override
    public  void paginated(Pageable pageable, Class cls, Consumer consumer) {
        executor.paginated(pageable, cls, consumer);
    }

    @Override
    public void paged(long pageSize, Consumer> consumer) {
        executor.paged(pageSize, consumer);
    }

    @Override
    public void paged(Pageable pageable, Consumer> consumer) {
        executor.paged(pageable, consumer);
    }

    @Override
    public  void paged(long pageSize, Class cls, Consumer> consumer) {
        executor.paged(pageSize, cls, consumer);
    }

    @Override
    public  void paged(Pageable pageable, Class cls, Consumer> consumer) {
        executor.paged(pageable, cls, consumer);
    }

    @Override
    public Optional tuple() {
        return executor.tuple();
    }

    @SuppressWarnings("unchecked")
    @Override
    public  Optional> tuple(Class cls) {
        return executor.tuple(cls);
    }

    @Override
    public List tuples() {
        return executor.tuples();
    }

    @SuppressWarnings("unchecked")
    @Override
    public  List tuples(Class cls) {
        return executor.tuples(cls);
    }

    @Override
    public PreparedQuery prepare() {
        return executor.prepare();
    }

    @Override
    public  QueryExecute projection(Class projection) {
        return executor.projection(projection);
    }

    @Override
    public QueryExecute flush(FlushModeType type) {
        return executor.flush(type);
    }

    @Override
    public QueryExecute lock(LockModeType type) {
        return executor.lock(type);
    }

    @Override
    public QueryExecute hint(String hint, Object value) {
        return executor.hint(hint, value);
    }

    @Override
    public QueryFilter filter(String name) {
        return executor.filter(name);
    }

    @Override
    public boolean exists() {
        return executor.exists();
    }

    @Override
    public void delete() {
        executor.delete();
    }

    @Override
    public int remove() {
        return executor.remove();
    }

    @Override
    public String print() {
        return executor.print();
    }

    public Object script(String script) {
        executor.script(script);
        return this;
    }

    public Object _open() {
        executor._open();
        return this;
    }

    @Override
    public Object sum() {
        executor.sum();
        return this;
    }

    @Override
    public Object min() {
        executor.min();
        return this;
    }

    @Override
    public Object max() {
        executor.max();
        return this;
    }

    @Override
    public Object avg() {
        executor.avg();
        return this;
    }

    @Override
    public Object cnt() {
        executor.cnt();
        return this;
    }

    @Override
    public Object distinct() {
        executor.distinct();
        return this;
    }


    @Override
    public Object desc() {
        return null;
    }

    @Override
    public Object asc() {
        return null;
    }

    public QueryAggregateOperation and() {
        return this;
    }

    public Object where() {
        executor.whereStart();
        return executor;
    }

    @Override
    public String getAccessorAlias() {
        return executor.getAccessorAlias();
    }

    @Override
    public StringBuilder getAccessorSelect() {
        return executor.getAccessorSelect();
    }

    @Override
    public StringBuilder getAccessorWhere() {
        return executor.getAccessorWhere();
    }

    @Override
    public StringBuilder getAccessorOrder() {
        return executor.getAccessorOrder();
    }

    @Override
    public List getParams() {
        return executor.getParams();
    }

    @Override
    public void setJoinSupplier(IntSupplier supplier) {
        executor.setJoinSupplier(supplier);
    }

    @Override
    public void setParams(List params) {
        executor.setParams(params);
    }

}