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

giis.tdrules.openapi.model.TdRule Maven / Gradle / Ivy

The newest version!
/*
 * TdRules API - Test Data Coverage Evaluation
 * A set of services to evaluate the coverage of test data.  Coverage criteria are implemented in a set of rules, that when evaluated with respect to a given data store determine the coverage of the data store with respect to the query. Two kind of coverage rules are generated, Full Predicate Coverage (FPC) Rules and SQL Mutants. 
 *
 * The version of the OpenAPI document: 4.0.2
 * 
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */


package giis.tdrules.openapi.model;

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.HashMap;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.annotation.JsonTypeName;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.StringJoiner;

/**
 * Represents a single coverage rule. In RDB, this query can be executed against the database to determine if it is covered
 */
@JsonPropertyOrder({
  TdRule.JSON_PROPERTY_SUMMARY,
  TdRule.JSON_PROPERTY_ID,
  TdRule.JSON_PROPERTY_CATEGORY,
  TdRule.JSON_PROPERTY_MAINTYPE,
  TdRule.JSON_PROPERTY_SUBTYPE,
  TdRule.JSON_PROPERTY_LOCATION,
  TdRule.JSON_PROPERTY_EQUIVALENT,
  TdRule.JSON_PROPERTY_QUERY,
  TdRule.JSON_PROPERTY_DESCRIPTION,
  TdRule.JSON_PROPERTY_ERROR
})
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.7.0")
public class TdRule {
  public static final String JSON_PROPERTY_SUMMARY = "summary";
  private Map summary = new java.util.LinkedHashMap<>();

  public static final String JSON_PROPERTY_ID = "id";
  private String id = "";

  public static final String JSON_PROPERTY_CATEGORY = "category";
  private String category = "";

  public static final String JSON_PROPERTY_MAINTYPE = "maintype";
  private String maintype = "";

  public static final String JSON_PROPERTY_SUBTYPE = "subtype";
  private String subtype = "";

  public static final String JSON_PROPERTY_LOCATION = "location";
  private String location = "";

  public static final String JSON_PROPERTY_EQUIVALENT = "equivalent";
  private String equivalent = "";

  public static final String JSON_PROPERTY_QUERY = "query";
  private String query = "";

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

  public static final String JSON_PROPERTY_ERROR = "error";
  private String error = "";

  public TdRule() {
  }

  public TdRule summary(Map summary) {
    
    this.summary = summary;
    return this;
  }

  public TdRule putSummaryItem(String key, String summaryItem) {
    if (this.summary == null) {
      this.summary = new java.util.LinkedHashMap<>();
    }
    this.summary.put(key, summaryItem);
    return this;
  }

  /**
   * A map of additional properties to store information about the evaluation of the rule
   * @return summary
   */
  @javax.annotation.Nullable
  @JsonProperty(JSON_PROPERTY_SUMMARY)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

  public Map getSummary() {
    return summary;
  }


  @JsonProperty(JSON_PROPERTY_SUMMARY)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setSummary(Map summary) {
    this.summary = summary;
  }

  public TdRule id(String id) {
    
    this.id = id;
    return this;
  }

  /**
   * Unique identifier of this rule in a set of rules
   * @return id
   */
  @javax.annotation.Nullable
  @JsonProperty(JSON_PROPERTY_ID)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

  public String getId() {
    return id;
  }


  @JsonProperty(JSON_PROPERTY_ID)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setId(String id) {
    this.id = id;
  }

  public TdRule category(String category) {
    
    this.category = category;
    return this;
  }

  /**
   * Top level classification of this rule
   * @return category
   */
  @javax.annotation.Nullable
  @JsonProperty(JSON_PROPERTY_CATEGORY)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

  public String getCategory() {
    return category;
  }


  @JsonProperty(JSON_PROPERTY_CATEGORY)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setCategory(String category) {
    this.category = category;
  }

  public TdRule maintype(String maintype) {
    
    this.maintype = maintype;
    return this;
  }

  /**
   * Second level classification of this rule
   * @return maintype
   */
  @javax.annotation.Nullable
  @JsonProperty(JSON_PROPERTY_MAINTYPE)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

  public String getMaintype() {
    return maintype;
  }


  @JsonProperty(JSON_PROPERTY_MAINTYPE)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setMaintype(String maintype) {
    this.maintype = maintype;
  }

  public TdRule subtype(String subtype) {
    
    this.subtype = subtype;
    return this;
  }

