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