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