com.zuora.model.OrderSubscriptions Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of zuora-sdk-java Show documentation
Show all versions of zuora-sdk-java Show documentation
The SDK of JAVA language for Zuora pricing system
/*
* Zuora API Reference
* REST API reference for the Zuora Billing, Payments, and Central Platform! Check out the [REST API Overview](https://www.zuora.com/developer/api-references/api/overview/).
*
* The version of the OpenAPI document: 2024-05-20
* Contact: [email protected]
*
* 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.zuora.model;
import java.util.Objects;
import com.google.gson.TypeAdapter;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.annotations.SerializedName;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import com.zuora.model.ExternallyManagedBy;
import com.zuora.model.OrderAction;
import com.zuora.model.OrderSubscriptionsSubscriptionOwnerAccountDetails;
import com.zuora.model.QuoteObjectFields;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonArray;
import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParseException;
import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import com.google.gson.TypeAdapter;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import java.io.IOException;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import com.zuora.JSON;
/**
* OrderSubscriptions
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.6.0")
public class OrderSubscriptions {
public static final String SERIALIZED_NAME_BASE_VERSION = "baseVersion";
@SerializedName(SERIALIZED_NAME_BASE_VERSION)
private Integer baseVersion;
public static final String SERIALIZED_NAME_CUSTOM_FIELDS = "customFields";
@SerializedName(SERIALIZED_NAME_CUSTOM_FIELDS)
private Map customFields;
public static final String SERIALIZED_NAME_EXTERNALLY_MANAGED_BY = "externallyManagedBy";
@SerializedName(SERIALIZED_NAME_EXTERNALLY_MANAGED_BY)
private ExternallyManagedBy externallyManagedBy;
public static final String SERIALIZED_NAME_NEW_VERSION = "newVersion";
@SerializedName(SERIALIZED_NAME_NEW_VERSION)
private Integer newVersion;
public static final String SERIALIZED_NAME_ORDER_ACTIONS = "orderActions";
@SerializedName(SERIALIZED_NAME_ORDER_ACTIONS)
private List orderActions;
public static final String SERIALIZED_NAME_QUOTE = "quote";
@SerializedName(SERIALIZED_NAME_QUOTE)
private QuoteObjectFields quote;
public static final String SERIALIZED_NAME_RAMP = "ramp";
@SerializedName(SERIALIZED_NAME_RAMP)
private Object ramp;
public static final String SERIALIZED_NAME_SEQUENCE = "sequence";
@SerializedName(SERIALIZED_NAME_SEQUENCE)
private Integer sequence;
public static final String SERIALIZED_NAME_SUBSCRIPTION_NUMBER = "subscriptionNumber";
@SerializedName(SERIALIZED_NAME_SUBSCRIPTION_NUMBER)
private String subscriptionNumber;
public static final String SERIALIZED_NAME_SUBSCRIPTION_OWNER_ACCOUNT_NUMBER = "subscriptionOwnerAccountNumber";
@SerializedName(SERIALIZED_NAME_SUBSCRIPTION_OWNER_ACCOUNT_NUMBER)
private String subscriptionOwnerAccountNumber;
public static final String SERIALIZED_NAME_SUBSCRIPTION_OWNER_ACCOUNT_DETAILS = "subscriptionOwnerAccountDetails";
@SerializedName(SERIALIZED_NAME_SUBSCRIPTION_OWNER_ACCOUNT_DETAILS)
private OrderSubscriptionsSubscriptionOwnerAccountDetails subscriptionOwnerAccountDetails;
public OrderSubscriptions() {
}
public OrderSubscriptions baseVersion(Integer baseVersion) {
this.baseVersion = baseVersion;
return this;
}
/**
* The base version of the subscription.
* @return baseVersion
*/
@javax.annotation.Nullable
public Integer getBaseVersion() {
return baseVersion;
}
public void setBaseVersion(Integer baseVersion) {
this.baseVersion = baseVersion;
}
public OrderSubscriptions customFields(Map customFields) {
this.customFields = customFields;
return this;
}
public OrderSubscriptions putCustomFieldsItem(String key, Object customFieldsItem) {
if (this.customFields == null) {
this.customFields = new HashMap<>();
}
this.customFields.put(key, customFieldsItem);
return this;
}
/**
* Container for custom fields of a Subscription object.
* @return customFields
*/
@javax.annotation.Nullable
public Map getCustomFields() {
return customFields;
}
public void setCustomFields(Map customFields) {
this.customFields = customFields;
}
public OrderSubscriptions externallyManagedBy(ExternallyManagedBy externallyManagedBy) {
this.externallyManagedBy = externallyManagedBy;
return this;
}
/**
* Get externallyManagedBy
* @return externallyManagedBy
*/
@javax.annotation.Nullable
public ExternallyManagedBy getExternallyManagedBy() {
return externallyManagedBy;
}
public void setExternallyManagedBy(ExternallyManagedBy externallyManagedBy) {
this.externallyManagedBy = externallyManagedBy;
}
public OrderSubscriptions newVersion(Integer newVersion) {
this.newVersion = newVersion;
return this;
}
/**
* The latest version of the subscription.
* @return newVersion
*/
@javax.annotation.Nullable
public Integer getNewVersion() {
return newVersion;
}
public void setNewVersion(Integer newVersion) {
this.newVersion = newVersion;
}
public OrderSubscriptions orderActions(List orderActions) {
this.orderActions = orderActions;
return this;
}
public OrderSubscriptions addOrderActionsItem(OrderAction orderActionsItem) {
if (this.orderActions == null) {
this.orderActions = new ArrayList<>();
}
this.orderActions.add(orderActionsItem);
return this;
}
/**
* Get orderActions
* @return orderActions
*/
@javax.annotation.Nullable
public List getOrderActions() {
return orderActions;
}
public void setOrderActions(List orderActions) {
this.orderActions = orderActions;
}
public OrderSubscriptions quote(QuoteObjectFields quote) {
this.quote = quote;
return this;
}
/**
* Get quote
* @return quote
*/
@javax.annotation.Nullable
public QuoteObjectFields getQuote() {
return quote;
}
public void setQuote(QuoteObjectFields quote) {
this.quote = quote;
}
public OrderSubscriptions ramp(Object ramp) {
this.ramp = ramp;
return this;
}
/**
* **Note**: This field is only available if you have the Ramps feature enabled. The [Orders](https://knowledgecenter.zuora.com/Billing/Subscriptions/Orders/AA_Overview_of_Orders) feature must be enabled before you can access the [Ramps](https://knowledgecenter.zuora.com/Billing/Subscriptions/Orders/Ramps_and_Ramp_Metrics/A_Overview_of_Ramps_and_Ramp_Metrics) feature. The Ramps feature is available for customers with Enterprise and Nine editions by default. If you are a Growth customer, see [Zuora Editions](https://knowledgecenter.zuora.com/BB_Introducing_Z_Business/C_Zuora_Editions) for pricing information coming October 2020. The ramp definition.
* @return ramp
*/
@javax.annotation.Nullable
public Object getRamp() {
return ramp;
}
public void setRamp(Object ramp) {
this.ramp = ramp;
}
public OrderSubscriptions sequence(Integer sequence) {
this.sequence = sequence;
return this;
}
/**
* The sequence number of a certain subscription processed by the order.
* @return sequence
*/
@javax.annotation.Nullable
public Integer getSequence() {
return sequence;
}
public void setSequence(Integer sequence) {
this.sequence = sequence;
}
public OrderSubscriptions subscriptionNumber(String subscriptionNumber) {
this.subscriptionNumber = subscriptionNumber;
return this;
}
/**
* The new subscription number for a new subscription created, or the existing subscription number. Unlike the order request, the subscription number here always has a value.
* @return subscriptionNumber
*/
@javax.annotation.Nullable
public String getSubscriptionNumber() {
return subscriptionNumber;
}
public void setSubscriptionNumber(String subscriptionNumber) {
this.subscriptionNumber = subscriptionNumber;
}
public OrderSubscriptions subscriptionOwnerAccountNumber(String subscriptionOwnerAccountNumber) {
this.subscriptionOwnerAccountNumber = subscriptionOwnerAccountNumber;
return this;
}
/**
* The number of the account that owns the subscription.
* @return subscriptionOwnerAccountNumber
*/
@javax.annotation.Nullable
public String getSubscriptionOwnerAccountNumber() {
return subscriptionOwnerAccountNumber;
}
public void setSubscriptionOwnerAccountNumber(String subscriptionOwnerAccountNumber) {
this.subscriptionOwnerAccountNumber = subscriptionOwnerAccountNumber;
}
public OrderSubscriptions subscriptionOwnerAccountDetails(OrderSubscriptionsSubscriptionOwnerAccountDetails subscriptionOwnerAccountDetails) {
this.subscriptionOwnerAccountDetails = subscriptionOwnerAccountDetails;
return this;
}
/**
* Get subscriptionOwnerAccountDetails
* @return subscriptionOwnerAccountDetails
*/
@javax.annotation.Nullable
public OrderSubscriptionsSubscriptionOwnerAccountDetails getSubscriptionOwnerAccountDetails() {
return subscriptionOwnerAccountDetails;
}
public void setSubscriptionOwnerAccountDetails(OrderSubscriptionsSubscriptionOwnerAccountDetails subscriptionOwnerAccountDetails) {
this.subscriptionOwnerAccountDetails = subscriptionOwnerAccountDetails;
}
/**
* A container for additional, undeclared properties.
* This is a holder for any undeclared properties as specified with
* the 'additionalProperties' keyword in the OAS document.
*/
private Map additionalProperties;
/**
* Set the additional (undeclared) property with the specified name and value.
* If the property does not already exist, create it otherwise replace it.
*
* @param key name of the property
* @param value value of the property
* @return the OrderSubscriptions instance itself
*/
public OrderSubscriptions putAdditionalProperty(String key, Object value) {
if (this.additionalProperties == null) {
this.additionalProperties = new HashMap();
}
this.additionalProperties.put(key, value);
return this;
}
/**
* Return the additional (undeclared) property.
*
* @return a map of objects
*/
public Map getAdditionalProperties() {
return additionalProperties;
}
/**
* Return the additional (undeclared) property with the specified name.
*
* @param key name of the property
* @return an object
*/
public Object getAdditionalProperty(String key) {
if (this.additionalProperties == null) {
return null;
}
return this.additionalProperties.get(key);
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
OrderSubscriptions orderSubscriptions = (OrderSubscriptions) o;
return Objects.equals(this.baseVersion, orderSubscriptions.baseVersion) &&
Objects.equals(this.customFields, orderSubscriptions.customFields) &&
Objects.equals(this.externallyManagedBy, orderSubscriptions.externallyManagedBy) &&
Objects.equals(this.newVersion, orderSubscriptions.newVersion) &&
Objects.equals(this.orderActions, orderSubscriptions.orderActions) &&
Objects.equals(this.quote, orderSubscriptions.quote) &&
Objects.equals(this.ramp, orderSubscriptions.ramp) &&
Objects.equals(this.sequence, orderSubscriptions.sequence) &&
Objects.equals(this.subscriptionNumber, orderSubscriptions.subscriptionNumber) &&
Objects.equals(this.subscriptionOwnerAccountNumber, orderSubscriptions.subscriptionOwnerAccountNumber) &&
Objects.equals(this.subscriptionOwnerAccountDetails, orderSubscriptions.subscriptionOwnerAccountDetails)&&
Objects.equals(this.additionalProperties, orderSubscriptions.additionalProperties);
}
@Override
public int hashCode() {
return Objects.hash(baseVersion, customFields, externallyManagedBy, newVersion, orderActions, quote, ramp, sequence, subscriptionNumber, subscriptionOwnerAccountNumber, subscriptionOwnerAccountDetails, additionalProperties);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class OrderSubscriptions {\n");
sb.append(" baseVersion: ").append(toIndentedString(baseVersion)).append("\n");
sb.append(" customFields: ").append(toIndentedString(customFields)).append("\n");
sb.append(" externallyManagedBy: ").append(toIndentedString(externallyManagedBy)).append("\n");
sb.append(" newVersion: ").append(toIndentedString(newVersion)).append("\n");
sb.append(" orderActions: ").append(toIndentedString(orderActions)).append("\n");
sb.append(" quote: ").append(toIndentedString(quote)).append("\n");
sb.append(" ramp: ").append(toIndentedString(ramp)).append("\n");
sb.append(" sequence: ").append(toIndentedString(sequence)).append("\n");
sb.append(" subscriptionNumber: ").append(toIndentedString(subscriptionNumber)).append("\n");
sb.append(" subscriptionOwnerAccountNumber: ").append(toIndentedString(subscriptionOwnerAccountNumber)).append("\n");
sb.append(" subscriptionOwnerAccountDetails: ").append(toIndentedString(subscriptionOwnerAccountDetails)).append("\n");
sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).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 ");
}
public static HashSet openapiFields;
public static HashSet openapiRequiredFields;
static {
// a set of all properties/fields (JSON key names)
openapiFields = new HashSet();
openapiFields.add("baseVersion");
openapiFields.add("customFields");
openapiFields.add("externallyManagedBy");
openapiFields.add("newVersion");
openapiFields.add("orderActions");
openapiFields.add("quote");
openapiFields.add("ramp");
openapiFields.add("sequence");
openapiFields.add("subscriptionNumber");
openapiFields.add("subscriptionOwnerAccountNumber");
openapiFields.add("subscriptionOwnerAccountDetails");
// a set of required properties/fields (JSON key names)
openapiRequiredFields = new HashSet();
}
/**
* Validates the JSON Element and throws an exception if issues found
*
* @param jsonElement JSON Element
* @throws IOException if the JSON Element is invalid with respect to OrderSubscriptions
*/
public static void validateJsonElement(JsonElement jsonElement) throws IOException {
if (jsonElement == null) {
if (!OrderSubscriptions.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null
throw new IllegalArgumentException(String.format("The required field(s) %s in OrderSubscriptions is not found in the empty JSON string", OrderSubscriptions.openapiRequiredFields.toString()));
}
}
JsonObject jsonObj = jsonElement.getAsJsonObject();
if ((jsonObj.get("externallyManagedBy") != null && !jsonObj.get("externallyManagedBy").isJsonNull()) && !jsonObj.get("externallyManagedBy").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `externallyManagedBy` to be a primitive type in the JSON string but got `%s`", jsonObj.get("externallyManagedBy").toString()));
}
// validate the optional field `externallyManagedBy`
if (jsonObj.get("externallyManagedBy") != null && !jsonObj.get("externallyManagedBy").isJsonNull()) {
ExternallyManagedBy.validateJsonElement(jsonObj.get("externallyManagedBy"));
}
if (jsonObj.get("orderActions") != null && !jsonObj.get("orderActions").isJsonNull()) {
JsonArray jsonArrayorderActions = jsonObj.getAsJsonArray("orderActions");
if (jsonArrayorderActions != null) {
// ensure the json data is an array
if (!jsonObj.get("orderActions").isJsonArray()) {
throw new IllegalArgumentException(String.format("Expected the field `orderActions` to be an array in the JSON string but got `%s`", jsonObj.get("orderActions").toString()));
}
// validate the optional field `orderActions` (array)
for (int i = 0; i < jsonArrayorderActions.size(); i++) {
OrderAction.validateJsonElement(jsonArrayorderActions.get(i));
};
}
}
// validate the optional field `quote`
if (jsonObj.get("quote") != null && !jsonObj.get("quote").isJsonNull()) {
QuoteObjectFields.validateJsonElement(jsonObj.get("quote"));
}
if ((jsonObj.get("subscriptionNumber") != null && !jsonObj.get("subscriptionNumber").isJsonNull()) && !jsonObj.get("subscriptionNumber").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `subscriptionNumber` to be a primitive type in the JSON string but got `%s`", jsonObj.get("subscriptionNumber").toString()));
}
if ((jsonObj.get("subscriptionOwnerAccountNumber") != null && !jsonObj.get("subscriptionOwnerAccountNumber").isJsonNull()) && !jsonObj.get("subscriptionOwnerAccountNumber").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `subscriptionOwnerAccountNumber` to be a primitive type in the JSON string but got `%s`", jsonObj.get("subscriptionOwnerAccountNumber").toString()));
}
// validate the optional field `subscriptionOwnerAccountDetails`
if (jsonObj.get("subscriptionOwnerAccountDetails") != null && !jsonObj.get("subscriptionOwnerAccountDetails").isJsonNull()) {
OrderSubscriptionsSubscriptionOwnerAccountDetails.validateJsonElement(jsonObj.get("subscriptionOwnerAccountDetails"));
}
}
public static class CustomTypeAdapterFactory implements TypeAdapterFactory {
@SuppressWarnings("unchecked")
@Override
public TypeAdapter create(Gson gson, TypeToken type) {
if (!OrderSubscriptions.class.isAssignableFrom(type.getRawType())) {
return null; // this class only serializes 'OrderSubscriptions' and its subtypes
}
final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class);
final TypeAdapter thisAdapter
= gson.getDelegateAdapter(this, TypeToken.get(OrderSubscriptions.class));
return (TypeAdapter) new TypeAdapter() {
@Override
public void write(JsonWriter out, OrderSubscriptions value) throws IOException {
JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject();
obj.remove("additionalProperties");
// support null values
out.beginObject();
Iterator iterator = obj.entrySet().iterator();
while(iterator.hasNext()) {
Map.Entry e = (Map.Entry) iterator.next();
out.name((String)e.getKey());
elementAdapter.write(out, e.getValue());
}
// end
// serialize additional properties
if (value.getAdditionalProperties() != null) {
// support null values
boolean oldSerializeNulls = out.getSerializeNulls();
out.setSerializeNulls(true); //force serialize
// end
for (Map.Entry entry : value.getAdditionalProperties().entrySet()) {
if (entry.getValue() instanceof String)
obj.addProperty(entry.getKey(), (String) entry.getValue());
else if (entry.getValue() instanceof Number)
obj.addProperty(entry.getKey(), (Number) entry.getValue());
else if (entry.getValue() instanceof Boolean)
obj.addProperty(entry.getKey(), (Boolean) entry.getValue());
else if (entry.getValue() instanceof Character)
obj.addProperty(entry.getKey(), (Character) entry.getValue());
else if (entry.getValue() == null)
obj.add(entry.getKey(), null);
else {
JsonElement jsonElement = gson.toJsonTree(entry.getValue());
if (jsonElement.isJsonArray()) {
obj.add(entry.getKey(), jsonElement.getAsJsonArray());
} else {
obj.add(entry.getKey(), jsonElement.getAsJsonObject());
}
}
out.name((String)entry.getKey());
elementAdapter.write(out, obj.get(entry.getKey()));
}
out.setSerializeNulls(oldSerializeNulls); //restore
}
out.endObject();
}
@Override
public OrderSubscriptions read(JsonReader in) throws IOException {
JsonElement jsonElement = elementAdapter.read(in);
validateJsonElement(jsonElement);
JsonObject jsonObj = jsonElement.getAsJsonObject();
// store additional fields in the deserialized instance
OrderSubscriptions instance = thisAdapter.fromJsonTree(jsonObj);
for (Map.Entry entry : jsonObj.entrySet()) {
if (!openapiFields.contains(entry.getKey())) {
if (entry.getValue().isJsonPrimitive()) { // primitive type
if (entry.getValue().getAsJsonPrimitive().isString())
instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString());
else if (entry.getValue().getAsJsonPrimitive().isNumber())
instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber());
else if (entry.getValue().getAsJsonPrimitive().isBoolean())
instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean());
else
throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString()));
} else if (entry.getValue().isJsonArray()) {
instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class));
} else { // JSON object
instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class));
}
}
}
return instance;
}
}.nullSafe();
}
}
/**
* Create an instance of OrderSubscriptions given an JSON string
*
* @param jsonString JSON string
* @return An instance of OrderSubscriptions
* @throws IOException if the JSON string is invalid with respect to OrderSubscriptions
*/
public static OrderSubscriptions fromJson(String jsonString) throws IOException {
return JSON.getGson().fromJson(jsonString, OrderSubscriptions.class);
}
/**
* Convert an instance of OrderSubscriptions to an JSON string
*
* @return JSON string
*/
public String toJson() {
return JSON.getGson().toJson(this);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy