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

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

The newest version!
/*
 * 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.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.camunda.community.rest.client.dto.JobDefinitionQueryDtoSortingInner;
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;

/**
 * A Job definition query which defines a list of Job definitions
 */
@JsonPropertyOrder({
  JobDefinitionQueryDto.JSON_PROPERTY_JOB_DEFINITION_ID,
  JobDefinitionQueryDto.JSON_PROPERTY_ACTIVITY_ID_IN,
  JobDefinitionQueryDto.JSON_PROPERTY_PROCESS_DEFINITION_ID,
  JobDefinitionQueryDto.JSON_PROPERTY_PROCESS_DEFINITION_KEY,
  JobDefinitionQueryDto.JSON_PROPERTY_JOB_TYPE,
  JobDefinitionQueryDto.JSON_PROPERTY_JOB_CONFIGURATION,
  JobDefinitionQueryDto.JSON_PROPERTY_ACTIVE,
  JobDefinitionQueryDto.JSON_PROPERTY_SUSPENDED,
  JobDefinitionQueryDto.JSON_PROPERTY_WITH_OVERRIDING_JOB_PRIORITY,
  JobDefinitionQueryDto.JSON_PROPERTY_TENANT_ID_IN,
  JobDefinitionQueryDto.JSON_PROPERTY_WITHOUT_TENANT_ID,
  JobDefinitionQueryDto.JSON_PROPERTY_INCLUDE_JOB_DEFINITIONS_WITHOUT_TENANT_ID,
  JobDefinitionQueryDto.JSON_PROPERTY_SORTING
})
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-06-27T13:50:23.655629899Z[Etc/UTC]")
public class JobDefinitionQueryDto {
  public static final String JSON_PROPERTY_JOB_DEFINITION_ID = "jobDefinitionId";
  private JsonNullable jobDefinitionId = JsonNullable.undefined();

  public static final String JSON_PROPERTY_ACTIVITY_ID_IN = "activityIdIn";
  private JsonNullable> activityIdIn = JsonNullable.>undefined();

  public static final String JSON_PROPERTY_PROCESS_DEFINITION_ID = "processDefinitionId";
  private JsonNullable processDefinitionId = JsonNullable.undefined();

  public static final String JSON_PROPERTY_PROCESS_DEFINITION_KEY = "processDefinitionKey";
  private JsonNullable processDefinitionKey = JsonNullable.undefined();

  public static final String JSON_PROPERTY_JOB_TYPE = "jobType";
  private JsonNullable jobType = JsonNullable.undefined();

  public static final String JSON_PROPERTY_JOB_CONFIGURATION = "jobConfiguration";
  private JsonNullable jobConfiguration = JsonNullable.undefined();

  public static final String JSON_PROPERTY_ACTIVE = "active";
  private JsonNullable active = JsonNullable.undefined();

  public static final String JSON_PROPERTY_SUSPENDED = "suspended";
  private JsonNullable suspended = JsonNullable.undefined();

  public static final String JSON_PROPERTY_WITH_OVERRIDING_JOB_PRIORITY = "withOverridingJobPriority";
  private JsonNullable withOverridingJobPriority = JsonNullable.undefined();

  public static final String JSON_PROPERTY_TENANT_ID_IN = "tenantIdIn";
  private JsonNullable> tenantIdIn = JsonNullable.>undefined();

  public static final String JSON_PROPERTY_WITHOUT_TENANT_ID = "withoutTenantId";
  private JsonNullable withoutTenantId = JsonNullable.undefined();

  public static final String JSON_PROPERTY_INCLUDE_JOB_DEFINITIONS_WITHOUT_TENANT_ID = "includeJobDefinitionsWithoutTenantId";
  private JsonNullable includeJobDefinitionsWithoutTenantId = JsonNullable.undefined();

  public static final String JSON_PROPERTY_SORTING = "sorting";
  private JsonNullable> sorting = JsonNullable.>undefined();

  public JobDefinitionQueryDto() {
  }

  public JobDefinitionQueryDto jobDefinitionId(String jobDefinitionId) {
    this.jobDefinitionId = JsonNullable.of(jobDefinitionId);
    
    return this;
  }

   /**
   * Filter by job definition id.
   * @return jobDefinitionId
  **/
  @javax.annotation.Nullable
  @JsonIgnore

  public String getJobDefinitionId() {
        return jobDefinitionId.orElse(null);
  }

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

  public JsonNullable getJobDefinitionId_JsonNullable() {
    return jobDefinitionId;
  }
  
  @JsonProperty(JSON_PROPERTY_JOB_DEFINITION_ID)
  public void setJobDefinitionId_JsonNullable(JsonNullable jobDefinitionId) {
    this.jobDefinitionId = jobDefinitionId;
  }

  public void setJobDefinitionId(String jobDefinitionId) {
    this.jobDefinitionId = JsonNullable.of(jobDefinitionId);
  }


  public JobDefinitionQueryDto activityIdIn(List activityIdIn) {
    this.activityIdIn = JsonNullable.>of(activityIdIn);
    
    return this;
  }

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

   /**
   * Only include job definitions which belong to one of the passed activity ids.
   * @return activityIdIn
  **/
  @javax.annotation.Nullable
  @JsonIgnore

  public List getActivityIdIn() {
        return activityIdIn.orElse(null);
  }

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

  public JsonNullable> getActivityIdIn_JsonNullable() {
    return activityIdIn;
  }
  
  @JsonProperty(JSON_PROPERTY_ACTIVITY_ID_IN)
  public void setActivityIdIn_JsonNullable(JsonNullable> activityIdIn) {
    this.activityIdIn = activityIdIn;
  }

  public void setActivityIdIn(List activityIdIn) {
    this.activityIdIn = JsonNullable.>of(activityIdIn);
  }


  public JobDefinitionQueryDto processDefinitionId(String processDefinitionId) {
    this.processDefinitionId = JsonNullable.of(processDefinitionId);
    
    return this;
  }

   /**
   * Only include job definitions which exist for the given process definition id.
   * @return processDefinitionId
  **/
  @javax.annotation.Nullable
  @JsonIgnore

  public String getProcessDefinitionId() {
        return processDefinitionId.orElse(null);
  }

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

  public JsonNullable getProcessDefinitionId_JsonNullable() {
    return processDefinitionId;
  }
  
  @JsonProperty(JSON_PROPERTY_PROCESS_DEFINITION_ID)
  public void setProcessDefinitionId_JsonNullable(JsonNullable processDefinitionId) {
    this.processDefinitionId = processDefinitionId;
  }

  public void setProcessDefinitionId(String processDefinitionId) {
    this.processDefinitionId = JsonNullable.of(processDefinitionId);
  }


  public JobDefinitionQueryDto processDefinitionKey(String processDefinitionKey) {
    this.processDefinitionKey = JsonNullable.of(processDefinitionKey);
    
    return this;
  }

   /**
   * Only include job definitions which exist for the given process definition key.
   * @return processDefinitionKey
  **/
  @javax.annotation.Nullable
  @JsonIgnore

  public String getProcessDefinitionKey() {
        return processDefinitionKey.orElse(null);
  }

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

  public JsonNullable getProcessDefinitionKey_JsonNullable() {
    return processDefinitionKey;
  }
  
  @JsonProperty(JSON_PROPERTY_PROCESS_DEFINITION_KEY)
  public void setProcessDefinitionKey_JsonNullable(JsonNullable processDefinitionKey) {
    this.processDefinitionKey = processDefinitionKey;
  }

  public void setProcessDefinitionKey(String processDefinitionKey) {
    this.processDefinitionKey = JsonNullable.of(processDefinitionKey);
  }


  public JobDefinitionQueryDto jobType(String jobType) {
    this.jobType = JsonNullable.of(jobType);
    
    return this;
  }

   /**
   * Only include job definitions which exist for the given job type. See the [User Guide](https://docs.camunda.org/manual/7.21/user-guide/process-engine/the-job-executor/#job-creation) for more information about job types.
   * @return jobType
  **/
  @javax.annotation.Nullable
  @JsonIgnore

  public String getJobType() {
        return jobType.orElse(null);
  }

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

  public JsonNullable getJobType_JsonNullable() {
    return jobType;
  }
  
