giis.tdrules.openapi.model.QueryParametersBody Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of tdrules-model Show documentation
Show all versions of tdrules-model Show documentation
Models of the FPC Rules, SQL Mutants and the data store schema
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 giis.tdrules.openapi.model.QueryParam;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
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 transformed parametrized query and the mapping parameter-values
*/
@JsonPropertyOrder({
QueryParametersBody.JSON_PROPERTY_QUERY,
QueryParametersBody.JSON_PROPERTY_PARSEDQUERY,
QueryParametersBody.JSON_PROPERTY_ERROR,
QueryParametersBody.JSON_PROPERTY_PARAMETERS
})
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.7.0")
public class QueryParametersBody {
public static final String JSON_PROPERTY_QUERY = "query";
private String query = "";
public static final String JSON_PROPERTY_PARSEDQUERY = "parsedquery";
private String parsedquery = "";
public static final String JSON_PROPERTY_ERROR = "error";
private String error = "";
public static final String JSON_PROPERTY_PARAMETERS = "parameters";
private List parameters = new ArrayList<>();
public QueryParametersBody() {
}
public QueryParametersBody query(String query) {
this.query = query;
return this;
}
/**
* The source (non-parametrized)
* @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 QueryParametersBody parsedquery(String parsedquery) {
this.parsedquery = parsedquery;
return this;
}
/**
* The transformed parametrized query
* @return parsedquery
*/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_PARSEDQUERY)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public String getParsedquery() {
return parsedquery;
}
@JsonProperty(JSON_PROPERTY_PARSEDQUERY)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setParsedquery(String parsedquery) {
this.parsedquery = parsedquery;
}
public QueryParametersBody error(String error) {
this.error = error;
return this;
}
/**
* If empty, the service successfully obtained this object, if not, indicates the error occurred
* @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;
}
public QueryParametersBody parameters(List parameters) {
this.parameters = parameters;
return this;
}
public QueryParametersBody addParametersItem(QueryParam parametersItem) {
if (this.parameters == null) {
this.parameters = new ArrayList<>();
}
this.parameters.add(parametersItem);
return this;
}
/**
* The list of parameters that have been extracted from the query
* @return parameters
*/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_PARAMETERS)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public List getParameters() {
return parameters;
}
@JsonProperty(JSON_PROPERTY_PARAMETERS)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setParameters(List parameters) {
this.parameters = parameters;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
QueryParametersBody queryParametersBody = (QueryParametersBody) o;
return Objects.equals(this.query, queryParametersBody.query) &&
Objects.equals(this.parsedquery, queryParametersBody.parsedquery) &&
Objects.equals(this.error, queryParametersBody.error) &&
Objects.equals(this.parameters, queryParametersBody.parameters);
}
@Override
public int hashCode() {
return Objects.hash(query, parsedquery, error, parameters);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class QueryParametersBody {\n");
sb.append(" query: ").append(toIndentedString(query)).append("\n");
sb.append(" parsedquery: ").append(toIndentedString(parsedquery)).append("\n");
sb.append(" error: ").append(toIndentedString(error)).append("\n");
sb.append(" parameters: ").append(toIndentedString(parameters)).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 `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 `parsedquery` to the URL query string
if (getParsedquery() != null) {
try {
joiner.add(String.format("%sparsedquery%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getParsedquery()), "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);
}
}
// add `parameters` to the URL query string
if (getParameters() != null) {
for (int i = 0; i < getParameters().size(); i++) {
if (getParameters().get(i) != null) {
joiner.add(getParameters().get(i).toUrlQueryString(String.format("%sparameters%s%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix))));
}
}
}
return joiner.toString();
}
}