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 * WorkRequirementStatusValue.java
021 */
022
023package com.echothree.model.data.workrequirement.server.value;
024
025import com.echothree.model.data.workrequirement.common.pk.WorkRequirementStatusPK;
026
027import com.echothree.model.data.workrequirement.server.factory.WorkRequirementStatusFactory;
028
029import com.echothree.model.data.workrequirement.common.pk.WorkRequirementPK;
030import com.echothree.model.data.workrequirement.common.pk.WorkAssignmentPK;
031import com.echothree.model.data.workrequirement.common.pk.WorkTimePK;
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 WorkRequirementStatusValue
041        extends BaseValue<WorkRequirementStatusPK>
042        implements Cloneable, Serializable {
043    
044    private WorkRequirementPK workRequirementPK;
045    private boolean workRequirementPKHasBeenModified = false;
046    private Integer workAssignmentSequence;
047    private boolean workAssignmentSequenceHasBeenModified = false;
048    private WorkAssignmentPK lastWorkAssignmentPK;
049    private boolean lastWorkAssignmentPKHasBeenModified = false;
050    private Integer workTimeSequence;
051    private boolean workTimeSequenceHasBeenModified = false;
052    private WorkTimePK lastWorkTimePK;
053    private boolean lastWorkTimePKHasBeenModified = false;
054    
055    private transient Integer _hashCode = null;
056    private transient String _stringValue = null;
057    
058    private void constructFields(WorkRequirementPK workRequirementPK, Integer workAssignmentSequence, WorkAssignmentPK lastWorkAssignmentPK, Integer workTimeSequence, WorkTimePK lastWorkTimePK)
059            throws PersistenceNotNullException {
060        checkForNull(workRequirementPK);
061        this.workRequirementPK = workRequirementPK;
062        checkForNull(workAssignmentSequence);
063        this.workAssignmentSequence = workAssignmentSequence;
064        this.lastWorkAssignmentPK = lastWorkAssignmentPK;
065        checkForNull(workTimeSequence);
066        this.workTimeSequence = workTimeSequence;
067        this.lastWorkTimePK = lastWorkTimePK;
068    }
069    
070    /** Creates a new instance of WorkRequirementStatusValue */
071    public WorkRequirementStatusValue(WorkRequirementStatusPK workRequirementStatusPK, WorkRequirementPK workRequirementPK, Integer workAssignmentSequence, WorkAssignmentPK lastWorkAssignmentPK, Integer workTimeSequence, WorkTimePK lastWorkTimePK)
072            throws PersistenceNotNullException {
073        super(workRequirementStatusPK);
074        constructFields(workRequirementPK, workAssignmentSequence, lastWorkAssignmentPK, workTimeSequence, lastWorkTimePK);
075    }
076    
077    /** Creates a new instance of WorkRequirementStatusValue */
078    public WorkRequirementStatusValue(WorkRequirementPK workRequirementPK, Integer workAssignmentSequence, WorkAssignmentPK lastWorkAssignmentPK, Integer workTimeSequence, WorkTimePK lastWorkTimePK)
079            throws PersistenceNotNullException {
080        super();
081        constructFields(workRequirementPK, workAssignmentSequence, lastWorkAssignmentPK, workTimeSequence, lastWorkTimePK);
082    }
083    
084   @Override
085   public WorkRequirementStatusFactory getBaseFactoryInstance() {
086        return WorkRequirementStatusFactory.getInstance();
087    }
088    
089    @Override
090    public WorkRequirementStatusValue clone() {
091        Object result;
092        
093        try {
094            result = super.clone();
095        } catch (CloneNotSupportedException cnse) {
096            // This shouldn't happen, fail when it does.
097            throw new PersistenceCloneException(cnse);
098        }
099        
100        return (WorkRequirementStatusValue)result;
101    }
102    
103   @Override
104    public WorkRequirementStatusPK getPrimaryKey() {
105        if(_primaryKey == null) {
106            _primaryKey = new WorkRequirementStatusPK(entityId);
107        }
108        
109        return _primaryKey;
110    }
111    
112    private void clearHashAndString() {
113        _hashCode = null;
114        _stringValue = null;
115    }
116    
117    @Override
118    public int hashCode() {
119        if(_hashCode == null) {
120            int hashCode = 17;
121            
122            hashCode = 37 * hashCode + ((entityId != null) ? entityId.hashCode() : 0);
123            
124            hashCode = 37 * hashCode + ((workRequirementPK != null) ? workRequirementPK.hashCode() : 0);
125            hashCode = 37 * hashCode + ((workAssignmentSequence != null) ? workAssignmentSequence.hashCode() : 0);
126            hashCode = 37 * hashCode + ((lastWorkAssignmentPK != null) ? lastWorkAssignmentPK.hashCode() : 0);
127            hashCode = 37 * hashCode + ((workTimeSequence != null) ? workTimeSequence.hashCode() : 0);
128            hashCode = 37 * hashCode + ((lastWorkTimePK != null) ? lastWorkTimePK.hashCode() : 0);
129            
130            _hashCode = hashCode;
131        }
132        
133        return _hashCode;
134    }
135    
136    @Override
137    public String toString() {
138        if(_stringValue == null) {
139            _stringValue = "{" + 
140                    "entityId=" + getEntityId() +
141                    ", workRequirementPK=" + getWorkRequirementPK() +
142                    ", workAssignmentSequence=" + getWorkAssignmentSequence() +
143                    ", lastWorkAssignmentPK=" + getLastWorkAssignmentPK() +
144                    ", workTimeSequence=" + getWorkTimeSequence() +
145                    ", lastWorkTimePK=" + getLastWorkTimePK() +
146                    "}";
147        }
148        return _stringValue;
149    }
150    
151    @Override
152    public boolean equals(Object other) {
153        if(this == other)
154            return true;
155        
156        if(!hasIdentity())
157            return false;
158        
159        if(other instanceof  WorkRequirementStatusValue that) {
160            if(!that.hasIdentity())
161                return false;
162            
163            Long thisEntityId = getEntityId();
164            Long thatEntityId = that.getEntityId();
165            
166            boolean objectsEqual = thisEntityId.equals(thatEntityId);
167            if(objectsEqual)
168                objectsEqual = isIdentical(that);
169            
170            return objectsEqual;
171        } else {
172            return false;
173        }
174    }
175    
176    public boolean isIdentical(Object other) {
177        if(other instanceof WorkRequirementStatusValue that) {
178            boolean objectsEqual = true;
179            
180            
181            if(objectsEqual) {
182                WorkRequirementPK thisWorkRequirementPK = getWorkRequirementPK();
183                WorkRequirementPK thatWorkRequirementPK = that.getWorkRequirementPK();
184                
185                if(thisWorkRequirementPK == null) {
186                    objectsEqual = objectsEqual && (thatWorkRequirementPK == null);
187                } else {
188                    objectsEqual = objectsEqual && thisWorkRequirementPK.equals(thatWorkRequirementPK);
189                }
190            }
191            
192            if(objectsEqual) {
193                Integer thisWorkAssignmentSequence = getWorkAssignmentSequence();
194                Integer thatWorkAssignmentSequence = that.getWorkAssignmentSequence();
195                
196                if(thisWorkAssignmentSequence == null) {
197                    objectsEqual = objectsEqual && (thatWorkAssignmentSequence == null);
198                } else {
199                    objectsEqual = objectsEqual && thisWorkAssignmentSequence.equals(thatWorkAssignmentSequence);
200                }
201            }
202            
203            if(objectsEqual) {
204                WorkAssignmentPK thisLastWorkAssignmentPK = getLastWorkAssignmentPK();
205                WorkAssignmentPK thatLastWorkAssignmentPK = that.getLastWorkAssignmentPK();
206                
207                if(thisLastWorkAssignmentPK == null) {
208                    objectsEqual = objectsEqual && (thatLastWorkAssignmentPK == null);
209                } else {
210                    objectsEqual = objectsEqual && thisLastWorkAssignmentPK.equals(thatLastWorkAssignmentPK);
211                }
212            }
213            
214            if(objectsEqual) {
215                Integer thisWorkTimeSequence = getWorkTimeSequence();
216                Integer thatWorkTimeSequence = that.getWorkTimeSequence();
217                
218                if(thisWorkTimeSequence == null) {
219                    objectsEqual = objectsEqual && (thatWorkTimeSequence == null);
220                } else {
221                    objectsEqual = objectsEqual && thisWorkTimeSequence.equals(thatWorkTimeSequence);
222                }
223            }
224            
225            if(objectsEqual) {
226                WorkTimePK thisLastWorkTimePK = getLastWorkTimePK();
227                WorkTimePK thatLastWorkTimePK = that.getLastWorkTimePK();
228                
229                if(thisLastWorkTimePK == null) {
230                    objectsEqual = objectsEqual && (thatLastWorkTimePK == null);
231                } else {
232                    objectsEqual = objectsEqual && thisLastWorkTimePK.equals(thatLastWorkTimePK);
233                }
234            }
235            
236            return objectsEqual;
237        } else {
238            return false;
239        }
240    }
241    
242    @Override
243    public boolean hasBeenModified() {
244        return workRequirementPKHasBeenModified || workAssignmentSequenceHasBeenModified || lastWorkAssignmentPKHasBeenModified || workTimeSequenceHasBeenModified || lastWorkTimePKHasBeenModified;
245    }
246    
247    @Override
248    public void clearHasBeenModified() {
249        workRequirementPKHasBeenModified = false;
250        workAssignmentSequenceHasBeenModified = false;
251        lastWorkAssignmentPKHasBeenModified = false;
252        workTimeSequenceHasBeenModified = false;
253        lastWorkTimePKHasBeenModified = false;
254    }
255    
256    public WorkRequirementPK getWorkRequirementPK() {
257        return workRequirementPK;
258    }
259    
260    public void setWorkRequirementPK(WorkRequirementPK workRequirementPK)
261            throws PersistenceNotNullException {
262        checkForNull(workRequirementPK);
263        
264        boolean update = true;
265        
266        if(this.workRequirementPK != null) {
267            if(this.workRequirementPK.equals(workRequirementPK)) {
268                update = false;
269            }
270        } else if(workRequirementPK == null) {
271            update = false;
272        }
273        
274        if(update) {
275            this.workRequirementPK = workRequirementPK;
276            workRequirementPKHasBeenModified = true;
277            clearHashAndString();
278        }
279    }
280    
281    public boolean getWorkRequirementPKHasBeenModified() {
282        return workRequirementPKHasBeenModified;
283    }
284    
285    public Integer getWorkAssignmentSequence() {
286        return workAssignmentSequence;
287    }
288    
289    public void setWorkAssignmentSequence(Integer workAssignmentSequence)
290            throws PersistenceNotNullException {
291        checkForNull(workAssignmentSequence);
292        
293        boolean update = true;
294        
295        if(this.workAssignmentSequence != null) {
296            if(this.workAssignmentSequence.equals(workAssignmentSequence)) {
297                update = false;
298            }
299        } else if(workAssignmentSequence == null) {
300            update = false;
301        }
302        
303        if(update) {
304            this.workAssignmentSequence = workAssignmentSequence;
305            workAssignmentSequenceHasBeenModified = true;
306            clearHashAndString();
307        }
308    }
309    
310    public boolean getWorkAssignmentSequenceHasBeenModified() {
311        return workAssignmentSequenceHasBeenModified;
312    }
313    
314    public WorkAssignmentPK getLastWorkAssignmentPK() {
315        return lastWorkAssignmentPK;
316    }
317    
318    public void setLastWorkAssignmentPK(WorkAssignmentPK lastWorkAssignmentPK) {
319        boolean update = true;
320        
321        if(this.lastWorkAssignmentPK != null) {
322            if(this.lastWorkAssignmentPK.equals(lastWorkAssignmentPK)) {
323                update = false;
324            }
325        } else if(lastWorkAssignmentPK == null) {
326            update = false;
327        }
328        
329        if(update) {
330            this.lastWorkAssignmentPK = lastWorkAssignmentPK;
331            lastWorkAssignmentPKHasBeenModified = true;
332            clearHashAndString();
333        }
334    }
335    
336    public boolean getLastWorkAssignmentPKHasBeenModified() {
337        return lastWorkAssignmentPKHasBeenModified;
338    }
339    
340    public Integer getWorkTimeSequence() {
341        return workTimeSequence;
342    }
343    
344    public void setWorkTimeSequence(Integer workTimeSequence)
345            throws PersistenceNotNullException {
346        checkForNull(workTimeSequence);
347        
348        boolean update = true;
349        
350        if(this.workTimeSequence != null) {
351            if(this.workTimeSequence.equals(workTimeSequence)) {
352                update = false;
353            }
354        } else if(workTimeSequence == null) {
355            update = false;
356        }
357        
358        if(update) {
359            this.workTimeSequence = workTimeSequence;
360            workTimeSequenceHasBeenModified = true;
361            clearHashAndString();
362        }
363    }
364    
365    public boolean getWorkTimeSequenceHasBeenModified() {
366        return workTimeSequenceHasBeenModified;
367    }
368    
369    public WorkTimePK getLastWorkTimePK() {
370        return lastWorkTimePK;
371    }
372    
373    public void setLastWorkTimePK(WorkTimePK lastWorkTimePK) {
374        boolean update = true;
375        
376        if(this.lastWorkTimePK != null) {
377            if(this.lastWorkTimePK.equals(lastWorkTimePK)) {
378                update = false;
379            }
380        } else if(lastWorkTimePK == null) {
381            update = false;
382        }
383        
384        if(update) {
385            this.lastWorkTimePK = lastWorkTimePK;
386            lastWorkTimePKHasBeenModified = true;
387            clearHashAndString();
388        }
389    }
390    
391    public boolean getLastWorkTimePKHasBeenModified() {
392        return lastWorkTimePKHasBeenModified;
393    }
394    
395}