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

org.graylog.plugins.views.search.AutoValue_Query Maven / Gradle / Ivy

There is a newer version: 6.1.4
Show newest version
package org.graylog.plugins.views.search;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.common.collect.ImmutableSet;
import java.util.List;
import java.util.Optional;
import java.util.Set;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import javax.annotation.processing.Generated;
import org.graylog.plugins.views.search.engine.BackendQuery;
import org.graylog.plugins.views.search.searchfilters.model.UsedSearchFilter;
import org.graylog2.plugin.indexer.searches.timeranges.TimeRange;

@Generated("com.google.auto.value.processor.AutoValueProcessor")
final class AutoValue_Query extends Query {

  @Nullable
  private final String id;

  private final TimeRange timerange;

  @Nullable
  private final Filter filter;

  private final List filters;

  private final BackendQuery query;

  private final Optional globalOverride;

  private final ImmutableSet searchTypes;

  private AutoValue_Query(
      @Nullable String id,
      TimeRange timerange,
      @Nullable Filter filter,
      List filters,
      BackendQuery query,
      Optional globalOverride,
      ImmutableSet searchTypes) {
    this.id = id;
    this.timerange = timerange;
    this.filter = filter;
    this.filters = filters;
    this.query = query;
    this.globalOverride = globalOverride;
    this.searchTypes = searchTypes;
  }

  @JsonProperty
  @Nullable
  @Override
  public String id() {
    return id;
  }

  @JsonProperty
  @Override
  public TimeRange timerange() {
    return timerange;
  }

  @JsonProperty
  @Nullable
  @Override
  public Filter filter() {
    return filter;
  }

  @JsonProperty
  @Override
  public List filters() {
    return filters;
  }

  @JsonProperty
  @Nonnull
  @Override
  public BackendQuery query() {
    return query;
  }

  @JsonIgnore
  @Override
  public Optional globalOverride() {
    return globalOverride;
  }

  @JsonProperty("search_types")
  @Nonnull
  @Override
  public ImmutableSet searchTypes() {
    return searchTypes;
  }

  @Override
  public String toString() {
    return "Query{"
        + "id=" + id + ", "
        + "timerange=" + timerange + ", "
        + "filter=" + filter + ", "
        + "filters=" + filters + ", "
        + "query=" + query + ", "
        + "globalOverride=" + globalOverride + ", "
        + "searchTypes=" + searchTypes
        + "}";
  }

  @Override
  public boolean equals(Object o) {
    if (o == this) {
      return true;
    }
    if (o instanceof Query) {
      Query that = (Query) o;
      return (this.id == null ? that.id() == null : this.id.equals(that.id()))
          && this.timerange.equals(that.timerange())
          && (this.filter == null ? that.filter() == null : this.filter.equals(that.filter()))
          && this.filters.equals(that.filters())
          && this.query.equals(that.query())
          && this.globalOverride.equals(that.globalOverride())
          && this.searchTypes.equals(that.searchTypes());
    }
    return false;
  }

  @Override
  public int hashCode() {
    int h$ = 1;
    h$ *= 1000003;
    h$ ^= (id == null) ? 0 : id.hashCode();
    h$ *= 1000003;
    h$ ^= timerange.hashCode();
    h$ *= 1000003;
    h$ ^= (filter == null) ? 0 : filter.hashCode();
    h$ *= 1000003;
    h$ ^= filters.hashCode();
    h$ *= 1000003;
    h$ ^= query.hashCode();
    h$ *= 1000003;
    h$ ^= globalOverride.hashCode();
    h$ *= 1000003;
    h$ ^= searchTypes.hashCode();
    return h$;
  }

  @Override
  public Query.Builder toBuilder() {
    return new Builder(this);
  }

  static final class Builder extends Query.Builder {
    private String id;
    private TimeRange timerange;
    private Filter filter;
    private List filters;
    private BackendQuery query;
    private Optional globalOverride = Optional.empty();
    private ImmutableSet searchTypes;
    Builder() {
    }
    private Builder(Query source) {
      this.id = source.id();
      this.timerange = source.timerange();
      this.filter = source.filter();
      this.filters = source.filters();
      this.query = source.query();
      this.globalOverride = source.globalOverride();
      this.searchTypes = source.searchTypes();
    }
    @Override
    public Query.Builder id(String id) {
      this.id = id;
      return this;
    }
    @Override
    @Nullable public String id() {
      return id;
    }
    @Override
    public Query.Builder timerange(TimeRange timerange) {
      if (timerange == null) {
        throw new NullPointerException("Null timerange");
      }
      this.timerange = timerange;
      return this;
    }
    @Override
    public Query.Builder filter(Filter filter) {
      this.filter = filter;
      return this;
    }
    @Override
    public Query.Builder filters(List filters) {
      if (filters == null) {
        throw new NullPointerException("Null filters");
      }
      this.filters = filters;
      return this;
    }
    @Override
    public Query.Builder query(BackendQuery query) {
      if (query == null) {
        throw new NullPointerException("Null query");
      }
      this.query = query;
      return this;
    }
    @Override
    public Query.Builder globalOverride(@Nullable GlobalOverride globalOverride) {
      this.globalOverride = Optional.ofNullable(globalOverride);
      return this;
    }
    @Override
    public Query.Builder searchTypes(@Nullable Set searchTypes) {
      this.searchTypes = ImmutableSet.copyOf(searchTypes);
      return this;
    }
    @Override
    Query autoBuild() {
      if (this.timerange == null
          || this.filters == null
          || this.query == null
          || this.searchTypes == null) {
        StringBuilder missing = new StringBuilder();
        if (this.timerange == null) {
          missing.append(" timerange");
        }
        if (this.filters == null) {
          missing.append(" filters");
        }
        if (this.query == null) {
          missing.append(" query");
        }
        if (this.searchTypes == null) {
          missing.append(" searchTypes");
        }
        throw new IllegalStateException("Missing required properties:" + missing);
      }
      return new AutoValue_Query(
          this.id,
          this.timerange,
          this.filter,
          this.filters,
          this.query,
          this.globalOverride,
          this.searchTypes);
    }
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy