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

org.camunda.community.rest.client.dto.CalledProcessDefinitionDto 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.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;

/**
 * CalledProcessDefinitionDto
 */
@JsonPropertyOrder({
  CalledProcessDefinitionDto.JSON_PROPERTY_ID,
  CalledProcessDefinitionDto.JSON_PROPERTY_KEY,
  CalledProcessDefinitionDto.JSON_PROPERTY_CATEGORY,
  CalledProcessDefinitionDto.JSON_PROPERTY_DESCRIPTION,
  CalledProcessDefinitionDto.JSON_PROPERTY_NAME,
  CalledProcessDefinitionDto.JSON_PROPERTY_VERSION,
  CalledProcessDefinitionDto.JSON_PROPERTY_RESOURCE,
  CalledProcessDefinitionDto.JSON_PROPERTY_DEPLOYMENT_ID,
  CalledProcessDefinitionDto.JSON_PROPERTY_DIAGRAM,
  CalledProcessDefinitionDto.JSON_PROPERTY_SUSPENDED,
  CalledProcessDefinitionDto.JSON_PROPERTY_TENANT_ID,
  CalledProcessDefinitionDto.JSON_PROPERTY_VERSION_TAG,
  CalledProcessDefinitionDto.JSON_PROPERTY_HISTORY_TIME_TO_LIVE,
  CalledProcessDefinitionDto.JSON_PROPERTY_STARTABLE_IN_TASKLIST,
  CalledProcessDefinitionDto.JSON_PROPERTY_CALLED_FROM_ACTIVITY_IDS,
  CalledProcessDefinitionDto.JSON_PROPERTY_CALLING_PROCESS_DEFINITION_ID
})
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-06-27T13:50:23.655629899Z[Etc/UTC]")
public class CalledProcessDefinitionDto {
  public static final String JSON_PROPERTY_ID = "id";
  private JsonNullable id = JsonNullable.undefined();

  public static final String JSON_PROPERTY_KEY = "key";
  private JsonNullable key = JsonNullable.undefined();

  public static final String JSON_PROPERTY_CATEGORY = "category";
  private JsonNullable category = JsonNullable.undefined();

  public static final String JSON_PROPERTY_DESCRIPTION = "description";
  private JsonNullable description = JsonNullable.undefined();

  public static final String JSON_PROPERTY_NAME = "name";
  private JsonNullable name = JsonNullable.undefined();

  public static final String JSON_PROPERTY_VERSION = "version";
  private JsonNullable version = JsonNullable.undefined();

  public static final String JSON_PROPERTY_RESOURCE = "resource";
  private JsonNullable resource = JsonNullable.undefined();

  public static final String JSON_PROPERTY_DEPLOYMENT_ID = "deploymentId";
  private JsonNullable deploymentId = JsonNullable.undefined();

  public static final String JSON_PROPERTY_DIAGRAM = "diagram";
  private JsonNullable diagram = JsonNullable.undefined();

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

  public static final String JSON_PROPERTY_TENANT_ID = "tenantId";
  private JsonNullable tenantId = JsonNullable.undefined();

  public static final String JSON_PROPERTY_VERSION_TAG = "versionTag";
  private JsonNullable versionTag = JsonNullable.undefined();

  public static final String JSON_PROPERTY_HISTORY_TIME_TO_LIVE = "historyTimeToLive";
  private JsonNullable historyTimeToLive = JsonNullable.undefined();

  public static final String JSON_PROPERTY_STARTABLE_IN_TASKLIST = "startableInTasklist";
  private JsonNullable startableInTasklist = JsonNullable.undefined();

  public static final String JSON_PROPERTY_CALLED_FROM_ACTIVITY_IDS = "calledFromActivityIds";
  private JsonNullable> calledFromActivityIds = JsonNullable.>undefined();

  public static final String JSON_PROPERTY_CALLING_PROCESS_DEFINITION_ID = "callingProcessDefinitionId";
  private JsonNullable callingProcessDefinitionId = JsonNullable.undefined();

  public CalledProcessDefinitionDto() {
  }

