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 * TrainingClassQuestionDetailValue.java
021 */
022
023package com.echothree.model.data.training.server.value;
024
025import com.echothree.model.data.training.common.pk.TrainingClassQuestionDetailPK;
026
027import com.echothree.model.data.training.server.factory.TrainingClassQuestionDetailFactory;
028
029import com.echothree.model.data.training.common.pk.TrainingClassQuestionPK;
030import com.echothree.model.data.training.common.pk.TrainingClassSectionPK;
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 TrainingClassQuestionDetailValue
040        extends BaseValue<TrainingClassQuestionDetailPK>
041        implements Cloneable, Serializable {
042    
043    private TrainingClassQuestionPK trainingClassQuestionPK;
044    private boolean trainingClassQuestionPKHasBeenModified = false;
045    private TrainingClassSectionPK trainingClassSectionPK;
046    private boolean trainingClassSectionPKHasBeenModified = false;
047    private String trainingClassQuestionName;
048    private boolean trainingClassQuestionNameHasBeenModified = false;
049    private Boolean askingRequired;
050    private boolean askingRequiredHasBeenModified = false;
051    private Boolean passingRequired;
052    private boolean passingRequiredHasBeenModified = 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(TrainingClassQuestionPK trainingClassQuestionPK, TrainingClassSectionPK trainingClassSectionPK, String trainingClassQuestionName, Boolean askingRequired, Boolean passingRequired, Integer sortOrder, Long fromTime, Long thruTime)
064            throws PersistenceNotNullException {
065        checkForNull(trainingClassQuestionPK);
066        this.trainingClassQuestionPK = trainingClassQuestionPK;
067        checkForNull(trainingClassSectionPK);
068        this.trainingClassSectionPK = trainingClassSectionPK;
069        checkForNull(trainingClassQuestionName);
070        this.trainingClassQuestionName = trainingClassQuestionName;
071        checkForNull(askingRequired);
072        this.askingRequired = askingRequired;
073        checkForNull(passingRequired);
074        this.passingRequired = passingRequired;
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 TrainingClassQuestionDetailValue */
084    public TrainingClassQuestionDetailValue(TrainingClassQuestionDetailPK trainingClassQuestionDetailPK, TrainingClassQuestionPK trainingClassQuestionPK, TrainingClassSectionPK trainingClassSectionPK, String trainingClassQuestionName, Boolean askingRequired, Boolean passingRequired, Integer sortOrder, Long fromTime, Long thruTime)
085            throws PersistenceNotNullException {
086        super(trainingClassQuestionDetailPK);
087        constructFields(trainingClassQuestionPK, trainingClassSectionPK, trainingClassQuestionName, askingRequired, passingRequired, sortOrder, fromTime, thruTime);
088    }
089    
090    /** Creates a new instance of TrainingClassQuestionDetailValue */
091    public TrainingClassQuestionDetailValue(TrainingClassQuestionPK trainingClassQuestionPK, TrainingClassSectionPK trainingClassSectionPK, String trainingClassQuestionName, Boolean askingRequired, Boolean passingRequired, Integer sortOrder, Long fromTime, Long thruTime)
092            throws PersistenceNotNullException {
093        super();
094        constructFields(trainingClassQuestionPK, trainingClassSectionPK, trainingClassQuestionName, askingRequired, passingRequired, sortOrder, fromTime, thruTime);
095    }
096    
097   @Override
098   public TrainingClassQuestionDetailFactory getBaseFactoryInstance() {
099        return TrainingClassQuestionDetailFactory.getInstance();
100    }
101    
102    @Override
103    public TrainingClassQuestionDetailValue 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 (TrainingClassQuestionDetailValue)result;
114    }
115    
116   @Override
117    public TrainingClassQuestionDetailPK getPrimaryKey() {
118        if(_primaryKey == null) {
119            _primaryKey = new TrainingClassQuestionDetailPK(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 + ((trainingClassQuestionPK != null) ? trainingClassQuestionPK.hashCode() : 0);
138            hashCode = 37 * hashCode + ((trainingClassSectionPK != null) ? trainingClassSectionPK.hashCode() : 0);
139            hashCode = 37 * hashCode + ((trainingClassQuestionName != null) ? trainingClassQuestionName.hashCode() : 0);
140            hashCode = 37 * hashCode + ((askingRequired != null) ? askingRequired.hashCode() : 0);
141            hashCode = 37 * hashCode + ((passingRequired != null) ? passingRequired.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            _stringValue = "{" + 
156                    "entityId=" + getEntityId() +
157                    ", trainingClassQuestionPK=" + getTrainingClassQuestionPK() +
158                    ", trainingClassSectionPK=" + getTrainingClassSectionPK() +
159                    ", trainingClassQuestionName=" + getTrainingClassQuestionName() +
160                    ", askingRequired=" + getAskingRequired() +
161                    ", passingRequired=" + getPassingRequired() +
162                    ", sortOrder=" + getSortOrder() +
163                    ", fromTime=" + getFromTime() +
164                    ", thruTime=" + getThruTime() +
165                    "}";
166        }
167        return _stringValue;
168    }
169    
170    @Override
171    public boolean equals(Object other) {
172        if(this == other)
173            return true;
174        
175        if(!hasIdentity())
176            return false;
177        
178        if(other instanceof  TrainingClassQuestionDetailValue that) {
179            if(!that.hasIdentity())
180                return false;
181            
182            Long thisEntityId = getEntityId();
183            Long thatEntityId = that.getEntityId();
184            
185            boolean objectsEqual = thisEntityId.equals(thatEntityId);
186            if(objectsEqual)
187                objectsEqual = isIdentical(that);
188            
189            return objectsEqual;
190        } else {
191            return false;
192        }
193    }
194    
195    public boolean isIdentical(Object other) {
196        if(other instanceof TrainingClassQuestionDetailValue that) {
197            boolean objectsEqual = true;
198            
199            
200            if(objectsEqual) {
201                TrainingClassQuestionPK thisTrainingClassQuestionPK = getTrainingClassQuestionPK();
202                TrainingClassQuestionPK thatTrainingClassQuestionPK = that.getTrainingClassQuestionPK();
203                
204                if(thisTrainingClassQuestionPK == null) {
205                    objectsEqual = objectsEqual && (thatTrainingClassQuestionPK == null);
206                } else {
207                    objectsEqual = objectsEqual && thisTrainingClassQuestionPK.equals(thatTrainingClassQuestionPK);
208                }
209            }
210            
211            if(objectsEqual) {
212                TrainingClassSectionPK thisTrainingClassSectionPK = getTrainingClassSectionPK();
213                TrainingClassSectionPK thatTrainingClassSectionPK = that.getTrainingClassSectionPK();
214                
215                if(thisTrainingClassSectionPK == null) {
216                    objectsEqual = objectsEqual && (thatTrainingClassSectionPK == null);
217                } else {
218                    objectsEqual = objectsEqual && thisTrainingClassSectionPK.equals(thatTrainingClassSectionPK);
219                }
220            }
221            
222            if(objectsEqual) {
223                String thisTrainingClassQuestionName = getTrainingClassQuestionName();
224                String thatTrainingClassQuestionName = that.getTrainingClassQuestionName();
225                
226                if(thisTrainingClassQuestionName == null) {
227                    objectsEqual = objectsEqual && (thatTrainingClassQuestionName == null);
228                } else {
229                    objectsEqual = objectsEqual && thisTrainingClassQuestionName.equals(thatTrainingClassQuestionName);
230                }
231            }
232            
233            if(objectsEqual) {
234                Boolean thisAskingRequired = getAskingRequired();
235                Boolean thatAskingRequired = that.getAskingRequired();
236                
237                if(thisAskingRequired == null) {
238                    objectsEqual = objectsEqual && (thatAskingRequired == null);
239                } else {
240                    objectsEqual = objectsEqual && thisAskingRequired.equals(thatAskingRequired);
241                }
242            }
243            
244            if(objectsEqual) {
245                Boolean thisPassingRequired = getPassingRequired();
246                Boolean thatPassingRequired = that.getPassingRequired();
247                
248                if(thisPassingRequired == null) {
249                    objectsEqual = objectsEqual && (thatPassingRequired == null);
250                } else {
251                    objectsEqual = objectsEqual && thisPassingRequired.equals(thatPassingRequired);
252                }
253            }
254            
255            if(objectsEqual) {
256                Integer thisSortOrder = getSortOrder();
257                Integer thatSortOrder = that.getSortOrder();
258                
259                if(thisSortOrder == null) {
260                    objectsEqual = objectsEqual && (thatSortOrder == null);
261                } else {
262                    objectsEqual = objectsEqual && thisSortOrder.equals(thatSortOrder);
263                }
264            }
265            
266            if(objectsEqual) {
267                Long thisFromTime = getFromTime();
268                Long thatFromTime = that.getFromTime();
269                
270                if(thisFromTime == null) {
271                    objectsEqual = objectsEqual && (thatFromTime == null);
272                } else {
273                    objectsEqual = objectsEqual && thisFromTime.equals(thatFromTime);
274                }
275            }
276            
277            if(objectsEqual) {
278                Long thisThruTime = getThruTime();
279                Long thatThruTime = that.getThruTime();
280                
281                if(thisThruTime == null) {
282                    objectsEqual = objectsEqual && (thatThruTime == null);
283                } else {
284                    objectsEqual = objectsEqual && thisThruTime.equals(thatThruTime);
285                }
286            }
287            
288            return objectsEqual;
289        } else {
290            return false;
291        }
292    }
293    
294    @Override
295    public boolean hasBeenModified() {
296        return trainingClassQuestionPKHasBeenModified || trainingClassSectionPKHasBeenModified || trainingClassQuestionNameHasBeenModified || askingRequiredHasBeenModified || passingRequiredHasBeenModified || sortOrderHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified;
297    }
298    
299    @Override
300    public void clearHasBeenModified() {
301        trainingClassQuestionPKHasBeenModified = false;
302        trainingClassSectionPKHasBeenModified = false;
303        trainingClassQuestionNameHasBeenModified = false;
304        askingRequiredHasBeenModified = false;
305        passingRequiredHasBeenModified = false;
306        sortOrderHasBeenModified = false;
307        fromTimeHasBeenModified = false;
308        thruTimeHasBeenModified = false;
309    }
310    
311    public TrainingClassQuestionPK getTrainingClassQuestionPK() {
312        return trainingClassQuestionPK;
313    }
314    
315    public void setTrainingClassQuestionPK(TrainingClassQuestionPK trainingClassQuestionPK)
316            throws PersistenceNotNullException {
317        checkForNull(trainingClassQuestionPK);
318        
319        boolean update = true;
320        
321        if(this.trainingClassQuestionPK != null) {
322            if(this.trainingClassQuestionPK.equals(trainingClassQuestionPK)) {
323                update = false;
324            }
325        } else if(trainingClassQuestionPK == null) {
326            update = false;
327        }
328        
329        if(update) {
330            this.trainingClassQuestionPK = trainingClassQuestionPK;
331            trainingClassQuestionPKHasBeenModified = true;
332            clearHashAndString();
333        }
334    }
335    
336    public boolean getTrainingClassQuestionPKHasBeenModified() {
337        return trainingClassQuestionPKHasBeenModified;
338    }
339    
340    public TrainingClassSectionPK getTrainingClassSectionPK() {
341        return trainingClassSectionPK;
342    }
343    
344    public void setTrainingClassSectionPK(TrainingClassSectionPK trainingClassSectionPK)
345            throws PersistenceNotNullException {
346        checkForNull(trainingClassSectionPK);
347        
348        boolean update = true;
349        
350        if(this.trainingClassSectionPK != null) {
351            if(this.trainingClassSectionPK.equals(trainingClassSectionPK)) {
352                update = false;
353            }
354        } else if(trainingClassSectionPK == null) {
355            update = false;
356        }
357        
358        if(update) {
359            this.trainingClassSectionPK = trainingClassSectionPK;
360            trainingClassSectionPKHasBeenModified = true;
361            clearHashAndString();
362        }
363    }
364    
365    public boolean getTrainingClassSectionPKHasBeenModified() {
366        return trainingClassSectionPKHasBeenModified;
367    }
368    
369    public String getTrainingClassQuestionName() {
370        return trainingClassQuestionName;
371    }
372    
373    public void setTrainingClassQuestionName(String trainingClassQuestionName)
374            throws PersistenceNotNullException {
375        checkForNull(trainingClassQuestionName);
376        
377        boolean update = true;
378        
379        if(this.trainingClassQuestionName != null) {
380            if(this.trainingClassQuestionName.equals(trainingClassQuestionName)) {
381                update = false;
382            }
383        } else if(trainingClassQuestionName == null) {
384            update = false;
385        }
386        
387        if(update) {
388            this.trainingClassQuestionName = trainingClassQuestionName;
389            trainingClassQuestionNameHasBeenModified = true;
390            clearHashAndString();
391        }
392    }
393    
394    public boolean getTrainingClassQuestionNameHasBeenModified() {
395        return trainingClassQuestionNameHasBeenModified;
396    }
397    
398    public Boolean getAskingRequired() {
399        return askingRequired;
400    }
401    
402    public void setAskingRequired(Boolean askingRequired)
403            throws PersistenceNotNullException {
404        checkForNull(askingRequired);
405        
406        boolean update = true;
407        
408        if(this.askingRequired != null) {
409            if(this.askingRequired.equals(askingRequired)) {
410                update = false;
411            }
412        } else if(askingRequired == null) {
413            update = false;
414        }
415        
416        if(update) {
417            this.askingRequired = askingRequired;
418            askingRequiredHasBeenModified = true;
419            clearHashAndString();
420        }
421    }
422    
423    public boolean getAskingRequiredHasBeenModified() {
424        return askingRequiredHasBeenModified;
425    }
426    
427    public Boolean getPassingRequired() {
428        return passingRequired;
429    }
430    
431    public void setPassingRequired(Boolean passingRequired)
432            throws PersistenceNotNullException {
433        checkForNull(passingRequired);
434        
435        boolean update = true;
436        
437        if(this.passingRequired != null) {
438            if(this.passingRequired.equals(passingRequired)) {
439                update = false;
440            }
441        } else if(passingRequired == null) {
442            update = false;
443        }
444        
445        if(update) {
446            this.passingRequired = passingRequired;
447            passingRequiredHasBeenModified = true;
448            clearHashAndString();
449        }
450    }
451    
452    public boolean getPassingRequiredHasBeenModified() {
453        return passingRequiredHasBeenModified;
454    }
455    
456    public Integer getSortOrder() {
457        return sortOrder;
458    }
459    
460    public void setSortOrder(Integer sortOrder)
461            throws PersistenceNotNullException {
462        checkForNull(sortOrder);
463        
464        boolean update = true;
465        
466        if(this.sortOrder != null) {
467            if(this.sortOrder.equals(sortOrder)) {
468                update = false;
469            }
470        } else if(sortOrder == null) {
471            update = false;
472        }
473        
474        if(update) {
475            this.sortOrder = sortOrder;
476            sortOrderHasBeenModified = true;
477            clearHashAndString();
478        }
479    }
480    
481    public boolean getSortOrderHasBeenModified() {
482        return sortOrderHasBeenModified;
483    }
484    
485    public Long getFromTime() {
486        return fromTime;
487    }
488    
489    public void setFromTime(Long fromTime)
490            throws PersistenceNotNullException {
491        checkForNull(fromTime);
492        
493        boolean update = true;
494        
495        if(this.fromTime != null) {
496            if(this.fromTime.equals(fromTime)) {
497                update = false;
498            }
499        } else if(fromTime == null) {
500            update = false;
501        }
502        
503        if(update) {
504            this.fromTime = fromTime;
505            fromTimeHasBeenModified = true;
506            clearHashAndString();
507        }
508    }
509    
510    public boolean getFromTimeHasBeenModified() {
511        return fromTimeHasBeenModified;
512    }
513    
514    public Long getThruTime() {
515        return thruTime;
516    }
517    
518    public void setThruTime(Long thruTime)
519            throws PersistenceNotNullException {
520        checkForNull(thruTime);
521        
522        boolean update = true;
523        
524        if(this.thruTime != null) {
525            if(this.thruTime.equals(thruTime)) {
526                update = false;
527            }
528        } else if(thruTime == null) {
529            update = false;
530        }
531        
532        if(update) {
533            this.thruTime = thruTime;
534            thruTimeHasBeenModified = true;
535            clearHashAndString();
536        }
537    }
538    
539    public boolean getThruTimeHasBeenModified() {
540        return thruTimeHasBeenModified;
541    }
542    
543}