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