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

com.finbourne.luminesce.model.BackgroundMultiQueryResponse 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.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.UUID;
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;

/**
 * BackgroundMultiQueryResponse
 */
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class BackgroundMultiQueryResponse {
  public static final String SERIALIZED_NAME_EXECUTION_ID = "executionId";
  @SerializedName(SERIALIZED_NAME_EXECUTION_ID)
  private UUID 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 List fetchJson;

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

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

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

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

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

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

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

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

  public BackgroundMultiQueryResponse() {
  }

  
  public BackgroundMultiQueryResponse(
     UUID executionId, 
     List fetchJson, 
     List fetchJsonProper, 
     List fetchXml, 
     List fetchParquet, 
     List fetchCsv, 
     List fetchPipe, 
     List fetchExcel, 
     List fetchSqlite, 
     List histogram
  ) {
    this();
    this.executionId = executionId;
    this.fetchJson = fetchJson;
    this.fetchJsonProper = fetchJsonProper;
    this.fetchXml = fetchXml;
    this.fetchParquet = fetchParquet;
    this.fetchCsv = fetchCsv;
    this.fetchPipe = fetchPipe;
    this.fetchExcel = fetchExcel;
    this.fetchSqlite = fetchSqlite;
    this.histogram = histogram;
  }

   /**
   * Get executionId
   * @return executionId
  **/
  @jakarta.annotation.Nullable
  public UUID getExecutionId() {
    return executionId;
  }




  public BackgroundMultiQueryResponse 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 BackgroundMultiQueryResponse 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;
  }


   /**
   * Json (as a string) data request links for all of the child queries
   * @return fetchJson
  **/
  @jakarta.annotation.Nullable
  public List getFetchJson() {
    return fetchJson;
  }




   /**
   * Json-proper data request links for all of the child queries
   * @return fetchJsonProper
  **/
  @jakarta.annotation.Nullable
  public List getFetchJsonProper() {
    return fetchJsonProper;
  }




   /**
   * Xml data request links for all of the child queries
   * @return fetchXml
  **/
  @jakarta.annotation.Nullable
  public List getFetchXml() {
    return fetchXml;
  }




   /**
   * Parquet data request links for all of the child queries
   * @return fetchParquet
  **/
  @jakarta.annotation.Nullable
  public List getFetchParquet() {
    return fetchParquet;
  }




   /**
   * CSV data request links for all of the child queries
   * @return fetchCsv
  **/
  @jakarta.annotation.Nullable
  public List getFetchCsv() {
    return fetchCsv;
  }




   /**
   * Pipe delimited data request links for all of the child queries
   * @return fetchPipe
  **/
  @jakarta.annotation.Nullable
  public List getFetchPipe() {
    return fetchPipe;
  }




   /**
   * Excel workbook data request links for all of the child queries
   * @return fetchExcel
  **/
  @jakarta.annotation.Nullable
  public List getFetchExcel() {
    return fetchExcel;
  }




   /**
   * SqLite DB data request links for all of the child queries
   * @return fetchSqlite
  **/
  @jakarta.annotation.Nullable
  public List getFetchSqlite() {
    return fetchSqlite;
  }




   /**
   * Histogram links for all of the child queries
   * @return histogram
  **/
  @jakarta.annotation.Nullable
  public List getHistogram() {
    return histogram;
  }





  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }
    BackgroundMultiQueryResponse backgroundMultiQueryResponse = (BackgroundMultiQueryResponse) o;
    return Objects.equals(this.executionId, backgroundMultiQueryResponse.executionId) &&
        Objects.equals(this.progress, backgroundMultiQueryResponse.progress) &&
        Objects.equals(this.cancel, backgroundMultiQueryResponse.cancel) &&
        Objects.equals(this.fetchJson, backgroundMultiQueryResponse.fetchJson) &&
        Objects.equals(this.fetchJsonProper, backgroundMultiQueryResponse.fetchJsonProper) &&
        Objects.equals(this.fetchXml, backgroundMultiQueryResponse.fetchXml) &&
        Objects.equals(this.fetchParquet, backgroundMultiQueryResponse.fetchParquet) &&
        Objects.equals(this.fetchCsv, backgroundMultiQueryResponse.fetchCsv) &&
        Objects.equals(this.fetchPipe, backgroundMultiQueryResponse.fetchPipe) &&
        Objects.equals(this.fetchExcel, backgroundMultiQueryResponse.fetchExcel) &&
        Objects.equals(this.fetchSqlite, backgroundMultiQueryResponse.fetchSqlite) &&
        Objects.equals(this.histogram, backgroundMultiQueryResponse.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 BackgroundMultiQueryResponse {\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 BackgroundMultiQueryResponse
  */
  public static void validateJsonElement(JsonElement jsonElement) throws IOException {
      if (jsonElement == null) {
        if (!BackgroundMultiQueryResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null
          throw new IllegalArgumentException(String.format("The required field(s) %s in BackgroundMultiQueryResponse is not found in the empty JSON string", BackgroundMultiQueryResponse.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"));
      }
      if (jsonObj.get("fetchJson") != null && !jsonObj.get("fetchJson").isJsonNull()) {
        JsonArray jsonArrayfetchJson = jsonObj.getAsJsonArray("fetchJson");
        if (jsonArrayfetchJson != null) {
          // ensure the json data is an array
          if (!jsonObj.get("fetchJson").isJsonArray()) {
            throw new IllegalArgumentException(String.format("Expected the field `fetchJson` to be an array in the JSON string but got `%s`", jsonObj.get("fetchJson").toString()));
          }

          // validate the optional field `fetchJson` (array)
          for (int i = 0; i < jsonArrayfetchJson.size(); i++) {
            Link.validateJsonElement(jsonArrayfetchJson.get(i));
          };
        }
      }
      if (jsonObj.get("fetchJsonProper") != null && !jsonObj.get("fetchJsonProper").isJsonNull()) {
        JsonArray jsonArrayfetchJsonProper = jsonObj.getAsJsonArray("fetchJsonProper");
        if (jsonArrayfetchJsonProper != null) {
          // ensure the json data is an array
          if (!jsonObj.get("fetchJsonProper").isJsonArray()) {
            throw new IllegalArgumentException(String.format("Expected the field `fetchJsonProper` to be an array in the JSON string but got `%s`", jsonObj.get("fetchJsonProper").toString()));
          }

          // validate the optional field `fetchJsonProper` (array)
          for (int i = 0; i < jsonArrayfetchJsonProper.size(); i++) {
            Link.validateJsonElement(jsonArrayfetchJsonProper.get(i));
          };
        }
      }
      if (jsonObj.get("fetchXml") != null && !jsonObj.get("fetchXml").isJsonNull()) {
        JsonArray jsonArrayfetchXml = jsonObj.getAsJsonArray("fetchXml");
        if (jsonArrayfetchXml != null) {
          // ensure the json data is an array
          if (!jsonObj.get("fetchXml").isJsonArray()) {
            throw new IllegalArgumentException(String.format("Expected the field `fetchXml` to be an array in the JSON string but got `%s`", jsonObj.get("fetchXml").toString()));
          }

          // validate the optional field `fetchXml` (array)
          for (int i = 0; i < jsonArrayfetchXml.size(); i++) {
            Link.validateJsonElement(jsonArrayfetchXml.get(i));
          };
        }
      }
      if (jsonObj.get("fetchParquet") != null && !jsonObj.get("fetchParquet").isJsonNull()) {
        JsonArray jsonArrayfetchParquet = jsonObj.getAsJsonArray("fetchParquet");
        if (jsonArrayfetchParquet != null) {
          // ensure the json data is an array
          if (!jsonObj.get("fetchParquet").isJsonArray()) {
            throw new IllegalArgumentException(String.format("Expected the field `fetchParquet` to be an array in the JSON string but got `%s`", jsonObj.get("fetchParquet").toString()));
          }

          // validate the optional field `fetchParquet` (array)
          for (int i = 0; i < jsonArrayfetchParquet.size(); i++) {
            Link.validateJsonElement(jsonArrayfetchParquet.get(i));
          };
        }
      }
      if (jsonObj.get("fetchCsv") != null && !jsonObj.get("fetchCsv").isJsonNull()) {
        JsonArray jsonArrayfetchCsv = jsonObj.getAsJsonArray("fetchCsv");
        if (jsonArrayfetchCsv != null) {
          // ensure the json data is an array
          if (!jsonObj.get("fetchCsv").isJsonArray()) {
            throw new IllegalArgumentException(String.format("Expected the field `fetchCsv` to be an array in the JSON string but got `%s`", jsonObj.get("fetchCsv").toString()));
          }

          // validate the optional field `fetchCsv` (array)
          for (int i = 0; i < jsonArrayfetchCsv.size(); i++) {
            Link.validateJsonElement(jsonArrayfetchCsv.get(i));
          };
        }
      }
      if (jsonObj.get("fetchPipe") != null && !jsonObj.get("fetchPipe").isJsonNull()) {
        JsonArray jsonArrayfetchPipe = jsonObj.getAsJsonArray("fetchPipe");
        if (jsonArrayfetchPipe != null) {
          // ensure the json data is an array
          if (!jsonObj.get("fetchPipe").isJsonArray()) {
            throw new IllegalArgumentException(String.format("Expected the field `fetchPipe` to be an array in the JSON string but got `%s`", jsonObj.get("fetchPipe").toString()));
          }

          // validate the optional field `fetchPipe` (array)
          for (int i = 0; i < jsonArrayfetchPipe.size(); i++) {
            Link.validateJsonElement(jsonArrayfetchPipe.get(i));
          };
        }
      }
      if (jsonObj.get("fetchExcel") != null && !jsonObj.get("fetchExcel").isJsonNull()) {
        JsonArray jsonArrayfetchExcel = jsonObj.getAsJsonArray("fetchExcel");
        if (jsonArrayfetchExcel != null) {
          // ensure the json data is an array
          if (!jsonObj.get("fetchExcel").isJsonArray()) {
            throw new IllegalArgumentException(String.format("Expected the field `fetchExcel` to be an array in the JSON string but got `%s`", jsonObj.get("fetchExcel").toString()));
          }

          // validate the optional field `fetchExcel` (array)
          for (int i = 0; i < jsonArrayfetchExcel.size(); i++) {
            Link.validateJsonElement(jsonArrayfetchExcel.get(i));
          };
        }
      }
      if (jsonObj.get("fetchSqlite") != null && !jsonObj.get("fetchSqlite").isJsonNull()) {
        JsonArray jsonArrayfetchSqlite = jsonObj.getAsJsonArray("fetchSqlite");
        if (jsonArrayfetchSqlite != null) {
          // ensure the json data is an array
          if (!jsonObj.get("fetchSqlite").isJsonArray()) {
            throw new IllegalArgumentException(String.format("Expected the field `fetchSqlite` to be an array in the JSON string but got `%s`", jsonObj.get("fetchSqlite").toString()));
          }

          // validate the optional field `fetchSqlite` (array)
          for (int i = 0; i < jsonArrayfetchSqlite.size(); i++) {
            Link.validateJsonElement(jsonArrayfetchSqlite.get(i));
          };
        }
      }
      if (jsonObj.get("histogram") != null && !jsonObj.get("histogram").isJsonNull()) {
        JsonArray jsonArrayhistogram = jsonObj.getAsJsonArray("histogram");
        if (jsonArrayhistogram != null) {
          // ensure the json data is an array
          if (!jsonObj.get("histogram").isJsonArray()) {
            throw new IllegalArgumentException(String.format("Expected the field `histogram` to be an array in the JSON string but got `%s`", jsonObj.get("histogram").toString()));
          }

          // validate the optional field `histogram` (array)
          for (int i = 0; i < jsonArrayhistogram.size(); i++) {
            Link.validateJsonElement(jsonArrayhistogram.get(i));
          };
        }
      }
  }

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

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

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

       }.nullSafe();
    }
  }

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy