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