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

com.github.jobservice.client.model.NewJob Maven / Gradle / Ivy

The newest version!
/*
 * Job Service
 * Allows background operations to be sent to the workers, and for the operations to be tracked and controlled.  You can check the progress of operations, and request to cancel, pause, or resume them.  The primary use of this functionality is batch document processing.  The service can send work to the Batch Worker, and then track the progress of that work. 
 *
 * The version of the OpenAPI document: 1.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 com.github.jobservice.client.model;

import java.util.Objects;
import java.util.Map;
import java.util.HashMap;
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 com.github.jobservice.client.model.WorkerAction;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.github.jobservice.job.client.JSON;


/**
 * Exactly one of task and job should be specified.
 */
@JsonPropertyOrder({
  NewJob.JSON_PROPERTY_NAME,
  NewJob.JSON_PROPERTY_DESCRIPTION,
  NewJob.JSON_PROPERTY_EXTERNAL_DATA,
  NewJob.JSON_PROPERTY_TASK,
  NewJob.JSON_PROPERTY_TYPE,
  NewJob.JSON_PROPERTY_PARAMETERS,
  NewJob.JSON_PROPERTY_PREREQUISITE_JOB_IDS,
  NewJob.JSON_PROPERTY_DELAY,
  NewJob.JSON_PROPERTY_LABELS
})
@JsonTypeName("newJob")
@com.fasterxml.jackson.annotation.JsonIgnoreProperties(ignoreUnknown = true)
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-05-20T20:37:34.533041584Z[Etc/UTC]")
public class NewJob {
  public static final String JSON_PROPERTY_NAME = "name";
  private String name;

  public static final String JSON_PROPERTY_DESCRIPTION = "description";
  private String description;

  public static final String JSON_PROPERTY_EXTERNAL_DATA = "externalData";
  private String externalData;

  public static final String JSON_PROPERTY_TASK = "task";
  private WorkerAction task;

  public static final String JSON_PROPERTY_TYPE = "type";
  private String type;

  public static final String JSON_PROPERTY_PARAMETERS = "parameters";
  private Object parameters;

  public static final String JSON_PROPERTY_PREREQUISITE_JOB_IDS = "prerequisiteJobIds";
  private List prerequisiteJobIds;

  public static final String JSON_PROPERTY_DELAY = "delay";
  private Integer delay = 0;

  public static final String JSON_PROPERTY_LABELS = "labels";
  private Map labels = new HashMap<>();

  public NewJob() { 
  }

  public NewJob name(String name) {
    this.name = name;
    return this;
  }

   /**
   * The name of the job
   * @return name
  **/
  @jakarta.annotation.Nullable
  @JsonProperty(JSON_PROPERTY_NAME)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

  public String getName() {
    return name;
  }


  @JsonProperty(JSON_PROPERTY_NAME)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setName(String name) {
    this.name = name;
  }


  public NewJob description(String description) {
    this.description = description;
    return this;
  }

   /**
   * The description of the job
   * @return description
  **/
  @jakarta.annotation.Nullable
  @JsonProperty(JSON_PROPERTY_DESCRIPTION)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

  public String getDescription() {
    return description;
  }


  @JsonProperty(JSON_PROPERTY_DESCRIPTION)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setDescription(String description) {
    this.description = description;
  }


  public NewJob externalData(String externalData) {
    this.externalData = externalData;
    return this;
  }

   /**
   * DEPRECATED - Replaced by labels. External data can be associated with the job for use by other components. 
   * @return externalData
  **/
  @jakarta.annotation.Nullable
  @JsonProperty(JSON_PROPERTY_EXTERNAL_DATA)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

  public String getExternalData() {
    return externalData;
  }


  @JsonProperty(JSON_PROPERTY_EXTERNAL_DATA)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setExternalData(String externalData) {
    this.externalData = externalData;
  }


  public NewJob task(WorkerAction task) {
    this.task = task;
    return this;
  }

   /**
   * Get task
   * @return task
  **/
  @jakarta.annotation.Nullable
  @JsonProperty(JSON_PROPERTY_TASK)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

  public WorkerAction getTask() {
    return task;
  }


  @JsonProperty(JSON_PROPERTY_TASK)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setTask(WorkerAction task) {
    this.task = task;
  }


  public NewJob type(String type) {
    this.type = type;
    return this;
  }

   /**
   * Execute the job using a specific job type configured on the service.
   * @return type
  **/
  @jakarta.annotation.Nullable
  @JsonProperty(JSON_PROPERTY_TYPE)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

  public String getType() {
    return type;
  }


