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 * 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            StringBuilder stringValue = new StringBuilder("{");
158            
159            stringValue.append("entityId=").append(getEntityId());
160            
161            stringValue.append(", userVisitPK=").append(getUserVisitPK());
162            stringValue.append(", userVisitCommandSequence=").append(getUserVisitCommandSequence());
163            stringValue.append(", partyPK=").append(getPartyPK());
164            stringValue.append(", commandPK=").append(getCommandPK());
165            stringValue.append(", startTime=").append(getStartTime());
166            stringValue.append(", endTime=").append(getEndTime());
167            stringValue.append(", hadSecurityErrors=").append(getHadSecurityErrors());
168            stringValue.append(", hadValidationErrors=").append(getHadValidationErrors());
169            stringValue.append(", hadExecutionErrors=").append(getHadExecutionErrors());
170            
171            stringValue.append('}');
172            
173            _stringValue = stringValue.toString();
174        }
175        return _stringValue;
176    }
177    
178    @Override
179    public boolean equals(Object other) {
180        if(this == other)
181            return true;
182        
183        if(!hasIdentity())
184            return false;
185        
186        if(other instanceof  UserVisitCommandValue) {
187            UserVisitCommandValue that = (UserVisitCommandValue)other;
188            
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 = 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) {
207            UserVisitCommandValue that = (UserVisitCommandValue)other;
208            boolean objectsEqual = true;
209            
210            
211            if(objectsEqual) {
212                UserVisitPK thisUserVisitPK = getUserVisitPK();
213                UserVisitPK thatUserVisitPK = that.getUserVisitPK();
214                
215                if(thisUserVisitPK == null) {
216                    objectsEqual = objectsEqual && (thatUserVisitPK == null);
217                } else {
218                    objectsEqual = objectsEqual && thisUserVisitPK.equals(thatUserVisitPK);
219                }
220            }
221            
222            if(objectsEqual) {
223                Integer thisUserVisitCommandSequence = getUserVisitCommandSequence();
224                Integer thatUserVisitCommandSequence = that.getUserVisitCommandSequence();
225                
226                if(thisUserVisitCommandSequence == null) {
227                    objectsEqual = objectsEqual && (thatUserVisitCommandSequence == null);
228                } else {
229                    objectsEqual = objectsEqual && thisUserVisitCommandSequence.equals(thatUserVisitCommandSequence);
230                }
231            }
232            
233            if(objectsEqual) {
234                PartyPK thisPartyPK = getPartyPK();
235                PartyPK thatPartyPK = that.getPartyPK();
236                
237                if(thisPartyPK == null) {
238                    objectsEqual = objectsEqual && (thatPartyPK == null);
239                } else {
240                    objectsEqual = objectsEqual && thisPartyPK.equals(thatPartyPK);
241                }
242            }
243            
244            if(objectsEqual) {
245                CommandPK thisCommandPK = getCommandPK();
246                CommandPK thatCommandPK = that.getCommandPK();
247                
248                if(thisCommandPK == null) {
249                    objectsEqual = objectsEqual && (thatCommandPK == null);
250                } else {
251                    objectsEqual = objectsEqual && thisCommandPK.equals(thatCommandPK);
252                }
253            }
254            
255            if(objectsEqual) {
256                Long thisStartTime = getStartTime();
257                Long thatStartTime = that.getStartTime();
258                
259                if(thisStartTime == null) {
260                    objectsEqual = objectsEqual && (thatStartTime == null);
261                } else {
262                    objectsEqual = objectsEqual && thisStartTime.equals(thatStartTime);
263                }
264            }
265            
266            if(objectsEqual) {
267                Long thisEndTime = getEndTime();
268                Long thatEndTime = that.getEndTime();
269                
270                if(thisEndTime == null) {
271                    objectsEqual = objectsEqual && (thatEndTime == null);
272                } else {
273                    objectsEqual = objectsEqual && thisEndTime.equals(thatEndTime);
274                }
275            }
276            
277            if(objectsEqual) {
278                Boolean thisHadSecurityErrors = getHadSecurityErrors();
279                Boolean thatHadSecurityErrors = that.getHadSecurityErrors();
280                
281                if(thisHadSecurityErrors == null) {
282                    objectsEqual = objectsEqual && (thatHadSecurityErrors == null);
283                } else {
284                    objectsEqual = objectsEqual && thisHadSecurityErrors.equals(thatHadSecurityErrors);
285                }
286            }
287            
288            if(objectsEqual) {
289                Boolean thisHadValidationErrors = getHadValidationErrors();
290                Boolean thatHadValidationErrors = that.getHadValidationErrors();
291                
292                if(thisHadValidationErrors == null) {
293                    objectsEqual = objectsEqual && (thatHadValidationErrors == null);
294                } else {
295                    objectsEqual = objectsEqual && thisHadValidationErrors.equals(thatHadValidationErrors);
296                }
297            }
298            
299            if(objectsEqual) {
300                Boolean thisHadExecutionErrors = getHadExecutionErrors();
301                Boolean thatHadExecutionErrors = that.getHadExecutionErrors();
302                
303                if(thisHadExecutionErrors == null) {
304                    objectsEqual = objectsEqual && (thatHadExecutionErrors == null);
305                } else {
306                    objectsEqual = objectsEqual && thisHadExecutionErrors.equals(thatHadExecutionErrors);
307                }
308            }
309            
310            return objectsEqual;
311        } else {
312            return false;
313        }
314    }
315    
316    @Override
317    public boolean hasBeenModified() {
318        return userVisitPKHasBeenModified || userVisitCommandSequenceHasBeenModified || partyPKHasBeenModified || commandPKHasBeenModified || startTimeHasBeenModified || endTimeHasBeenModified || hadSecurityErrorsHasBeenModified || hadValidationErrorsHasBeenModified || hadExecutionErrorsHasBeenModified;
319    }
320    
321    @Override
322    public void clearHasBeenModified() {
323        userVisitPKHasBeenModified = false;
324        userVisitCommandSequenceHasBeenModified = false;
325        partyPKHasBeenModified = false;
326        commandPKHasBeenModified = false;
327        startTimeHasBeenModified = false;
328        endTimeHasBeenModified = false;
329        hadSecurityErrorsHasBeenModified = false;
330        hadValidationErrorsHasBeenModified = false;
331        hadExecutionErrorsHasBeenModified = false;
332    }
333    
334    public UserVisitPK getUserVisitPK() {
335        return userVisitPK;
336    }
337    
338    public void setUserVisitPK(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    public Integer getUserVisitCommandSequence() {
364        return userVisitCommandSequence;
365    }
366    
367    public void setUserVisitCommandSequence(Integer userVisitCommandSequence)
368            throws PersistenceNotNullException {
369        checkForNull(userVisitCommandSequence);
370        
371        boolean update = true;
372        
373        if(this.userVisitCommandSequence != null) {
374            if(this.userVisitCommandSequence.equals(userVisitCommandSequence)) {
375                update = false;
376            }
377        } else if(userVisitCommandSequence == null) {
378            update = false;
379        }
380        
381        if(update) {
382            this.userVisitCommandSequence = userVisitCommandSequence;
383            userVisitCommandSequenceHasBeenModified = true;
384            clearHashAndString();
385        }
386    }
387    
388    public boolean getUserVisitCommandSequenceHasBeenModified() {
389        return userVisitCommandSequenceHasBeenModified;
390    }
391    
392    public PartyPK getPartyPK() {
393        return partyPK;
394    }
395    
396    public void setPartyPK(PartyPK partyPK) {
397        boolean update = true;
398        
399        if(this.partyPK != null) {
400            if(this.partyPK.equals(partyPK)) {
401                update = false;
402            }
403        } else if(partyPK == null) {
404            update = false;
405        }
406        
407        if(update) {
408            this.partyPK = partyPK;
409            partyPKHasBeenModified = true;
410            clearHashAndString();
411        }
412    }
413    
414    public boolean getPartyPKHasBeenModified() {
415        return partyPKHasBeenModified;
416    }
417    
418    public CommandPK getCommandPK() {
419        return commandPK;
420    }
421    
422    public void setCommandPK(CommandPK commandPK)
423            throws PersistenceNotNullException {
424        checkForNull(commandPK);
425        
426        boolean update = true;
427        
428        if(this.commandPK != null) {
429            if(this.commandPK.equals(commandPK)) {
430                update = false;
431            }
432        } else if(commandPK == null) {
433            update = false;
434        }
435        
436        if(update) {
437            this.commandPK = commandPK;
438            commandPKHasBeenModified = true;
439            clearHashAndString();
440        }
441    }
442    
443    public boolean getCommandPKHasBeenModified() {
444        return commandPKHasBeenModified;
445    }
446    
447    public Long getStartTime() {
448        return startTime;
449    }
450    
451    public void setStartTime(Long startTime)
452            throws PersistenceNotNullException {
453        checkForNull(startTime);
454        
455        boolean update = true;
456        
457        if(this.startTime != null) {
458            if(this.startTime.equals(startTime)) {
459                update = false;
460            }
461        } else if(startTime == null) {
462            update = false;
463        }
464        
465        if(update) {
466            this.startTime = startTime;
467            startTimeHasBeenModified = true;
468            clearHashAndString();
469        }
470    }
471    
472    public boolean getStartTimeHasBeenModified() {
473        return startTimeHasBeenModified;
474    }
475    
476    public Long getEndTime() {
477        return endTime;
478    }
479    
480    public void setEndTime(Long endTime)
481            throws PersistenceNotNullException {
482        checkForNull(endTime);
483        
484        boolean update = true;
485        
486        if(this.endTime != null) {
487            if(this.endTime.equals(endTime)) {
488                update = false;
489            }
490        } else if(endTime == null) {
491            update = false;
492        }
493        
494        if(update) {
495            this.endTime = endTime;
496            endTimeHasBeenModified = true;
497            clearHashAndString();
498        }
499    }
500    
501    public boolean getEndTimeHasBeenModified() {
502        return endTimeHasBeenModified;
503    }
504    
505    public Boolean getHadSecurityErrors() {
506        return hadSecurityErrors;
507    }
508    
509    public void setHadSecurityErrors(Boolean hadSecurityErrors) {
510        boolean update = true;
511        
512        if(this.hadSecurityErrors != null) {
513            if(this.hadSecurityErrors.equals(hadSecurityErrors)) {
514                update = false;
515            }
516        } else if(hadSecurityErrors == null) {
517            update = false;
518        }
519        
520        if(update) {
521            this.hadSecurityErrors = hadSecurityErrors;
522            hadSecurityErrorsHasBeenModified = true;
523            clearHashAndString();
524        }
525    }
526    
527    public boolean getHadSecurityErrorsHasBeenModified() {
528        return hadSecurityErrorsHasBeenModified;
529    }
530    
531    public Boolean getHadValidationErrors() {
532        return hadValidationErrors;
533    }
534    
535    public void setHadValidationErrors(Boolean hadValidationErrors) {
536        boolean update = true;
537        
538        if(this.hadValidationErrors != null) {
539            if(this.hadValidationErrors.equals(hadValidationErrors)) {
540                update = false;
541            }
542        } else if(hadValidationErrors == null) {
543            update = false;
544        }
545        
546        if(update) {
547            this.hadValidationErrors = hadValidationErrors;
548            hadValidationErrorsHasBeenModified = true;
549            clearHashAndString();
550        }
551    }
552    
553    public boolean getHadValidationErrorsHasBeenModified() {
554        return hadValidationErrorsHasBeenModified;
555    }
556    
557    public Boolean getHadExecutionErrors() {
558        return hadExecutionErrors;
559    }
560    
561    public void setHadExecutionErrors(Boolean hadExecutionErrors) {
562        boolean update = true;
563        
564        if(this.hadExecutionErrors != null) {
565            if(this.hadExecutionErrors.equals(hadExecutionErrors)) {
566                update = false;
567            }
568        } else if(hadExecutionErrors == null) {
569            update = false;
570        }
571        
572        if(update) {
573            this.hadExecutionErrors = hadExecutionErrors;
574            hadExecutionErrorsHasBeenModified = true;
575            clearHashAndString();
576        }
577    }
578    
579    public boolean getHadExecutionErrorsHasBeenModified() {
580        return hadExecutionErrorsHasBeenModified;
581    }
582    
583}