  @JsonProperty(JSON_PROPERTY_JOB_TYPE)
  public void setJobType_JsonNullable(JsonNullable jobType) {
    this.jobType = jobType;
  }

  public void setJobType(String jobType) {
    this.jobType = JsonNullable.of(jobType);
  }


  public JobDefinitionQueryDto jobConfiguration(String jobConfiguration) {
    this.jobConfiguration = JsonNullable.of(jobConfiguration);
    
    return this;
  }

   /**
   * Only include job definitions which exist for the given job configuration. For example: for timer jobs it is the timer configuration.
   * @return jobConfiguration
  **/
  @javax.annotation.Nullable
  @JsonIgnore

  public String getJobConfiguration() {
        return jobConfiguration.orElse(null);
  }

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

  public JsonNullable getJobConfiguration_JsonNullable() {
    return jobConfiguration;
  }
  
  @JsonProperty(JSON_PROPERTY_JOB_CONFIGURATION)
  public void setJobConfiguration_JsonNullable(JsonNullable jobConfiguration) {
    this.jobConfiguration = jobConfiguration;
  }

  public void setJobConfiguration(String jobConfiguration) {
    this.jobConfiguration = JsonNullable.of(jobConfiguration);
  }


  public JobDefinitionQueryDto active(Boolean active) {
    this.active = JsonNullable.of(active);
    
    return this;
  }

   /**
   * Only include active job definitions. Value may only be `true`, as `false` is the default behavior.
   * @return active
  **/
  @javax.annotation.Nullable
  @JsonIgnore

  public Boolean getActive() {
        return active.orElse(null);
  }

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

  public JsonNullable getActive_JsonNullable() {
    return active;
  }
  
  @JsonProperty(JSON_PROPERTY_ACTIVE)
  public void setActive_JsonNullable(JsonNullable active) {
    this.active = active;
  }

  public void setActive(Boolean active) {
    this.active = JsonNullable.of(active);
  }


  public JobDefinitionQueryDto suspended(Boolean suspended) {
    this.suspended = JsonNullable.of(suspended);
    
    return this;
  }

   /**
   * Only include suspended job definitions. Value may only be `true`, as `false` is the default behavior.
   * @return suspended
  **/
  @javax.annotation.Nullable
  @JsonIgnore

  public Boolean getSuspended() {
        return suspended.orElse(null);
  }

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

  public JsonNullable getSuspended_JsonNullable() {
    return suspended;
  }
  
  @JsonProperty(JSON_PROPERTY_SUSPENDED)
  public void setSuspended_JsonNullable(JsonNullable suspended) {
    this.suspended = suspended;
  }

  public void setSuspended(Boolean suspended) {
    this.suspended = JsonNullable.of(suspended);
  }


  public JobDefinitionQueryDto withOverridingJobPriority(Boolean withOverridingJobPriority) {
    this.withOverridingJobPriority = JsonNullable.of(withOverridingJobPriority);
    
    return this;
  }

   /**
   * Only include job definitions that have an overriding job priority defined. The only effective value is `true`. If set to `false`, this filter is not applied.
   * @return withOverridingJobPriority
  **/
  @javax.annotation.Nullable
  @JsonIgnore

  public Boolean getWithOverridingJobPriority() {
        return withOverridingJobPriority.orElse(null);
  }

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

  public JsonNullable getWithOverridingJobPriority_JsonNullable() {
    return withOverridingJobPriority;
  }
  
  @JsonProperty(JSON_PROPERTY_WITH_OVERRIDING_JOB_PRIORITY)
  public void setWithOverridingJobPriority_JsonNullable(JsonNullable withOverridingJobPriority) {
    this.withOverridingJobPriority = withOverridingJobPriority;
  }

  public void setWithOverridingJobPriority(Boolean withOverridingJobPriority) {
    this.withOverridingJobPriority = JsonNullable.of(withOverridingJobPriority);
  }


  public JobDefinitionQueryDto tenantIdIn(List tenantIdIn) {
    this.tenantIdIn = JsonNullable.>of(tenantIdIn);
    
    return this;
  }

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

   /**
   * Only include job definitions which belong to one of the passed tenant ids.
   * @return tenantIdIn
  **/
  @javax.annotation.Nullable
  @JsonIgnore

