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

org.influxdb.querybuilder.SelectSubQueryImpl Maven / Gradle / Ivy

There is a newer version: 2.24
Show newest version
package org.influxdb.querybuilder;

import java.util.List;
import org.influxdb.querybuilder.clauses.Clause;
import org.influxdb.querybuilder.clauses.FromClause;

public class SelectSubQueryImpl extends SubQuery
    implements SelectWithSubquery {

  private SelectCoreImpl, T>> selectCore;
  private WhereSubQueryImpl, T> whereSubQuery;

  SelectSubQueryImpl(
      final FromClause fromClause, final List columns, final boolean isDistinct) {
    whereSubQuery = new WhereSubQueryImpl<>(this, new WhereCoreImpl<>(this));
    this.selectCore = new SelectCoreImpl<>(fromClause, columns, isDistinct, whereSubQuery);
  }

  SelectSubQueryImpl(final List columns, final boolean isDistinct) {
    whereSubQuery = new WhereSubQueryImpl<>(this, new WhereCoreImpl<>(this));
    this.selectCore = new SelectCoreImpl<>(columns, isDistinct, whereSubQuery);
  }

  @Override
  public WhereSubQueryImpl, T> where() {
    return selectCore.where();
  }

  @Override
  public WhereSubQueryImpl, T> where(final Clause clause) {
    return selectCore.where(clause);
  }

  @Override
  public WhereSubQueryImpl, T> where(final String text) {
    return selectCore.where(text);
  }

  @Override
  public SelectSubQueryImpl orderBy(final Ordering ordering) {
    selectCore.orderBy(ordering);
    return this;
  }

  @Override
  public SelectSubQueryImpl groupBy(final Object... columns) {
    selectCore.groupBy(columns);
    return this;
  }

  @Override
  public SelectSubQueryImpl fill(final Number value) {
    selectCore.fill(value);
    return this;
  }

  @Override
  public SelectSubQueryImpl fill(final String value) {
    selectCore.fill(value);
    return this;
  }

  @Override
  public SelectSubQueryImpl limit(final int limit) {
    selectCore.limit(limit);
    return this;
  }

  @Override
  public SelectSubQueryImpl limit(final int limit, final long offSet) {
    selectCore.limit(limit, offSet);
    return this;
  }

  @Override
  public SelectSubQueryImpl sLimit(final int sLimit) {
    selectCore.sLimit(sLimit);
    return this;
  }

  @Override
  public SelectSubQueryImpl sLimit(final int sLimit, final long sOffSet) {
    selectCore.sLimit(sLimit, sOffSet);
    return this;
  }

  @Override
  public SelectSubQueryImpl tz(final String timezone) {
    selectCore.tz(timezone);
    return this;
  }

  @Override
  public StringBuilder buildQueryString() {
    return selectCore.buildQueryString(new StringBuilder());
  }

  @Override
  public StringBuilder buildQueryString(final StringBuilder stringBuilder) {
    return selectCore.buildQueryString(stringBuilder);
  }

  @Override
  public void setSubQuery(final QueryStringBuilder query) {
    selectCore.setSubQuery(query);
  }

  @Override
  void setParent(final T parent) {
    whereSubQuery.setParent(parent);
    super.setParent(parent);
  }
}