  public CalledProcessDefinitionDto id(String id) {
    this.id = JsonNullable.of(id);
    
    return this;
  }

   /**
   * The id of the process definition
   * @return id
  **/
  @javax.annotation.Nullable
  @JsonIgnore

  public String getId() {
        return id.orElse(null);
  }

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

  public JsonNullable getId_JsonNullable() {
    return id;
  }
  
  @JsonProperty(JSON_PROPERTY_ID)
  public void setId_JsonNullable(JsonNullable id) {
    this.id = id;
  }

  public void setId(String id) {
    this.id = JsonNullable.of(id);
  }


  public CalledProcessDefinitionDto key(String key) {
    this.key = JsonNullable.of(key);
    
    return this;
  }

   /**
   * The key of the process definition, i.e., the id of the BPMN 2.0 XML process definition.
   * @return key
  **/
  @javax.annotation.Nullable
  @JsonIgnore

  public String getKey() {
        return key.orElse(null);
  }

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

  public JsonNullable getKey_JsonNullable() {
    return key;
  }
  
  @JsonProperty(JSON_PROPERTY_KEY)
  public void setKey_JsonNullable(JsonNullable key) {
    this.key = key;
  }

  public void setKey(String key) {
    this.key = JsonNullable.of(key);
  }


  public CalledProcessDefinitionDto category(String category) {
    this.category = JsonNullable.of(category);
    
    return this;
  }

   /**
   * The category of the process definition.
   * @return category
  **/
  @javax.annotation.Nullable
  @JsonIgnore

  public String getCategory() {
        return category.orElse(null);
  }

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

  public JsonNullable getCategory_JsonNullable() {
    return category;
  }
  
  @JsonProperty(JSON_PROPERTY_CATEGORY)
  public void setCategory_JsonNullable(JsonNullable category) {
    this.category = category;
  }

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


  public CalledProcessDefinitionDto description(String description) {
    this.description = JsonNullable.of(description);
    
    return this;
  }

   /**
   * The description of the process definition.
   * @return description
  **/
  @javax.annotation.Nullable
  @JsonIgnore

  public String getDescription() {
        return description.orElse(null);
  }

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

  public JsonNullable getDescription_JsonNullable() {
    return description;
  }
  
  @JsonProperty(JSON_PROPERTY_DESCRIPTION)
  public void setDescription_JsonNullable(JsonNullable description) {
    this.description = description;
  }

  public void setDescription(String description) {
    this.description = JsonNullable.of(description);
  }


  public CalledProcessDefinitionDto name(String name) {
    this.name = JsonNullable.of(name);
    
    return this;
  }

   /**
   * The name of the process definition.
   * @return name
  **/
  @javax.annotation.Nullable
  @JsonIgnore

  public String getName() {
        return name.orElse(null);
  }

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

  public JsonNullable getName_JsonNullable() {
    return name;
  }
  
  @JsonProperty(JSON_PROPERTY_NAME)
  public void setName_JsonNullable(JsonNullable name) {
    this.name = name;
  }

  public void setName(String name) {
    this.name = JsonNullable.of(name);
  }


  public CalledProcessDefinitionDto version(Integer version) {
    this.version = JsonNullable.of(version);
    
    return this;
  }

   /**
   * The version of the process definition that the engine assigned to it.
   * @return version
  **/
  @javax.annotation.Nullable
  @JsonIgnore

  public Integer getVersion() {
        return version.orElse(null);
  }

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

  public JsonNullable getVersion_JsonNullable() {
    return version;
  }
  
  @JsonProperty(JSON_PROPERTY_VERSION)
  public void setVersion_JsonNullable(JsonNullable version) {
    this.version = version;
  }

  public void setVersion(Integer version) {
    this.version = JsonNullable.of(version);
  }


  public CalledProcessDefinitionDto resource(String resource) {
    this.resource = JsonNullable.of(resource);
    
    return this;
  }

   /**
   * The file name of the process definition.
   * @return resource
  **/
  @javax.annotation.Nullable
  @JsonIgnore

  public String getResource() {
        return resource.orElse(null);
  }

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