  public List getTenantIdIn() {
        return tenantIdIn.orElse(null);
  }

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

  public JsonNullable> getTenantIdIn_JsonNullable() {
    return tenantIdIn;
  }
  
  @JsonProperty(JSON_PROPERTY_TENANT_ID_IN)
  public void setTenantIdIn_JsonNullable(JsonNullable> tenantIdIn) {
    this.tenantIdIn = tenantIdIn;
  }

  public void setTenantIdIn(List tenantIdIn) {
    this.tenantIdIn = JsonNullable.>of(tenantIdIn);
  }


  public JobDefinitionQueryDto withoutTenantId(Boolean withoutTenantId) {
    this.withoutTenantId = JsonNullable.of(withoutTenantId);
    
    return this;
  }

   /**
   * Only include job definitions which belong to no tenant. Value may only be `true`, as `false` is the default behavior.
   * @return withoutTenantId
  **/
  @javax.annotation.Nullable
  @JsonIgnore

  public Boolean getWithoutTenantId() {
        return withoutTenantId.orElse(null);
  }

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

  public JsonNullable getWithoutTenantId_JsonNullable() {
    return withoutTenantId;
  }
  
  @JsonProperty(JSON_PROPERTY_WITHOUT_TENANT_ID)
  public void setWithoutTenantId_JsonNullable(JsonNullable withoutTenantId) {
    this.withoutTenantId = withoutTenantId;
  }

  public void setWithoutTenantId(Boolean withoutTenantId) {
    this.withoutTenantId = JsonNullable.of(withoutTenantId);
  }


  public JobDefinitionQueryDto includeJobDefinitionsWithoutTenantId(Boolean includeJobDefinitionsWithoutTenantId) {
    this.includeJobDefinitionsWithoutTenantId = JsonNullable.of(includeJobDefinitionsWithoutTenantId);
    
    return this;
  }

   /**
   * Include job definitions which belong to no tenant. Can be used in combination with `tenantIdIn`. Value may only be `true`, as `false` is the default behavior.
   * @return includeJobDefinitionsWithoutTenantId
  **/
  @javax.annotation.Nullable
  @JsonIgnore

  public Boolean getIncludeJobDefinitionsWithoutTenantId() {
        return includeJobDefinitionsWithoutTenantId.orElse(null);
  }

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

  public JsonNullable getIncludeJobDefinitionsWithoutTenantId_JsonNullable() {
    return includeJobDefinitionsWithoutTenantId;
  }
  
  @JsonProperty(JSON_PROPERTY_INCLUDE_JOB_DEFINITIONS_WITHOUT_TENANT_ID)
  public void setIncludeJobDefinitionsWithoutTenantId_JsonNullable(JsonNullable includeJobDefinitionsWithoutTenantId) {
    this.includeJobDefinitionsWithoutTenantId = includeJobDefinitionsWithoutTenantId;
  }

  public void setIncludeJobDefinitionsWithoutTenantId(Boolean includeJobDefinitionsWithoutTenantId) {
    this.includeJobDefinitionsWithoutTenantId = JsonNullable.of(includeJobDefinitionsWithoutTenantId);
  }


  public JobDefinitionQueryDto sorting(List sorting) {
    this.sorting = JsonNullable.>of(sorting);
    
    return this;
  }

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

   /**
   * An array of criteria to sort the result by. Each element of the array is                        an object that specifies one ordering. The position in the array                        identifies the rank of an ordering, i.e., whether it is primary, secondary,                        etc. Sorting has no effect for `count` endpoints.
   * @return sorting
  **/
  @javax.annotation.Nullable
  @JsonIgnore

  public List getSorting() {
        return sorting.orElse(null);
  }

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

  public JsonNullable> getSorting_JsonNullable() {
    return sorting;
  }
  
  @JsonProperty(JSON_PROPERTY_SORTING)
  public void setSorting_JsonNullable(JsonNullable> sorting) {
    this.sorting = sorting;
  }

