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