  public JsonNullable getResource_JsonNullable() {
    return resource;
  }
  
  @JsonProperty(JSON_PROPERTY_RESOURCE)
  public void setResource_JsonNullable(JsonNullable resource) {
    this.resource = resource;
  }

  public void setResource(String resource) {
    this.resource = JsonNullable.of(resource);
  }


  public CalledProcessDefinitionDto deploymentId(String deploymentId) {
    this.deploymentId = JsonNullable.of(deploymentId);
    
    return this;
  }

   /**
   * The deployment id of the process definition.
   * @return deploymentId
  **/
  @javax.annotation.Nullable
  @JsonIgnore

  public String getDeploymentId() {
        return deploymentId.orElse(null);
  }

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

  public JsonNullable getDeploymentId_JsonNullable() {
    return deploymentId;
  }
  
  @JsonProperty(JSON_PROPERTY_DEPLOYMENT_ID)
  public void setDeploymentId_JsonNullable(JsonNullable deploymentId) {
    this.deploymentId = deploymentId;
  }

  public void setDeploymentId(String deploymentId) {
    this.deploymentId = JsonNullable.of(deploymentId);
  }


  public CalledProcessDefinitionDto diagram(String diagram) {
    this.diagram = JsonNullable.of(diagram);
    
    return this;
  }

   /**
   * The file name of the process definition diagram, if it exists.
   * @return diagram
  **/
  @javax.annotation.Nullable
  @JsonIgnore

  public String getDiagram() {
        return diagram.orElse(null);
  }

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

  public JsonNullable getDiagram_JsonNullable() {
    return diagram;
  }
  
  @JsonProperty(JSON_PROPERTY_DIAGRAM)
  public void setDiagram_JsonNullable(JsonNullable diagram) {
    this.diagram = diagram;
  }

  public void setDiagram(String diagram) {
    this.diagram = JsonNullable.of(diagram);
  }


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

   /**
   * A flag indicating whether the definition is suspended or not.
   * @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 CalledProcessDefinitionDto tenantId(String tenantId) {
    this.tenantId = JsonNullable.of(tenantId);
    
    return this;
  }

   /**
   * The tenant id of the process definition.
   * @return tenantId
  **/
  @javax.annotation.Nullable
  @JsonIgnore

  public String getTenantId() {
        return tenantId.orElse(null);
  }

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

  public JsonNullable getTenantId_JsonNullable() {
    return tenantId;
  }
  
  @JsonProperty(JSON_PROPERTY_TENANT_ID)
  public void setTenantId_JsonNullable(JsonNullable tenantId) {
    this.tenantId = tenantId;
  }

  public void setTenantId(String tenantId) {
    this.tenantId = JsonNullable.of(tenantId);
  }


  public CalledProcessDefinitionDto versionTag(String versionTag) {
    this.versionTag = JsonNullable.of(versionTag);
    
    return this;
  }

   /**
   * The version tag of the process definition.
   * @return versionTag
  **/
  @javax.annotation.Nullable
  @JsonIgnore

  public String getVersionTag() {
        return versionTag.orElse(null);
  }

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

  public JsonNullable getVersionTag_JsonNullable() {
    return versionTag;
  }
  
  @JsonProperty(JSON_PROPERTY_VERSION_TAG)
  public void setVersionTag_JsonNullable(JsonNullable versionTag) {
    this.versionTag = versionTag;
  }

  public void setVersionTag(String versionTag) {
    this.versionTag = JsonNullable.of(versionTag);
  }


  public CalledProcessDefinitionDto historyTimeToLive(Integer historyTimeToLive) {
    this.historyTimeToLive = JsonNullable.of(historyTimeToLive);
    
    return this;
  }

   /**
   * History time to live value of the process definition. Is used within [History cleanup](https://docs.camunda.org/manual/7.21/user-guide/process-engine/history/#history-cleanup).
   * minimum: 0
   * @return historyTimeToLive
  **/
  @javax.annotation.Nullable
  @JsonIgnore

  public Integer getHistoryTimeToLive() {
        return historyTimeToLive.orElse(null);
  }

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

