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 * WorkRequirementDetailValue.java
021 */
022
023package com.echothree.model.data.workrequirement.server.value;
024
025import com.echothree.model.data.workrequirement.common.pk.WorkRequirementDetailPK;
026
027import com.echothree.model.data.workrequirement.server.factory.WorkRequirementDetailFactory;
028
029import com.echothree.model.data.workrequirement.common.pk.WorkRequirementPK;
030import com.echothree.model.data.workeffort.common.pk.WorkEffortPK;
031import com.echothree.model.data.workrequirement.common.pk.WorkRequirementScopePK;
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 WorkRequirementDetailValue
041        extends BaseValue<WorkRequirementDetailPK>
042        implements Cloneable, Serializable {
043    
044    private WorkRequirementPK workRequirementPK;
045    private boolean workRequirementPKHasBeenModified = false;
046    private String workRequirementName;
047    private boolean workRequirementNameHasBeenModified = false;
048    private WorkEffortPK workEffortPK;
049    private boolean workEffortPKHasBeenModified = false;
050    private WorkRequirementScopePK workRequirementScopePK;
051    private boolean workRequirementScopePKHasBeenModified = false;
052    private Long startTime;
053    private boolean startTimeHasBeenModified = false;
054    private Long requiredTime;
055    private boolean requiredTimeHasBeenModified = 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(WorkRequirementPK workRequirementPK, String workRequirementName, WorkEffortPK workEffortPK, WorkRequirementScopePK workRequirementScopePK, Long startTime, Long requiredTime, Long fromTime, Long thruTime)
065            throws PersistenceNotNullException {
066        checkForNull(workRequirementPK);
067        this.workRequirementPK = workRequirementPK;
068        checkForNull(workRequirementName);
069        this.workRequirementName = workRequirementName;
070        checkForNull(workEffortPK);
071        this.workEffortPK = workEffortPK;
072        checkForNull(workRequirementScopePK);
073        this.workRequirementScopePK = workRequirementScopePK;
074        checkForNull(startTime);
075        this.startTime = startTime;
076        this.requiredTime = requiredTime;
077        checkForNull(fromTime);
078        this.fromTime = fromTime;
079        checkForNull(thruTime);
080        this.thruTime = thruTime;
081    }
082    
083    /** Creates a new instance of WorkRequirementDetailValue */
084    public WorkRequirementDetailValue(WorkRequirementDetailPK workRequirementDetailPK, WorkRequirementPK workRequirementPK, String workRequirementName, WorkEffortPK workEffortPK, WorkRequirementScopePK workRequirementScopePK, Long startTime, Long requiredTime, Long fromTime, Long thruTime)
085            throws PersistenceNotNullException {
086        super(workRequirementDetailPK);
087        constructFields(workRequirementPK, workRequirementName, workEffortPK, workRequirementScopePK, startTime, requiredTime, fromTime, thruTime);
088    }
089    
090    /** Creates a new instance of WorkRequirementDetailValue */
091    public WorkRequirementDetailValue(WorkRequirementPK workRequirementPK, String workRequirementName, WorkEffortPK workEffortPK, WorkRequirementScopePK workRequirementScopePK, Long startTime, Long requiredTime, Long fromTime, Long thruTime)
092            throws PersistenceNotNullException {
093        super();
094        constructFields(workRequirementPK, workRequirementName, workEffortPK, workRequirementScopePK, startTime, requiredTime, fromTime, thruTime);
095    }
096    
097   @Override
098   public WorkRequirementDetailFactory getBaseFactoryInstance() {
099        return WorkRequirementDetailFactory.getInstance();
100    }
101    
102    @Override
103    public WorkRequirementDetailValue clone() {
104        Object result;
105        
106        try {
107            result = super.clone();
108        } catch (CloneNotSupportedException cnse) {
109            // This shouldn't happen, fail when it does.
110            throw new PersistenceCloneException(cnse);
111        }
112        
113        return (WorkRequirementDetailValue)result;
114    }
115    
116   @Override
117    public WorkRequirementDetailPK getPrimaryKey() {
118        if(_primaryKey == null) {
119            _primaryKey = new WorkRequirementDetailPK(entityId);
120        }
121        
122        return _primaryKey;
123    }
124    
125    private void clearHashAndString() {
126        _hashCode = null;
127        _stringValue = null;
128    }
129    
130    @Override
131    public int hashCode() {
132        if(_hashCode == null) {
133            int hashCode = 17;
134            
135            hashCode = 37 * hashCode + ((entityId != null) ? entityId.hashCode() : 0);
136            
137            hashCode = 37 * hashCode + ((workRequirementPK != null) ? workRequirementPK.hashCode() : 0);
138            hashCode = 37 * hashCode + ((workRequirementName != null) ? workRequirementName.hashCode() : 0);
139            hashCode = 37 * hashCode + ((workEffortPK != null) ? workEffortPK.hashCode() : 0);
140            hashCode = 37 * hashCode + ((workRequirementScopePK != null) ? workRequirementScopePK.hashCode() : 0);
141            hashCode = 37 * hashCode + ((startTime != null) ? startTime.hashCode() : 0);
142            hashCode = 37 * hashCode + ((requiredTime != null) ? requiredTime.hashCode() : 0);
143            hashCode = 37 * hashCode + ((fromTime != null) ? fromTime.hashCode() : 0);
144            hashCode = 37 * hashCode + ((thruTime != null) ? thruTime.hashCode() : 0);
145            
146            _hashCode = hashCode;
147        }
148        
149        return _hashCode;
150    }
151    
152    @Override
153    public String toString() {
154        if(_stringValue == null) {
155            StringBuilder stringValue = new StringBuilder("{");
156            
157            stringValue.append("entityId=").append(getEntityId());
158            
159            stringValue.append(", workRequirementPK=").append(getWorkRequirementPK());
160            stringValue.append(", workRequirementName=").append(getWorkRequirementName());
161            stringValue.append(", workEffortPK=").append(getWorkEffortPK());
162            stringValue.append(", workRequirementScopePK=").append(getWorkRequirementScopePK());
163            stringValue.append(", startTime=").append(getStartTime());
164            stringValue.append(", requiredTime=").append(getRequiredTime());
165            stringValue.append(", fromTime=").append(getFromTime());
166            stringValue.append(", thruTime=").append(getThruTime());
167            
168            stringValue.append('}');
169            
170            _stringValue = stringValue.toString();
171        }
172        return _stringValue;
173    }
174    
175    @Override
176    public boolean equals(Object other) {
177        if(this == other)
178            return true;
179        
180        if(!hasIdentity())
181            return false;
182        
183        if(other instanceof  WorkRequirementDetailValue) {
184            WorkRequirementDetailValue that = (WorkRequirementDetailValue)other;
185            
186            if(!that.hasIdentity())
187                return false;
188            
189            Long thisEntityId = getEntityId();
190            Long thatEntityId = that.getEntityId();
191            
192            boolean objectsEqual = thisEntityId.equals(thatEntityId);
193            if(objectsEqual)
194                objectsEqual = objectsEqual && isIdentical(that);
195            
196            return objectsEqual;
197        } else {
198            return false;
199        }
200    }
201    
202    public boolean isIdentical(Object other) {
203        if(other instanceof WorkRequirementDetailValue) {
204            WorkRequirementDetailValue that = (WorkRequirementDetailValue)other;
205            boolean objectsEqual = true;
206            
207            
208            if(objectsEqual) {
209                WorkRequirementPK thisWorkRequirementPK = getWorkRequirementPK();
210                WorkRequirementPK thatWorkRequirementPK = that.getWorkRequirementPK();
211                
212                if(thisWorkRequirementPK == null) {
213                    objectsEqual = objectsEqual && (thatWorkRequirementPK == null);
214                } else {
215                    objectsEqual = objectsEqual && thisWorkRequirementPK.equals(thatWorkRequirementPK);
216                }
217            }
218            
219            if(objectsEqual) {
220                String thisWorkRequirementName = getWorkRequirementName();
221                String thatWorkRequirementName = that.getWorkRequirementName();
222                
223                if(thisWorkRequirementName == null) {
224                    objectsEqual = objectsEqual && (thatWorkRequirementName == null);
225                } else {
226                    objectsEqual = objectsEqual && thisWorkRequirementName.equals(thatWorkRequirementName);
227                }
228            }
229            
230            if(objectsEqual) {
231                WorkEffortPK thisWorkEffortPK = getWorkEffortPK();
232                WorkEffortPK thatWorkEffortPK = that.getWorkEffortPK();
233                
234                if(thisWorkEffortPK == null) {
235                    objectsEqual = objectsEqual && (thatWorkEffortPK == null);
236                } else {
237                    objectsEqual = objectsEqual && thisWorkEffortPK.equals(thatWorkEffortPK);
238                }
239            }
240            
241            if(objectsEqual) {
242                WorkRequirementScopePK thisWorkRequirementScopePK = getWorkRequirementScopePK();
243                WorkRequirementScopePK thatWorkRequirementScopePK = that.getWorkRequirementScopePK();
244                
245                if(thisWorkRequirementScopePK == null) {
246                    objectsEqual = objectsEqual && (thatWorkRequirementScopePK == null);
247                } else {
248                    objectsEqual = objectsEqual && thisWorkRequirementScopePK.equals(thatWorkRequirementScopePK);
249                }
250            }
251            
252            if(objectsEqual) {
253                Long thisStartTime = getStartTime();
254                Long thatStartTime = that.getStartTime();
255                
256                if(thisStartTime == null) {
257                    objectsEqual = objectsEqual && (thatStartTime == null);
258                } else {
259                    objectsEqual = objectsEqual && thisStartTime.equals(thatStartTime);
260                }
261            }
262            
263            if(objectsEqual) {
264                Long thisRequiredTime = getRequiredTime();
265                Long thatRequiredTime = that.getRequiredTime();
266                
267                if(thisRequiredTime == null) {
268                    objectsEqual = objectsEqual && (thatRequiredTime == null);
269                } else {
270                    objectsEqual = objectsEqual && thisRequiredTime.equals(thatRequiredTime);
271                }
272            }
273            
274            if(objectsEqual) {
275                Long thisFromTime = getFromTime();
276                Long thatFromTime = that.getFromTime();
277                
278                if(thisFromTime == null) {
279                    objectsEqual = objectsEqual && (thatFromTime == null);
280                } else {
281                    objectsEqual = objectsEqual && thisFromTime.equals(thatFromTime);
282                }
283            }
284            
285            if(objectsEqual) {
286                Long thisThruTime = getThruTime();
287                Long thatThruTime = that.getThruTime();
288                
289                if(thisThruTime == null) {
290                    objectsEqual = objectsEqual && (thatThruTime == null);
291                } else {
292                    objectsEqual = objectsEqual && thisThruTime.equals(thatThruTime);
293                }
294            }
295            
296            return objectsEqual;
297        } else {
298            return false;
299        }
300    }
301    
302    @Override
303    public boolean hasBeenModified() {
304        return workRequirementPKHasBeenModified || workRequirementNameHasBeenModified || workEffortPKHasBeenModified || workRequirementScopePKHasBeenModified || startTimeHasBeenModified || requiredTimeHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified;
305    }
306    
307    @Override
308    public void clearHasBeenModified() {
309        workRequirementPKHasBeenModified = false;
310        workRequirementNameHasBeenModified = false;
311        workEffortPKHasBeenModified = false;
312        workRequirementScopePKHasBeenModified = false;
313        startTimeHasBeenModified = false;
314        requiredTimeHasBeenModified = false;
315        fromTimeHasBeenModified = false;
316        thruTimeHasBeenModified = false;
317    }
318    
319    public WorkRequirementPK getWorkRequirementPK() {
320        return workRequirementPK;
321    }
322    
323    public void setWorkRequirementPK(WorkRequirementPK workRequirementPK)
324            throws PersistenceNotNullException {
325        checkForNull(workRequirementPK);
326        
327        boolean update = true;
328        
329        if(this.workRequirementPK != null) {
330            if(this.workRequirementPK.equals(workRequirementPK)) {
331                update = false;
332            }
333        } else if(workRequirementPK == null) {
334            update = false;
335        }
336        
337        if(update) {
338            this.workRequirementPK = workRequirementPK;
339            workRequirementPKHasBeenModified = true;
340            clearHashAndString();
341        }
342    }
343    
344    public boolean getWorkRequirementPKHasBeenModified() {
345        return workRequirementPKHasBeenModified;
346    }
347    
348    public String getWorkRequirementName() {
349        return workRequirementName;
350    }
351    
352    public void setWorkRequirementName(String workRequirementName)
353            throws PersistenceNotNullException {
354        checkForNull(workRequirementName);
355        
356        boolean update = true;
357        
358        if(this.workRequirementName != null) {
359            if(this.workRequirementName.equals(workRequirementName)) {
360                update = false;
361            }
362        } else if(workRequirementName == null) {
363            update = false;
364        }
365        
366        if(update) {
367            this.workRequirementName = workRequirementName;
368            workRequirementNameHasBeenModified = true;
369            clearHashAndString();
370        }
371    }
372    
373    public boolean getWorkRequirementNameHasBeenModified() {
374        return workRequirementNameHasBeenModified;
375    }
376    
377    public WorkEffortPK getWorkEffortPK() {
378        return workEffortPK;
379    }
380    
381    public void setWorkEffortPK(WorkEffortPK workEffortPK)
382            throws PersistenceNotNullException {
383        checkForNull(workEffortPK);
384        
385        boolean update = true;
386        
387        if(this.workEffortPK != null) {
388            if(this.workEffortPK.equals(workEffortPK)) {
389                update = false;
390            }
391        } else if(workEffortPK == null) {
392            update = false;
393        }
394        
395        if(update) {
396            this.workEffortPK = workEffortPK;
397            workEffortPKHasBeenModified = true;
398            clearHashAndString();
399        }
400    }
401    
402    public boolean getWorkEffortPKHasBeenModified() {
403        return workEffortPKHasBeenModified;
404    }
405    
406    public WorkRequirementScopePK getWorkRequirementScopePK() {
407        return workRequirementScopePK;
408    }
409    
410    public void setWorkRequirementScopePK(WorkRequirementScopePK workRequirementScopePK)
411            throws PersistenceNotNullException {
412        checkForNull(workRequirementScopePK);
413        
414        boolean update = true;
415        
416        if(this.workRequirementScopePK != null) {
417            if(this.workRequirementScopePK.equals(workRequirementScopePK)) {
418                update = false;
419            }
420        } else if(workRequirementScopePK == null) {
421            update = false;
422        }
423        
424        if(update) {
425            this.workRequirementScopePK = workRequirementScopePK;
426            workRequirementScopePKHasBeenModified = true;
427            clearHashAndString();
428        }
429    }
430    
431    public boolean getWorkRequirementScopePKHasBeenModified() {
432        return workRequirementScopePKHasBeenModified;
433    }
434    
435    public Long getStartTime() {
436        return startTime;
437    }
438    
439    public void setStartTime(Long startTime)
440            throws PersistenceNotNullException {
441        checkForNull(startTime);
442        
443        boolean update = true;
444        
445        if(this.startTime != null) {
446            if(this.startTime.equals(startTime)) {
447                update = false;
448            }
449        } else if(startTime == null) {
450            update = false;
451        }
452        
453        if(update) {
454            this.startTime = startTime;
455            startTimeHasBeenModified = true;
456            clearHashAndString();
457        }
458    }
459    
460    public boolean getStartTimeHasBeenModified() {
461        return startTimeHasBeenModified;
462    }
463    
464    public Long getRequiredTime() {
465        return requiredTime;
466    }
467    
468    public void setRequiredTime(Long requiredTime) {
469        boolean update = true;
470        
471        if(this.requiredTime != null) {
472            if(this.requiredTime.equals(requiredTime)) {
473                update = false;
474            }
475        } else if(requiredTime == null) {
476            update = false;
477        }
478        
479        if(update) {
480            this.requiredTime = requiredTime;
481            requiredTimeHasBeenModified = true;
482            clearHashAndString();
483        }
484    }
485    
486    public boolean getRequiredTimeHasBeenModified() {
487        return requiredTimeHasBeenModified;
488    }
489    
490    public Long getFromTime() {
491        return fromTime;
492    }
493    
494    public void setFromTime(Long fromTime)
495            throws PersistenceNotNullException {
496        checkForNull(fromTime);
497        
498        boolean update = true;
499        
500        if(this.fromTime != null) {
501            if(this.fromTime.equals(fromTime)) {
502                update = false;
503            }
504        } else if(fromTime == null) {
505            update = false;
506        }
507        
508        if(update) {
509            this.fromTime = fromTime;
510            fromTimeHasBeenModified = true;
511            clearHashAndString();
512        }
513    }
514    
515    public boolean getFromTimeHasBeenModified() {
516        return fromTimeHasBeenModified;
517    }
518    
519    public Long getThruTime() {
520        return thruTime;
521    }
522    
523    public void setThruTime(Long thruTime)
524            throws PersistenceNotNullException {
525        checkForNull(thruTime);
526        
527        boolean update = true;
528        
529        if(this.thruTime != null) {
530            if(this.thruTime.equals(thruTime)) {
531                update = false;
532            }
533        } else if(thruTime == null) {
534            update = false;
535        }
536        
537        if(update) {
538            this.thruTime = thruTime;
539            thruTimeHasBeenModified = true;
540            clearHashAndString();
541        }
542    }
543    
544    public boolean getThruTimeHasBeenModified() {
545        return thruTimeHasBeenModified;
546    }
547    
548}