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