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 * 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            StringBuilder stringValue = new StringBuilder("{");
157            
158            stringValue.append("entityId=").append(getEntityId());
159            
160            stringValue.append(", workflowStepPK=").append(getWorkflowStepPK());
161            stringValue.append(", workflowPK=").append(getWorkflowPK());
162            stringValue.append(", workflowStepName=").append(getWorkflowStepName());
163            stringValue.append(", workflowStepTypePK=").append(getWorkflowStepTypePK());
164            stringValue.append(", isDefault=").append(getIsDefault());
165            stringValue.append(", sortOrder=").append(getSortOrder());
166            stringValue.append(", fromTime=").append(getFromTime());
167            stringValue.append(", thruTime=").append(getThruTime());
168            
169            stringValue.append('}');
170            
171            _stringValue = stringValue.toString();
172        }
173        return _stringValue;
174    }
175    
176    @Override
177    public boolean equals(Object other) {
178        if(this == other)
179            return true;
180        
181        if(!hasIdentity())
182            return false;
183        
184        if(other instanceof  WorkflowStepDetailValue) {
185            WorkflowStepDetailValue that = (WorkflowStepDetailValue)other;
186            
187            if(!that.hasIdentity())
188                return false;
189            
190            Long thisEntityId = getEntityId();
191            Long thatEntityId = that.getEntityId();
192            
193            boolean objectsEqual = thisEntityId.equals(thatEntityId);
194            if(objectsEqual)
195                objectsEqual = objectsEqual && isIdentical(that);
196            
197            return objectsEqual;
198        } else {
199            return false;
200        }
201    }
202    
203    public boolean isIdentical(Object other) {
204        if(other instanceof WorkflowStepDetailValue) {
205            WorkflowStepDetailValue that = (WorkflowStepDetailValue)other;
206            boolean objectsEqual = true;
207            
208            
209            if(objectsEqual) {
210                WorkflowStepPK thisWorkflowStepPK = getWorkflowStepPK();
211                WorkflowStepPK thatWorkflowStepPK = that.getWorkflowStepPK();
212                
213                if(thisWorkflowStepPK == null) {
214                    objectsEqual = objectsEqual && (thatWorkflowStepPK == null);
215                } else {
216                    objectsEqual = objectsEqual && thisWorkflowStepPK.equals(thatWorkflowStepPK);
217                }
218            }
219            
220            if(objectsEqual) {
221                WorkflowPK thisWorkflowPK = getWorkflowPK();
222                WorkflowPK thatWorkflowPK = that.getWorkflowPK();
223                
224                if(thisWorkflowPK == null) {
225                    objectsEqual = objectsEqual && (thatWorkflowPK == null);
226                } else {
227                    objectsEqual = objectsEqual && thisWorkflowPK.equals(thatWorkflowPK);
228                }
229            }
230            
231            if(objectsEqual) {
232                String thisWorkflowStepName = getWorkflowStepName();
233                String thatWorkflowStepName = that.getWorkflowStepName();
234                
235                if(thisWorkflowStepName == null) {
236                    objectsEqual = objectsEqual && (thatWorkflowStepName == null);
237                } else {
238                    objectsEqual = objectsEqual && thisWorkflowStepName.equals(thatWorkflowStepName);
239                }
240            }
241            
242            if(objectsEqual) {
243                WorkflowStepTypePK thisWorkflowStepTypePK = getWorkflowStepTypePK();
244                WorkflowStepTypePK thatWorkflowStepTypePK = that.getWorkflowStepTypePK();
245                
246                if(thisWorkflowStepTypePK == null) {
247                    objectsEqual = objectsEqual && (thatWorkflowStepTypePK == null);
248                } else {
249                    objectsEqual = objectsEqual && thisWorkflowStepTypePK.equals(thatWorkflowStepTypePK);
250                }
251            }
252            
253            if(objectsEqual) {
254                Boolean thisIsDefault = getIsDefault();
255                Boolean thatIsDefault = that.getIsDefault();
256                
257                if(thisIsDefault == null) {
258                    objectsEqual = objectsEqual && (thatIsDefault == null);
259                } else {
260                    objectsEqual = objectsEqual && thisIsDefault.equals(thatIsDefault);
261                }
262            }
263            
264            if(objectsEqual) {
265                Integer thisSortOrder = getSortOrder();
266                Integer thatSortOrder = that.getSortOrder();
267                
268                if(thisSortOrder == null) {
269                    objectsEqual = objectsEqual && (thatSortOrder == null);
270                } else {
271                    objectsEqual = objectsEqual && thisSortOrder.equals(thatSortOrder);
272                }
273            }
274            
275            if(objectsEqual) {
276                Long thisFromTime = getFromTime();
277                Long thatFromTime = that.getFromTime();
278                
279                if(thisFromTime == null) {
280                    objectsEqual = objectsEqual && (thatFromTime == null);
281                } else {
282                    objectsEqual = objectsEqual && thisFromTime.equals(thatFromTime);
283                }
284            }
285            
286            if(objectsEqual) {
287                Long thisThruTime = getThruTime();
288                Long thatThruTime = that.getThruTime();
289                
290                if(thisThruTime == null) {
291                    objectsEqual = objectsEqual && (thatThruTime == null);
292                } else {
293                    objectsEqual = objectsEqual && thisThruTime.equals(thatThruTime);
294                }
295            }
296            
297            return objectsEqual;
298        } else {
299            return false;
300        }
301    }
302    
303    @Override
304    public boolean hasBeenModified() {
305        return workflowStepPKHasBeenModified || workflowPKHasBeenModified || workflowStepNameHasBeenModified || workflowStepTypePKHasBeenModified || isDefaultHasBeenModified || sortOrderHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified;
306    }
307    
308    @Override
309    public void clearHasBeenModified() {
310        workflowStepPKHasBeenModified = false;
311        workflowPKHasBeenModified = false;
312        workflowStepNameHasBeenModified = false;
313        workflowStepTypePKHasBeenModified = false;
314        isDefaultHasBeenModified = false;
315        sortOrderHasBeenModified = false;
316        fromTimeHasBeenModified = false;
317        thruTimeHasBeenModified = false;
318    }
319    
320    public WorkflowStepPK getWorkflowStepPK() {
321        return workflowStepPK;
322    }
323    
324    public void setWorkflowStepPK(WorkflowStepPK workflowStepPK)
325            throws PersistenceNotNullException {
326        checkForNull(workflowStepPK);
327        
328        boolean update = true;
329        
330        if(this.workflowStepPK != null) {
331            if(this.workflowStepPK.equals(workflowStepPK)) {
332                update = false;
333            }
334        } else if(workflowStepPK == null) {
335            update = false;
336        }
337        
338        if(update) {
339            this.workflowStepPK = workflowStepPK;
340            workflowStepPKHasBeenModified = true;
341            clearHashAndString();
342        }
343    }
344    
345    public boolean getWorkflowStepPKHasBeenModified() {
346        return workflowStepPKHasBeenModified;
347    }
348    
349    public WorkflowPK getWorkflowPK() {
350        return workflowPK;
351    }
352    
353    public void setWorkflowPK(WorkflowPK workflowPK)
354            throws PersistenceNotNullException {
355        checkForNull(workflowPK);
356        
357        boolean update = true;
358        
359        if(this.workflowPK != null) {
360            if(this.workflowPK.equals(workflowPK)) {
361                update = false;
362            }
363        } else if(workflowPK == null) {
364            update = false;
365        }
366        
367        if(update) {
368            this.workflowPK = workflowPK;
369            workflowPKHasBeenModified = true;
370            clearHashAndString();
371        }
372    }
373    
374    public boolean getWorkflowPKHasBeenModified() {
375        return workflowPKHasBeenModified;
376    }
377    
378    public String getWorkflowStepName() {
379        return workflowStepName;
380    }
381    
382    public void setWorkflowStepName(String workflowStepName)
383            throws PersistenceNotNullException {
384        checkForNull(workflowStepName);
385        
386        boolean update = true;
387        
388        if(this.workflowStepName != null) {
389            if(this.workflowStepName.equals(workflowStepName)) {
390                update = false;
391            }
392        } else if(workflowStepName == null) {
393            update = false;
394        }
395        
396        if(update) {
397            this.workflowStepName = workflowStepName;
398            workflowStepNameHasBeenModified = true;
399            clearHashAndString();
400        }
401    }
402    
403    public boolean getWorkflowStepNameHasBeenModified() {
404        return workflowStepNameHasBeenModified;
405    }
406    
407    public WorkflowStepTypePK getWorkflowStepTypePK() {
408        return workflowStepTypePK;
409    }
410    
411    public void setWorkflowStepTypePK(WorkflowStepTypePK workflowStepTypePK)
412            throws PersistenceNotNullException {
413        checkForNull(workflowStepTypePK);
414        
415        boolean update = true;
416        
417        if(this.workflowStepTypePK != null) {
418            if(this.workflowStepTypePK.equals(workflowStepTypePK)) {
419                update = false;
420            }
421        } else if(workflowStepTypePK == null) {
422            update = false;
423        }
424        
425        if(update) {
426            this.workflowStepTypePK = workflowStepTypePK;
427            workflowStepTypePKHasBeenModified = true;
428            clearHashAndString();
429        }
430    }
431    
432    public boolean getWorkflowStepTypePKHasBeenModified() {
433        return workflowStepTypePKHasBeenModified;
434    }
435    
436    public Boolean getIsDefault() {
437        return isDefault;
438    }
439    
440    public void setIsDefault(Boolean isDefault)
441            throws PersistenceNotNullException {
442        checkForNull(isDefault);
443        
444        boolean update = true;
445        
446        if(this.isDefault != null) {
447            if(this.isDefault.equals(isDefault)) {
448                update = false;
449            }
450        } else if(isDefault == null) {
451            update = false;
452        }
453        
454        if(update) {
455            this.isDefault = isDefault;
456            isDefaultHasBeenModified = true;
457            clearHashAndString();
458        }
459    }
460    
461    public boolean getIsDefaultHasBeenModified() {
462        return isDefaultHasBeenModified;
463    }
464    
465    public Integer getSortOrder() {
466        return sortOrder;
467    }
468    
469    public void setSortOrder(Integer sortOrder)
470            throws PersistenceNotNullException {
471        checkForNull(sortOrder);
472        
473        boolean update = true;
474        
475        if(this.sortOrder != null) {
476            if(this.sortOrder.equals(sortOrder)) {
477                update = false;
478            }
479        } else if(sortOrder == null) {
480            update = false;
481        }
482        
483        if(update) {
484            this.sortOrder = sortOrder;
485            sortOrderHasBeenModified = true;
486            clearHashAndString();
487        }
488    }
489    
490    public boolean getSortOrderHasBeenModified() {
491        return sortOrderHasBeenModified;
492    }
493    
494    public Long getFromTime() {
495        return fromTime;
496    }
497    
498    public void setFromTime(Long fromTime)
499            throws PersistenceNotNullException {
500        checkForNull(fromTime);
501        
502        boolean update = true;
503        
504        if(this.fromTime != null) {
505            if(this.fromTime.equals(fromTime)) {
506                update = false;
507            }
508        } else if(fromTime == null) {
509            update = false;
510        }
511        
512        if(update) {
513            this.fromTime = fromTime;
514            fromTimeHasBeenModified = true;
515            clearHashAndString();
516        }
517    }
518    
519    public boolean getFromTimeHasBeenModified() {
520        return fromTimeHasBeenModified;
521    }
522    
523    public Long getThruTime() {
524        return thruTime;
525    }
526    
527    public void setThruTime(Long thruTime)
528            throws PersistenceNotNullException {
529        checkForNull(thruTime);
530        
531        boolean update = true;
532        
533        if(this.thruTime != null) {
534            if(this.thruTime.equals(thruTime)) {
535                update = false;
536            }
537        } else if(thruTime == null) {
538            update = false;
539        }
540        
541        if(update) {
542            this.thruTime = thruTime;
543            thruTimeHasBeenModified = true;
544            clearHashAndString();
545        }
546    }
547    
548    public boolean getThruTimeHasBeenModified() {
549        return thruTimeHasBeenModified;
550    }
551    
552}