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