001// --------------------------------------------------------------------------------
002// Copyright 2002-2026 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 * UserVisitCommandValue.java
021 */
022
023package com.echothree.model.data.user.server.value;
024
025import com.echothree.model.data.user.common.pk.UserVisitCommandPK;
026
027import com.echothree.model.data.user.server.factory.UserVisitCommandFactory;
028
029import com.echothree.model.data.user.common.pk.UserVisitPK;
030import com.echothree.model.data.party.common.pk.PartyPK;
031import com.echothree.model.data.core.common.pk.CommandPK;
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
040import javax.annotation.Nonnull;
041import javax.annotation.Nullable;
042
043public class UserVisitCommandValue
044        extends BaseValue<UserVisitCommandPK>
045        implements Cloneable, Serializable {
046    
047    private UserVisitPK userVisitPK;
048    private boolean userVisitPKHasBeenModified = false;
049    private Integer userVisitCommandSequence;
050    private boolean userVisitCommandSequenceHasBeenModified = false;
051    private PartyPK partyPK;
052    private boolean partyPKHasBeenModified = false;
053    private CommandPK commandPK;
054    private boolean commandPKHasBeenModified = false;
055    private Long startTime;
056    private boolean startTimeHasBeenModified = false;
057    private Long endTime;
058    private boolean endTimeHasBeenModified = false;
059    private Boolean hadSecurityErrors;
060    private boolean hadSecurityErrorsHasBeenModified = false;
061    private Boolean hadValidationErrors;
062    private boolean hadValidationErrorsHasBeenModified = false;
063    private Boolean hadExecutionErrors;
064    private boolean hadExecutionErrorsHasBeenModified = false;
065    
066    private transient Integer _hashCode = null;
067    private transient String _stringValue = null;
068    
069    private void constructFields(UserVisitPK userVisitPK, Integer userVisitCommandSequence, PartyPK partyPK, CommandPK commandPK, Long startTime, Long endTime, Boolean hadSecurityErrors, Boolean hadValidationErrors, Boolean hadExecutionErrors)
070            throws PersistenceNotNullException {
071        checkForNull(userVisitPK);
072        this.userVisitPK = userVisitPK;
073        checkForNull(userVisitCommandSequence);
074        this.userVisitCommandSequence = userVisitCommandSequence;
075        this.partyPK = partyPK;
076        checkForNull(commandPK);
077        this.commandPK = commandPK;
078        checkForNull(startTime);
079        this.startTime = startTime;
080        checkForNull(endTime);
081        this.endTime = endTime;
082        this.hadSecurityErrors = hadSecurityErrors;
083        this.hadValidationErrors = hadValidationErrors;
084        this.hadExecutionErrors = hadExecutionErrors;
085    }
086    
087    /** Creates a new instance of UserVisitCommandValue */
088    public UserVisitCommandValue(UserVisitCommandPK userVisitCommandPK, UserVisitPK userVisitPK, Integer userVisitCommandSequence, PartyPK partyPK, CommandPK commandPK, Long startTime, Long endTime, Boolean hadSecurityErrors, Boolean hadValidationErrors, Boolean hadExecutionErrors)
089            throws PersistenceNotNullException {
090        super(userVisitCommandPK);
091        constructFields(userVisitPK, userVisitCommandSequence, partyPK, commandPK, startTime, endTime, hadSecurityErrors, hadValidationErrors, hadExecutionErrors);
092    }
093    
094    /** Creates a new instance of UserVisitCommandValue */
095    public UserVisitCommandValue(UserVisitPK userVisitPK, Integer userVisitCommandSequence, PartyPK partyPK, CommandPK commandPK, Long startTime, Long endTime, Boolean hadSecurityErrors, Boolean hadValidationErrors, Boolean hadExecutionErrors)
096            throws PersistenceNotNullException {
097        super();
098        constructFields(userVisitPK, userVisitCommandSequence, partyPK, commandPK, startTime, endTime, hadSecurityErrors, hadValidationErrors, hadExecutionErrors);
099    }
100    
101    @Override
102    @Nonnull
103    public UserVisitCommandFactory getBaseFactoryInstance() {
104        return UserVisitCommandFactory.getInstance();
105    }
106    
107    @Override
108    @Nonnull
109    public UserVisitCommandValue clone() {
110        Object result;
111        
112        try {
113            result = super.clone();
114        } catch (CloneNotSupportedException cnse) {
115            // This shouldn't happen, fail when it does.
116            throw new PersistenceCloneException(cnse);
117        }
118        
119        return (UserVisitCommandValue)result;
120    }
121    
122    @Override
123    @Nonnull
124    public UserVisitCommandPK getPrimaryKey() {
125        if(_primaryKey == null) {
126            _primaryKey = new UserVisitCommandPK(entityId);
127        }
128        
129        return _primaryKey;
130    }
131    
132    private void clearHashAndString() {
133        _hashCode = null;
134        _stringValue = null;
135    }
136    
137    @Override
138    public int hashCode() {
139        if(_hashCode == null) {
140            int hashCode = 17;
141            
142            hashCode = 37 * hashCode + ((entityId != null) ? entityId.hashCode() : 0);
143            
144            hashCode = 37 * hashCode + ((userVisitPK != null) ? userVisitPK.hashCode() : 0);
145            hashCode = 37 * hashCode + ((userVisitCommandSequence != null) ? userVisitCommandSequence.hashCode() : 0);
146            hashCode = 37 * hashCode + ((partyPK != null) ? partyPK.hashCode() : 0);
147            hashCode = 37 * hashCode + ((commandPK != null) ? commandPK.hashCode() : 0);
148            hashCode = 37 * hashCode + ((startTime != null) ? startTime.hashCode() : 0);
149            hashCode = 37 * hashCode + ((endTime != null) ? endTime.hashCode() : 0);
150            hashCode = 37 * hashCode + ((hadSecurityErrors != null) ? hadSecurityErrors.hashCode() : 0);
151            hashCode = 37 * hashCode + ((hadValidationErrors != null) ? hadValidationErrors.hashCode() : 0);
152            hashCode = 37 * hashCode + ((hadExecutionErrors != null) ? hadExecutionErrors.hashCode() : 0);
153            
154            _hashCode = hashCode;
155        }
156        
157        return _hashCode;
158    }
159    
160    @Override
161    @Nonnull
162    public String toString() {
163        if(_stringValue == null) {
164            _stringValue = "{" + 
165                    "entityId=" + getEntityId() +
166                    ", userVisitPK=" + getUserVisitPK() +
167                    ", userVisitCommandSequence=" + getUserVisitCommandSequence() +
168                    ", partyPK=" + getPartyPK() +
169                    ", commandPK=" + getCommandPK() +
170                    ", startTime=" + getStartTime() +
171                    ", endTime=" + getEndTime() +
172                    ", hadSecurityErrors=" + getHadSecurityErrors() +
173                    ", hadValidationErrors=" + getHadValidationErrors() +
174                    ", hadExecutionErrors=" + getHadExecutionErrors() +
175                    "}";
176        }
177        return _stringValue;
178    }
179    
180    @Override
181    public boolean equals(Object other) {
182        if(this == other)
183            return true;
184        
185        if(!hasIdentity())
186            return false;
187        
188        if(other instanceof  UserVisitCommandValue that) {
189            if(!that.hasIdentity())
190                return false;
191            
192            Long thisEntityId = getEntityId();
193            Long thatEntityId = that.getEntityId();
194            
195            boolean objectsEqual = thisEntityId.equals(thatEntityId);
196            if(objectsEqual)
197                objectsEqual = isIdentical(that);
198            
199            return objectsEqual;
200        } else {
201            return false;
202        }
203    }
204    
205    public boolean isIdentical(Object other) {
206        if(other instanceof UserVisitCommandValue that) {
207            boolean objectsEqual = true;
208            
209            
210            if(objectsEqual) {
211                UserVisitPK thisUserVisitPK = getUserVisitPK();
212                UserVisitPK thatUserVisitPK = that.getUserVisitPK();
213                
214                if(thisUserVisitPK == null) {
215                    objectsEqual = objectsEqual && (thatUserVisitPK == null);
216                } else {
217                    objectsEqual = objectsEqual && thisUserVisitPK.equals(thatUserVisitPK);
218                }
219            }
220            
221            if(objectsEqual) {
222                Integer thisUserVisitCommandSequence = getUserVisitCommandSequence();
223                Integer thatUserVisitCommandSequence = that.getUserVisitCommandSequence();
224                
225                if(thisUserVisitCommandSequence == null) {
226                    objectsEqual = objectsEqual && (thatUserVisitCommandSequence == null);
227                } else {
228                    objectsEqual = objectsEqual && thisUserVisitCommandSequence.equals(thatUserVisitCommandSequence);
229                }
230            }
231            
232            if(objectsEqual) {
233                PartyPK thisPartyPK = getPartyPK();
234                PartyPK thatPartyPK = that.getPartyPK();
235                
236                if(thisPartyPK == null) {
237                    objectsEqual = objectsEqual && (thatPartyPK == null);
238                } else {
239                    objectsEqual = objectsEqual && thisPartyPK.equals(thatPartyPK);
240                }
241            }
242            
243            if(objectsEqual) {
244                CommandPK thisCommandPK = getCommandPK();
245                CommandPK thatCommandPK = that.getCommandPK();
246                
247                if(thisCommandPK == null) {
248                    objectsEqual = objectsEqual && (thatCommandPK == null);
249                } else {
250                    objectsEqual = objectsEqual && thisCommandPK.equals(thatCommandPK);
251                }
252            }
253            
254            if(objectsEqual) {
255                Long thisStartTime = getStartTime();
256                Long thatStartTime = that.getStartTime();
257                
258                if(thisStartTime == null) {
259                    objectsEqual = objectsEqual && (thatStartTime == null);
260                } else {
261                    objectsEqual = objectsEqual && thisStartTime.equals(thatStartTime);
262                }
263            }
264            
265            if(objectsEqual) {
266                Long thisEndTime = getEndTime();
267                Long thatEndTime = that.getEndTime();
268                
269                if(thisEndTime == null) {
270                    objectsEqual = objectsEqual && (thatEndTime == null);
271                } else {
272                    objectsEqual = objectsEqual && thisEndTime.equals(thatEndTime);
273                }
274            }
275            
276            if(objectsEqual) {
277                Boolean thisHadSecurityErrors = getHadSecurityErrors();
278                Boolean thatHadSecurityErrors = that.getHadSecurityErrors();
279                
280                if(thisHadSecurityErrors == null) {
281                    objectsEqual = objectsEqual && (thatHadSecurityErrors == null);
282                } else {
283                    objectsEqual = objectsEqual && thisHadSecurityErrors.equals(thatHadSecurityErrors);
284                }
285            }
286            
287            if(objectsEqual) {
288                Boolean thisHadValidationErrors = getHadValidationErrors();
289                Boolean thatHadValidationErrors = that.getHadValidationErrors();
290                
291                if(thisHadValidationErrors == null) {
292                    objectsEqual = objectsEqual && (thatHadValidationErrors == null);
293                } else {
294                    objectsEqual = objectsEqual && thisHadValidationErrors.equals(thatHadValidationErrors);
295                }
296            }
297            
298            if(objectsEqual) {
299                Boolean thisHadExecutionErrors = getHadExecutionErrors();
300                Boolean thatHadExecutionErrors = that.getHadExecutionErrors();
301                
302                if(thisHadExecutionErrors == null) {
303                    objectsEqual = objectsEqual && (thatHadExecutionErrors == null);
304                } else {
305                    objectsEqual = objectsEqual && thisHadExecutionErrors.equals(thatHadExecutionErrors);
306                }
307            }
308            
309            return objectsEqual;
310        } else {
311            return false;
312        }
313    }
314    
315    @Override
316    public boolean hasBeenModified() {
317        return userVisitPKHasBeenModified || userVisitCommandSequenceHasBeenModified || partyPKHasBeenModified || commandPKHasBeenModified || startTimeHasBeenModified || endTimeHasBeenModified || hadSecurityErrorsHasBeenModified || hadValidationErrorsHasBeenModified || hadExecutionErrorsHasBeenModified;
318    }
319    
320    @Override
321    public void clearHasBeenModified() {
322        userVisitPKHasBeenModified = false;
323        userVisitCommandSequenceHasBeenModified = false;
324        partyPKHasBeenModified = false;
325        commandPKHasBeenModified = false;
326        startTimeHasBeenModified = false;
327        endTimeHasBeenModified = false;
328        hadSecurityErrorsHasBeenModified = false;
329        hadValidationErrorsHasBeenModified = false;
330        hadExecutionErrorsHasBeenModified = false;
331    }
332    
333    @Nonnull
334    public UserVisitPK getUserVisitPK() {
335        return userVisitPK;
336    }
337    
338    public void setUserVisitPK(@Nonnull UserVisitPK userVisitPK)
339            throws PersistenceNotNullException {
340        checkForNull(userVisitPK);
341        
342        boolean update = true;
343        
344        if(this.userVisitPK != null) {
345            if(this.userVisitPK.equals(userVisitPK)) {
346                update = false;
347            }
348        } else if(userVisitPK == null) {
349            update = false;
350        }
351        
352        if(update) {
353            this.userVisitPK = userVisitPK;
354            userVisitPKHasBeenModified = true;
355            clearHashAndString();
356        }
357    }
358    
359    public boolean getUserVisitPKHasBeenModified() {
360        return userVisitPKHasBeenModified;
361    }
362    
363    @Nonnull
364    public Integer getUserVisitCommandSequence() {
365        return userVisitCommandSequence;
366    }
367    
368    public void setUserVisitCommandSequence(@Nonnull Integer userVisitCommandSequence)
369            throws PersistenceNotNullException {
370        checkForNull(userVisitCommandSequence);
371        
372        boolean update = true;
373        
374        if(this.userVisitCommandSequence != null) {
375            if(this.userVisitCommandSequence.equals(userVisitCommandSequence)) {
376                update = false;
377            }
378        } else if(userVisitCommandSequence == null) {
379            update = false;
380        }
381        
382        if(update) {
383            this.userVisitCommandSequence = userVisitCommandSequence;
384            userVisitCommandSequenceHasBeenModified = true;
385            clearHashAndString();
386        }
387    }
388    
389    public boolean getUserVisitCommandSequenceHasBeenModified() {
390        return userVisitCommandSequenceHasBeenModified;
391    }
392    
393    @Nullable
394    public PartyPK getPartyPK() {
395        return partyPK;
396    }
397    
398    public void setPartyPK(@Nullable PartyPK partyPK) {
399        boolean update = true;
400        
401        if(this.partyPK != null) {
402            if(this.partyPK.equals(partyPK)) {
403                update = false;
404            }
405        } else if(partyPK == null) {
406            update = false;
407        }
408        
409        if(update) {
410            this.partyPK = partyPK;
411            partyPKHasBeenModified = true;
412            clearHashAndString();
413        }
414    }
415    
416    public boolean getPartyPKHasBeenModified() {
417        return partyPKHasBeenModified;
418    }
419    
420    @Nonnull
421    public CommandPK getCommandPK() {
422        return commandPK;
423    }
424    
425    public void setCommandPK(@Nonnull CommandPK commandPK)
426            throws PersistenceNotNullException {
427        checkForNull(commandPK);
428        
429        boolean update = true;
430        
431        if(this.commandPK != null) {
432            if(this.commandPK.equals(commandPK)) {
433                update = false;
434            }
435        } else if(commandPK == null) {
436            update = false;
437        }
438        
439        if(update) {
440            this.commandPK = commandPK;
441            commandPKHasBeenModified = true;
442            clearHashAndString();
443        }
444    }
445    
446    public boolean getCommandPKHasBeenModified() {
447        return commandPKHasBeenModified;
448    }
449    
450    @Nonnull
451    public Long getStartTime() {
452        return startTime;
453    }
454    
455    public void setStartTime(@Nonnull Long startTime)
456            throws PersistenceNotNullException {
457        checkForNull(startTime);
458        
459        boolean update = true;
460        
461        if(this.startTime != null) {
462            if(this.startTime.equals(startTime)) {
463                update = false;
464            }
465        } else if(startTime == null) {
466            update = false;
467        }
468        
469        if(update) {
470            this.startTime = startTime;
471            startTimeHasBeenModified = true;
472            clearHashAndString();
473        }
474    }
475    
476    public boolean getStartTimeHasBeenModified() {
477        return startTimeHasBeenModified;
478    }
479    
480    @Nonnull
481    public Long getEndTime() {
482        return endTime;
483    }
484    
485    public void setEndTime(@Nonnull Long endTime)
486            throws PersistenceNotNullException {
487        checkForNull(endTime);
488        
489        boolean update = true;
490        
491        if(this.endTime != null) {
492            if(this.endTime.equals(endTime)) {
493                update = false;
494            }
495        } else if(endTime == null) {
496            update = false;
497        }
498        
499        if(update) {
500            this.endTime = endTime;
501            endTimeHasBeenModified = true;
502            clearHashAndString();
503        }
504    }
505    
506    public boolean getEndTimeHasBeenModified() {
507        return endTimeHasBeenModified;
508    }
509    
510    @Nullable
511    public Boolean getHadSecurityErrors() {
512        return hadSecurityErrors;
513    }
514    
515    public void setHadSecurityErrors(@Nullable Boolean hadSecurityErrors) {
516        boolean update = true;
517        
518        if(this.hadSecurityErrors != null) {
519            if(this.hadSecurityErrors.equals(hadSecurityErrors)) {
520                update = false;
521            }
522        } else if(hadSecurityErrors == null) {
523            update = false;
524        }
525        
526        if(update) {
527            this.hadSecurityErrors = hadSecurityErrors;
528            hadSecurityErrorsHasBeenModified = true;
529            clearHashAndString();
530        }
531    }
532    
533    public boolean getHadSecurityErrorsHasBeenModified() {
534        return hadSecurityErrorsHasBeenModified;
535    }
536    
537    @Nullable
538    public Boolean getHadValidationErrors() {
539        return hadValidationErrors;
540    }
541    
542    public void setHadValidationErrors(@Nullable Boolean hadValidationErrors) {
543        boolean update = true;
544        
545        if(this.hadValidationErrors != null) {
546            if(this.hadValidationErrors.equals(hadValidationErrors)) {
547                update = false;
548            }
549        } else if(hadValidationErrors == null) {
550            update = false;
551        }
552        
553        if(update) {
554            this.hadValidationErrors = hadValidationErrors;
555            hadValidationErrorsHasBeenModified = true;
556            clearHashAndString();
557        }
558    }
559    
560    public boolean getHadValidationErrorsHasBeenModified() {
561        return hadValidationErrorsHasBeenModified;
562    }
563    
564    @Nullable
565    public Boolean getHadExecutionErrors() {
566        return hadExecutionErrors;
567    }
568    
569    public void setHadExecutionErrors(@Nullable Boolean hadExecutionErrors) {
570        boolean update = true;
571        
572        if(this.hadExecutionErrors != null) {
573            if(this.hadExecutionErrors.equals(hadExecutionErrors)) {
574                update = false;
575            }
576        } else if(hadExecutionErrors == null) {
577            update = false;
578        }
579        
580        if(update) {
581            this.hadExecutionErrors = hadExecutionErrors;
582            hadExecutionErrorsHasBeenModified = true;
583            clearHashAndString();
584        }
585    }
586    
587    public boolean getHadExecutionErrorsHasBeenModified() {
588        return hadExecutionErrorsHasBeenModified;
589    }
590    
591}