  public JsonNullable getHistoryTimeToLive_JsonNullable() {
    return historyTimeToLive;
  }
  
  @JsonProperty(JSON_PROPERTY_HISTORY_TIME_TO_LIVE)
  public void setHistoryTimeToLive_JsonNullable(JsonNullable historyTimeToLive) {
    this.historyTimeToLive = historyTimeToLive;
  }

  public void setHistoryTimeToLive(Integer historyTimeToLive) {
    this.historyTimeToLive = JsonNullable.of(historyTimeToLive);
  }


  public CalledProcessDefinitionDto startableInTasklist(Boolean startableInTasklist) {
    this.startableInTasklist = JsonNullable.of(startableInTasklist);
    
    return this;
  }

   /**
   * A flag indicating whether the process definition is startable in Tasklist or not.
   * @return startableInTasklist
  **/
  @javax.annotation.Nullable
  @JsonIgnore

  public Boolean getStartableInTasklist() {
        return startableInTasklist.orElse(null);
  }

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

  public JsonNullable getStartableInTasklist_JsonNullable() {
    return startableInTasklist;
  }
  
  @JsonProperty(JSON_PROPERTY_STARTABLE_IN_TASKLIST)
  public void setStartableInTasklist_JsonNullable(JsonNullable startableInTasklist) {
    this.startableInTasklist = startableInTasklist;
  }

  public void setStartableInTasklist(Boolean startableInTasklist) {
    this.startableInTasklist = JsonNullable.of(startableInTasklist);
  }


  public CalledProcessDefinitionDto calledFromActivityIds(List calledFromActivityIds) {
    this.calledFromActivityIds = JsonNullable.>of(calledFromActivityIds);
    
    return this;
  }

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

   /**
   * Ids of the CallActivities which call this process.
   * @return calledFromActivityIds
  **/
  @javax.annotation.Nullable
  @JsonIgnore

  public List getCalledFromActivityIds() {
        return calledFromActivityIds.orElse(null);
  }

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

  public JsonNullable> getCalledFromActivityIds_JsonNullable() {
    return calledFromActivityIds;
  }
  
  @JsonProperty(JSON_PROPERTY_CALLED_FROM_ACTIVITY_IDS)
  public void setCalledFromActivityIds_JsonNullable(JsonNullable> calledFromActivityIds) {
    this.calledFromActivityIds = calledFromActivityIds;
  }

  public void setCalledFromActivityIds(List calledFromActivityIds) {
    this.calledFromActivityIds = JsonNullable.>of(calledFromActivityIds);
  }


  public CalledProcessDefinitionDto callingProcessDefinitionId(String callingProcessDefinitionId) {
    this.callingProcessDefinitionId = JsonNullable.of(callingProcessDefinitionId);
    
    return this;
  }

   /**
   * The id of the calling process definition
   * @return callingProcessDefinitionId
  **/
  @javax.annotation.Nullable
  @JsonIgnore

  public String getCallingProcessDefinitionId() {
        return callingProcessDefinitionId.orElse(null);
  }

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

  public JsonNullable getCallingProcessDefinitionId_JsonNullable() {
    return callingProcessDefinitionId;
  }
  
  @JsonProperty(JSON_PROPERTY_CALLING_PROCESS_DEFINITION_ID)
  public void setCallingProcessDefinitionId_JsonNullable(JsonNullable callingProcessDefinitionId) {
    this.callingProcessDefinitionId = callingProcessDefinitionId;
  }

