001
002package com.commercetools.history.models.change;
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>Change triggered by the following update actions:</p>
019 *  <ul>
020 *   <li>Change the state of LineItem according to allowed transitions on Orders.</li>
021 *   <li>Change the state of LineItem according to allowed transitions on Staged Orders.</li>
022 *  </ul>
023 */
024@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
025public class TransitionLineItemStateChangeImpl implements TransitionLineItemStateChange, ModelBase {
026
027    private String type;
028
029    private String change;
030
031    private java.util.List<com.commercetools.history.models.common.ItemState> previousValue;
032
033    private java.util.List<com.commercetools.history.models.common.ItemState> nextValue;
034
035    private String lineItemId;
036
037    private String stateId;
038
039    /**
040     * create instance with all properties
041     */
042    @JsonCreator
043    TransitionLineItemStateChangeImpl(@JsonProperty("change") final String change,
044            @JsonProperty("previousValue") final java.util.List<com.commercetools.history.models.common.ItemState> previousValue,
045            @JsonProperty("nextValue") final java.util.List<com.commercetools.history.models.common.ItemState> nextValue,
046            @JsonProperty("lineItemId") final String lineItemId, @JsonProperty("stateId") final String stateId) {
047        this.change = change;
048        this.previousValue = previousValue;
049        this.nextValue = nextValue;
050        this.lineItemId = lineItemId;
051        this.stateId = stateId;
052        this.type = TRANSITION_LINE_ITEM_STATE_CHANGE;
053    }
054
055    /**
056     * create empty instance
057     */
058    public TransitionLineItemStateChangeImpl() {
059        this.type = TRANSITION_LINE_ITEM_STATE_CHANGE;
060    }
061
062    /**
063     *
064     */
065
066    public String getType() {
067        return this.type;
068    }
069
070    /**
071     *
072     */
073
074    public String getChange() {
075        return this.change;
076    }
077
078    /**
079     *  <p>Value before the change.</p>
080     */
081
082    public java.util.List<com.commercetools.history.models.common.ItemState> getPreviousValue() {
083        return this.previousValue;
084    }
085
086    /**
087     *  <p>Value after the change.</p>
088     */
089
090    public java.util.List<com.commercetools.history.models.common.ItemState> getNextValue() {
091        return this.nextValue;
092    }
093
094    /**
095     *  <p><code>id</code> of the updated LineItem.</p>
096     */
097
098    public String getLineItemId() {
099        return this.lineItemId;
100    }
101
102    /**
103     *  <p><code>id</code> of the State involved in the transition.</p>
104     */
105
106    public String getStateId() {
107        return this.stateId;
108    }
109
110    public void setChange(final String change) {
111        this.change = change;
112    }
113
114    public void setPreviousValue(final com.commercetools.history.models.common.ItemState... previousValue) {
115        this.previousValue = new ArrayList<>(Arrays.asList(previousValue));
116    }
117
118    public void setPreviousValue(
119            final java.util.List<com.commercetools.history.models.common.ItemState> previousValue) {
120        this.previousValue = previousValue;
121    }
122
123    public void setNextValue(final com.commercetools.history.models.common.ItemState... nextValue) {
124        this.nextValue = new ArrayList<>(Arrays.asList(nextValue));
125    }
126
127    public void setNextValue(final java.util.List<com.commercetools.history.models.common.ItemState> nextValue) {
128        this.nextValue = nextValue;
129    }
130
131    public void setLineItemId(final String lineItemId) {
132        this.lineItemId = lineItemId;
133    }
134
135    public void setStateId(final String stateId) {
136        this.stateId = stateId;
137    }
138
139    @Override
140    public boolean equals(Object o) {
141        if (this == o)
142            return true;
143
144        if (o == null || getClass() != o.getClass())
145            return false;
146
147        TransitionLineItemStateChangeImpl that = (TransitionLineItemStateChangeImpl) o;
148
149        return new EqualsBuilder().append(type, that.type)
150                .append(change, that.change)
151                .append(previousValue, that.previousValue)
152                .append(nextValue, that.nextValue)
153                .append(lineItemId, that.lineItemId)
154                .append(stateId, that.stateId)
155                .append(type, that.type)
156                .append(change, that.change)
157                .append(previousValue, that.previousValue)
158                .append(nextValue, that.nextValue)
159                .append(lineItemId, that.lineItemId)
160                .append(stateId, that.stateId)
161                .isEquals();
162    }
163
164    @Override
165    public int hashCode() {
166        return new HashCodeBuilder(17, 37).append(type)
167                .append(change)
168                .append(previousValue)
169                .append(nextValue)
170                .append(lineItemId)
171                .append(stateId)
172                .toHashCode();
173    }
174
175}