001
002package com.commercetools.importapi.models.productvariants;
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>The data representation for a ProductVariant to be imported that is persisted as a ProductVariant in the Project.</p>
019 */
020@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
021public class ProductVariantImportImpl implements ProductVariantImport, ModelBase {
022
023    private String key;
024
025    private String sku;
026
027    private Boolean isMasterVariant;
028
029    private java.util.List<com.commercetools.importapi.models.productvariants.Attribute> attributes;
030
031    private java.util.List<com.commercetools.importapi.models.common.Image> images;
032
033    private java.util.List<com.commercetools.importapi.models.common.Asset> assets;
034
035    private Boolean publish;
036
037    private com.commercetools.importapi.models.common.ProductKeyReference product;
038
039    /**
040     * create instance with all properties
041     */
042    @JsonCreator
043    ProductVariantImportImpl(@JsonProperty("key") final String key, @JsonProperty("sku") final String sku,
044            @JsonProperty("isMasterVariant") final Boolean isMasterVariant,
045            @JsonProperty("attributes") final java.util.List<com.commercetools.importapi.models.productvariants.Attribute> attributes,
046            @JsonProperty("images") final java.util.List<com.commercetools.importapi.models.common.Image> images,
047            @JsonProperty("assets") final java.util.List<com.commercetools.importapi.models.common.Asset> assets,
048            @JsonProperty("publish") final Boolean publish,
049            @JsonProperty("product") final com.commercetools.importapi.models.common.ProductKeyReference product) {
050        this.key = key;
051        this.sku = sku;
052        this.isMasterVariant = isMasterVariant;
053        this.attributes = attributes;
054        this.images = images;
055        this.assets = assets;
056        this.publish = publish;
057        this.product = product;
058    }
059
060    /**
061     * create empty instance
062     */
063    public ProductVariantImportImpl() {
064    }
065
066    /**
067     *  <p>User-defined unique identifier.</p>
068     */
069
070    public String getKey() {
071        return this.key;
072    }
073
074    /**
075     *  <p>Maps to <code>ProductVariant.sku</code>.</p>
076     */
077
078    public String getSku() {
079        return this.sku;
080    }
081
082    /**
083     *  <p>Maps to <code>ProductVariant.isMasterVariant</code>.</p>
084     */
085
086    public Boolean getIsMasterVariant() {
087        return this.isMasterVariant;
088    }
089
090    /**
091     *  <p>Maps to <code>ProductVariant.attributes</code>. The referenced attribute must be defined in an already existing ProductType in the project, or the <code>state</code> of the ImportOperation will be <code>unresolved</code>.</p>
092     */
093
094    public java.util.List<com.commercetools.importapi.models.productvariants.Attribute> getAttributes() {
095        return this.attributes;
096    }
097
098    /**
099     *  <p>Maps to <code>ProductVariant.images</code>.</p>
100     */
101
102    public java.util.List<com.commercetools.importapi.models.common.Image> getImages() {
103        return this.images;
104    }
105
106    /**
107     *  <p>Maps to <code>ProductVariant.assets</code>.</p>
108     */
109
110    public java.util.List<com.commercetools.importapi.models.common.Asset> getAssets() {
111        return this.assets;
112    }
113
114    /**
115     *  <p>If <code>publish</code> is set to either <code>true</code> or <code>false</code>, both staged and current projections are set to the same value provided by the import data. If <code>publish</code> is not set, the staged projection is set to the provided import data, but the current projection stays unchanged. However, if the import data contains no update, that is, if it matches the staged projection of the existing Product, the import induces no change in the existing Product whether <code>publish</code> is set or not.</p>
116     */
117
118    public Boolean getPublish() {
119        return this.publish;
120    }
121
122    /**
123     *  <p>The Product to which this Product Variant belongs. Maps to <code>ProductVariant.product</code>. The Reference to the Product with which the ProductVariant is associated. If referenced Product does not exist, the <code>state</code> of the ImportOperation will be set to <code>unresolved</code> until the necessary Product is created.</p>
124     */
125
126    public com.commercetools.importapi.models.common.ProductKeyReference getProduct() {
127        return this.product;
128    }
129
130    public void setKey(final String key) {
131        this.key = key;
132    }
133
134    public void setSku(final String sku) {
135        this.sku = sku;
136    }
137
138    public void setIsMasterVariant(final Boolean isMasterVariant) {
139        this.isMasterVariant = isMasterVariant;
140    }
141
142    public void setAttributes(final com.commercetools.importapi.models.productvariants.Attribute... attributes) {
143        this.attributes = new ArrayList<>(Arrays.asList(attributes));
144    }
145
146    public void setAttributes(
147            final java.util.List<com.commercetools.importapi.models.productvariants.Attribute> attributes) {
148        this.attributes = attributes;
149    }
150
151    public void setImages(final com.commercetools.importapi.models.common.Image... images) {
152        this.images = new ArrayList<>(Arrays.asList(images));
153    }
154
155    public void setImages(final java.util.List<com.commercetools.importapi.models.common.Image> images) {
156        this.images = images;
157    }
158
159    public void setAssets(final com.commercetools.importapi.models.common.Asset... assets) {
160        this.assets = new ArrayList<>(Arrays.asList(assets));
161    }
162
163    public void setAssets(final java.util.List<com.commercetools.importapi.models.common.Asset> assets) {
164        this.assets = assets;
165    }
166
167    public void setPublish(final Boolean publish) {
168        this.publish = publish;
169    }
170
171    public void setProduct(final com.commercetools.importapi.models.common.ProductKeyReference product) {
172        this.product = product;
173    }
174
175    @Override
176    public boolean equals(Object o) {
177        if (this == o)
178            return true;
179
180        if (o == null || getClass() != o.getClass())
181            return false;
182
183        ProductVariantImportImpl that = (ProductVariantImportImpl) o;
184
185        return new EqualsBuilder().append(key, that.key)
186                .append(sku, that.sku)
187                .append(isMasterVariant, that.isMasterVariant)
188                .append(attributes, that.attributes)
189                .append(images, that.images)
190                .append(assets, that.assets)
191                .append(publish, that.publish)
192                .append(product, that.product)
193                .isEquals();
194    }
195
196    @Override
197    public int hashCode() {
198        return new HashCodeBuilder(17, 37).append(key)
199                .append(sku)
200                .append(isMasterVariant)
201                .append(attributes)
202                .append(images)
203                .append(assets)
204                .append(publish)
205                .append(product)
206                .toHashCode();
207    }
208
209}