  public void setCallingProcessDefinitionId(String callingProcessDefinitionId) {
    this.callingProcessDefinitionId = JsonNullable.of(callingProcessDefinitionId);
  }

  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }
    CalledProcessDefinitionDto calledProcessDefinitionDto = (CalledProcessDefinitionDto) o;
    return equalsNullable(this.id, calledProcessDefinitionDto.id) &&
        equalsNullable(this.key, calledProcessDefinitionDto.key) &&
        equalsNullable(this.category, calledProcessDefinitionDto.category) &&
        equalsNullable(this.description, calledProcessDefinitionDto.description) &&
        equalsNullable(this.name, calledProcessDefinitionDto.name) &&
        equalsNullable(this.version, calledProcessDefinitionDto.version) &&
        equalsNullable(this.resource, calledProcessDefinitionDto.resource) &&
        equalsNullable(this.deploymentId, calledProcessDefinitionDto.deploymentId) &&
        equalsNullable(this.diagram, calledProcessDefinitionDto.diagram) &&
        equalsNullable(this.suspended, calledProcessDefinitionDto.suspended) &&
        equalsNullable(this.tenantId, calledProcessDefinitionDto.tenantId) &&
        equalsNullable(this.versionTag, calledProcessDefinitionDto.versionTag) &&
        equalsNullable(this.historyTimeToLive, calledProcessDefinitionDto.historyTimeToLive) &&
        equalsNullable(this.startableInTasklist, calledProcessDefinitionDto.startableInTasklist) &&
        equalsNullable(this.calledFromActivityIds, calledProcessDefinitionDto.calledFromActivityIds) &&
        equalsNullable(this.callingProcessDefinitionId, calledProcessDefinitionDto.callingProcessDefinitionId);
  }

  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(id), hashCodeNullable(key), hashCodeNullable(category), hashCodeNullable(description), hashCodeNullable(name), hashCodeNullable(version), hashCodeNullable(resource), hashCodeNullable(deploymentId), hashCodeNullable(diagram), hashCodeNullable(suspended), hashCodeNullable(tenantId), hashCodeNullable(versionTag), hashCodeNullable(historyTimeToLive), hashCodeNullable(startableInTasklist), hashCodeNullable(calledFromActivityIds), hashCodeNullable(callingProcessDefinitionId));
  }

  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 CalledProcessDefinitionDto {\n");
    sb.append("    id: ").append(toIndentedString(id)).append("\n");
    sb.append("    key: ").append(toIndentedString(key)).append("\n");
    sb.append("    category: ").append(toIndentedString(category)).append("\n");
    sb.append("    description: ").append(toIndentedString(description)).append("\n");
    sb.append("    name: ").append(toIndentedString(name)).append("\n");
    sb.append("    version: ").append(toIndentedString(version)).append("\n");
    sb.append("    resource: ").append(toIndentedString(resource)).append("\n");
    sb.append("    deploymentId: ").append(toIndentedString(deploymentId)).append("\n");
    sb.append("    diagram: ").append(toIndentedString(diagram)).append("\n");
    sb.append("    suspended: ").append(toIndentedString(suspended)).append("\n");
    sb.append("    tenantId: ").append(toIndentedString(tenantId)).append("\n");
    sb.append("    versionTag: ").append(toIndentedString(versionTag)).append("\n");
    sb.append("    historyTimeToLive: ").append(toIndentedString(historyTimeToLive)).append("\n");
    sb.append("    startableInTasklist: ").append(toIndentedString(startableInTasklist)).append("\n");
    sb.append("    calledFromActivityIds: ").append(toIndentedString(calledFromActivityIds)).append("\n");
    sb.append("    callingProcessDefinitionId: ").append(toIndentedString(callingProcessDefinitionId)).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 `id` to the URL query string
    if (getId() != null) {
      try {
        joiner.add(String.format("%sid%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getId()), "UTF-8").replaceAll("\\+", "%20")));
      } catch (UnsupportedEncodingException e) {
        // Should never happen, UTF-8 is always supported
        throw new RuntimeException(e);
      }
    }

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

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

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

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

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

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

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

    // add `diagram` to the URL query string
    if (getDiagram() != null) {
      try {
        joiner.add(String.format("%sdiagram%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getDiagram()), "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 `tenantId` to the URL query string
    if (getTenantId() != null) {
      try {
        joiner.add(String.format("%stenantId%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getTenantId()), "UTF-8").replaceAll("\\+", "%20")));
      } catch (UnsupportedEncodingException e) {
        // Should never happen, UTF-8 is always supported
        throw new RuntimeException(e);
      }
    }

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

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

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

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

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

    return joiner.toString();
  }

}





© 2015 - 2025 Weber Informatics LLC | Privacy Policy