001// --------------------------------------------------------------------------------
002// Copyright 2002-2024 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 * OrderShipmentGroupDetailValue.java
021 */
022
023package com.echothree.model.data.order.server.value;
024
025import com.echothree.model.data.order.common.pk.OrderShipmentGroupDetailPK;
026
027import com.echothree.model.data.order.server.factory.OrderShipmentGroupDetailFactory;
028
029import com.echothree.model.data.order.common.pk.OrderShipmentGroupPK;
030import com.echothree.model.data.order.common.pk.OrderPK;
031import com.echothree.model.data.item.common.pk.ItemDeliveryTypePK;
032import com.echothree.model.data.contact.common.pk.PartyContactMechanismPK;
033import com.echothree.model.data.shipping.common.pk.ShippingMethodPK;
034
035import com.echothree.util.common.exception.PersistenceCloneException;
036import com.echothree.util.common.exception.PersistenceNotNullException;
037
038import com.echothree.util.server.persistence.BaseValue;
039
040import java.io.Serializable;
041
042public class OrderShipmentGroupDetailValue
043        extends BaseValue<OrderShipmentGroupDetailPK>
044        implements Cloneable, Serializable {
045    
046    private OrderShipmentGroupPK orderShipmentGroupPK;
047    private boolean orderShipmentGroupPKHasBeenModified = false;
048    private OrderPK orderPK;
049    private boolean orderPKHasBeenModified = false;
050    private Integer orderShipmentGroupSequence;
051    private boolean orderShipmentGroupSequenceHasBeenModified = false;
052    private ItemDeliveryTypePK itemDeliveryTypePK;
053    private boolean itemDeliveryTypePKHasBeenModified = false;
054    private Boolean isDefault;
055    private boolean isDefaultHasBeenModified = false;
056    private PartyContactMechanismPK partyContactMechanismPK;
057    private boolean partyContactMechanismPKHasBeenModified = false;
058    private ShippingMethodPK shippingMethodPK;
059    private boolean shippingMethodPKHasBeenModified = false;
060    private Boolean holdUntilComplete;
061    private boolean holdUntilCompleteHasBeenModified = false;
062    private Long fromTime;
063    private boolean fromTimeHasBeenModified = false;
064    private Long thruTime;
065    private boolean thruTimeHasBeenModified = false;
066    
067    private transient Integer _hashCode = null;
068    private transient String _stringValue = null;
069    
070    private void constructFields(OrderShipmentGroupPK orderShipmentGroupPK, OrderPK orderPK, Integer orderShipmentGroupSequence, ItemDeliveryTypePK itemDeliveryTypePK, Boolean isDefault, PartyContactMechanismPK partyContactMechanismPK, ShippingMethodPK shippingMethodPK, Boolean holdUntilComplete, Long fromTime, Long thruTime)
071            throws PersistenceNotNullException {
072        checkForNull(orderShipmentGroupPK);
073        this.orderShipmentGroupPK = orderShipmentGroupPK;
074        checkForNull(orderPK);
075        this.orderPK = orderPK;
076        checkForNull(orderShipmentGroupSequence);
077        this.orderShipmentGroupSequence = orderShipmentGroupSequence;
078        checkForNull(itemDeliveryTypePK);
079        this.itemDeliveryTypePK = itemDeliveryTypePK;
080        checkForNull(isDefault);
081        this.isDefault = isDefault;
082        this.partyContactMechanismPK = partyContactMechanismPK;
083        this.shippingMethodPK = shippingMethodPK;
084        this.holdUntilComplete = holdUntilComplete;
085        checkForNull(fromTime);
086        this.fromTime = fromTime;
087        checkForNull(thruTime);
088        this.thruTime = thruTime;
089    }
090    
091    /** Creates a new instance of OrderShipmentGroupDetailValue */
092    public OrderShipmentGroupDetailValue(OrderShipmentGroupDetailPK orderShipmentGroupDetailPK, OrderShipmentGroupPK orderShipmentGroupPK, OrderPK orderPK, Integer orderShipmentGroupSequence, ItemDeliveryTypePK itemDeliveryTypePK, Boolean isDefault, PartyContactMechanismPK partyContactMechanismPK, ShippingMethodPK shippingMethodPK, Boolean holdUntilComplete, Long fromTime, Long thruTime)
093            throws PersistenceNotNullException {
094        super(orderShipmentGroupDetailPK);
095        constructFields(orderShipmentGroupPK, orderPK, orderShipmentGroupSequence, itemDeliveryTypePK, isDefault, partyContactMechanismPK, shippingMethodPK, holdUntilComplete, fromTime, thruTime);
096    }
097    
098    /** Creates a new instance of OrderShipmentGroupDetailValue */
099    public OrderShipmentGroupDetailValue(OrderShipmentGroupPK orderShipmentGroupPK, OrderPK orderPK, Integer orderShipmentGroupSequence, ItemDeliveryTypePK itemDeliveryTypePK, Boolean isDefault, PartyContactMechanismPK partyContactMechanismPK, ShippingMethodPK shippingMethodPK, Boolean holdUntilComplete, Long fromTime, Long thruTime)
100            throws PersistenceNotNullException {
101        super();
102        constructFields(orderShipmentGroupPK, orderPK, orderShipmentGroupSequence, itemDeliveryTypePK, isDefault, partyContactMechanismPK, shippingMethodPK, holdUntilComplete, fromTime, thruTime);
103    }
104    
105   @Override
106   public OrderShipmentGroupDetailFactory getBaseFactoryInstance() {
107        return OrderShipmentGroupDetailFactory.getInstance();
108    }
109    
110    @Override
111    public OrderShipmentGroupDetailValue clone() {
112        Object result;
113        
114        try {
115            result = super.clone();
116        } catch (CloneNotSupportedException cnse) {
117            // This shouldn't happen, fail when it does.
118            throw new PersistenceCloneException(cnse);
119        }
120        
121        return (OrderShipmentGroupDetailValue)result;
122    }
123    
124   @Override
125    public OrderShipmentGroupDetailPK getPrimaryKey() {
126        if(_primaryKey == null) {
127            _primaryKey = new OrderShipmentGroupDetailPK(entityId);
128        }
129        
130        return _primaryKey;
131    }
132    
133    private void clearHashAndString() {
134        _hashCode = null;
135        _stringValue = null;
136    }
137    
138    @Override
139    public int hashCode() {
140        if(_hashCode == null) {
141            int hashCode = 17;
142            
143            hashCode = 37 * hashCode + ((entityId != null) ? entityId.hashCode() : 0);
144            
145            hashCode = 37 * hashCode + ((orderShipmentGroupPK != null) ? orderShipmentGroupPK.hashCode() : 0);
146            hashCode = 37 * hashCode + ((orderPK != null) ? orderPK.hashCode() : 0);
147            hashCode = 37 * hashCode + ((orderShipmentGroupSequence != null) ? orderShipmentGroupSequence.hashCode() : 0);
148            hashCode = 37 * hashCode + ((itemDeliveryTypePK != null) ? itemDeliveryTypePK.hashCode() : 0);
149            hashCode = 37 * hashCode + ((isDefault != null) ? isDefault.hashCode() : 0);
150            hashCode = 37 * hashCode + ((partyContactMechanismPK != null) ? partyContactMechanismPK.hashCode() : 0);
151            hashCode = 37 * hashCode + ((shippingMethodPK != null) ? shippingMethodPK.hashCode() : 0);
152            hashCode = 37 * hashCode + ((holdUntilComplete != null) ? holdUntilComplete.hashCode() : 0);
153            hashCode = 37 * hashCode + ((fromTime != null) ? fromTime.hashCode() : 0);
154            hashCode = 37 * hashCode + ((thruTime != null) ? thruTime.hashCode() : 0);
155            
156            _hashCode = hashCode;
157        }
158        
159        return _hashCode;
160    }
161    
162    @Override
163    public String toString() {
164        if(_stringValue == null) {
165            StringBuilder stringValue = new StringBuilder("{");
166            
167            stringValue.append("entityId=").append(getEntityId());
168            
169            stringValue.append(", orderShipmentGroupPK=").append(getOrderShipmentGroupPK());
170            stringValue.append(", orderPK=").append(getOrderPK());
171            stringValue.append(", orderShipmentGroupSequence=").append(getOrderShipmentGroupSequence());
172            stringValue.append(", itemDeliveryTypePK=").append(getItemDeliveryTypePK());
173            stringValue.append(", isDefault=").append(getIsDefault());
174            stringValue.append(", partyContactMechanismPK=").append(getPartyContactMechanismPK());
175            stringValue.append(", shippingMethodPK=").append(getShippingMethodPK());
176            stringValue.append(", holdUntilComplete=").append(getHoldUntilComplete());
177            stringValue.append(", fromTime=").append(getFromTime());
178            stringValue.append(", thruTime=").append(getThruTime());
179            
180            stringValue.append('}');
181            
182            _stringValue = stringValue.toString();
183        }
184        return _stringValue;
185    }
186    
187    @Override
188    public boolean equals(Object other) {
189        if(this == other)
190            return true;
191        
192        if(!hasIdentity())
193            return false;
194        
195        if(other instanceof  OrderShipmentGroupDetailValue) {
196            OrderShipmentGroupDetailValue that = (OrderShipmentGroupDetailValue)other;
197            
198            if(!that.hasIdentity())
199                return false;
200            
201            Long thisEntityId = getEntityId();
202            Long thatEntityId = that.getEntityId();
203            
204            boolean objectsEqual = thisEntityId.equals(thatEntityId);
205            if(objectsEqual)
206                objectsEqual = objectsEqual && isIdentical(that);
207            
208            return objectsEqual;
209        } else {
210            return false;
211        }
212    }
213    
214    public boolean isIdentical(Object other) {
215        if(other instanceof OrderShipmentGroupDetailValue) {
216            OrderShipmentGroupDetailValue that = (OrderShipmentGroupDetailValue)other;
217            boolean objectsEqual = true;
218            
219            
220            if(objectsEqual) {
221                OrderShipmentGroupPK thisOrderShipmentGroupPK = getOrderShipmentGroupPK();
222                OrderShipmentGroupPK thatOrderShipmentGroupPK = that.getOrderShipmentGroupPK();
223                
224                if(thisOrderShipmentGroupPK == null) {
225                    objectsEqual = objectsEqual && (thatOrderShipmentGroupPK == null);
226                } else {
227                    objectsEqual = objectsEqual && thisOrderShipmentGroupPK.equals(thatOrderShipmentGroupPK);
228                }
229            }
230            
231            if(objectsEqual) {
232                OrderPK thisOrderPK = getOrderPK();
233                OrderPK thatOrderPK = that.getOrderPK();
234                
235                if(thisOrderPK == null) {
236                    objectsEqual = objectsEqual && (thatOrderPK == null);
237                } else {
238                    objectsEqual = objectsEqual && thisOrderPK.equals(thatOrderPK);
239                }
240            }
241            
242            if(objectsEqual) {
243                Integer thisOrderShipmentGroupSequence = getOrderShipmentGroupSequence();
244                Integer thatOrderShipmentGroupSequence = that.getOrderShipmentGroupSequence();
245                
246                if(thisOrderShipmentGroupSequence == null) {
247                    objectsEqual = objectsEqual && (thatOrderShipmentGroupSequence == null);
248                } else {
249                    objectsEqual = objectsEqual && thisOrderShipmentGroupSequence.equals(thatOrderShipmentGroupSequence);
250                }
251            }
252            
253            if(objectsEqual) {
254                ItemDeliveryTypePK thisItemDeliveryTypePK = getItemDeliveryTypePK();
255                ItemDeliveryTypePK thatItemDeliveryTypePK = that.getItemDeliveryTypePK();
256                
257                if(thisItemDeliveryTypePK == null) {
258                    objectsEqual = objectsEqual && (thatItemDeliveryTypePK == null);
259                } else {
260                    objectsEqual = objectsEqual && thisItemDeliveryTypePK.equals(thatItemDeliveryTypePK);
261                }
262            }
263            
264            if(objectsEqual) {
265                Boolean thisIsDefault = getIsDefault();
266                Boolean thatIsDefault = that.getIsDefault();
267                
268                if(thisIsDefault == null) {
269                    objectsEqual = objectsEqual && (thatIsDefault == null);
270                } else {
271                    objectsEqual = objectsEqual && thisIsDefault.equals(thatIsDefault);
272                }
273            }
274            
275            if(objectsEqual) {
276                PartyContactMechanismPK thisPartyContactMechanismPK = getPartyContactMechanismPK();
277                PartyContactMechanismPK thatPartyContactMechanismPK = that.getPartyContactMechanismPK();
278                
279                if(thisPartyContactMechanismPK == null) {
280                    objectsEqual = objectsEqual && (thatPartyContactMechanismPK == null);
281                } else {
282                    objectsEqual = objectsEqual && thisPartyContactMechanismPK.equals(thatPartyContactMechanismPK);
283                }
284            }
285            
286            if(objectsEqual) {
287                ShippingMethodPK thisShippingMethodPK = getShippingMethodPK();
288                ShippingMethodPK thatShippingMethodPK = that.getShippingMethodPK();
289                
290                if(thisShippingMethodPK == null) {
291                    objectsEqual = objectsEqual && (thatShippingMethodPK == null);
292                } else {
293                    objectsEqual = objectsEqual && thisShippingMethodPK.equals(thatShippingMethodPK);
294                }
295            }
296            
297            if(objectsEqual) {
298                Boolean thisHoldUntilComplete = getHoldUntilComplete();
299                Boolean thatHoldUntilComplete = that.getHoldUntilComplete();
300                
301                if(thisHoldUntilComplete == null) {
302                    objectsEqual = objectsEqual && (thatHoldUntilComplete == null);
303                } else {
304                    objectsEqual = objectsEqual && thisHoldUntilComplete.equals(thatHoldUntilComplete);
305                }
306            }
307            
308            if(objectsEqual) {
309                Long thisFromTime = getFromTime();
310                Long thatFromTime = that.getFromTime();
311                
312                if(thisFromTime == null) {
313                    objectsEqual = objectsEqual && (thatFromTime == null);
314                } else {
315                    objectsEqual = objectsEqual && thisFromTime.equals(thatFromTime);
316                }
317            }
318            
319            if(objectsEqual) {
320                Long thisThruTime = getThruTime();
321                Long thatThruTime = that.getThruTime();
322                
323                if(thisThruTime == null) {
324                    objectsEqual = objectsEqual && (thatThruTime == null);
325                } else {
326                    objectsEqual = objectsEqual && thisThruTime.equals(thatThruTime);
327                }
328            }
329            
330            return objectsEqual;
331        } else {
332            return false;
333        }
334    }
335    
336    @Override
337    public boolean hasBeenModified() {
338        return orderShipmentGroupPKHasBeenModified || orderPKHasBeenModified || orderShipmentGroupSequenceHasBeenModified || itemDeliveryTypePKHasBeenModified || isDefaultHasBeenModified || partyContactMechanismPKHasBeenModified || shippingMethodPKHasBeenModified || holdUntilCompleteHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified;
339    }
340    
341    @Override
342    public void clearHasBeenModified() {
343        orderShipmentGroupPKHasBeenModified = false;
344        orderPKHasBeenModified = false;
345        orderShipmentGroupSequenceHasBeenModified = false;
346        itemDeliveryTypePKHasBeenModified = false;
347        isDefaultHasBeenModified = false;
348        partyContactMechanismPKHasBeenModified = false;
349        shippingMethodPKHasBeenModified = false;
350        holdUntilCompleteHasBeenModified = false;
351        fromTimeHasBeenModified = false;
352        thruTimeHasBeenModified = false;
353    }
354    
355    public OrderShipmentGroupPK getOrderShipmentGroupPK() {
356        return orderShipmentGroupPK;
357    }
358    
359    public void setOrderShipmentGroupPK(OrderShipmentGroupPK orderShipmentGroupPK)
360            throws PersistenceNotNullException {
361        checkForNull(orderShipmentGroupPK);
362        
363        boolean update = true;
364        
365        if(this.orderShipmentGroupPK != null) {
366            if(this.orderShipmentGroupPK.equals(orderShipmentGroupPK)) {
367                update = false;
368            }
369        } else if(orderShipmentGroupPK == null) {
370            update = false;
371        }
372        
373        if(update) {
374            this.orderShipmentGroupPK = orderShipmentGroupPK;
375            orderShipmentGroupPKHasBeenModified = true;
376            clearHashAndString();
377        }
378    }
379    
380    public boolean getOrderShipmentGroupPKHasBeenModified() {
381        return orderShipmentGroupPKHasBeenModified;
382    }
383    
384    public OrderPK getOrderPK() {
385        return orderPK;
386    }
387    
388    public void setOrderPK(OrderPK orderPK)
389            throws PersistenceNotNullException {
390        checkForNull(orderPK);
391        
392        boolean update = true;
393        
394        if(this.orderPK != null) {
395            if(this.orderPK.equals(orderPK)) {
396                update = false;
397            }
398        } else if(orderPK == null) {
399            update = false;
400        }
401        
402        if(update) {
403            this.orderPK = orderPK;
404            orderPKHasBeenModified = true;
405            clearHashAndString();
406        }
407    }
408    
409    public boolean getOrderPKHasBeenModified() {
410        return orderPKHasBeenModified;
411    }
412    
413    public Integer getOrderShipmentGroupSequence() {
414        return orderShipmentGroupSequence;
415    }
416    
417    public void setOrderShipmentGroupSequence(Integer orderShipmentGroupSequence)
418            throws PersistenceNotNullException {
419        checkForNull(orderShipmentGroupSequence);
420        
421        boolean update = true;
422        
423        if(this.orderShipmentGroupSequence != null) {
424            if(this.orderShipmentGroupSequence.equals(orderShipmentGroupSequence)) {
425                update = false;
426            }
427        } else if(orderShipmentGroupSequence == null) {
428            update = false;
429        }
430        
431        if(update) {
432            this.orderShipmentGroupSequence = orderShipmentGroupSequence;
433            orderShipmentGroupSequenceHasBeenModified = true;
434            clearHashAndString();
435        }
436    }
437    
438    public boolean getOrderShipmentGroupSequenceHasBeenModified() {
439        return orderShipmentGroupSequenceHasBeenModified;
440    }
441    
442    public ItemDeliveryTypePK getItemDeliveryTypePK() {
443        return itemDeliveryTypePK;
444    }
445    
446    public void setItemDeliveryTypePK(ItemDeliveryTypePK itemDeliveryTypePK)
447            throws PersistenceNotNullException {
448        checkForNull(itemDeliveryTypePK);
449        
450        boolean update = true;
451        
452        if(this.itemDeliveryTypePK != null) {
453            if(this.itemDeliveryTypePK.equals(itemDeliveryTypePK)) {
454                update = false;
455            }
456        } else if(itemDeliveryTypePK == null) {
457            update = false;
458        }
459        
460        if(update) {
461            this.itemDeliveryTypePK = itemDeliveryTypePK;
462            itemDeliveryTypePKHasBeenModified = true;
463            clearHashAndString();
464        }
465    }
466    
467    public boolean getItemDeliveryTypePKHasBeenModified() {
468        return itemDeliveryTypePKHasBeenModified;
469    }
470    
471    public Boolean getIsDefault() {
472        return isDefault;
473    }
474    
475    public void setIsDefault(Boolean isDefault)
476            throws PersistenceNotNullException {
477        checkForNull(isDefault);
478        
479        boolean update = true;
480        
481        if(this.isDefault != null) {
482            if(this.isDefault.equals(isDefault)) {
483                update = false;
484            }
485        } else if(isDefault == null) {
486            update = false;
487        }
488        
489        if(update) {
490            this.isDefault = isDefault;
491            isDefaultHasBeenModified = true;
492            clearHashAndString();
493        }
494    }
495    
496    public boolean getIsDefaultHasBeenModified() {
497        return isDefaultHasBeenModified;
498    }
499    
500    public PartyContactMechanismPK getPartyContactMechanismPK() {
501        return partyContactMechanismPK;
502    }
503    
504    public void setPartyContactMechanismPK(PartyContactMechanismPK partyContactMechanismPK) {
505        boolean update = true;
506        
507        if(this.partyContactMechanismPK != null) {
508            if(this.partyContactMechanismPK.equals(partyContactMechanismPK)) {
509                update = false;
510            }
511        } else if(partyContactMechanismPK == null) {
512            update = false;
513        }
514        
515        if(update) {
516            this.partyContactMechanismPK = partyContactMechanismPK;
517            partyContactMechanismPKHasBeenModified = true;
518            clearHashAndString();
519        }
520    }
521    
522    public boolean getPartyContactMechanismPKHasBeenModified() {
523        return partyContactMechanismPKHasBeenModified;
524    }
525    
526    public ShippingMethodPK getShippingMethodPK() {
527        return shippingMethodPK;
528    }
529    
530    public void setShippingMethodPK(ShippingMethodPK shippingMethodPK) {
531        boolean update = true;
532        
533        if(this.shippingMethodPK != null) {
534            if(this.shippingMethodPK.equals(shippingMethodPK)) {
535                update = false;
536            }
537        } else if(shippingMethodPK == null) {
538            update = false;
539        }
540        
541        if(update) {
542            this.shippingMethodPK = shippingMethodPK;
543            shippingMethodPKHasBeenModified = true;
544            clearHashAndString();
545        }
546    }
547    
548    public boolean getShippingMethodPKHasBeenModified() {
549        return shippingMethodPKHasBeenModified;
550    }
551    
552    public Boolean getHoldUntilComplete() {
553        return holdUntilComplete;
554    }
555    
556    public void setHoldUntilComplete(Boolean holdUntilComplete) {
557        boolean update = true;
558        
559        if(this.holdUntilComplete != null) {
560            if(this.holdUntilComplete.equals(holdUntilComplete)) {
561                update = false;
562            }
563        } else if(holdUntilComplete == null) {
564            update = false;
565        }
566        
567        if(update) {
568            this.holdUntilComplete = holdUntilComplete;
569            holdUntilCompleteHasBeenModified = true;
570            clearHashAndString();
571        }
572    }
573    
574    public boolean getHoldUntilCompleteHasBeenModified() {
575        return holdUntilCompleteHasBeenModified;
576    }
577    
578    public Long getFromTime() {
579        return fromTime;
580    }
581    
582    public void setFromTime(Long fromTime)
583            throws PersistenceNotNullException {
584        checkForNull(fromTime);
585        
586        boolean update = true;
587        
588        if(this.fromTime != null) {
589            if(this.fromTime.equals(fromTime)) {
590                update = false;
591            }
592        } else if(fromTime == null) {
593            update = false;
594        }
595        
596        if(update) {
597            this.fromTime = fromTime;
598            fromTimeHasBeenModified = true;
599            clearHashAndString();
600        }
601    }
602    
603    public boolean getFromTimeHasBeenModified() {
604        return fromTimeHasBeenModified;
605    }
606    
607    public Long getThruTime() {
608        return thruTime;
609    }
610    
611    public void setThruTime(Long thruTime)
612            throws PersistenceNotNullException {
613        checkForNull(thruTime);
614        
615        boolean update = true;
616        
617        if(this.thruTime != null) {
618            if(this.thruTime.equals(thruTime)) {
619                update = false;
620            }
621        } else if(thruTime == null) {
622            update = false;
623        }
624        
625        if(update) {
626            this.thruTime = thruTime;
627            thruTimeHasBeenModified = true;
628            clearHashAndString();
629        }
630    }
631    
632    public boolean getThruTimeHasBeenModified() {
633        return thruTimeHasBeenModified;
634    }
635    
636}