com.finbourne.horizon.model.ProcessInformation 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.finbourne.horizon.model.ProcessSummary;
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;
/**
* Required information for each process
*/
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class ProcessInformation {
public static final String SERIALIZED_NAME_DOMAIN = "domain";
@SerializedName(SERIALIZED_NAME_DOMAIN)
private String domain;
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_START_TIME = "startTime";
@SerializedName(SERIALIZED_NAME_START_TIME)
private OffsetDateTime startTime;
public static final String SERIALIZED_NAME_DATA_ACTION = "dataAction";
@SerializedName(SERIALIZED_NAME_DATA_ACTION)
private String dataAction;
public static final String SERIALIZED_NAME_SCHEMA_VERSION = "schemaVersion";
@SerializedName(SERIALIZED_NAME_SCHEMA_VERSION)
private String schemaVersion;
public static final String SERIALIZED_NAME_USER_ID = "userId";
@SerializedName(SERIALIZED_NAME_USER_ID)
private String userId;
public static final String SERIALIZED_NAME_PROCESS_SUMMARY = "processSummary";
@SerializedName(SERIALIZED_NAME_PROCESS_SUMMARY)
private ProcessSummary processSummary;
public ProcessInformation() {
}
public ProcessInformation 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 ProcessInformation 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 ProcessInformation 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 ProcessInformation startTime(OffsetDateTime startTime) {
this.startTime = startTime;
return this;
}
/**
*
* @return startTime
**/
@jakarta.annotation.Nonnull
public OffsetDateTime getStartTime() {
return startTime;
}
public void setStartTime(OffsetDateTime startTime) {
this.startTime = startTime;
}
public ProcessInformation dataAction(String dataAction) {
this.dataAction = dataAction;
return this;
}
/**
*
* @return dataAction
**/
@jakarta.annotation.Nonnull
public String getDataAction() {
return dataAction;
}
public void setDataAction(String dataAction) {
this.dataAction = dataAction;
}
public ProcessInformation 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;
}
public ProcessInformation userId(String userId) {
this.userId = userId;
return this;
}
/**
*
* @return userId
**/
@jakarta.annotation.Nonnull
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public ProcessInformation processSummary(ProcessSummary processSummary) {
this.processSummary = processSummary;
return this;
}
/**
* Get processSummary
* @return processSummary
**/
@jakarta.annotation.Nullable
public ProcessSummary getProcessSummary() {
return processSummary;
}
public void setProcessSummary(ProcessSummary processSummary) {
this.processSummary = processSummary;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
ProcessInformation processInformation = (ProcessInformation) o;
return Objects.equals(this.domain, processInformation.domain) &&
Objects.equals(this.processName, processInformation.processName) &&
Objects.equals(this.runId, processInformation.runId) &&
Objects.equals(this.startTime, processInformation.startTime) &&
Objects.equals(this.dataAction, processInformation.dataAction) &&
Objects.equals(this.schemaVersion, processInformation.schemaVersion) &&
Objects.equals(this.userId, processInformation.userId) &&
Objects.equals(this.processSummary, processInformation.processSummary);
}
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, processName, runId, startTime, dataAction, schemaVersion, userId, processSummary);
}
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 ProcessInformation {\n");
sb.append(" domain: ").append(toIndentedString(domain)).append("\n");
sb.append(" processName: ").append(toIndentedString(processName)).append("\n");
sb.append(" runId: ").append(toIndentedString(runId)).append("\n");
sb.append(" startTime: ").append(toIndentedString(startTime)).append("\n");
sb.append(" dataAction: ").append(toIndentedString(dataAction)).append("\n");
sb.append(" schemaVersion: ").append(toIndentedString(schemaVersion)).append("\n");
sb.append(" userId: ").append(toIndentedString(userId)).append("\n");
sb.append(" processSummary: ").append(toIndentedString(processSummary)).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("processName");
openapiFields.add("runId");
openapiFields.add("startTime");
openapiFields.add("dataAction");
openapiFields.add("schemaVersion");
openapiFields.add("userId");
openapiFields.add("processSummary");
// a set of required properties/fields (JSON key names)
openapiRequiredFields = new HashSet();
openapiRequiredFields.add("domain");
openapiRequiredFields.add("processName");
openapiRequiredFields.add("runId");
openapiRequiredFields.add("startTime");
openapiRequiredFields.add("dataAction");
openapiRequiredFields.add("userId");
}
/**
* 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 ProcessInformation
*/
public static void validateJsonElement(JsonElement jsonElement) throws IOException {
if (jsonElement == null) {
if (!ProcessInformation.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null
throw new IllegalArgumentException(String.format("The required field(s) %s in ProcessInformation is not found in the empty JSON string", ProcessInformation.openapiRequiredFields.toString()));
}
}
// check to make sure all required properties/fields are present in the JSON string
for (String requiredField : ProcessInformation.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("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("dataAction").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `dataAction` to be a primitive type in the JSON string but got `%s`", jsonObj.get("dataAction").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()));
}
if (!jsonObj.get("userId").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `userId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("userId").toString()));
}
// validate the optional field `processSummary`
if (jsonObj.get("processSummary") != null && !jsonObj.get("processSummary").isJsonNull()) {
ProcessSummary.validateJsonElement(jsonObj.get("processSummary"));
}
}
public static class CustomTypeAdapterFactory implements TypeAdapterFactory {
@SuppressWarnings("unchecked")
@Override
public TypeAdapter create(Gson gson, TypeToken type) {
if (!ProcessInformation.class.isAssignableFrom(type.getRawType())) {
return null; // this class only serializes 'ProcessInformation' and its subtypes
}
final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class);
final TypeAdapter thisAdapter
= gson.getDelegateAdapter(this, TypeToken.get(ProcessInformation.class));
return (TypeAdapter) new TypeAdapter() {
@Override
public void write(JsonWriter out, ProcessInformation value) throws IOException {
JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject();
elementAdapter.write(out, obj);
}
@Override
public ProcessInformation read(JsonReader in) throws IOException {
JsonElement jsonElement = elementAdapter.read(in);
validateJsonElement(jsonElement);
return thisAdapter.fromJsonTree(jsonElement);
}
}.nullSafe();
}
}
/**
* Create an instance of ProcessInformation given an JSON string
*
* @param jsonString JSON string
* @return An instance of ProcessInformation
* @throws IOException if the JSON string is invalid with respect to ProcessInformation
*/
public static ProcessInformation fromJson(String jsonString) throws IOException {
return JSON.getGson().fromJson(jsonString, ProcessInformation.class);
}
/**
* Convert an instance of ProcessInformation to an JSON string
*
* @return JSON string
*/
public String toJson() {
return JSON.getGson().toJson(this);
}
}