  @JsonProperty(JSON_PROPERTY_TYPE)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setType(String type) {
    this.type = type;
  }


  public NewJob parameters(Object parameters) {
    this.parameters = parameters;
    return this;
  }

   /**
   * Input to the selected job type.
   * @return parameters
  **/
  @jakarta.annotation.Nullable
  @JsonProperty(JSON_PROPERTY_PARAMETERS)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

  public Object getParameters() {
    return parameters;
  }


  @JsonProperty(JSON_PROPERTY_PARAMETERS)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setParameters(Object parameters) {
    this.parameters = parameters;
  }


  public NewJob prerequisiteJobIds(List prerequisiteJobIds) {
    this.prerequisiteJobIds = prerequisiteJobIds;
    return this;
  }

  public NewJob addPrerequisiteJobIdsItem(String prerequisiteJobIdsItem) {
    if (this.prerequisiteJobIds == null) {
      this.prerequisiteJobIds = new ArrayList<>();
    }
    this.prerequisiteJobIds.add(prerequisiteJobIdsItem);
    return this;
  }

   /**
   * List of job identifiers that must be complete prior to the start of this job.
   * @return prerequisiteJobIds
  **/
  @jakarta.annotation.Nullable
  @JsonProperty(JSON_PROPERTY_PREREQUISITE_JOB_IDS)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

  public List getPrerequisiteJobIds() {
    return prerequisiteJobIds;
  }


  @JsonProperty(JSON_PROPERTY_PREREQUISITE_JOB_IDS)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setPrerequisiteJobIds(List prerequisiteJobIds) {
    this.prerequisiteJobIds = prerequisiteJobIds;
  }


  public NewJob delay(Integer delay) {
    this.delay = delay;
    return this;
  }

   /**
   * The time in seconds after the prerequisite job identifiers have completed before this job is eligible for running.
   * @return delay
  **/
  @jakarta.annotation.Nullable
  @JsonProperty(JSON_PROPERTY_DELAY)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

  public Integer getDelay() {
    return delay;
  }


  @JsonProperty(JSON_PROPERTY_DELAY)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setDelay(Integer delay) {
    this.delay = delay;
  }


  public NewJob labels(Map labels) {
    this.labels = labels;
    return this;
  }

  public NewJob putLabelsItem(String key, String labelsItem) {
    if (this.labels == null) {
      this.labels = new HashMap<>();
    }
    this.labels.put(key, labelsItem);
    return this;
  }

   /**
   * A map of meta data associated with this job. Note that the keys can only include alphanumeric, '_', '-' and ':' characters 
   * @return labels
  **/
  @jakarta.annotation.Nullable
  @JsonProperty(JSON_PROPERTY_LABELS)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

  public Map getLabels() {
    return labels;
  }


  @JsonProperty(JSON_PROPERTY_LABELS)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setLabels(Map labels) {
    this.labels = labels;
  }


  /**
   * Return true if this newJob object is equal to o.
   */
  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }
    NewJob newJob = (NewJob) o;
    return Objects.equals(this.name, newJob.name) &&
        Objects.equals(this.description, newJob.description) &&
        Objects.equals(this.externalData, newJob.externalData) &&
        Objects.equals(this.task, newJob.task) &&
        Objects.equals(this.type, newJob.type) &&
        Objects.equals(this.parameters, newJob.parameters) &&
        Objects.equals(this.prerequisiteJobIds, newJob.prerequisiteJobIds) &&
        Objects.equals(this.delay, newJob.delay) &&
        Objects.equals(this.labels, newJob.labels);
  }

  @Override
  public int hashCode() {
    return Objects.hash(name, description, externalData, task, type, parameters, prerequisiteJobIds, delay, labels);
  }

  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("class NewJob {\n");
    sb.append("    name: ").append(toIndentedString(name)).append("\n");
    sb.append("    description: ").append(toIndentedString(description)).append("\n");
    sb.append("    externalData: ").append(toIndentedString(externalData)).append("\n");
    sb.append("    task: ").append(toIndentedString(task)).append("\n");
    sb.append("    type: ").append(toIndentedString(type)).append("\n");
    sb.append("    parameters: ").append(toIndentedString(parameters)).append("\n");
    sb.append("    prerequisiteJobIds: ").append(toIndentedString(prerequisiteJobIds)).append("\n");
    sb.append("    delay: ").append(toIndentedString(delay)).append("\n");
    sb.append("    labels: ").append(toIndentedString(labels)).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    ");
  }

}





© 2015 - 2025 Weber Informatics LLC | Privacy Policy