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 Price scope conflicts with an existing one during an Update Product request.</p> 019 * <p>Every Price of a Product Variant must have a distinct combination of currency, Customer Group, country, and Channel that constitute the scope of a Price.</p> 020 */ 021@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") 022public class GraphQLDuplicatePriceScopeErrorImpl implements GraphQLDuplicatePriceScopeError, ModelBase { 023 024 private String code; 025 026 private Map<String, java.lang.Object> values; 027 028 private com.commercetools.api.models.common.Price conflictingPrice; 029 030 /** 031 * create instance with all properties 032 */ 033 @JsonCreator 034 GraphQLDuplicatePriceScopeErrorImpl(@JsonProperty("values") final Map<String, java.lang.Object> values, 035 @JsonProperty("conflictingPrice") final com.commercetools.api.models.common.Price conflictingPrice) { 036 this.values = values; 037 this.conflictingPrice = conflictingPrice; 038 this.code = DUPLICATE_PRICE_SCOPE; 039 } 040 041 /** 042 * create empty instance 043 */ 044 public GraphQLDuplicatePriceScopeErrorImpl() { 045 this.code = DUPLICATE_PRICE_SCOPE; 046 } 047 048 /** 049 * 050 */ 051 052 public String getCode() { 053 return this.code; 054 } 055 056 /** 057 * <p>Error-specific additional fields.</p> 058 */ 059 060 public Map<String, java.lang.Object> values() { 061 return values; 062 } 063 064 /** 065 * <p>Conflicting Embedded Price.</p> 066 */ 067 068 public com.commercetools.api.models.common.Price getConflictingPrice() { 069 return this.conflictingPrice; 070 } 071 072 public void setValue(String key, java.lang.Object value) { 073 if (values == null) { 074 values = new HashMap<>(); 075 } 076 values.put(key, value); 077 } 078 079 public void setConflictingPrice(final com.commercetools.api.models.common.Price conflictingPrice) { 080 this.conflictingPrice = conflictingPrice; 081 } 082 083 @Override 084 public boolean equals(Object o) { 085 if (this == o) 086 return true; 087 088 if (o == null || getClass() != o.getClass()) 089 return false; 090 091 GraphQLDuplicatePriceScopeErrorImpl that = (GraphQLDuplicatePriceScopeErrorImpl) o; 092 093 return new EqualsBuilder().append(code, that.code) 094 .append(values, that.values) 095 .append(conflictingPrice, that.conflictingPrice) 096 .append(code, that.code) 097 .append(values, that.values) 098 .append(conflictingPrice, that.conflictingPrice) 099 .isEquals(); 100 } 101 102 @Override 103 public int hashCode() { 104 return new HashCodeBuilder(17, 37).append(code).append(values).append(conflictingPrice).toHashCode(); 105 } 106 107}