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

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

There is a newer version: 2.0.463
Show 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.finbourne.horizon.model.FileDetails;
import com.finbourne.horizon.model.RowDetails;
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.ArrayList;
import java.util.Arrays;
import java.util.List;
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;

/**
 * Completed event details
 */
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class ProcessSummary {
  public static final String SERIALIZED_NAME_END_TIME = "endTime";
  @SerializedName(SERIALIZED_NAME_END_TIME)
  private OffsetDateTime endTime;

  public static final String SERIALIZED_NAME_CATEGORY = "category";
  @SerializedName(SERIALIZED_NAME_CATEGORY)
  private String category;

  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_ROWS = "rows";
  @SerializedName(SERIALIZED_NAME_ROWS)
  private RowDetails rows;

  public static final String SERIALIZED_NAME_FILE_DETAILS = "fileDetails";
  @SerializedName(SERIALIZED_NAME_FILE_DETAILS)
  private List fileDetails;

  public ProcessSummary() {
  }

  public ProcessSummary endTime(OffsetDateTime endTime) {
    
    this.endTime = endTime;
    return this;
  }

   /**
   * 
   * @return endTime
  **/
  @jakarta.annotation.Nullable
  public OffsetDateTime getEndTime() {
    return endTime;
  }


  public void setEndTime(OffsetDateTime endTime) {
    this.endTime = endTime;
  }


  public ProcessSummary category(String category) {
    
    this.category = category;
    return this;
  }

   /**
   * 
   * @return category
  **/
  @jakarta.annotation.Nullable
  public String getCategory() {
    return category;
  }


  public void setCategory(String category) {
    this.category = category;
  }


  public ProcessSummary 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 ProcessSummary 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 ProcessSummary rows(RowDetails rows) {
    
    this.rows = rows;
    return this;
  }

   /**
   * Get rows
   * @return rows
  **/
  @jakarta.annotation.Nonnull
  public RowDetails getRows() {
    return rows;
  }


  public void setRows(RowDetails rows) {
    this.rows = rows;
  }


  public ProcessSummary fileDetails(List fileDetails) {
    
    this.fileDetails = fileDetails;
    return this;
  }

  public ProcessSummary addFileDetailsItem(FileDetails fileDetailsItem) {
    if (this.fileDetails == null) {
      this.fileDetails = new ArrayList<>();
    }
    this.fileDetails.add(fileDetailsItem);
    return this;
  }

   /**
   * 
   * @return fileDetails
  **/
  @jakarta.annotation.Nullable
  public List getFileDetails() {
    return fileDetails;
  }


  public void setFileDetails(List fileDetails) {
    this.fileDetails = fileDetails;
  }



  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }
    ProcessSummary processSummary = (ProcessSummary) o;
    return Objects.equals(this.endTime, processSummary.endTime) &&
        Objects.equals(this.category, processSummary.category) &&
        Objects.equals(this.status, processSummary.status) &&
        Objects.equals(this.message, processSummary.message) &&
        Objects.equals(this.rows, processSummary.rows) &&
        Objects.equals(this.fileDetails, processSummary.fileDetails);
  }

  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(endTime, category, status, message, rows, fileDetails);
  }

  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 ProcessSummary {\n");
    sb.append("    endTime: ").append(toIndentedString(endTime)).append("\n");
    sb.append("    category: ").append(toIndentedString(category)).append("\n");
    sb.append("    status: ").append(toIndentedString(status)).append("\n");
    sb.append("    message: ").append(toIndentedString(message)).append("\n");
    sb.append("    rows: ").append(toIndentedString(rows)).append("\n");
    sb.append("    fileDetails: ").append(toIndentedString(fileDetails)).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("endTime");
    openapiFields.add("category");
    openapiFields.add("status");
    openapiFields.add("message");
    openapiFields.add("rows");
    openapiFields.add("fileDetails");

    // a set of required properties/fields (JSON key names)
    openapiRequiredFields = new HashSet();
    openapiRequiredFields.add("status");
    openapiRequiredFields.add("message");
    openapiRequiredFields.add("rows");
  }

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

      // check to make sure all required properties/fields are present in the JSON string
      for (String requiredField : ProcessSummary.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("category") != null && !jsonObj.get("category").isJsonNull()) && !jsonObj.get("category").isJsonPrimitive()) {
        throw new IllegalArgumentException(String.format("Expected the field `category` to be a primitive type in the JSON string but got `%s`", jsonObj.get("category").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()));
      }
      // validate the required field `rows`
      RowDetails.validateJsonElement(jsonObj.get("rows"));
      if (jsonObj.get("fileDetails") != null && !jsonObj.get("fileDetails").isJsonNull()) {
        JsonArray jsonArrayfileDetails = jsonObj.getAsJsonArray("fileDetails");
        if (jsonArrayfileDetails != null) {
          // ensure the json data is an array
          if (!jsonObj.get("fileDetails").isJsonArray()) {
            throw new IllegalArgumentException(String.format("Expected the field `fileDetails` to be an array in the JSON string but got `%s`", jsonObj.get("fileDetails").toString()));
          }

          // validate the optional field `fileDetails` (array)
          for (int i = 0; i < jsonArrayfileDetails.size(); i++) {
            FileDetails.validateJsonElement(jsonArrayfileDetails.get(i));
          };
        }
      }
  }

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

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

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

       }.nullSafe();
    }
  }

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy