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

org.neogroup.warp.data.query.SelectQuery Maven / Gradle / Ivy

There is a newer version: 1.4.3
Show newest version

package org.neogroup.warp.data.query;

import org.neogroup.warp.data.query.conditions.ConditionGroup;
import org.neogroup.warp.data.query.fields.Field;
import org.neogroup.warp.data.query.fields.SelectField;
import org.neogroup.warp.data.query.fields.SortField;
import org.neogroup.warp.data.query.joins.Join;
import org.neogroup.warp.data.query.traits.*;

import java.util.ArrayList;
import java.util.List;

public class SelectQuery extends Query implements
        HasTable,
        HasTableSubQuery,
        HasTableAlias,
        HasDistinct,
        HasSelectFields,
        HasJoins,
        HasWhereConditions,
        HasHavingConditions,
        HasOrderByFields,
        HasGroupByFields,
        HasLimit,
        HasOffset {

    private String tableName;
    private String tableAlias;
    private SelectQuery subQuery;
    private List selectFields;
    private List groupByFields;
    private List orderByFields;
    private ConditionGroup whereConditionGroup;
    private ConditionGroup havingConditionGroup;
    private List joins;
    private Boolean distinct;
    private Integer limit;
    private Integer offset;

    public SelectQuery() {
        this.tableName = null;
        this.tableAlias = null;
        this.subQuery = null;
        this.selectFields = new ArrayList<>();
        this.groupByFields = new ArrayList<>();
        this.orderByFields = new ArrayList<>();
        this.whereConditionGroup = new ConditionGroup();
        this.havingConditionGroup = new ConditionGroup();
        this.joins = new ArrayList<>();
        this.limit = null;
        this.offset = null;
        this.distinct = false;
    }

    @Override
    public String getTableName() {
        return tableName;
    }

    @Override
    public SelectQuery setTableName(String tableName) {
        this.tableName = tableName;
        return this;
    }

    @Override
    public String getTableAlias() {
        return tableAlias;
    }

    @Override
    public SelectQuery setTableAlias(String tableAlias) {
        this.tableAlias = tableAlias;
        return this;
    }

    @Override
    public SelectQuery getTableSubQuery() {
        return subQuery;
    }

    @Override
    public SelectQuery setTableSubQuery(SelectQuery subQuery) {
        this.subQuery = subQuery;
        return this;
    }

    @Override
    public Boolean isDistinct() {
        return distinct;
    }

    @Override
    public SelectQuery setDistinct(Boolean distinct) {
        this.distinct = distinct;
        return this;
    }

    @Override
    public List getSelectFields() {
        return selectFields;
    }

    @Override
    public SelectQuery setSelectFields(List selectFields) {
        this.selectFields = selectFields;
        return this;
    }

    @Override
    public List getJoins() {
        return joins;
    }

    @Override
    public SelectQuery setJoins(List joins) {
        this.joins = joins;
        return this;
    }

    @Override
    public ConditionGroup getWhereConditions() {
        return whereConditionGroup;
    }

    @Override
    public SelectQuery setWhereConditions(ConditionGroup conditionGroup) {
        this.whereConditionGroup = conditionGroup;
        return this;
    }

    @Override
    public ConditionGroup getHavingConditions() {
        return havingConditionGroup;
    }

    @Override
    public SelectQuery setHavingConditions(ConditionGroup conditionGroup) {
        this.havingConditionGroup = conditionGroup;
        return this;
    }

    @Override
    public List getGroupByFields() {
        return groupByFields;
    }

    @Override
    public SelectQuery setGroupByFields(List groupByFields) {
        this.groupByFields = groupByFields;
        return this;
    }

    @Override
    public List getOrderByFields() {
        return orderByFields;
    }

    @Override
    public SelectQuery setOrderByFields(List orderByFields) {
        this.orderByFields = orderByFields;
        return this;
    }

    @Override
    public Integer getLimit() {
        return limit;
    }

    @Override
    public SelectQuery limit(Integer limit) {
        this.limit = limit;
        return this;
    }

    @Override
    public Integer getOffset() {
        return offset;
    }

    @Override
    public SelectQuery offset(Integer offset) {
        this.offset = offset;
        return this;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy