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

com.finbourne.luminesce.model.BackgroundQueryResponse Maven / Gradle / Ivy

There is a newer version: 2.0.285
Show newest version
/*
 * FINBOURNE Luminesce Web API
 *
 * Contact: [email protected]
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */

package com.finbourne.luminesce.model;

import java.util.Objects;
import com.finbourne.luminesce.model.Link;
import com.google.gson.TypeAdapter;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.annotations.SerializedName;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import java.io.IOException;
import java.util.Arrays;
import org.openapitools.jackson.nullable.JsonNullable;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonArray;
import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParseException;
import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import com.google.gson.TypeAdapter;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import java.io.IOException;

import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;

import com.finbourne.luminesce.JSON;

/**
 * Response for Background Query Start requests
 */
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class BackgroundQueryResponse {
  public static final String SERIALIZED_NAME_EXECUTION_ID = "executionId";
  @SerializedName(SERIALIZED_NAME_EXECUTION_ID)
  private String executionId;

  public static final String SERIALIZED_NAME_PROGRESS = "progress";
  @SerializedName(SERIALIZED_NAME_PROGRESS)
  private Link progress;

  public static final String SERIALIZED_NAME_CANCEL = "cancel";
  @SerializedName(SERIALIZED_NAME_CANCEL)
  private Link cancel;

  public static final String SERIALIZED_NAME_FETCH_JSON = "fetchJson";
  @SerializedName(SERIALIZED_NAME_FETCH_JSON)
  private Link fetchJson;

  public static final String SERIALIZED_NAME_FETCH_JSON_PROPER = "fetchJsonProper";
  @SerializedName(SERIALIZED_NAME_FETCH_JSON_PROPER)
  private Link fetchJsonProper;

  public static final String SERIALIZED_NAME_FETCH_XML = "fetchXml";
  @SerializedName(SERIALIZED_NAME_FETCH_XML)
  private Link fetchXml;

  public static final String SERIALIZED_NAME_FETCH_PARQUET = "fetchParquet";
  @SerializedName(SERIALIZED_NAME_FETCH_PARQUET)
  private Link fetchParquet;

  public static final String SERIALIZED_NAME_FETCH_CSV = "fetchCsv";
  @SerializedName(SERIALIZED_NAME_FETCH_CSV)
  private Link fetchCsv;

  public static final String SERIALIZED_NAME_FETCH_PIPE = "fetchPipe";
  @SerializedName(SERIALIZED_NAME_FETCH_PIPE)
  private Link fetchPipe;

  public static final String SERIALIZED_NAME_FETCH_EXCEL = "fetchExcel";
  @SerializedName(SERIALIZED_NAME_FETCH_EXCEL)
  private Link fetchExcel;

  public static final String SERIALIZED_NAME_FETCH_SQLITE = "fetchSqlite";
  @SerializedName(SERIALIZED_NAME_FETCH_SQLITE)
  private Link fetchSqlite;

  public static final String SERIALIZED_NAME_HISTOGRAM = "histogram";
  @SerializedName(SERIALIZED_NAME_HISTOGRAM)
  private Link histogram;

  public BackgroundQueryResponse() {
  }

  public BackgroundQueryResponse executionId(String executionId) {
    
    this.executionId = executionId;
    return this;
  }

   /**
   * ExecutionId of the started-query
   * @return executionId
  **/
  @jakarta.annotation.Nullable
  public String getExecutionId() {
    return executionId;
  }


  public void setExecutionId(String executionId) {
    this.executionId = executionId;
  }


  public BackgroundQueryResponse progress(Link progress) {
    
    this.progress = progress;
    return this;
  }

   /**
   * Get progress
   * @return progress
  **/
  @jakarta.annotation.Nullable
  public Link getProgress() {
    return progress;
  }


  public void setProgress(Link progress) {
    this.progress = progress;
  }


  public BackgroundQueryResponse cancel(Link cancel) {
    
    this.cancel = cancel;
    return this;
  }

   /**
   * Get cancel
   * @return cancel
  **/
  @jakarta.annotation.Nullable
  public Link getCancel() {
    return cancel;
  }


  public void setCancel(Link cancel) {
    this.cancel = cancel;
  }


  public BackgroundQueryResponse fetchJson(Link fetchJson) {
    
    this.fetchJson = fetchJson;
    return this;
  }

   /**
   * Get fetchJson
   * @return fetchJson
  **/
  @jakarta.annotation.Nullable
  public Link getFetchJson() {
    return fetchJson;
  }


  public void setFetchJson(Link fetchJson) {
    this.fetchJson = fetchJson;
  }


  public BackgroundQueryResponse fetchJsonProper(Link fetchJsonProper) {
    
    this.fetchJsonProper = fetchJsonProper;
    return this;
  }

   /**
   * Get fetchJsonProper
   * @return fetchJsonProper
  **/
  @jakarta.annotation.Nullable
  public Link getFetchJsonProper() {
    return fetchJsonProper;
  }


  public void setFetchJsonProper(Link fetchJsonProper) {
    this.fetchJsonProper = fetchJsonProper;
  }


  public BackgroundQueryResponse fetchXml(Link fetchXml) {
    
    this.fetchXml = fetchXml;
    return this;
  }

   /**
   * Get fetchXml
   * @return fetchXml
  **/
  @jakarta.annotation.Nullable
  public Link getFetchXml() {
    return fetchXml;
  }


  public void setFetchXml(Link fetchXml) {
    this.fetchXml = fetchXml;
  }


  public BackgroundQueryResponse fetchParquet(Link fetchParquet) {
    
    this.fetchParquet = fetchParquet;
    return this;
  }

   /**
   * Get fetchParquet
   * @return fetchParquet
  **/
  @jakarta.annotation.Nullable
  public Link getFetchParquet() {
    return fetchParquet;
  }


  public void setFetchParquet(Link fetchParquet) {
    this.fetchParquet = fetchParquet;
  }


  public BackgroundQueryResponse fetchCsv(Link fetchCsv) {
    
    this.fetchCsv = fetchCsv;
    return this;
  }

   /**
   * Get fetchCsv
   * @return fetchCsv
  **/
  @jakarta.annotation.Nullable
  public Link getFetchCsv() {
    return fetchCsv;
  }


  public void setFetchCsv(Link fetchCsv) {
    this.fetchCsv = fetchCsv;
  }


  public BackgroundQueryResponse fetchPipe(Link fetchPipe) {
    
    this.fetchPipe = fetchPipe;
    return this;
  }

   /**
   * Get fetchPipe
   * @return fetchPipe
  **/
  @jakarta.annotation.Nullable
  public Link getFetchPipe() {
    return fetchPipe;
  }


  public void setFetchPipe(Link fetchPipe) {
    this.fetchPipe = fetchPipe;
  }


  public BackgroundQueryResponse fetchExcel(Link fetchExcel) {
    
    this.fetchExcel = fetchExcel;
    return this;
  }

   /**
   * Get fetchExcel
   * @return fetchExcel
  **/
  @jakarta.annotation.Nullable
  public Link getFetchExcel() {
    return fetchExcel;
  }


  public void setFetchExcel(Link fetchExcel) {
    this.fetchExcel = fetchExcel;
  }


  public BackgroundQueryResponse fetchSqlite(Link fetchSqlite) {
    
    this.fetchSqlite = fetchSqlite;
    return this;
  }

   /**
   * Get fetchSqlite
   * @return fetchSqlite
  **/
  @jakarta.annotation.Nullable
  public Link getFetchSqlite() {
    return fetchSqlite;
  }


  public void setFetchSqlite(Link fetchSqlite) {
    this.fetchSqlite = fetchSqlite;
  }


  public BackgroundQueryResponse histogram(Link histogram) {
    
    this.histogram = histogram;
    return this;
  }

   /**
   * Get histogram
   * @return histogram
  **/
  @jakarta.annotation.Nullable
  public Link getHistogram() {
    return histogram;
  }


  public void setHistogram(Link histogram) {
    this.histogram = histogram;
  }



  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }
    BackgroundQueryResponse backgroundQueryResponse = (BackgroundQueryResponse) o;
    return Objects.equals(this.executionId, backgroundQueryResponse.executionId) &&
        Objects.equals(this.progress, backgroundQueryResponse.progress) &&
        Objects.equals(this.cancel, backgroundQueryResponse.cancel) &&
        Objects.equals(this.fetchJson, backgroundQueryResponse.fetchJson) &&
        Objects.equals(this.fetchJsonProper, backgroundQueryResponse.fetchJsonProper) &&
        Objects.equals(this.fetchXml, backgroundQueryResponse.fetchXml) &&
        Objects.equals(this.fetchParquet, backgroundQueryResponse.fetchParquet) &&
        Objects.equals(this.fetchCsv, backgroundQueryResponse.fetchCsv) &&
        Objects.equals(this.fetchPipe, backgroundQueryResponse.fetchPipe) &&
        Objects.equals(this.fetchExcel, backgroundQueryResponse.fetchExcel) &&
        Objects.equals(this.fetchSqlite, backgroundQueryResponse.fetchSqlite) &&
        Objects.equals(this.histogram, backgroundQueryResponse.histogram);
  }

  private static  boolean equalsNullable(JsonNullable a, JsonNullable b) {
    return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get()));
  }

  @Override
  public int hashCode() {
    return Objects.hash(executionId, progress, cancel, fetchJson, fetchJsonProper, fetchXml, fetchParquet, fetchCsv, fetchPipe, fetchExcel, fetchSqlite, histogram);
  }

  private static  int hashCodeNullable(JsonNullable a) {
    if (a == null) {
      return 1;
    }
    return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31;
  }

  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("class BackgroundQueryResponse {\n");
    sb.append("    executionId: ").append(toIndentedString(executionId)).append("\n");
    sb.append("    progress: ").append(toIndentedString(progress)).append("\n");
    sb.append("    cancel: ").append(toIndentedString(cancel)).append("\n");
    sb.append("    fetchJson: ").append(toIndentedString(fetchJson)).append("\n");
    sb.append("    fetchJsonProper: ").append(toIndentedString(fetchJsonProper)).append("\n");
    sb.append("    fetchXml: ").append(toIndentedString(fetchXml)).append("\n");
    sb.append("    fetchParquet: ").append(toIndentedString(fetchParquet)).append("\n");
    sb.append("    fetchCsv: ").append(toIndentedString(fetchCsv)).append("\n");
    sb.append("    fetchPipe: ").append(toIndentedString(fetchPipe)).append("\n");
    sb.append("    fetchExcel: ").append(toIndentedString(fetchExcel)).append("\n");
    sb.append("    fetchSqlite: ").append(toIndentedString(fetchSqlite)).append("\n");
    sb.append("    histogram: ").append(toIndentedString(histogram)).append("\n");
    sb.append("}");
    return sb.toString();
  }

  /**
   * Convert the given object to string with each line indented by 4 spaces
   * (except the first line).
   */
  private String toIndentedString(Object o) {
    if (o == null) {
      return "null";
    }
    return o.toString().replace("\n", "\n    ");
  }


  public static HashSet openapiFields;
  public static HashSet openapiRequiredFields;

  static {
    // a set of all properties/fields (JSON key names)
    openapiFields = new HashSet();
    openapiFields.add("executionId");
    openapiFields.add("progress");
    openapiFields.add("cancel");
    openapiFields.add("fetchJson");
    openapiFields.add("fetchJsonProper");
    openapiFields.add("fetchXml");
    openapiFields.add("fetchParquet");
    openapiFields.add("fetchCsv");
    openapiFields.add("fetchPipe");
    openapiFields.add("fetchExcel");
    openapiFields.add("fetchSqlite");
    openapiFields.add("histogram");

    // a set of required properties/fields (JSON key names)
    openapiRequiredFields = new HashSet();
  }

 /**
  * Validates the JSON Element and throws an exception if issues found
  *
  * @param jsonElement JSON Element
  * @throws IOException if the JSON Element is invalid with respect to BackgroundQueryResponse
  */
  public static void validateJsonElement(JsonElement jsonElement) throws IOException {
      if (jsonElement == null) {
        if (!BackgroundQueryResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null
          throw new IllegalArgumentException(String.format("The required field(s) %s in BackgroundQueryResponse is not found in the empty JSON string", BackgroundQueryResponse.openapiRequiredFields.toString()));
        }
      }
        JsonObject jsonObj = jsonElement.getAsJsonObject();
      if ((jsonObj.get("executionId") != null && !jsonObj.get("executionId").isJsonNull()) && !jsonObj.get("executionId").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `executionId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("executionId").toString()));
      }
      // validate the optional field `progress`
      if (jsonObj.get("progress") != null && !jsonObj.get("progress").isJsonNull()) {
        Link.validateJsonElement(jsonObj.get("progress"));
      }
      // validate the optional field `cancel`
      if (jsonObj.get("cancel") != null && !jsonObj.get("cancel").isJsonNull()) {
        Link.validateJsonElement(jsonObj.get("cancel"));
      }
      // validate the optional field `fetchJson`
      if (jsonObj.get("fetchJson") != null && !jsonObj.get("fetchJson").isJsonNull()) {
        Link.validateJsonElement(jsonObj.get("fetchJson"));
      }
      // validate the optional field `fetchJsonProper`
      if (jsonObj.get("fetchJsonProper") != null && !jsonObj.get("fetchJsonProper").isJsonNull()) {
        Link.validateJsonElement(jsonObj.get("fetchJsonProper"));
      }
      // validate the optional field `fetchXml`
      if (jsonObj.get("fetchXml") != null && !jsonObj.get("fetchXml").isJsonNull()) {
        Link.validateJsonElement(jsonObj.get("fetchXml"));
      }
      // validate the optional field `fetchParquet`
      if (jsonObj.get("fetchParquet") != null && !jsonObj.get("fetchParquet").isJsonNull()) {
        Link.validateJsonElement(jsonObj.get("fetchParquet"));
      }
      // validate the optional field `fetchCsv`
      if (jsonObj.get("fetchCsv") != null && !jsonObj.get("fetchCsv").isJsonNull()) {
        Link.validateJsonElement(jsonObj.get("fetchCsv"));
      }
      // validate the optional field `fetchPipe`
      if (jsonObj.get("fetchPipe") != null && !jsonObj.get("fetchPipe").isJsonNull()) {
        Link.validateJsonElement(jsonObj.get("fetchPipe"));
      }
      // validate the optional field `fetchExcel`
      if (jsonObj.get("fetchExcel") != null && !jsonObj.get("fetchExcel").isJsonNull()) {
        Link.validateJsonElement(jsonObj.get("fetchExcel"));
      }
      // validate the optional field `fetchSqlite`
      if (jsonObj.get("fetchSqlite") != null && !jsonObj.get("fetchSqlite").isJsonNull()) {
        Link.validateJsonElement(jsonObj.get("fetchSqlite"));
      }
      // validate the optional field `histogram`
      if (jsonObj.get("histogram") != null && !jsonObj.get("histogram").isJsonNull()) {
        Link.validateJsonElement(jsonObj.get("histogram"));
      }
  }

  public static class CustomTypeAdapterFactory implements TypeAdapterFactory {
    @SuppressWarnings("unchecked")
    @Override
    public  TypeAdapter create(Gson gson, TypeToken type) {
       if (!BackgroundQueryResponse.class.isAssignableFrom(type.getRawType())) {
         return null; // this class only serializes 'BackgroundQueryResponse' and its subtypes
       }
       final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class);
       final TypeAdapter thisAdapter
                        = gson.getDelegateAdapter(this, TypeToken.get(BackgroundQueryResponse.class));

       return (TypeAdapter) new TypeAdapter() {
           @Override
           public void write(JsonWriter out, BackgroundQueryResponse value) throws IOException {
             JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject();
             elementAdapter.write(out, obj);
           }

           @Override
           public BackgroundQueryResponse read(JsonReader in) throws IOException {
             JsonElement jsonElement = elementAdapter.read(in);
             validateJsonElement(jsonElement);
             return thisAdapter.fromJsonTree(jsonElement);
           }

       }.nullSafe();
    }
  }

 /**
  * Create an instance of BackgroundQueryResponse given an JSON string
  *
  * @param jsonString JSON string
  * @return An instance of BackgroundQueryResponse
  * @throws IOException if the JSON string is invalid with respect to BackgroundQueryResponse
  */
  public static BackgroundQueryResponse fromJson(String jsonString) throws IOException {
    return JSON.getGson().fromJson(jsonString, BackgroundQueryResponse.class);
  }

 /**
  * Convert an instance of BackgroundQueryResponse to an JSON string
  *
  * @return JSON string
  */
  public String toJson() {
    return JSON.getGson().toJson(this);
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy