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

org.camunda.community.rest.client.dto.SetJobRetriesDto Maven / Gradle / Ivy

/*
 * Camunda Platform REST API
 * OpenApi Spec for Camunda Platform REST API.
 *
 * The version of the OpenAPI document: 7.21.0
 * 
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */


package org.camunda.community.rest.client.dto;

import java.util.Objects;
import java.util.Arrays;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import java.time.OffsetDateTime;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.camunda.community.rest.client.dto.JobQueryDto;
import org.openapitools.jackson.nullable.JsonNullable;
import com.fasterxml.jackson.annotation.JsonIgnore;
import org.openapitools.jackson.nullable.JsonNullable;
import java.util.NoSuchElementException;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.annotation.JsonTypeName;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.StringJoiner;

/**
 * SetJobRetriesDto
 */
@JsonPropertyOrder({
  SetJobRetriesDto.JSON_PROPERTY_DUE_DATE,
  SetJobRetriesDto.JSON_PROPERTY_RETRIES,
  SetJobRetriesDto.JSON_PROPERTY_JOB_IDS,
  SetJobRetriesDto.JSON_PROPERTY_JOB_QUERY
})
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-06-27T13:50:23.655629899Z[Etc/UTC]")
public class SetJobRetriesDto {
  public static final String JSON_PROPERTY_DUE_DATE = "dueDate";
  private JsonNullable dueDate = JsonNullable.undefined();

  public static final String JSON_PROPERTY_RETRIES = "retries";
  private JsonNullable retries = JsonNullable.undefined();

  public static final String JSON_PROPERTY_JOB_IDS = "jobIds";
  private JsonNullable> jobIds = JsonNullable.>undefined();

  public static final String JSON_PROPERTY_JOB_QUERY = "jobQuery";
  private JobQueryDto jobQuery;

  public SetJobRetriesDto() {
  }

  public SetJobRetriesDto dueDate(OffsetDateTime dueDate) {
    this.dueDate = JsonNullable.of(dueDate);
    
    return this;
  }

   /**
   * The due date to set for the job. A due date indicates when this job is ready for execution. Jobs with due dates in the past will be scheduled for execution.
   * @return dueDate
  **/
  @javax.annotation.Nullable
  @JsonIgnore

  public OffsetDateTime getDueDate() {
        return dueDate.orElse(null);
  }

  @JsonProperty(JSON_PROPERTY_DUE_DATE)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

  public JsonNullable getDueDate_JsonNullable() {
    return dueDate;
  }
  
  @JsonProperty(JSON_PROPERTY_DUE_DATE)
  public void setDueDate_JsonNullable(JsonNullable dueDate) {
    this.dueDate = dueDate;
  }

  public void setDueDate(OffsetDateTime dueDate) {
    this.dueDate = JsonNullable.of(dueDate);
  }


  public SetJobRetriesDto retries(Integer retries) {
    this.retries = JsonNullable.of(retries);
    
    return this;
  }

   /**
   * The number of retries to set for the resource.  Must be >= 0. If this is 0, an incident is created and the task, or job, cannot be fetched, or acquired anymore unless the retries are increased again. Can not be null.
   * @return retries
  **/
  @javax.annotation.Nullable
  @JsonIgnore

  public Integer getRetries() {
        return retries.orElse(null);
  }

  @JsonProperty(JSON_PROPERTY_RETRIES)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

  public JsonNullable getRetries_JsonNullable() {
    return retries;
  }
  
  @JsonProperty(JSON_PROPERTY_RETRIES)
  public void setRetries_JsonNullable(JsonNullable retries) {
    this.retries = retries;
  }

  public void setRetries(Integer retries) {
    this.retries = JsonNullable.of(retries);
  }


  public SetJobRetriesDto jobIds(List jobIds) {
    this.jobIds = JsonNullable.>of(jobIds);
    
    return this;
  }

  public SetJobRetriesDto addJobIdsItem(String jobIdsItem) {
    if (this.jobIds == null || !this.jobIds.isPresent()) {
      this.jobIds = JsonNullable.>of(new ArrayList<>());
    }
    try {
      this.jobIds.get().add(jobIdsItem);
    } catch (java.util.NoSuchElementException e) {
      // this can never happen, as we make sure above that the value is present
    }
    return this;
  }

   /**
   * A list of job ids to set retries for.
   * @return jobIds
  **/
  @javax.annotation.Nullable
  @JsonIgnore

  public List getJobIds() {
        return jobIds.orElse(null);
  }

  @JsonProperty(JSON_PROPERTY_JOB_IDS)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

  public JsonNullable> getJobIds_JsonNullable() {
    return jobIds;
  }
  
  @JsonProperty(JSON_PROPERTY_JOB_IDS)
  public void setJobIds_JsonNullable(JsonNullable> jobIds) {
    this.jobIds = jobIds;
  }

  public void setJobIds(List jobIds) {
    this.jobIds = JsonNullable.>of(jobIds);
  }


  public SetJobRetriesDto jobQuery(JobQueryDto jobQuery) {
    
    this.jobQuery = jobQuery;
    return this;
  }

   /**
   * Get jobQuery
   * @return jobQuery
  **/
  @javax.annotation.Nullable
  @JsonProperty(JSON_PROPERTY_JOB_QUERY)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

  public JobQueryDto getJobQuery() {
    return jobQuery;
  }


  @JsonProperty(JSON_PROPERTY_JOB_QUERY)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setJobQuery(JobQueryDto jobQuery) {
    this.jobQuery = jobQuery;
  }

  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }
    SetJobRetriesDto setJobRetriesDto = (SetJobRetriesDto) o;
    return equalsNullable(this.dueDate, setJobRetriesDto.dueDate) &&
        equalsNullable(this.retries, setJobRetriesDto.retries) &&
        equalsNullable(this.jobIds, setJobRetriesDto.jobIds) &&
        Objects.equals(this.jobQuery, setJobRetriesDto.jobQuery);
  }

  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(hashCodeNullable(dueDate), hashCodeNullable(retries), hashCodeNullable(jobIds), jobQuery);
  }

  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 SetJobRetriesDto {\n");
    sb.append("    dueDate: ").append(toIndentedString(dueDate)).append("\n");
    sb.append("    retries: ").append(toIndentedString(retries)).append("\n");
    sb.append("    jobIds: ").append(toIndentedString(jobIds)).append("\n");
    sb.append("    jobQuery: ").append(toIndentedString(jobQuery)).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    ");
  }

  /**
   * Convert the instance into URL query string.
   *
   * @return URL query string
   */
  public String toUrlQueryString() {
    return toUrlQueryString(null);
  }

  /**
   * Convert the instance into URL query string.
   *
   * @param prefix prefix of the query string
   * @return URL query string
   */
  public String toUrlQueryString(String prefix) {
    String suffix = "";
    String containerSuffix = "";
    String containerPrefix = "";
    if (prefix == null) {
      // style=form, explode=true, e.g. /pet?name=cat&type=manx
      prefix = "";
    } else {
      // deepObject style e.g. /pet?id[name]=cat&id[type]=manx
      prefix = prefix + "[";
      suffix = "]";
      containerSuffix = "]";
      containerPrefix = "[";
    }

    StringJoiner joiner = new StringJoiner("&");

    // add `dueDate` to the URL query string
    if (getDueDate() != null) {
      try {
        joiner.add(String.format("%sdueDate%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getDueDate()), "UTF-8").replaceAll("\\+", "%20")));
      } catch (UnsupportedEncodingException e) {
        // Should never happen, UTF-8 is always supported
        throw new RuntimeException(e);
      }
    }

    // add `retries` to the URL query string
    if (getRetries() != null) {
      try {
        joiner.add(String.format("%sretries%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getRetries()), "UTF-8").replaceAll("\\+", "%20")));
      } catch (UnsupportedEncodingException e) {
        // Should never happen, UTF-8 is always supported
        throw new RuntimeException(e);
      }
    }

    // add `jobIds` to the URL query string
    if (getJobIds() != null) {
      for (int i = 0; i < getJobIds().size(); i++) {
        try {
          joiner.add(String.format("%sjobIds%s%s=%s", prefix, suffix,
              "".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix),
              URLEncoder.encode(String.valueOf(getJobIds().get(i)), "UTF-8").replaceAll("\\+", "%20")));
        } catch (UnsupportedEncodingException e) {
          // Should never happen, UTF-8 is always supported
          throw new RuntimeException(e);
        }
      }
    }

    // add `jobQuery` to the URL query string
    if (getJobQuery() != null) {
      joiner.add(getJobQuery().toUrlQueryString(prefix + "jobQuery" + suffix));
    }

    return joiner.toString();
  }

}





© 2015 - 2025 Weber Informatics LLC | Privacy Policy