  public void setSorting(List sorting) {
    this.sorting = JsonNullable.>of(sorting);
  }

  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }
    JobDefinitionQueryDto jobDefinitionQueryDto = (JobDefinitionQueryDto) o;
    return equalsNullable(this.jobDefinitionId, jobDefinitionQueryDto.jobDefinitionId) &&
        equalsNullable(this.activityIdIn, jobDefinitionQueryDto.activityIdIn) &&
        equalsNullable(this.processDefinitionId, jobDefinitionQueryDto.processDefinitionId) &&
        equalsNullable(this.processDefinitionKey, jobDefinitionQueryDto.processDefinitionKey) &&
        equalsNullable(this.jobType, jobDefinitionQueryDto.jobType) &&
        equalsNullable(this.jobConfiguration, jobDefinitionQueryDto.jobConfiguration) &&
        equalsNullable(this.active, jobDefinitionQueryDto.active) &&
        equalsNullable(this.suspended, jobDefinitionQueryDto.suspended) &&
        equalsNullable(this.withOverridingJobPriority, jobDefinitionQueryDto.withOverridingJobPriority) &&
        equalsNullable(this.tenantIdIn, jobDefinitionQueryDto.tenantIdIn) &&
        equalsNullable(this.withoutTenantId, jobDefinitionQueryDto.withoutTenantId) &&
        equalsNullable(this.includeJobDefinitionsWithoutTenantId, jobDefinitionQueryDto.includeJobDefinitionsWithoutTenantId) &&
        equalsNullable(this.sorting, jobDefinitionQueryDto.sorting);
  }

  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(jobDefinitionId), hashCodeNullable(activityIdIn), hashCodeNullable(processDefinitionId), hashCodeNullable(processDefinitionKey), hashCodeNullable(jobType), hashCodeNullable(jobConfiguration), hashCodeNullable(active), hashCodeNullable(suspended), hashCodeNullable(withOverridingJobPriority), hashCodeNullable(tenantIdIn), hashCodeNullable(withoutTenantId), hashCodeNullable(includeJobDefinitionsWithoutTenantId), hashCodeNullable(sorting));
  }

  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 JobDefinitionQueryDto {\n");
    sb.append("    jobDefinitionId: ").append(toIndentedString(jobDefinitionId)).append("\n");
    sb.append("    activityIdIn: ").append(toIndentedString(activityIdIn)).append("\n");
    sb.append("    processDefinitionId: ").append(toIndentedString(processDefinitionId)).append("\n");
    sb.append("    processDefinitionKey: ").append(toIndentedString(processDefinitionKey)).append("\n");
    sb.append("    jobType: ").append(toIndentedString(jobType)).append("\n");
    sb.append("    jobConfiguration: ").append(toIndentedString(jobConfiguration)).append("\n");
    sb.append("    active: ").append(toIndentedString(active)).append("\n");
    sb.append("    suspended: ").append(toIndentedString(suspended)).append("\n");
    sb.append("    withOverridingJobPriority: ").append(toIndentedString(withOverridingJobPriority)).append("\n");
    sb.append("    tenantIdIn: ").append(toIndentedString(tenantIdIn)).append("\n");
    sb.append("    withoutTenantId: ").append(toIndentedString(withoutTenantId)).append("\n");
    sb.append("    includeJobDefinitionsWithoutTenantId: ").append(toIndentedString(includeJobDefinitionsWithoutTenantId)).append("\n");
    sb.append("    sorting: ").append(toIndentedString(sorting)).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 `jobDefinitionId` to the URL query string
    if (getJobDefinitionId() != null) {
      try {
        joiner.add(String.format("%sjobDefinitionId%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getJobDefinitionId()), "UTF-8").replaceAll("\\+", "%20")));
      } catch (UnsupportedEncodingException e) {
        // Should never happen, UTF-8 is always supported
        throw new RuntimeException(e);
      }
    }

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

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

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

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

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

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

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

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

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

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

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

    // add `sorting` to the URL query string
    if (getSorting() != null) {
      for (int i = 0; i < getSorting().size(); i++) {
        if (getSorting().get(i) != null) {
          joiner.add(getSorting().get(i).toUrlQueryString(String.format("%ssorting%s%s", prefix, suffix,
              "".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix))));
        }
      }
    }

    return joiner.toString();
  }

}





© 2015 - 2025 Weber Informatics LLC | Privacy Policy