  /**
   * Third level classification of this rule
   * @return subtype
   */
  @javax.annotation.Nullable
  @JsonProperty(JSON_PROPERTY_SUBTYPE)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

  public String getSubtype() {
    return subtype;
  }


  @JsonProperty(JSON_PROPERTY_SUBTYPE)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setSubtype(String subtype) {
    this.subtype = subtype;
  }

  public TdRule location(String location) {
    
    this.location = location;
    return this;
  }

  /**
   * Identification about the place of the query that has been considered to generate the rule
   * @return location
   */
  @javax.annotation.Nullable
  @JsonProperty(JSON_PROPERTY_LOCATION)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

  public String getLocation() {
    return location;
  }


  @JsonProperty(JSON_PROPERTY_LOCATION)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setLocation(String location) {
    this.location = location;
  }

  public TdRule equivalent(String equivalent) {
    
    this.equivalent = equivalent;
    return this;
  }

  /**
   * Only for mutants, indicates if this is an equivalent mutant
   * @return equivalent
   */
  @javax.annotation.Nullable
  @JsonProperty(JSON_PROPERTY_EQUIVALENT)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

  public String getEquivalent() {
    return equivalent;
  }


  @JsonProperty(JSON_PROPERTY_EQUIVALENT)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setEquivalent(String equivalent) {
    this.equivalent = equivalent;
  }

  public TdRule query(String query) {
    
    this.query = query;
    return this;
  }

  /**
   * The query expression that describes this rule
   * @return query
   */
  @javax.annotation.Nullable
  @JsonProperty(JSON_PROPERTY_QUERY)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

  public String getQuery() {
    return query;
  }


  @JsonProperty(JSON_PROPERTY_QUERY)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setQuery(String query) {
    this.query = query;
  }

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

  /**
   * An human readable textual description of what this rule represents
   * @return description
   */
  @javax.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 TdRule error(String error) {
    
    this.error = error;
    return this;
  }

  /**
   * This field can be used to store runtime errors when generating or evaluating this rule
   * @return error
   */
  @javax.annotation.Nullable
  @JsonProperty(JSON_PROPERTY_ERROR)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

  public String getError() {
    return error;
  }


  @JsonProperty(JSON_PROPERTY_ERROR)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setError(String error) {
    this.error = error;
  }

  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }
    TdRule tdRule = (TdRule) o;
    return Objects.equals(this.summary, tdRule.summary) &&
        Objects.equals(this.id, tdRule.id) &&
        Objects.equals(this.category, tdRule.category) &&
        Objects.equals(this.maintype, tdRule.maintype) &&
        Objects.equals(this.subtype, tdRule.subtype) &&
        Objects.equals(this.location, tdRule.location) &&
        Objects.equals(this.equivalent, tdRule.equivalent) &&
        Objects.equals(this.query, tdRule.query) &&
        Objects.equals(this.description, tdRule.description) &&
        Objects.equals(this.error, tdRule.error);
  }

  @Override
  public int hashCode() {
    return Objects.hash(summary, id, category, maintype, subtype, location, equivalent, query, description, error);
  }

  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("class TdRule {\n");
    sb.append("    summary: ").append(toIndentedString(summary)).append("\n");
    sb.append("    id: ").append(toIndentedString(id)).append("\n");
    sb.append("    category: ").append(toIndentedString(category)).append("\n");
    sb.append("    maintype: ").append(toIndentedString(maintype)).append("\n");
    sb.append("    subtype: ").append(toIndentedString(subtype)).append("\n");
    sb.append("    location: ").append(toIndentedString(location)).append("\n");
    sb.append("    equivalent: ").append(toIndentedString(equivalent)).append("\n");
    sb.append("    query: ").append(toIndentedString(query)).append("\n");
    sb.append("    description: ").append(toIndentedString(description)).append("\n");
    sb.append("    error: ").append(toIndentedString(error)).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 `summary` to the URL query string
    if (getSummary() != null) {
      for (String _key : getSummary().keySet()) {
        try {
          joiner.add(String.format("%ssummary%s%s=%s", prefix, suffix,
              "".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, _key, containerSuffix),
              getSummary().get(_key), URLEncoder.encode(String.valueOf(getSummary().get(_key)), "UTF-8").replaceAll("\\+", "%20")));
        } catch (UnsupportedEncodingException e) {
          // Should never happen, UTF-8 is always supported
          throw new RuntimeException(e);
        }
      }
    }

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

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

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

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

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

    return joiner.toString();
  }

}





© 2015 - 2024 Weber Informatics LLC | Privacy Policy