001
002package com.commercetools.history.models.change_history;
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>Captures the differences between the previous and next version of a resource.</p>
019 *  <p>The maximum number of Records that can be stored and their retention period are subject to a limit.</p>
020 */
021@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
022public class RecordImpl implements Record, ModelBase {
023
024    private Integer version;
025
026    private Integer previousVersion;
027
028    private String type;
029
030    private com.commercetools.history.models.change_history.ModifiedBy modifiedBy;
031
032    private String modifiedAt;
033
034    private com.commercetools.history.models.label.Label label;
035
036    private com.commercetools.history.models.label.Label previousLabel;
037
038    private java.util.List<com.commercetools.history.models.change.Change> changes;
039
040    private com.commercetools.history.models.common.ResourceIdentifier resource;
041
042    private java.util.List<com.commercetools.history.models.common.KeyReference> stores;
043
044    private Boolean withoutChanges;
045
046    /**
047     * create instance with all properties
048     */
049    @JsonCreator
050    RecordImpl(@JsonProperty("version") final Integer version,
051            @JsonProperty("previousVersion") final Integer previousVersion, @JsonProperty("type") final String type,
052            @JsonProperty("modifiedBy") final com.commercetools.history.models.change_history.ModifiedBy modifiedBy,
053            @JsonProperty("modifiedAt") final String modifiedAt,
054            @JsonProperty("label") final com.commercetools.history.models.label.Label label,
055            @JsonProperty("previousLabel") final com.commercetools.history.models.label.Label previousLabel,
056            @JsonProperty("changes") final java.util.List<com.commercetools.history.models.change.Change> changes,
057            @JsonProperty("resource") final com.commercetools.history.models.common.ResourceIdentifier resource,
058            @JsonProperty("stores") final java.util.List<com.commercetools.history.models.common.KeyReference> stores,
059            @JsonProperty("withoutChanges") final Boolean withoutChanges) {
060        this.version = version;
061        this.previousVersion = previousVersion;
062        this.type = type;
063        this.modifiedBy = modifiedBy;
064        this.modifiedAt = modifiedAt;
065        this.label = label;
066        this.previousLabel = previousLabel;
067        this.changes = changes;
068        this.resource = resource;
069        this.stores = stores;
070        this.withoutChanges = withoutChanges;
071    }
072
073    /**
074     * create empty instance
075     */
076    public RecordImpl() {
077    }
078
079    /**
080     *  <p>Version of the resource after the change.</p>
081     *  <p>For more information on how the version is incremented, see Optimistic Concurrency Control.</p>
082     */
083
084    public Integer getVersion() {
085        return this.version;
086    }
087
088    /**
089     *  <p>Version of the resource before the change.</p>
090     */
091
092    public Integer getPreviousVersion() {
093        return this.previousVersion;
094    }
095
096    /**
097     *  <p>Indicates the type of change. For creation, update, or deletion, the value is <code>"ResourceCreated"</code>, <code>"ResourceUpdated"</code>, or <code>"ResourceDeleted"</code> respectively.</p>
098     */
099
100    public String getType() {
101        return this.type;
102    }
103
104    /**
105     *  <p>Information about the user or API Client who performed the change.</p>
106     */
107
108    public com.commercetools.history.models.change_history.ModifiedBy getModifiedBy() {
109        return this.modifiedBy;
110    }
111
112    /**
113     *  <p>Date and time (UTC) when the change was made.</p>
114     */
115
116    public String getModifiedAt() {
117        return this.modifiedAt;
118    }
119
120    /**
121     *  <p>Information that describes the resource after the change.</p>
122     */
123
124    public com.commercetools.history.models.label.Label getLabel() {
125        return this.label;
126    }
127
128    /**
129     *  <p>Information that describes the resource before the change.</p>
130     */
131
132    public com.commercetools.history.models.label.Label getPreviousLabel() {
133        return this.previousLabel;
134    }
135
136    /**
137     *  <p>Shows the differences in the resource between <code>previousVersion</code> and <code>version</code>.</p>
138     *  <p>The value is not identical to the actual array of update actions sent and is not limited to update actions (see, for example, Optimistic Concurrency Control).</p>
139     */
140
141    public java.util.List<com.commercetools.history.models.change.Change> getChanges() {
142        return this.changes;
143    }
144
145    /**
146     *  <p>ResourceIdentifier of the changed resource.</p>
147     */
148
149    public com.commercetools.history.models.common.ResourceIdentifier getResource() {
150        return this.resource;
151    }
152
153    /**
154     *  <p>References to the Stores associated with the Change.</p>
155     */
156
157    public java.util.List<com.commercetools.history.models.common.KeyReference> getStores() {
158        return this.stores;
159    }
160
161    /**
162     *  <p><code>true</code> if no change was detected.</p>
163     *  <p>The version number of the resource can be increased even without any change in the resource.</p>
164     */
165
166    public Boolean getWithoutChanges() {
167        return this.withoutChanges;
168    }
169
170    public void setVersion(final Integer version) {
171        this.version = version;
172    }
173
174    public void setPreviousVersion(final Integer previousVersion) {
175        this.previousVersion = previousVersion;
176    }
177
178    public void setType(final String type) {
179        this.type = type;
180    }
181
182    public void setModifiedBy(final com.commercetools.history.models.change_history.ModifiedBy modifiedBy) {
183        this.modifiedBy = modifiedBy;
184    }
185
186    public void setModifiedAt(final String modifiedAt) {
187        this.modifiedAt = modifiedAt;
188    }
189
190    public void setLabel(final com.commercetools.history.models.label.Label label) {
191        this.label = label;
192    }
193
194    public void setPreviousLabel(final com.commercetools.history.models.label.Label previousLabel) {
195        this.previousLabel = previousLabel;
196    }
197
198    public void setChanges(final com.commercetools.history.models.change.Change... changes) {
199        this.changes = new ArrayList<>(Arrays.asList(changes));
200    }
201
202    public void setChanges(final java.util.List<com.commercetools.history.models.change.Change> changes) {
203        this.changes = changes;
204    }
205
206    public void setResource(final com.commercetools.history.models.common.ResourceIdentifier resource) {
207        this.resource = resource;
208    }
209
210    public void setStores(final com.commercetools.history.models.common.KeyReference... stores) {
211        this.stores = new ArrayList<>(Arrays.asList(stores));
212    }
213
214    public void setStores(final java.util.List<com.commercetools.history.models.common.KeyReference> stores) {
215        this.stores = stores;
216    }
217
218    public void setWithoutChanges(final Boolean withoutChanges) {
219        this.withoutChanges = withoutChanges;
220    }
221
222    @Override
223    public boolean equals(Object o) {
224        if (this == o)
225            return true;
226
227        if (o == null || getClass() != o.getClass())
228            return false;
229
230        RecordImpl that = (RecordImpl) o;
231
232        return new EqualsBuilder().append(version, that.version)
233                .append(previousVersion, that.previousVersion)
234                .append(type, that.type)
235                .append(modifiedBy, that.modifiedBy)
236                .append(modifiedAt, that.modifiedAt)
237                .append(label, that.label)
238                .append(previousLabel, that.previousLabel)
239                .append(changes, that.changes)
240                .append(resource, that.resource)
241                .append(stores, that.stores)
242                .append(withoutChanges, that.withoutChanges)
243                .append(version, that.version)
244                .append(previousVersion, that.previousVersion)
245                .append(type, that.type)
246                .append(modifiedBy, that.modifiedBy)
247                .append(modifiedAt, that.modifiedAt)
248                .append(label, that.label)
249                .append(previousLabel, that.previousLabel)
250                .append(changes, that.changes)
251                .append(resource, that.resource)
252                .append(stores, that.stores)
253                .append(withoutChanges, that.withoutChanges)
254                .isEquals();
255    }
256
257    @Override
258    public int hashCode() {
259        return new HashCodeBuilder(17, 37).append(version)
260                .append(previousVersion)
261                .append(type)
262                .append(modifiedBy)
263                .append(modifiedAt)
264                .append(label)
265                .append(previousLabel)
266                .append(changes)
267                .append(resource)
268                .append(stores)
269                .append(withoutChanges)
270                .toHashCode();
271    }
272
273}