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 * OrderPriorityDetailValue.java
021 */
022
023package com.echothree.model.data.order.server.value;
024
025import com.echothree.model.data.order.common.pk.OrderPriorityDetailPK;
026
027import com.echothree.model.data.order.server.factory.OrderPriorityDetailFactory;
028
029import com.echothree.model.data.order.common.pk.OrderPriorityPK;
030import com.echothree.model.data.order.common.pk.OrderTypePK;
031
032import com.echothree.util.common.exception.PersistenceCloneException;
033import com.echothree.util.common.exception.PersistenceNotNullException;
034
035import com.echothree.util.server.persistence.BaseValue;
036
037import java.io.Serializable;
038
039public class OrderPriorityDetailValue
040        extends BaseValue<OrderPriorityDetailPK>
041        implements Cloneable, Serializable {
042    
043    private OrderPriorityPK orderPriorityPK;
044    private boolean orderPriorityPKHasBeenModified = false;
045    private OrderTypePK orderTypePK;
046    private boolean orderTypePKHasBeenModified = false;
047    private String orderPriorityName;
048    private boolean orderPriorityNameHasBeenModified = false;
049    private Integer priority;
050    private boolean priorityHasBeenModified = false;
051    private Boolean isDefault;
052    private boolean isDefaultHasBeenModified = false;
053    private Integer sortOrder;
054    private boolean sortOrderHasBeenModified = false;
055    private Long fromTime;
056    private boolean fromTimeHasBeenModified = false;
057    private Long thruTime;
058    private boolean thruTimeHasBeenModified = false;
059    
060    private transient Integer _hashCode = null;
061    private transient String _stringValue = null;
062    
063    private void constructFields(OrderPriorityPK orderPriorityPK, OrderTypePK orderTypePK, String orderPriorityName, Integer priority, Boolean isDefault, Integer sortOrder, Long fromTime, Long thruTime)
064            throws PersistenceNotNullException {
065        checkForNull(orderPriorityPK);
066        this.orderPriorityPK = orderPriorityPK;
067        checkForNull(orderTypePK);
068        this.orderTypePK = orderTypePK;
069        checkForNull(orderPriorityName);
070        this.orderPriorityName = orderPriorityName;
071        checkForNull(priority);
072        this.priority = priority;
073        checkForNull(isDefault);
074        this.isDefault = isDefault;
075        checkForNull(sortOrder);
076        this.sortOrder = sortOrder;
077        checkForNull(fromTime);
078        this.fromTime = fromTime;
079        checkForNull(thruTime);
080        this.thruTime = thruTime;
081    }
082    
083    /** Creates a new instance of OrderPriorityDetailValue */
084    public OrderPriorityDetailValue(OrderPriorityDetailPK orderPriorityDetailPK, OrderPriorityPK orderPriorityPK, OrderTypePK orderTypePK, String orderPriorityName, Integer priority, Boolean isDefault, Integer sortOrder, Long fromTime, Long thruTime)
085            throws PersistenceNotNullException {
086        super(orderPriorityDetailPK);
087        constructFields(orderPriorityPK, orderTypePK, orderPriorityName, priority, isDefault, sortOrder, fromTime, thruTime);
088    }
089    
090    /** Creates a new instance of OrderPriorityDetailValue */
091    public OrderPriorityDetailValue(OrderPriorityPK orderPriorityPK, OrderTypePK orderTypePK, String orderPriorityName, Integer priority, Boolean isDefault, Integer sortOrder, Long fromTime, Long thruTime)
092            throws PersistenceNotNullException {
093        super();
094        constructFields(orderPriorityPK, orderTypePK, orderPriorityName, priority, isDefault, sortOrder, fromTime, thruTime);
095    }
096    
097   @Override
098   public OrderPriorityDetailFactory getBaseFactoryInstance() {
099        return OrderPriorityDetailFactory.getInstance();
100    }
101    
102    @Override
103    public OrderPriorityDetailValue clone() {
104        Object result;
105        
106        try {
107            result = super.clone();
108        } catch (CloneNotSupportedException cnse) {
109            // This shouldn't happen, fail when it does.
110            throw new PersistenceCloneException(cnse);
111        }
112        
113        return (OrderPriorityDetailValue)result;
114    }
115    
116   @Override
117    public OrderPriorityDetailPK getPrimaryKey() {
118        if(_primaryKey == null) {
119            _primaryKey = new OrderPriorityDetailPK(entityId);
120        }
121        
122        return _primaryKey;
123    }
124    
125    private void clearHashAndString() {
126        _hashCode = null;
127        _stringValue = null;
128    }
129    
130    @Override
131    public int hashCode() {
132        if(_hashCode == null) {
133            int hashCode = 17;
134            
135            hashCode = 37 * hashCode + ((entityId != null) ? entityId.hashCode() : 0);
136            
137            hashCode = 37 * hashCode + ((orderPriorityPK != null) ? orderPriorityPK.hashCode() : 0);
138            hashCode = 37 * hashCode + ((orderTypePK != null) ? orderTypePK.hashCode() : 0);
139            hashCode = 37 * hashCode + ((orderPriorityName != null) ? orderPriorityName.hashCode() : 0);
140            hashCode = 37 * hashCode + ((priority != null) ? priority.hashCode() : 0);
141            hashCode = 37 * hashCode + ((isDefault != null) ? isDefault.hashCode() : 0);
142            hashCode = 37 * hashCode + ((sortOrder != null) ? sortOrder.hashCode() : 0);
143            hashCode = 37 * hashCode + ((fromTime != null) ? fromTime.hashCode() : 0);
144            hashCode = 37 * hashCode + ((thruTime != null) ? thruTime.hashCode() : 0);
145            
146            _hashCode = hashCode;
147        }
148        
149        return _hashCode;
150    }
151    
152    @Override
153    public String toString() {
154        if(_stringValue == null) {
155            StringBuilder stringValue = new StringBuilder("{");
156            
157            stringValue.append("entityId=").append(getEntityId());
158            
159            stringValue.append(", orderPriorityPK=").append(getOrderPriorityPK());
160            stringValue.append(", orderTypePK=").append(getOrderTypePK());
161            stringValue.append(", orderPriorityName=").append(getOrderPriorityName());
162            stringValue.append(", priority=").append(getPriority());
163            stringValue.append(", isDefault=").append(getIsDefault());
164            stringValue.append(", sortOrder=").append(getSortOrder());
165            stringValue.append(", fromTime=").append(getFromTime());
166            stringValue.append(", thruTime=").append(getThruTime());
167            
168            stringValue.append('}');
169            
170            _stringValue = stringValue.toString();
171        }
172        return _stringValue;
173    }
174    
175    @Override
176    public boolean equals(Object other) {
177        if(this == other)
178            return true;
179        
180        if(!hasIdentity())
181            return false;
182        
183        if(other instanceof  OrderPriorityDetailValue) {
184            OrderPriorityDetailValue that = (OrderPriorityDetailValue)other;
185            
186            if(!that.hasIdentity())
187                return false;
188            
189            Long thisEntityId = getEntityId();
190            Long thatEntityId = that.getEntityId();
191            
192            boolean objectsEqual = thisEntityId.equals(thatEntityId);
193            if(objectsEqual)
194                objectsEqual = objectsEqual && isIdentical(that);
195            
196            return objectsEqual;
197        } else {
198            return false;
199        }
200    }
201    
202    public boolean isIdentical(Object other) {
203        if(other instanceof OrderPriorityDetailValue) {
204            OrderPriorityDetailValue that = (OrderPriorityDetailValue)other;
205            boolean objectsEqual = true;
206            
207            
208            if(objectsEqual) {
209                OrderPriorityPK thisOrderPriorityPK = getOrderPriorityPK();
210                OrderPriorityPK thatOrderPriorityPK = that.getOrderPriorityPK();
211                
212                if(thisOrderPriorityPK == null) {
213                    objectsEqual = objectsEqual && (thatOrderPriorityPK == null);
214                } else {
215                    objectsEqual = objectsEqual && thisOrderPriorityPK.equals(thatOrderPriorityPK);
216                }
217            }
218            
219            if(objectsEqual) {
220                OrderTypePK thisOrderTypePK = getOrderTypePK();
221                OrderTypePK thatOrderTypePK = that.getOrderTypePK();
222                
223                if(thisOrderTypePK == null) {
224                    objectsEqual = objectsEqual && (thatOrderTypePK == null);
225                } else {
226                    objectsEqual = objectsEqual && thisOrderTypePK.equals(thatOrderTypePK);
227                }
228            }
229            
230            if(objectsEqual) {
231                String thisOrderPriorityName = getOrderPriorityName();
232                String thatOrderPriorityName = that.getOrderPriorityName();
233                
234                if(thisOrderPriorityName == null) {
235                    objectsEqual = objectsEqual && (thatOrderPriorityName == null);
236                } else {
237                    objectsEqual = objectsEqual && thisOrderPriorityName.equals(thatOrderPriorityName);
238                }
239            }
240            
241            if(objectsEqual) {
242                Integer thisPriority = getPriority();
243                Integer thatPriority = that.getPriority();
244                
245                if(thisPriority == null) {
246                    objectsEqual = objectsEqual && (thatPriority == null);
247                } else {
248                    objectsEqual = objectsEqual && thisPriority.equals(thatPriority);
249                }
250            }
251            
252            if(objectsEqual) {
253                Boolean thisIsDefault = getIsDefault();
254                Boolean thatIsDefault = that.getIsDefault();
255                
256                if(thisIsDefault == null) {
257                    objectsEqual = objectsEqual && (thatIsDefault == null);
258                } else {
259                    objectsEqual = objectsEqual && thisIsDefault.equals(thatIsDefault);
260                }
261            }
262            
263            if(objectsEqual) {
264                Integer thisSortOrder = getSortOrder();
265                Integer thatSortOrder = that.getSortOrder();
266                
267                if(thisSortOrder == null) {
268                    objectsEqual = objectsEqual && (thatSortOrder == null);
269                } else {
270                    objectsEqual = objectsEqual && thisSortOrder.equals(thatSortOrder);
271                }
272            }
273            
274            if(objectsEqual) {
275                Long thisFromTime = getFromTime();
276                Long thatFromTime = that.getFromTime();
277                
278                if(thisFromTime == null) {
279                    objectsEqual = objectsEqual && (thatFromTime == null);
280                } else {
281                    objectsEqual = objectsEqual && thisFromTime.equals(thatFromTime);
282                }
283            }
284            
285            if(objectsEqual) {
286                Long thisThruTime = getThruTime();
287                Long thatThruTime = that.getThruTime();
288                
289                if(thisThruTime == null) {
290                    objectsEqual = objectsEqual && (thatThruTime == null);
291                } else {
292                    objectsEqual = objectsEqual && thisThruTime.equals(thatThruTime);
293                }
294            }
295            
296            return objectsEqual;
297        } else {
298            return false;
299        }
300    }
301    
302    @Override
303    public boolean hasBeenModified() {
304        return orderPriorityPKHasBeenModified || orderTypePKHasBeenModified || orderPriorityNameHasBeenModified || priorityHasBeenModified || isDefaultHasBeenModified || sortOrderHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified;
305    }
306    
307    @Override
308    public void clearHasBeenModified() {
309        orderPriorityPKHasBeenModified = false;
310        orderTypePKHasBeenModified = false;
311        orderPriorityNameHasBeenModified = false;
312        priorityHasBeenModified = false;
313        isDefaultHasBeenModified = false;
314        sortOrderHasBeenModified = false;
315        fromTimeHasBeenModified = false;
316        thruTimeHasBeenModified = false;
317    }
318    
319    public OrderPriorityPK getOrderPriorityPK() {
320        return orderPriorityPK;
321    }
322    
323    public void setOrderPriorityPK(OrderPriorityPK orderPriorityPK)
324            throws PersistenceNotNullException {
325        checkForNull(orderPriorityPK);
326        
327        boolean update = true;
328        
329        if(this.orderPriorityPK != null) {
330            if(this.orderPriorityPK.equals(orderPriorityPK)) {
331                update = false;
332            }
333        } else if(orderPriorityPK == null) {
334            update = false;
335        }
336        
337        if(update) {
338            this.orderPriorityPK = orderPriorityPK;
339            orderPriorityPKHasBeenModified = true;
340            clearHashAndString();
341        }
342    }
343    
344    public boolean getOrderPriorityPKHasBeenModified() {
345        return orderPriorityPKHasBeenModified;
346    }
347    
348    public OrderTypePK getOrderTypePK() {
349        return orderTypePK;
350    }
351    
352    public void setOrderTypePK(OrderTypePK orderTypePK)
353            throws PersistenceNotNullException {
354        checkForNull(orderTypePK);
355        
356        boolean update = true;
357        
358        if(this.orderTypePK != null) {
359            if(this.orderTypePK.equals(orderTypePK)) {
360                update = false;
361            }
362        } else if(orderTypePK == null) {
363            update = false;
364        }
365        
366        if(update) {
367            this.orderTypePK = orderTypePK;
368            orderTypePKHasBeenModified = true;
369            clearHashAndString();
370        }
371    }
372    
373    public boolean getOrderTypePKHasBeenModified() {
374        return orderTypePKHasBeenModified;
375    }
376    
377    public String getOrderPriorityName() {
378        return orderPriorityName;
379    }
380    
381    public void setOrderPriorityName(String orderPriorityName)
382            throws PersistenceNotNullException {
383        checkForNull(orderPriorityName);
384        
385        boolean update = true;
386        
387        if(this.orderPriorityName != null) {
388            if(this.orderPriorityName.equals(orderPriorityName)) {
389                update = false;
390            }
391        } else if(orderPriorityName == null) {
392            update = false;
393        }
394        
395        if(update) {
396            this.orderPriorityName = orderPriorityName;
397            orderPriorityNameHasBeenModified = true;
398            clearHashAndString();
399        }
400    }
401    
402    public boolean getOrderPriorityNameHasBeenModified() {
403        return orderPriorityNameHasBeenModified;
404    }
405    
406    public Integer getPriority() {
407        return priority;
408    }
409    
410    public void setPriority(Integer priority)
411            throws PersistenceNotNullException {
412        checkForNull(priority);
413        
414        boolean update = true;
415        
416        if(this.priority != null) {
417            if(this.priority.equals(priority)) {
418                update = false;
419            }
420        } else if(priority == null) {
421            update = false;
422        }
423        
424        if(update) {
425            this.priority = priority;
426            priorityHasBeenModified = true;
427            clearHashAndString();
428        }
429    }
430    
431    public boolean getPriorityHasBeenModified() {
432        return priorityHasBeenModified;
433    }
434    
435    public Boolean getIsDefault() {
436        return isDefault;
437    }
438    
439    public void setIsDefault(Boolean isDefault)
440            throws PersistenceNotNullException {
441        checkForNull(isDefault);
442        
443        boolean update = true;
444        
445        if(this.isDefault != null) {
446            if(this.isDefault.equals(isDefault)) {
447                update = false;
448            }
449        } else if(isDefault == null) {
450            update = false;
451        }
452        
453        if(update) {
454            this.isDefault = isDefault;
455            isDefaultHasBeenModified = true;
456            clearHashAndString();
457        }
458    }
459    
460    public boolean getIsDefaultHasBeenModified() {
461        return isDefaultHasBeenModified;
462    }
463    
464    public Integer getSortOrder() {
465        return sortOrder;
466    }
467    
468    public void setSortOrder(Integer sortOrder)
469            throws PersistenceNotNullException {
470        checkForNull(sortOrder);
471        
472        boolean update = true;
473        
474        if(this.sortOrder != null) {
475            if(this.sortOrder.equals(sortOrder)) {
476                update = false;
477            }
478        } else if(sortOrder == null) {
479            update = false;
480        }
481        
482        if(update) {
483            this.sortOrder = sortOrder;
484            sortOrderHasBeenModified = true;
485            clearHashAndString();
486        }
487    }
488    
489    public boolean getSortOrderHasBeenModified() {
490        return sortOrderHasBeenModified;
491    }
492    
493    public Long getFromTime() {
494        return fromTime;
495    }
496    
497    public void setFromTime(Long fromTime)
498            throws PersistenceNotNullException {
499        checkForNull(fromTime);
500        
501        boolean update = true;
502        
503        if(this.fromTime != null) {
504            if(this.fromTime.equals(fromTime)) {
505                update = false;
506            }
507        } else if(fromTime == null) {
508            update = false;
509        }
510        
511        if(update) {
512            this.fromTime = fromTime;
513            fromTimeHasBeenModified = true;
514            clearHashAndString();
515        }
516    }
517    
518    public boolean getFromTimeHasBeenModified() {
519        return fromTimeHasBeenModified;
520    }
521    
522    public Long getThruTime() {
523        return thruTime;
524    }
525    
526    public void setThruTime(Long thruTime)
527            throws PersistenceNotNullException {
528        checkForNull(thruTime);
529        
530        boolean update = true;
531        
532        if(this.thruTime != null) {
533            if(this.thruTime.equals(thruTime)) {
534                update = false;
535            }
536        } else if(thruTime == null) {
537            update = false;
538        }
539        
540        if(update) {
541            this.thruTime = thruTime;
542            thruTimeHasBeenModified = true;
543            clearHashAndString();
544        }
545    }
546    
547    public boolean getThruTimeHasBeenModified() {
548        return thruTimeHasBeenModified;
549    }
550    
551}