001// --------------------------------------------------------------------------------
002// Copyright 2002-2025 Echo Three, LLC
003//
004// Licensed under the Apache License, Version 2.0 (the "License");
005// you may not use this file except in compliance with the License.
006// You may obtain a copy of the License at
007//
008//     http://www.apache.org/licenses/LICENSE-2.0
009//
010// Unless required by applicable law or agreed to in writing, software
011// distributed under the License is distributed on an "AS IS" BASIS,
012// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013// See the License for the specific language governing permissions and
014// limitations under the License.
015// --------------------------------------------------------------------------------
016// Generated File -- DO NOT EDIT BY HAND
017// --------------------------------------------------------------------------------
018
019/**
020 * OrderStatusValue.java
021 */
022
023package com.echothree.model.data.order.server.value;
024
025import com.echothree.model.data.order.common.pk.OrderStatusPK;
026
027import com.echothree.model.data.order.server.factory.OrderStatusFactory;
028
029import com.echothree.model.data.order.common.pk.OrderPK;
030
031import com.echothree.util.common.exception.PersistenceCloneException;
032import com.echothree.util.common.exception.PersistenceNotNullException;
033
034import com.echothree.util.server.persistence.BaseValue;
035
036import java.io.Serializable;
037
038public class OrderStatusValue
039        extends BaseValue<OrderStatusPK>
040        implements Cloneable, Serializable {
041    
042    private OrderPK orderPK;
043    private boolean orderPKHasBeenModified = false;
044    private Integer orderShipmentGroupSequence;
045    private boolean orderShipmentGroupSequenceHasBeenModified = false;
046    private Integer orderLineSequence;
047    private boolean orderLineSequenceHasBeenModified = false;
048    private Integer orderAdjustmentSequence;
049    private boolean orderAdjustmentSequenceHasBeenModified = false;
050    private Integer orderPaymentPreferenceSequence;
051    private boolean orderPaymentPreferenceSequenceHasBeenModified = false;
052    
053    private transient Integer _hashCode = null;
054    private transient String _stringValue = null;
055    
056    private void constructFields(OrderPK orderPK, Integer orderShipmentGroupSequence, Integer orderLineSequence, Integer orderAdjustmentSequence, Integer orderPaymentPreferenceSequence)
057            throws PersistenceNotNullException {
058        checkForNull(orderPK);
059        this.orderPK = orderPK;
060        checkForNull(orderShipmentGroupSequence);
061        this.orderShipmentGroupSequence = orderShipmentGroupSequence;
062        checkForNull(orderLineSequence);
063        this.orderLineSequence = orderLineSequence;
064        checkForNull(orderAdjustmentSequence);
065        this.orderAdjustmentSequence = orderAdjustmentSequence;
066        checkForNull(orderPaymentPreferenceSequence);
067        this.orderPaymentPreferenceSequence = orderPaymentPreferenceSequence;
068    }
069    
070    /** Creates a new instance of OrderStatusValue */
071    public OrderStatusValue(OrderStatusPK orderStatusPK, OrderPK orderPK, Integer orderShipmentGroupSequence, Integer orderLineSequence, Integer orderAdjustmentSequence, Integer orderPaymentPreferenceSequence)
072            throws PersistenceNotNullException {
073        super(orderStatusPK);
074        constructFields(orderPK, orderShipmentGroupSequence, orderLineSequence, orderAdjustmentSequence, orderPaymentPreferenceSequence);
075    }
076    
077    /** Creates a new instance of OrderStatusValue */
078    public OrderStatusValue(OrderPK orderPK, Integer orderShipmentGroupSequence, Integer orderLineSequence, Integer orderAdjustmentSequence, Integer orderPaymentPreferenceSequence)
079            throws PersistenceNotNullException {
080        super();
081        constructFields(orderPK, orderShipmentGroupSequence, orderLineSequence, orderAdjustmentSequence, orderPaymentPreferenceSequence);
082    }
083    
084   @Override
085   public OrderStatusFactory getBaseFactoryInstance() {
086        return OrderStatusFactory.getInstance();
087    }
088    
089    @Override
090    public OrderStatusValue clone() {
091        Object result;
092        
093        try {
094            result = super.clone();
095        } catch (CloneNotSupportedException cnse) {
096            // This shouldn't happen, fail when it does.
097            throw new PersistenceCloneException(cnse);
098        }
099        
100        return (OrderStatusValue)result;
101    }
102    
103   @Override
104    public OrderStatusPK getPrimaryKey() {
105        if(_primaryKey == null) {
106            _primaryKey = new OrderStatusPK(entityId);
107        }
108        
109        return _primaryKey;
110    }
111    
112    private void clearHashAndString() {
113        _hashCode = null;
114        _stringValue = null;
115    }
116    
117    @Override
118    public int hashCode() {
119        if(_hashCode == null) {
120            int hashCode = 17;
121            
122            hashCode = 37 * hashCode + ((entityId != null) ? entityId.hashCode() : 0);
123            
124            hashCode = 37 * hashCode + ((orderPK != null) ? orderPK.hashCode() : 0);
125            hashCode = 37 * hashCode + ((orderShipmentGroupSequence != null) ? orderShipmentGroupSequence.hashCode() : 0);
126            hashCode = 37 * hashCode + ((orderLineSequence != null) ? orderLineSequence.hashCode() : 0);
127            hashCode = 37 * hashCode + ((orderAdjustmentSequence != null) ? orderAdjustmentSequence.hashCode() : 0);
128            hashCode = 37 * hashCode + ((orderPaymentPreferenceSequence != null) ? orderPaymentPreferenceSequence.hashCode() : 0);
129            
130            _hashCode = hashCode;
131        }
132        
133        return _hashCode;
134    }
135    
136    @Override
137    public String toString() {
138        if(_stringValue == null) {
139            _stringValue = "{" + 
140                    "entityId=" + getEntityId() +
141                    ", orderPK=" + getOrderPK() +
142                    ", orderShipmentGroupSequence=" + getOrderShipmentGroupSequence() +
143                    ", orderLineSequence=" + getOrderLineSequence() +
144                    ", orderAdjustmentSequence=" + getOrderAdjustmentSequence() +
145                    ", orderPaymentPreferenceSequence=" + getOrderPaymentPreferenceSequence() +
146                    "}";
147        }
148        return _stringValue;
149    }
150    
151    @Override
152    public boolean equals(Object other) {
153        if(this == other)
154            return true;
155        
156        if(!hasIdentity())
157            return false;
158        
159        if(other instanceof  OrderStatusValue that) {
160            if(!that.hasIdentity())
161                return false;
162            
163            Long thisEntityId = getEntityId();
164            Long thatEntityId = that.getEntityId();
165            
166            boolean objectsEqual = thisEntityId.equals(thatEntityId);
167            if(objectsEqual)
168                objectsEqual = isIdentical(that);
169            
170            return objectsEqual;
171        } else {
172            return false;
173        }
174    }
175    
176    public boolean isIdentical(Object other) {
177        if(other instanceof OrderStatusValue that) {
178            boolean objectsEqual = true;
179            
180            
181            if(objectsEqual) {
182                OrderPK thisOrderPK = getOrderPK();
183                OrderPK thatOrderPK = that.getOrderPK();
184                
185                if(thisOrderPK == null) {
186                    objectsEqual = objectsEqual && (thatOrderPK == null);
187                } else {
188                    objectsEqual = objectsEqual && thisOrderPK.equals(thatOrderPK);
189                }
190            }
191            
192            if(objectsEqual) {
193                Integer thisOrderShipmentGroupSequence = getOrderShipmentGroupSequence();
194                Integer thatOrderShipmentGroupSequence = that.getOrderShipmentGroupSequence();
195                
196                if(thisOrderShipmentGroupSequence == null) {
197                    objectsEqual = objectsEqual && (thatOrderShipmentGroupSequence == null);
198                } else {
199                    objectsEqual = objectsEqual && thisOrderShipmentGroupSequence.equals(thatOrderShipmentGroupSequence);
200                }
201            }
202            
203            if(objectsEqual) {
204                Integer thisOrderLineSequence = getOrderLineSequence();
205                Integer thatOrderLineSequence = that.getOrderLineSequence();
206                
207                if(thisOrderLineSequence == null) {
208                    objectsEqual = objectsEqual && (thatOrderLineSequence == null);
209                } else {
210                    objectsEqual = objectsEqual && thisOrderLineSequence.equals(thatOrderLineSequence);
211                }
212            }
213            
214            if(objectsEqual) {
215                Integer thisOrderAdjustmentSequence = getOrderAdjustmentSequence();
216                Integer thatOrderAdjustmentSequence = that.getOrderAdjustmentSequence();
217                
218                if(thisOrderAdjustmentSequence == null) {
219                    objectsEqual = objectsEqual && (thatOrderAdjustmentSequence == null);
220                } else {
221                    objectsEqual = objectsEqual && thisOrderAdjustmentSequence.equals(thatOrderAdjustmentSequence);
222                }
223            }
224            
225            if(objectsEqual) {
226                Integer thisOrderPaymentPreferenceSequence = getOrderPaymentPreferenceSequence();
227                Integer thatOrderPaymentPreferenceSequence = that.getOrderPaymentPreferenceSequence();
228                
229                if(thisOrderPaymentPreferenceSequence == null) {
230                    objectsEqual = objectsEqual && (thatOrderPaymentPreferenceSequence == null);
231                } else {
232                    objectsEqual = objectsEqual && thisOrderPaymentPreferenceSequence.equals(thatOrderPaymentPreferenceSequence);
233                }
234            }
235            
236            return objectsEqual;
237        } else {
238            return false;
239        }
240    }
241    
242    @Override
243    public boolean hasBeenModified() {
244        return orderPKHasBeenModified || orderShipmentGroupSequenceHasBeenModified || orderLineSequenceHasBeenModified || orderAdjustmentSequenceHasBeenModified || orderPaymentPreferenceSequenceHasBeenModified;
245    }
246    
247    @Override
248    public void clearHasBeenModified() {
249        orderPKHasBeenModified = false;
250        orderShipmentGroupSequenceHasBeenModified = false;
251        orderLineSequenceHasBeenModified = false;
252        orderAdjustmentSequenceHasBeenModified = false;
253        orderPaymentPreferenceSequenceHasBeenModified = false;
254    }
255    
256    public OrderPK getOrderPK() {
257        return orderPK;
258    }
259    
260    public void setOrderPK(OrderPK orderPK)
261            throws PersistenceNotNullException {
262        checkForNull(orderPK);
263        
264        boolean update = true;
265        
266        if(this.orderPK != null) {
267            if(this.orderPK.equals(orderPK)) {
268                update = false;
269            }
270        } else if(orderPK == null) {
271            update = false;
272        }
273        
274        if(update) {
275            this.orderPK = orderPK;
276            orderPKHasBeenModified = true;
277            clearHashAndString();
278        }
279    }
280    
281    public boolean getOrderPKHasBeenModified() {
282        return orderPKHasBeenModified;
283    }
284    
285    public Integer getOrderShipmentGroupSequence() {
286        return orderShipmentGroupSequence;
287    }
288    
289    public void setOrderShipmentGroupSequence(Integer orderShipmentGroupSequence)
290            throws PersistenceNotNullException {
291        checkForNull(orderShipmentGroupSequence);
292        
293        boolean update = true;
294        
295        if(this.orderShipmentGroupSequence != null) {
296            if(this.orderShipmentGroupSequence.equals(orderShipmentGroupSequence)) {
297                update = false;
298            }
299        } else if(orderShipmentGroupSequence == null) {
300            update = false;
301        }
302        
303        if(update) {
304            this.orderShipmentGroupSequence = orderShipmentGroupSequence;
305            orderShipmentGroupSequenceHasBeenModified = true;
306            clearHashAndString();
307        }
308    }
309    
310    public boolean getOrderShipmentGroupSequenceHasBeenModified() {
311        return orderShipmentGroupSequenceHasBeenModified;
312    }
313    
314    public Integer getOrderLineSequence() {
315        return orderLineSequence;
316    }
317    
318    public void setOrderLineSequence(Integer orderLineSequence)
319            throws PersistenceNotNullException {
320        checkForNull(orderLineSequence);
321        
322        boolean update = true;
323        
324        if(this.orderLineSequence != null) {
325            if(this.orderLineSequence.equals(orderLineSequence)) {
326                update = false;
327            }
328        } else if(orderLineSequence == null) {
329            update = false;
330        }
331        
332        if(update) {
333            this.orderLineSequence = orderLineSequence;
334            orderLineSequenceHasBeenModified = true;
335            clearHashAndString();
336        }
337    }
338    
339    public boolean getOrderLineSequenceHasBeenModified() {
340        return orderLineSequenceHasBeenModified;
341    }
342    
343    public Integer getOrderAdjustmentSequence() {
344        return orderAdjustmentSequence;
345    }
346    
347    public void setOrderAdjustmentSequence(Integer orderAdjustmentSequence)
348            throws PersistenceNotNullException {
349        checkForNull(orderAdjustmentSequence);
350        
351        boolean update = true;
352        
353        if(this.orderAdjustmentSequence != null) {
354            if(this.orderAdjustmentSequence.equals(orderAdjustmentSequence)) {
355                update = false;
356            }
357        } else if(orderAdjustmentSequence == null) {
358            update = false;
359        }
360        
361        if(update) {
362            this.orderAdjustmentSequence = orderAdjustmentSequence;
363            orderAdjustmentSequenceHasBeenModified = true;
364            clearHashAndString();
365        }
366    }
367    
368    public boolean getOrderAdjustmentSequenceHasBeenModified() {
369        return orderAdjustmentSequenceHasBeenModified;
370    }
371    
372    public Integer getOrderPaymentPreferenceSequence() {
373        return orderPaymentPreferenceSequence;
374    }
375    
376    public void setOrderPaymentPreferenceSequence(Integer orderPaymentPreferenceSequence)
377            throws PersistenceNotNullException {
378        checkForNull(orderPaymentPreferenceSequence);
379        
380        boolean update = true;
381        
382        if(this.orderPaymentPreferenceSequence != null) {
383            if(this.orderPaymentPreferenceSequence.equals(orderPaymentPreferenceSequence)) {
384                update = false;
385            }
386        } else if(orderPaymentPreferenceSequence == null) {
387            update = false;
388        }
389        
390        if(update) {
391            this.orderPaymentPreferenceSequence = orderPaymentPreferenceSequence;
392            orderPaymentPreferenceSequenceHasBeenModified = true;
393            clearHashAndString();
394        }
395    }
396    
397    public boolean getOrderPaymentPreferenceSequenceHasBeenModified() {
398        return orderPaymentPreferenceSequenceHasBeenModified;
399    }
400    
401}