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