001 002package com.commercetools.api.models.error; 003 004import java.time.*; 005import java.util.*; 006 007import com.fasterxml.jackson.annotation.JsonCreator; 008import com.fasterxml.jackson.annotation.JsonProperty; 009import com.fasterxml.jackson.databind.annotation.*; 010 011import io.vrap.rmf.base.client.ModelBase; 012import io.vrap.rmf.base.client.utils.Generated; 013 014import org.apache.commons.lang3.builder.EqualsBuilder; 015import org.apache.commons.lang3.builder.HashCodeBuilder; 016 017/** 018 * <p>Returned when a given Price validity period conflicts with an existing one. Every Standalone Price associated with the same SKU and with the same combination of currency, country, Customer Group, and Channel, must have non-overlapping validity periods (<code>validFrom</code> and <code>validUntil</code>).</p> 019 * <p>The error is returned as a failed response to the Create StandalonePrice request.</p> 020 */ 021@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") 022public class GraphQLOverlappingStandalonePriceValidityErrorImpl 023 implements GraphQLOverlappingStandalonePriceValidityError, ModelBase { 024 025 private String code; 026 027 private Map<String, java.lang.Object> values; 028 029 private com.commercetools.api.models.standalone_price.StandalonePriceReference conflictingStandalonePrice; 030 031 private String sku; 032 033 private String currency; 034 035 private String country; 036 037 private com.commercetools.api.models.customer_group.CustomerGroupResourceIdentifier customerGroup; 038 039 private com.commercetools.api.models.channel.ChannelResourceIdentifier channel; 040 041 private java.time.ZonedDateTime validFrom; 042 043 private java.time.ZonedDateTime validUntil; 044 045 private java.time.ZonedDateTime conflictingValidFrom; 046 047 private java.time.ZonedDateTime conflictingValidUntil; 048 049 /** 050 * create instance with all properties 051 */ 052 @JsonCreator 053 GraphQLOverlappingStandalonePriceValidityErrorImpl( 054 @JsonProperty("values") final Map<String, java.lang.Object> values, 055 @JsonProperty("conflictingStandalonePrice") final com.commercetools.api.models.standalone_price.StandalonePriceReference conflictingStandalonePrice, 056 @JsonProperty("sku") final String sku, @JsonProperty("currency") final String currency, 057 @JsonProperty("country") final String country, 058 @JsonProperty("customerGroup") final com.commercetools.api.models.customer_group.CustomerGroupResourceIdentifier customerGroup, 059 @JsonProperty("channel") final com.commercetools.api.models.channel.ChannelResourceIdentifier channel, 060 @JsonProperty("validFrom") final java.time.ZonedDateTime validFrom, 061 @JsonProperty("validUntil") final java.time.ZonedDateTime validUntil, 062 @JsonProperty("conflictingValidFrom") final java.time.ZonedDateTime conflictingValidFrom, 063 @JsonProperty("conflictingValidUntil") final java.time.ZonedDateTime conflictingValidUntil) { 064 this.values = values; 065 this.conflictingStandalonePrice = conflictingStandalonePrice; 066 this.sku = sku; 067 this.currency = currency; 068 this.country = country; 069 this.customerGroup = customerGroup; 070 this.channel = channel; 071 this.validFrom = validFrom; 072 this.validUntil = validUntil; 073 this.conflictingValidFrom = conflictingValidFrom; 074 this.conflictingValidUntil = conflictingValidUntil; 075 this.code = OVERLAPPING_STANDALONE_PRICE_VALIDITY; 076 } 077 078 /** 079 * create empty instance 080 */ 081 public GraphQLOverlappingStandalonePriceValidityErrorImpl() { 082 this.code = OVERLAPPING_STANDALONE_PRICE_VALIDITY; 083 } 084 085 /** 086 * 087 */ 088 089 public String getCode() { 090 return this.code; 091 } 092 093 /** 094 * <p>Error-specific additional fields.</p> 095 */ 096 097 public Map<String, java.lang.Object> values() { 098 return values; 099 } 100 101 /** 102 * <p>Reference to the conflicting Standalone Price.</p> 103 */ 104 105 public com.commercetools.api.models.standalone_price.StandalonePriceReference getConflictingStandalonePrice() { 106 return this.conflictingStandalonePrice; 107 } 108 109 /** 110 * <p>SKU of the ProductVariant to which the conflicting Standalone Price is associated.</p> 111 */ 112 113 public String getSku() { 114 return this.sku; 115 } 116 117 /** 118 * <p>Currency code of the country.</p> 119 */ 120 121 public String getCurrency() { 122 return this.currency; 123 } 124 125 /** 126 * <p>Country code of the geographic location.</p> 127 */ 128 129 public String getCountry() { 130 return this.country; 131 } 132 133 /** 134 * <p>CustomerGroup for which the Standalone Price is valid.</p> 135 */ 136 137 public com.commercetools.api.models.customer_group.CustomerGroupResourceIdentifier getCustomerGroup() { 138 return this.customerGroup; 139 } 140 141 /** 142 * <p>Channel for which the Standalone Price is valid.</p> 143 */ 144 145 public com.commercetools.api.models.channel.ChannelResourceIdentifier getChannel() { 146 return this.channel; 147 } 148 149 /** 150 * <p>Date and time (UTC) from which the Standalone Price is valid.</p> 151 */ 152 153 public java.time.ZonedDateTime getValidFrom() { 154 return this.validFrom; 155 } 156 157 /** 158 * <p>Date and time (UTC) until which the Standalone Price is valid.</p> 159 */ 160 161 public java.time.ZonedDateTime getValidUntil() { 162 return this.validUntil; 163 } 164 165 /** 166 * <p>Date and time (UTC) from which the conflicting Standalone Price is valid.</p> 167 */ 168 169 public java.time.ZonedDateTime getConflictingValidFrom() { 170 return this.conflictingValidFrom; 171 } 172 173 /** 174 * <p>Date and time (UTC) until which the conflicting Standalone Price is valid.</p> 175 */ 176 177 public java.time.ZonedDateTime getConflictingValidUntil() { 178 return this.conflictingValidUntil; 179 } 180 181 public void setValue(String key, java.lang.Object value) { 182 if (values == null) { 183 values = new HashMap<>(); 184 } 185 values.put(key, value); 186 } 187 188 public void setConflictingStandalonePrice( 189 final com.commercetools.api.models.standalone_price.StandalonePriceReference conflictingStandalonePrice) { 190 this.conflictingStandalonePrice = conflictingStandalonePrice; 191 } 192 193 public void setSku(final String sku) { 194 this.sku = sku; 195 } 196 197 public void setCurrency(final String currency) { 198 this.currency = currency; 199 } 200 201 public void setCountry(final String country) { 202 this.country = country; 203 } 204 205 public void setCustomerGroup( 206 final com.commercetools.api.models.customer_group.CustomerGroupResourceIdentifier customerGroup) { 207 this.customerGroup = customerGroup; 208 } 209 210 public void setChannel(final com.commercetools.api.models.channel.ChannelResourceIdentifier channel) { 211 this.channel = channel; 212 } 213 214 public void setValidFrom(final java.time.ZonedDateTime validFrom) { 215 this.validFrom = validFrom; 216 } 217 218 public void setValidUntil(final java.time.ZonedDateTime validUntil) { 219 this.validUntil = validUntil; 220 } 221 222 public void setConflictingValidFrom(final java.time.ZonedDateTime conflictingValidFrom) { 223 this.conflictingValidFrom = conflictingValidFrom; 224 } 225 226 public void setConflictingValidUntil(final java.time.ZonedDateTime conflictingValidUntil) { 227 this.conflictingValidUntil = conflictingValidUntil; 228 } 229 230 @Override 231 public boolean equals(Object o) { 232 if (this == o) 233 return true; 234 235 if (o == null || getClass() != o.getClass()) 236 return false; 237 238 GraphQLOverlappingStandalonePriceValidityErrorImpl that = (GraphQLOverlappingStandalonePriceValidityErrorImpl) o; 239 240 return new EqualsBuilder().append(code, that.code) 241 .append(values, that.values) 242 .append(conflictingStandalonePrice, that.conflictingStandalonePrice) 243 .append(sku, that.sku) 244 .append(currency, that.currency) 245 .append(country, that.country) 246 .append(customerGroup, that.customerGroup) 247 .append(channel, that.channel) 248 .append(validFrom, that.validFrom) 249 .append(validUntil, that.validUntil) 250 .append(conflictingValidFrom, that.conflictingValidFrom) 251 .append(conflictingValidUntil, that.conflictingValidUntil) 252 .append(code, that.code) 253 .append(values, that.values) 254 .append(conflictingStandalonePrice, that.conflictingStandalonePrice) 255 .append(sku, that.sku) 256 .append(currency, that.currency) 257 .append(country, that.country) 258 .append(customerGroup, that.customerGroup) 259 .append(channel, that.channel) 260 .append(validFrom, that.validFrom) 261 .append(validUntil, that.validUntil) 262 .append(conflictingValidFrom, that.conflictingValidFrom) 263 .append(conflictingValidUntil, that.conflictingValidUntil) 264 .isEquals(); 265 } 266 267 @Override 268 public int hashCode() { 269 return new HashCodeBuilder(17, 37).append(code) 270 .append(values) 271 .append(conflictingStandalonePrice) 272 .append(sku) 273 .append(currency) 274 .append(country) 275 .append(customerGroup) 276 .append(channel) 277 .append(validFrom) 278 .append(validUntil) 279 .append(conflictingValidFrom) 280 .append(conflictingValidUntil) 281 .toHashCode(); 282 } 283 284}