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 * WorkRequirementScopeDetailValue.java
021 */
022
023package com.echothree.model.data.workrequirement.server.value;
024
025import com.echothree.model.data.workrequirement.common.pk.WorkRequirementScopeDetailPK;
026
027import com.echothree.model.data.workrequirement.server.factory.WorkRequirementScopeDetailFactory;
028
029import com.echothree.model.data.workrequirement.common.pk.WorkRequirementScopePK;
030import com.echothree.model.data.workeffort.common.pk.WorkEffortScopePK;
031import com.echothree.model.data.workrequirement.common.pk.WorkRequirementTypePK;
032import com.echothree.model.data.sequence.common.pk.SequencePK;
033import com.echothree.model.data.selector.common.pk.SelectorPK;
034
035import com.echothree.util.common.exception.PersistenceCloneException;
036import com.echothree.util.common.exception.PersistenceNotNullException;
037
038import com.echothree.util.server.persistence.BaseValue;
039
040import java.io.Serializable;
041
042public class WorkRequirementScopeDetailValue
043        extends BaseValue<WorkRequirementScopeDetailPK>
044        implements Cloneable, Serializable {
045    
046    private WorkRequirementScopePK workRequirementScopePK;
047    private boolean workRequirementScopePKHasBeenModified = false;
048    private WorkEffortScopePK workEffortScopePK;
049    private boolean workEffortScopePKHasBeenModified = false;
050    private WorkRequirementTypePK workRequirementTypePK;
051    private boolean workRequirementTypePKHasBeenModified = false;
052    private SequencePK workRequirementSequencePK;
053    private boolean workRequirementSequencePKHasBeenModified = false;
054    private SequencePK workTimeSequencePK;
055    private boolean workTimeSequencePKHasBeenModified = false;
056    private SelectorPK workAssignmentSelectorPK;
057    private boolean workAssignmentSelectorPKHasBeenModified = false;
058    private Long estimatedTimeAllowed;
059    private boolean estimatedTimeAllowedHasBeenModified = false;
060    private Long maximumTimeAllowed;
061    private boolean maximumTimeAllowedHasBeenModified = false;
062    private Long fromTime;
063    private boolean fromTimeHasBeenModified = false;
064    private Long thruTime;
065    private boolean thruTimeHasBeenModified = false;
066    
067    private transient Integer _hashCode = null;
068    private transient String _stringValue = null;
069    
070    private void constructFields(WorkRequirementScopePK workRequirementScopePK, WorkEffortScopePK workEffortScopePK, WorkRequirementTypePK workRequirementTypePK, SequencePK workRequirementSequencePK, SequencePK workTimeSequencePK, SelectorPK workAssignmentSelectorPK, Long estimatedTimeAllowed, Long maximumTimeAllowed, Long fromTime, Long thruTime)
071            throws PersistenceNotNullException {
072        checkForNull(workRequirementScopePK);
073        this.workRequirementScopePK = workRequirementScopePK;
074        checkForNull(workEffortScopePK);
075        this.workEffortScopePK = workEffortScopePK;
076        checkForNull(workRequirementTypePK);
077        this.workRequirementTypePK = workRequirementTypePK;
078        this.workRequirementSequencePK = workRequirementSequencePK;
079        this.workTimeSequencePK = workTimeSequencePK;
080        this.workAssignmentSelectorPK = workAssignmentSelectorPK;
081        this.estimatedTimeAllowed = estimatedTimeAllowed;
082        this.maximumTimeAllowed = maximumTimeAllowed;
083        checkForNull(fromTime);
084        this.fromTime = fromTime;
085        checkForNull(thruTime);
086        this.thruTime = thruTime;
087    }
088    
089    /** Creates a new instance of WorkRequirementScopeDetailValue */
090    public WorkRequirementScopeDetailValue(WorkRequirementScopeDetailPK workRequirementScopeDetailPK, WorkRequirementScopePK workRequirementScopePK, WorkEffortScopePK workEffortScopePK, WorkRequirementTypePK workRequirementTypePK, SequencePK workRequirementSequencePK, SequencePK workTimeSequencePK, SelectorPK workAssignmentSelectorPK, Long estimatedTimeAllowed, Long maximumTimeAllowed, Long fromTime, Long thruTime)
091            throws PersistenceNotNullException {
092        super(workRequirementScopeDetailPK);
093        constructFields(workRequirementScopePK, workEffortScopePK, workRequirementTypePK, workRequirementSequencePK, workTimeSequencePK, workAssignmentSelectorPK, estimatedTimeAllowed, maximumTimeAllowed, fromTime, thruTime);
094    }
095    
096    /** Creates a new instance of WorkRequirementScopeDetailValue */
097    public WorkRequirementScopeDetailValue(WorkRequirementScopePK workRequirementScopePK, WorkEffortScopePK workEffortScopePK, WorkRequirementTypePK workRequirementTypePK, SequencePK workRequirementSequencePK, SequencePK workTimeSequencePK, SelectorPK workAssignmentSelectorPK, Long estimatedTimeAllowed, Long maximumTimeAllowed, Long fromTime, Long thruTime)
098            throws PersistenceNotNullException {
099        super();
100        constructFields(workRequirementScopePK, workEffortScopePK, workRequirementTypePK, workRequirementSequencePK, workTimeSequencePK, workAssignmentSelectorPK, estimatedTimeAllowed, maximumTimeAllowed, fromTime, thruTime);
101    }
102    
103   @Override
104   public WorkRequirementScopeDetailFactory getBaseFactoryInstance() {
105        return WorkRequirementScopeDetailFactory.getInstance();
106    }
107    
108    @Override
109    public WorkRequirementScopeDetailValue clone() {
110        Object result;
111        
112        try {
113            result = super.clone();
114        } catch (CloneNotSupportedException cnse) {
115            // This shouldn't happen, fail when it does.
116            throw new PersistenceCloneException(cnse);
117        }
118        
119        return (WorkRequirementScopeDetailValue)result;
120    }
121    
122   @Override
123    public WorkRequirementScopeDetailPK getPrimaryKey() {
124        if(_primaryKey == null) {
125            _primaryKey = new WorkRequirementScopeDetailPK(entityId);
126        }
127        
128        return _primaryKey;
129    }
130    
131    private void clearHashAndString() {
132        _hashCode = null;
133        _stringValue = null;
134    }
135    
136    @Override
137    public int hashCode() {
138        if(_hashCode == null) {
139            int hashCode = 17;
140            
141            hashCode = 37 * hashCode + ((entityId != null) ? entityId.hashCode() : 0);
142            
143            hashCode = 37 * hashCode + ((workRequirementScopePK != null) ? workRequirementScopePK.hashCode() : 0);
144            hashCode = 37 * hashCode + ((workEffortScopePK != null) ? workEffortScopePK.hashCode() : 0);
145            hashCode = 37 * hashCode + ((workRequirementTypePK != null) ? workRequirementTypePK.hashCode() : 0);
146            hashCode = 37 * hashCode + ((workRequirementSequencePK != null) ? workRequirementSequencePK.hashCode() : 0);
147            hashCode = 37 * hashCode + ((workTimeSequencePK != null) ? workTimeSequencePK.hashCode() : 0);
148            hashCode = 37 * hashCode + ((workAssignmentSelectorPK != null) ? workAssignmentSelectorPK.hashCode() : 0);
149            hashCode = 37 * hashCode + ((estimatedTimeAllowed != null) ? estimatedTimeAllowed.hashCode() : 0);
150            hashCode = 37 * hashCode + ((maximumTimeAllowed != null) ? maximumTimeAllowed.hashCode() : 0);
151            hashCode = 37 * hashCode + ((fromTime != null) ? fromTime.hashCode() : 0);
152            hashCode = 37 * hashCode + ((thruTime != null) ? thruTime.hashCode() : 0);
153            
154            _hashCode = hashCode;
155        }
156        
157        return _hashCode;
158    }
159    
160    @Override
161    public String toString() {
162        if(_stringValue == null) {
163            _stringValue = "{" + 
164                    "entityId=" + getEntityId() +
165                    ", workRequirementScopePK=" + getWorkRequirementScopePK() +
166                    ", workEffortScopePK=" + getWorkEffortScopePK() +
167                    ", workRequirementTypePK=" + getWorkRequirementTypePK() +
168                    ", workRequirementSequencePK=" + getWorkRequirementSequencePK() +
169                    ", workTimeSequencePK=" + getWorkTimeSequencePK() +
170                    ", workAssignmentSelectorPK=" + getWorkAssignmentSelectorPK() +
171                    ", estimatedTimeAllowed=" + getEstimatedTimeAllowed() +
172                    ", maximumTimeAllowed=" + getMaximumTimeAllowed() +
173                    ", fromTime=" + getFromTime() +
174                    ", thruTime=" + getThruTime() +
175                    "}";
176        }
177        return _stringValue;
178    }
179    
180    @Override
181    public boolean equals(Object other) {
182        if(this == other)
183            return true;
184        
185        if(!hasIdentity())
186            return false;
187        
188        if(other instanceof  WorkRequirementScopeDetailValue that) {
189            if(!that.hasIdentity())
190                return false;
191            
192            Long thisEntityId = getEntityId();
193            Long thatEntityId = that.getEntityId();
194            
195            boolean objectsEqual = thisEntityId.equals(thatEntityId);
196            if(objectsEqual)
197                objectsEqual = isIdentical(that);
198            
199            return objectsEqual;
200        } else {
201            return false;
202        }
203    }
204    
205    public boolean isIdentical(Object other) {
206        if(other instanceof WorkRequirementScopeDetailValue that) {
207            boolean objectsEqual = true;
208            
209            
210            if(objectsEqual) {
211                WorkRequirementScopePK thisWorkRequirementScopePK = getWorkRequirementScopePK();
212                WorkRequirementScopePK thatWorkRequirementScopePK = that.getWorkRequirementScopePK();
213                
214                if(thisWorkRequirementScopePK == null) {
215                    objectsEqual = objectsEqual && (thatWorkRequirementScopePK == null);
216                } else {
217                    objectsEqual = objectsEqual && thisWorkRequirementScopePK.equals(thatWorkRequirementScopePK);
218                }
219            }
220            
221            if(objectsEqual) {
222                WorkEffortScopePK thisWorkEffortScopePK = getWorkEffortScopePK();
223                WorkEffortScopePK thatWorkEffortScopePK = that.getWorkEffortScopePK();
224                
225                if(thisWorkEffortScopePK == null) {
226                    objectsEqual = objectsEqual && (thatWorkEffortScopePK == null);
227                } else {
228                    objectsEqual = objectsEqual && thisWorkEffortScopePK.equals(thatWorkEffortScopePK);
229                }
230            }
231            
232            if(objectsEqual) {
233                WorkRequirementTypePK thisWorkRequirementTypePK = getWorkRequirementTypePK();
234                WorkRequirementTypePK thatWorkRequirementTypePK = that.getWorkRequirementTypePK();
235                
236                if(thisWorkRequirementTypePK == null) {
237                    objectsEqual = objectsEqual && (thatWorkRequirementTypePK == null);
238                } else {
239                    objectsEqual = objectsEqual && thisWorkRequirementTypePK.equals(thatWorkRequirementTypePK);
240                }
241            }
242            
243            if(objectsEqual) {
244                SequencePK thisWorkRequirementSequencePK = getWorkRequirementSequencePK();
245                SequencePK thatWorkRequirementSequencePK = that.getWorkRequirementSequencePK();
246                
247                if(thisWorkRequirementSequencePK == null) {
248                    objectsEqual = objectsEqual && (thatWorkRequirementSequencePK == null);
249                } else {
250                    objectsEqual = objectsEqual && thisWorkRequirementSequencePK.equals(thatWorkRequirementSequencePK);
251                }
252            }
253            
254            if(objectsEqual) {
255                SequencePK thisWorkTimeSequencePK = getWorkTimeSequencePK();
256                SequencePK thatWorkTimeSequencePK = that.getWorkTimeSequencePK();
257                
258                if(thisWorkTimeSequencePK == null) {
259                    objectsEqual = objectsEqual && (thatWorkTimeSequencePK == null);
260                } else {
261                    objectsEqual = objectsEqual && thisWorkTimeSequencePK.equals(thatWorkTimeSequencePK);
262                }
263            }
264            
265            if(objectsEqual) {
266                SelectorPK thisWorkAssignmentSelectorPK = getWorkAssignmentSelectorPK();
267                SelectorPK thatWorkAssignmentSelectorPK = that.getWorkAssignmentSelectorPK();
268                
269                if(thisWorkAssignmentSelectorPK == null) {
270                    objectsEqual = objectsEqual && (thatWorkAssignmentSelectorPK == null);
271                } else {
272                    objectsEqual = objectsEqual && thisWorkAssignmentSelectorPK.equals(thatWorkAssignmentSelectorPK);
273                }
274            }
275            
276            if(objectsEqual) {
277                Long thisEstimatedTimeAllowed = getEstimatedTimeAllowed();
278                Long thatEstimatedTimeAllowed = that.getEstimatedTimeAllowed();
279                
280                if(thisEstimatedTimeAllowed == null) {
281                    objectsEqual = objectsEqual && (thatEstimatedTimeAllowed == null);
282                } else {
283                    objectsEqual = objectsEqual && thisEstimatedTimeAllowed.equals(thatEstimatedTimeAllowed);
284                }
285            }
286            
287            if(objectsEqual) {
288                Long thisMaximumTimeAllowed = getMaximumTimeAllowed();
289                Long thatMaximumTimeAllowed = that.getMaximumTimeAllowed();
290                
291                if(thisMaximumTimeAllowed == null) {
292                    objectsEqual = objectsEqual && (thatMaximumTimeAllowed == null);
293                } else {
294                    objectsEqual = objectsEqual && thisMaximumTimeAllowed.equals(thatMaximumTimeAllowed);
295                }
296            }
297            
298            if(objectsEqual) {
299                Long thisFromTime = getFromTime();
300                Long thatFromTime = that.getFromTime();
301                
302                if(thisFromTime == null) {
303                    objectsEqual = objectsEqual && (thatFromTime == null);
304                } else {
305                    objectsEqual = objectsEqual && thisFromTime.equals(thatFromTime);
306                }
307            }
308            
309            if(objectsEqual) {
310                Long thisThruTime = getThruTime();
311                Long thatThruTime = that.getThruTime();
312                
313                if(thisThruTime == null) {
314                    objectsEqual = objectsEqual && (thatThruTime == null);
315                } else {
316                    objectsEqual = objectsEqual && thisThruTime.equals(thatThruTime);
317                }
318            }
319            
320            return objectsEqual;
321        } else {
322            return false;
323        }
324    }
325    
326    @Override
327    public boolean hasBeenModified() {
328        return workRequirementScopePKHasBeenModified || workEffortScopePKHasBeenModified || workRequirementTypePKHasBeenModified || workRequirementSequencePKHasBeenModified || workTimeSequencePKHasBeenModified || workAssignmentSelectorPKHasBeenModified || estimatedTimeAllowedHasBeenModified || maximumTimeAllowedHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified;
329    }
330    
331    @Override
332    public void clearHasBeenModified() {
333        workRequirementScopePKHasBeenModified = false;
334        workEffortScopePKHasBeenModified = false;
335        workRequirementTypePKHasBeenModified = false;
336        workRequirementSequencePKHasBeenModified = false;
337        workTimeSequencePKHasBeenModified = false;
338        workAssignmentSelectorPKHasBeenModified = false;
339        estimatedTimeAllowedHasBeenModified = false;
340        maximumTimeAllowedHasBeenModified = false;
341        fromTimeHasBeenModified = false;
342        thruTimeHasBeenModified = false;
343    }
344    
345    public WorkRequirementScopePK getWorkRequirementScopePK() {
346        return workRequirementScopePK;
347    }
348    
349    public void setWorkRequirementScopePK(WorkRequirementScopePK workRequirementScopePK)
350            throws PersistenceNotNullException {
351        checkForNull(workRequirementScopePK);
352        
353        boolean update = true;
354        
355        if(this.workRequirementScopePK != null) {
356            if(this.workRequirementScopePK.equals(workRequirementScopePK)) {
357                update = false;
358            }
359        } else if(workRequirementScopePK == null) {
360            update = false;
361        }
362        
363        if(update) {
364            this.workRequirementScopePK = workRequirementScopePK;
365            workRequirementScopePKHasBeenModified = true;
366            clearHashAndString();
367        }
368    }
369    
370    public boolean getWorkRequirementScopePKHasBeenModified() {
371        return workRequirementScopePKHasBeenModified;
372    }
373    
374    public WorkEffortScopePK getWorkEffortScopePK() {
375        return workEffortScopePK;
376    }
377    
378    public void setWorkEffortScopePK(WorkEffortScopePK workEffortScopePK)
379            throws PersistenceNotNullException {
380        checkForNull(workEffortScopePK);
381        
382        boolean update = true;
383        
384        if(this.workEffortScopePK != null) {
385            if(this.workEffortScopePK.equals(workEffortScopePK)) {
386                update = false;
387            }
388        } else if(workEffortScopePK == null) {
389            update = false;
390        }
391        
392        if(update) {
393            this.workEffortScopePK = workEffortScopePK;
394            workEffortScopePKHasBeenModified = true;
395            clearHashAndString();
396        }
397    }
398    
399    public boolean getWorkEffortScopePKHasBeenModified() {
400        return workEffortScopePKHasBeenModified;
401    }
402    
403    public WorkRequirementTypePK getWorkRequirementTypePK() {
404        return workRequirementTypePK;
405    }
406    
407    public void setWorkRequirementTypePK(WorkRequirementTypePK workRequirementTypePK)
408            throws PersistenceNotNullException {
409        checkForNull(workRequirementTypePK);
410        
411        boolean update = true;
412        
413        if(this.workRequirementTypePK != null) {
414            if(this.workRequirementTypePK.equals(workRequirementTypePK)) {
415                update = false;
416            }
417        } else if(workRequirementTypePK == null) {
418            update = false;
419        }
420        
421        if(update) {
422            this.workRequirementTypePK = workRequirementTypePK;
423            workRequirementTypePKHasBeenModified = true;
424            clearHashAndString();
425        }
426    }
427    
428    public boolean getWorkRequirementTypePKHasBeenModified() {
429        return workRequirementTypePKHasBeenModified;
430    }
431    
432    public SequencePK getWorkRequirementSequencePK() {
433        return workRequirementSequencePK;
434    }
435    
436    public void setWorkRequirementSequencePK(SequencePK workRequirementSequencePK) {
437        boolean update = true;
438        
439        if(this.workRequirementSequencePK != null) {
440            if(this.workRequirementSequencePK.equals(workRequirementSequencePK)) {
441                update = false;
442            }
443        } else if(workRequirementSequencePK == null) {
444            update = false;
445        }
446        
447        if(update) {
448            this.workRequirementSequencePK = workRequirementSequencePK;
449            workRequirementSequencePKHasBeenModified = true;
450            clearHashAndString();
451        }
452    }
453    
454    public boolean getWorkRequirementSequencePKHasBeenModified() {
455        return workRequirementSequencePKHasBeenModified;
456    }
457    
458    public SequencePK getWorkTimeSequencePK() {
459        return workTimeSequencePK;
460    }
461    
462    public void setWorkTimeSequencePK(SequencePK workTimeSequencePK) {
463        boolean update = true;
464        
465        if(this.workTimeSequencePK != null) {
466            if(this.workTimeSequencePK.equals(workTimeSequencePK)) {
467                update = false;
468            }
469        } else if(workTimeSequencePK == null) {
470            update = false;
471        }
472        
473        if(update) {
474            this.workTimeSequencePK = workTimeSequencePK;
475            workTimeSequencePKHasBeenModified = true;
476            clearHashAndString();
477        }
478    }
479    
480    public boolean getWorkTimeSequencePKHasBeenModified() {
481        return workTimeSequencePKHasBeenModified;
482    }
483    
484    public SelectorPK getWorkAssignmentSelectorPK() {
485        return workAssignmentSelectorPK;
486    }
487    
488    public void setWorkAssignmentSelectorPK(SelectorPK workAssignmentSelectorPK) {
489        boolean update = true;
490        
491        if(this.workAssignmentSelectorPK != null) {
492            if(this.workAssignmentSelectorPK.equals(workAssignmentSelectorPK)) {
493                update = false;
494            }
495        } else if(workAssignmentSelectorPK == null) {
496            update = false;
497        }
498        
499        if(update) {
500            this.workAssignmentSelectorPK = workAssignmentSelectorPK;
501            workAssignmentSelectorPKHasBeenModified = true;
502            clearHashAndString();
503        }
504    }
505    
506    public boolean getWorkAssignmentSelectorPKHasBeenModified() {
507        return workAssignmentSelectorPKHasBeenModified;
508    }
509    
510    public Long getEstimatedTimeAllowed() {
511        return estimatedTimeAllowed;
512    }
513    
514    public void setEstimatedTimeAllowed(Long estimatedTimeAllowed) {
515        boolean update = true;
516        
517        if(this.estimatedTimeAllowed != null) {
518            if(this.estimatedTimeAllowed.equals(estimatedTimeAllowed)) {
519                update = false;
520            }
521        } else if(estimatedTimeAllowed == null) {
522            update = false;
523        }
524        
525        if(update) {
526            this.estimatedTimeAllowed = estimatedTimeAllowed;
527            estimatedTimeAllowedHasBeenModified = true;
528            clearHashAndString();
529        }
530    }
531    
532    public boolean getEstimatedTimeAllowedHasBeenModified() {
533        return estimatedTimeAllowedHasBeenModified;
534    }
535    
536    public Long getMaximumTimeAllowed() {
537        return maximumTimeAllowed;
538    }
539    
540    public void setMaximumTimeAllowed(Long maximumTimeAllowed) {
541        boolean update = true;
542        
543        if(this.maximumTimeAllowed != null) {
544            if(this.maximumTimeAllowed.equals(maximumTimeAllowed)) {
545                update = false;
546            }
547        } else if(maximumTimeAllowed == null) {
548            update = false;
549        }
550        
551        if(update) {
552            this.maximumTimeAllowed = maximumTimeAllowed;
553            maximumTimeAllowedHasBeenModified = true;
554            clearHashAndString();
555        }
556    }
557    
558    public boolean getMaximumTimeAllowedHasBeenModified() {
559        return maximumTimeAllowedHasBeenModified;
560    }
561    
562    public Long getFromTime() {
563        return fromTime;
564    }
565    
566    public void setFromTime(Long fromTime)
567            throws PersistenceNotNullException {
568        checkForNull(fromTime);
569        
570        boolean update = true;
571        
572        if(this.fromTime != null) {
573            if(this.fromTime.equals(fromTime)) {
574                update = false;
575            }
576        } else if(fromTime == null) {
577            update = false;
578        }
579        
580        if(update) {
581            this.fromTime = fromTime;
582            fromTimeHasBeenModified = true;
583            clearHashAndString();
584        }
585    }
586    
587    public boolean getFromTimeHasBeenModified() {
588        return fromTimeHasBeenModified;
589    }
590    
591    public Long getThruTime() {
592        return thruTime;
593    }
594    
595    public void setThruTime(Long thruTime)
596            throws PersistenceNotNullException {
597        checkForNull(thruTime);
598        
599        boolean update = true;
600        
601        if(this.thruTime != null) {
602            if(this.thruTime.equals(thruTime)) {
603                update = false;
604            }
605        } else if(thruTime == null) {
606            update = false;
607        }
608        
609        if(update) {
610            this.thruTime = thruTime;
611            thruTimeHasBeenModified = true;
612            clearHashAndString();
613        }
614    }
615    
616    public boolean getThruTimeHasBeenModified() {
617        return thruTimeHasBeenModified;
618    }
619    
620}