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

com.finbourne.horizon.model.ProcessUpdateResult Maven / Gradle / Ivy

The newest version!
/*
 * FINBOURNE Horizon 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.horizon.model;

import java.util.Objects;
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.time.OffsetDateTime;
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.horizon.JSON;

/**
 * Shows details relevant to update events for a query
 */
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class ProcessUpdateResult {
  public static final String SERIALIZED_NAME_DOMAIN = "domain";
  @SerializedName(SERIALIZED_NAME_DOMAIN)
  private String domain;

  public static final String SERIALIZED_NAME_ENTRY_ID = "entryId";
  @SerializedName(SERIALIZED_NAME_ENTRY_ID)
  private String entryId;

  public static final String SERIALIZED_NAME_PROCESS_NAME = "processName";
  @SerializedName(SERIALIZED_NAME_PROCESS_NAME)
  private String processName;

  public static final String SERIALIZED_NAME_RUN_ID = "runId";
  @SerializedName(SERIALIZED_NAME_RUN_ID)
  private String runId;

  public static final String SERIALIZED_NAME_ENTRY_DATE = "entryDate";
  @SerializedName(SERIALIZED_NAME_ENTRY_DATE)
  private OffsetDateTime entryDate;

  public static final String SERIALIZED_NAME_STATUS = "status";
  @SerializedName(SERIALIZED_NAME_STATUS)
  private String status;

  public static final String SERIALIZED_NAME_MESSAGE = "message";
  @SerializedName(SERIALIZED_NAME_MESSAGE)
  private String message;

  public static final String SERIALIZED_NAME_SCHEMA_VERSION = "schemaVersion";
  @SerializedName(SERIALIZED_NAME_SCHEMA_VERSION)
  private String schemaVersion;

  public ProcessUpdateResult() {
  }

  public ProcessUpdateResult domain(String domain) {
    
    this.domain = domain;
    return this;
  }

   /**
   * 
   * @return domain
  **/
  @jakarta.annotation.Nonnull
  public String getDomain() {
    return domain;
  }


  public void setDomain(String domain) {
    this.domain = domain;
  }


  public ProcessUpdateResult entryId(String entryId) {
    
    this.entryId = entryId;
    return this;
  }

   /**
   * 
   * @return entryId
  **/
  @jakarta.annotation.Nonnull
  public String getEntryId() {
    return entryId;
  }


  public void setEntryId(String entryId) {
    this.entryId = entryId;
  }


  public ProcessUpdateResult processName(String processName) {
    
    this.processName = processName;
    return this;
  }

   /**
   * 
   * @return processName
  **/
  @jakarta.annotation.Nonnull
  public String getProcessName() {
    return processName;
  }


  public void setProcessName(String processName) {
    this.processName = processName;
  }


  public ProcessUpdateResult runId(String runId) {
    
    this.runId = runId;
    return this;
  }

   /**
   * 
   * @return runId
  **/
  @jakarta.annotation.Nonnull
  public String getRunId() {
    return runId;
  }


  public void setRunId(String runId) {
    this.runId = runId;
  }


  public ProcessUpdateResult entryDate(OffsetDateTime entryDate) {
    
    this.entryDate = entryDate;
    return this;
  }

   /**
   * 
   * @return entryDate
  **/
  @jakarta.annotation.Nonnull
  public OffsetDateTime getEntryDate() {
    return entryDate;
  }


  public void setEntryDate(OffsetDateTime entryDate) {
    this.entryDate = entryDate;
  }


  public ProcessUpdateResult status(String status) {
    
    this.status = status;
    return this;
  }

   /**
   * 
   * @return status
  **/
  @jakarta.annotation.Nonnull
  public String getStatus() {
    return status;
  }


  public void setStatus(String status) {
    this.status = status;
  }


  public ProcessUpdateResult message(String message) {
    
    this.message = message;
    return this;
  }

   /**
   * 
   * @return message
  **/
  @jakarta.annotation.Nonnull
  public String getMessage() {
    return message;
  }


  public void setMessage(String message) {
    this.message = message;
  }


  public ProcessUpdateResult schemaVersion(String schemaVersion) {
    
    this.schemaVersion = schemaVersion;
    return this;
  }

   /**
   * 
   * @return schemaVersion
  **/
  @jakarta.annotation.Nullable
  public String getSchemaVersion() {
    return schemaVersion;
  }


  public void setSchemaVersion(String schemaVersion) {
    this.schemaVersion = schemaVersion;
  }



  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }
    ProcessUpdateResult processUpdateResult = (ProcessUpdateResult) o;
    return Objects.equals(this.domain, processUpdateResult.domain) &&
        Objects.equals(this.entryId, processUpdateResult.entryId) &&
        Objects.equals(this.processName, processUpdateResult.processName) &&
        Objects.equals(this.runId, processUpdateResult.runId) &&
        Objects.equals(this.entryDate, processUpdateResult.entryDate) &&
        Objects.equals(this.status, processUpdateResult.status) &&
        Objects.equals(this.message, processUpdateResult.message) &&
        Objects.equals(this.schemaVersion, processUpdateResult.schemaVersion);
  }

  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(domain, entryId, processName, runId, entryDate, status, message, schemaVersion);
  }

  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 ProcessUpdateResult {\n");
    sb.append("    domain: ").append(toIndentedString(domain)).append("\n");
    sb.append("    entryId: ").append(toIndentedString(entryId)).append("\n");
    sb.append("    processName: ").append(toIndentedString(processName)).append("\n");
    sb.append("    runId: ").append(toIndentedString(runId)).append("\n");
    sb.append("    entryDate: ").append(toIndentedString(entryDate)).append("\n");
    sb.append("    status: ").append(toIndentedString(status)).append("\n");
    sb.append("    message: ").append(toIndentedString(message)).append("\n");
    sb.append("    schemaVersion: ").append(toIndentedString(schemaVersion)).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("domain");
    openapiFields.add("entryId");
    openapiFields.add("processName");
    openapiFields.add("runId");
    openapiFields.add("entryDate");
    openapiFields.add("status");
    openapiFields.add("message");
    openapiFields.add("schemaVersion");

    // a set of required properties/fields (JSON key names)
    openapiRequiredFields = new HashSet();
    openapiRequiredFields.add("domain");
    openapiRequiredFields.add("entryId");
    openapiRequiredFields.add("processName");
    openapiRequiredFields.add("runId");
    openapiRequiredFields.add("entryDate");
    openapiRequiredFields.add("status");
    openapiRequiredFields.add("message");
  }

 /**
  * 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 ProcessUpdateResult
  */
  public static void validateJsonElement(JsonElement jsonElement) throws IOException {
      if (jsonElement == null) {
        if (!ProcessUpdateResult.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null
          throw new IllegalArgumentException(String.format("The required field(s) %s in ProcessUpdateResult is not found in the empty JSON string", ProcessUpdateResult.openapiRequiredFields.toString()));
        }
      }

      // check to make sure all required properties/fields are present in the JSON string
      for (String requiredField : ProcessUpdateResult.openapiRequiredFields) {
        if (jsonElement.getAsJsonObject().get(requiredField) == null) {
          throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString()));
        }
      }
        JsonObject jsonObj = jsonElement.getAsJsonObject();
      if (!jsonObj.get("domain").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `domain` to be a primitive type in the JSON string but got `%s`", jsonObj.get("domain").toString()));
      }
      if (!jsonObj.get("entryId").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `entryId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("entryId").toString()));
      }
      if (!jsonObj.get("processName").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `processName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("processName").toString()));
      }
      if (!jsonObj.get("runId").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `runId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("runId").toString()));
      }
      if (!jsonObj.get("status").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString()));
      }
      if (!jsonObj.get("message").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `message` to be a primitive type in the JSON string but got `%s`", jsonObj.get("message").toString()));
      }
      if ((jsonObj.get("schemaVersion") != null && !jsonObj.get("schemaVersion").isJsonNull()) && !jsonObj.get("schemaVersion").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `schemaVersion` to be a primitive type in the JSON string but got `%s`", jsonObj.get("schemaVersion").toString()));
      }
  }

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

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

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

       }.nullSafe();
    }
  }

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy