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 * UserVisitStatusValue.java
021 */
022
023package com.echothree.model.data.user.server.value;
024
025import com.echothree.model.data.user.common.pk.UserVisitStatusPK;
026
027import com.echothree.model.data.user.server.factory.UserVisitStatusFactory;
028
029import com.echothree.model.data.user.common.pk.UserVisitPK;
030
031import com.echothree.util.common.exception.PersistenceCloneException;
032import com.echothree.util.common.exception.PersistenceNotNullException;
033
034import com.echothree.util.server.persistence.BaseValue;
035
036import java.io.Serializable;
037
038import javax.annotation.Nonnull;
039import javax.annotation.Nullable;
040
041public class UserVisitStatusValue
042        extends BaseValue<UserVisitStatusPK>
043        implements Cloneable, Serializable {
044    
045    private UserVisitPK userVisitPK;
046    private boolean userVisitPKHasBeenModified = false;
047    private Integer userVisitCommandSequence;
048    private boolean userVisitCommandSequenceHasBeenModified = false;
049    private Integer userVisitCachedSearchSequence;
050    private boolean userVisitCachedSearchSequenceHasBeenModified = false;
051    private Integer userVisitCampaignSequence;
052    private boolean userVisitCampaignSequenceHasBeenModified = false;
053    private Integer userVisitTrackSequence;
054    private boolean userVisitTrackSequenceHasBeenModified = false;
055    
056    private transient Integer _hashCode = null;
057    private transient String _stringValue = null;
058    
059    private void constructFields(UserVisitPK userVisitPK, Integer userVisitCommandSequence, Integer userVisitCachedSearchSequence, Integer userVisitCampaignSequence, Integer userVisitTrackSequence)
060            throws PersistenceNotNullException {
061        checkForNull(userVisitPK);
062        this.userVisitPK = userVisitPK;
063        checkForNull(userVisitCommandSequence);
064        this.userVisitCommandSequence = userVisitCommandSequence;
065        checkForNull(userVisitCachedSearchSequence);
066        this.userVisitCachedSearchSequence = userVisitCachedSearchSequence;
067        checkForNull(userVisitCampaignSequence);
068        this.userVisitCampaignSequence = userVisitCampaignSequence;
069        checkForNull(userVisitTrackSequence);
070        this.userVisitTrackSequence = userVisitTrackSequence;
071    }
072    
073    /** Creates a new instance of UserVisitStatusValue */
074    public UserVisitStatusValue(UserVisitStatusPK userVisitStatusPK, UserVisitPK userVisitPK, Integer userVisitCommandSequence, Integer userVisitCachedSearchSequence, Integer userVisitCampaignSequence, Integer userVisitTrackSequence)
075            throws PersistenceNotNullException {
076        super(userVisitStatusPK);
077        constructFields(userVisitPK, userVisitCommandSequence, userVisitCachedSearchSequence, userVisitCampaignSequence, userVisitTrackSequence);
078    }
079    
080    /** Creates a new instance of UserVisitStatusValue */
081    public UserVisitStatusValue(UserVisitPK userVisitPK, Integer userVisitCommandSequence, Integer userVisitCachedSearchSequence, Integer userVisitCampaignSequence, Integer userVisitTrackSequence)
082            throws PersistenceNotNullException {
083        super();
084        constructFields(userVisitPK, userVisitCommandSequence, userVisitCachedSearchSequence, userVisitCampaignSequence, userVisitTrackSequence);
085    }
086    
087    @Override
088    @Nonnull
089    public UserVisitStatusFactory getBaseFactoryInstance() {
090        return UserVisitStatusFactory.getInstance();
091    }
092    
093    @Override
094    @Nonnull
095    public UserVisitStatusValue clone() {
096        Object result;
097        
098        try {
099            result = super.clone();
100        } catch (CloneNotSupportedException cnse) {
101            // This shouldn't happen, fail when it does.
102            throw new PersistenceCloneException(cnse);
103        }
104        
105        return (UserVisitStatusValue)result;
106    }
107    
108    @Override
109    @Nonnull
110    public UserVisitStatusPK getPrimaryKey() {
111        if(_primaryKey == null) {
112            _primaryKey = new UserVisitStatusPK(entityId);
113        }
114        
115        return _primaryKey;
116    }
117    
118    private void clearHashAndString() {
119        _hashCode = null;
120        _stringValue = null;
121    }
122    
123    @Override
124    public int hashCode() {
125        if(_hashCode == null) {
126            int hashCode = 17;
127            
128            hashCode = 37 * hashCode + ((entityId != null) ? entityId.hashCode() : 0);
129            
130            hashCode = 37 * hashCode + ((userVisitPK != null) ? userVisitPK.hashCode() : 0);
131            hashCode = 37 * hashCode + ((userVisitCommandSequence != null) ? userVisitCommandSequence.hashCode() : 0);
132            hashCode = 37 * hashCode + ((userVisitCachedSearchSequence != null) ? userVisitCachedSearchSequence.hashCode() : 0);
133            hashCode = 37 * hashCode + ((userVisitCampaignSequence != null) ? userVisitCampaignSequence.hashCode() : 0);
134            hashCode = 37 * hashCode + ((userVisitTrackSequence != null) ? userVisitTrackSequence.hashCode() : 0);
135            
136            _hashCode = hashCode;
137        }
138        
139        return _hashCode;
140    }
141    
142    @Override
143    @Nonnull
144    public String toString() {
145        if(_stringValue == null) {
146            _stringValue = "{" + 
147                    "entityId=" + getEntityId() +
148                    ", userVisitPK=" + getUserVisitPK() +
149                    ", userVisitCommandSequence=" + getUserVisitCommandSequence() +
150                    ", userVisitCachedSearchSequence=" + getUserVisitCachedSearchSequence() +
151                    ", userVisitCampaignSequence=" + getUserVisitCampaignSequence() +
152                    ", userVisitTrackSequence=" + getUserVisitTrackSequence() +
153                    "}";
154        }
155        return _stringValue;
156    }
157    
158    @Override
159    public boolean equals(Object other) {
160        if(this == other)
161            return true;
162        
163        if(!hasIdentity())
164            return false;
165        
166        if(other instanceof  UserVisitStatusValue that) {
167            if(!that.hasIdentity())
168                return false;
169            
170            Long thisEntityId = getEntityId();
171            Long thatEntityId = that.getEntityId();
172            
173            boolean objectsEqual = thisEntityId.equals(thatEntityId);
174            if(objectsEqual)
175                objectsEqual = isIdentical(that);
176            
177            return objectsEqual;
178        } else {
179            return false;
180        }
181    }
182    
183    public boolean isIdentical(Object other) {
184        if(other instanceof UserVisitStatusValue that) {
185            boolean objectsEqual = true;
186            
187            
188            if(objectsEqual) {
189                UserVisitPK thisUserVisitPK = getUserVisitPK();
190                UserVisitPK thatUserVisitPK = that.getUserVisitPK();
191                
192                if(thisUserVisitPK == null) {
193                    objectsEqual = objectsEqual && (thatUserVisitPK == null);
194                } else {
195                    objectsEqual = objectsEqual && thisUserVisitPK.equals(thatUserVisitPK);
196                }
197            }
198            
199            if(objectsEqual) {
200                Integer thisUserVisitCommandSequence = getUserVisitCommandSequence();
201                Integer thatUserVisitCommandSequence = that.getUserVisitCommandSequence();
202                
203                if(thisUserVisitCommandSequence == null) {
204                    objectsEqual = objectsEqual && (thatUserVisitCommandSequence == null);
205                } else {
206                    objectsEqual = objectsEqual && thisUserVisitCommandSequence.equals(thatUserVisitCommandSequence);
207                }
208            }
209            
210            if(objectsEqual) {
211                Integer thisUserVisitCachedSearchSequence = getUserVisitCachedSearchSequence();
212                Integer thatUserVisitCachedSearchSequence = that.getUserVisitCachedSearchSequence();
213                
214                if(thisUserVisitCachedSearchSequence == null) {
215                    objectsEqual = objectsEqual && (thatUserVisitCachedSearchSequence == null);
216                } else {
217                    objectsEqual = objectsEqual && thisUserVisitCachedSearchSequence.equals(thatUserVisitCachedSearchSequence);
218                }
219            }
220            
221            if(objectsEqual) {
222                Integer thisUserVisitCampaignSequence = getUserVisitCampaignSequence();
223                Integer thatUserVisitCampaignSequence = that.getUserVisitCampaignSequence();
224                
225                if(thisUserVisitCampaignSequence == null) {
226                    objectsEqual = objectsEqual && (thatUserVisitCampaignSequence == null);
227                } else {
228                    objectsEqual = objectsEqual && thisUserVisitCampaignSequence.equals(thatUserVisitCampaignSequence);
229                }
230            }
231            
232            if(objectsEqual) {
233                Integer thisUserVisitTrackSequence = getUserVisitTrackSequence();
234                Integer thatUserVisitTrackSequence = that.getUserVisitTrackSequence();
235                
236                if(thisUserVisitTrackSequence == null) {
237                    objectsEqual = objectsEqual && (thatUserVisitTrackSequence == null);
238                } else {
239                    objectsEqual = objectsEqual && thisUserVisitTrackSequence.equals(thatUserVisitTrackSequence);
240                }
241            }
242            
243            return objectsEqual;
244        } else {
245            return false;
246        }
247    }
248    
249    @Override
250    public boolean hasBeenModified() {
251        return userVisitPKHasBeenModified || userVisitCommandSequenceHasBeenModified || userVisitCachedSearchSequenceHasBeenModified || userVisitCampaignSequenceHasBeenModified || userVisitTrackSequenceHasBeenModified;
252    }
253    
254    @Override
255    public void clearHasBeenModified() {
256        userVisitPKHasBeenModified = false;
257        userVisitCommandSequenceHasBeenModified = false;
258        userVisitCachedSearchSequenceHasBeenModified = false;
259        userVisitCampaignSequenceHasBeenModified = false;
260        userVisitTrackSequenceHasBeenModified = false;
261    }
262    
263    @Nonnull
264    public UserVisitPK getUserVisitPK() {
265        return userVisitPK;
266    }
267    
268    public void setUserVisitPK(@Nonnull UserVisitPK userVisitPK)
269            throws PersistenceNotNullException {
270        checkForNull(userVisitPK);
271        
272        boolean update = true;
273        
274        if(this.userVisitPK != null) {
275            if(this.userVisitPK.equals(userVisitPK)) {
276                update = false;
277            }
278        } else if(userVisitPK == null) {
279            update = false;
280        }
281        
282        if(update) {
283            this.userVisitPK = userVisitPK;
284            userVisitPKHasBeenModified = true;
285            clearHashAndString();
286        }
287    }
288    
289    public boolean getUserVisitPKHasBeenModified() {
290        return userVisitPKHasBeenModified;
291    }
292    
293    @Nonnull
294    public Integer getUserVisitCommandSequence() {
295        return userVisitCommandSequence;
296    }
297    
298    public void setUserVisitCommandSequence(@Nonnull Integer userVisitCommandSequence)
299            throws PersistenceNotNullException {
300        checkForNull(userVisitCommandSequence);
301        
302        boolean update = true;
303        
304        if(this.userVisitCommandSequence != null) {
305            if(this.userVisitCommandSequence.equals(userVisitCommandSequence)) {
306                update = false;
307            }
308        } else if(userVisitCommandSequence == null) {
309            update = false;
310        }
311        
312        if(update) {
313            this.userVisitCommandSequence = userVisitCommandSequence;
314            userVisitCommandSequenceHasBeenModified = true;
315            clearHashAndString();
316        }
317    }
318    
319    public boolean getUserVisitCommandSequenceHasBeenModified() {
320        return userVisitCommandSequenceHasBeenModified;
321    }
322    
323    @Nonnull
324    public Integer getUserVisitCachedSearchSequence() {
325        return userVisitCachedSearchSequence;
326    }
327    
328    public void setUserVisitCachedSearchSequence(@Nonnull Integer userVisitCachedSearchSequence)
329            throws PersistenceNotNullException {
330        checkForNull(userVisitCachedSearchSequence);
331        
332        boolean update = true;
333        
334        if(this.userVisitCachedSearchSequence != null) {
335            if(this.userVisitCachedSearchSequence.equals(userVisitCachedSearchSequence)) {
336                update = false;
337            }
338        } else if(userVisitCachedSearchSequence == null) {
339            update = false;
340        }
341        
342        if(update) {
343            this.userVisitCachedSearchSequence = userVisitCachedSearchSequence;
344            userVisitCachedSearchSequenceHasBeenModified = true;
345            clearHashAndString();
346        }
347    }
348    
349    public boolean getUserVisitCachedSearchSequenceHasBeenModified() {
350        return userVisitCachedSearchSequenceHasBeenModified;
351    }
352    
353    @Nonnull
354    public Integer getUserVisitCampaignSequence() {
355        return userVisitCampaignSequence;
356    }
357    
358    public void setUserVisitCampaignSequence(@Nonnull Integer userVisitCampaignSequence)
359            throws PersistenceNotNullException {
360        checkForNull(userVisitCampaignSequence);
361        
362        boolean update = true;
363        
364        if(this.userVisitCampaignSequence != null) {
365            if(this.userVisitCampaignSequence.equals(userVisitCampaignSequence)) {
366                update = false;
367            }
368        } else if(userVisitCampaignSequence == null) {
369            update = false;
370        }
371        
372        if(update) {
373            this.userVisitCampaignSequence = userVisitCampaignSequence;
374            userVisitCampaignSequenceHasBeenModified = true;
375            clearHashAndString();
376        }
377    }
378    
379    public boolean getUserVisitCampaignSequenceHasBeenModified() {
380        return userVisitCampaignSequenceHasBeenModified;
381    }
382    
383    @Nonnull
384    public Integer getUserVisitTrackSequence() {
385        return userVisitTrackSequence;
386    }
387    
388    public void setUserVisitTrackSequence(@Nonnull Integer userVisitTrackSequence)
389            throws PersistenceNotNullException {
390        checkForNull(userVisitTrackSequence);
391        
392        boolean update = true;
393        
394        if(this.userVisitTrackSequence != null) {
395            if(this.userVisitTrackSequence.equals(userVisitTrackSequence)) {
396                update = false;
397            }
398        } else if(userVisitTrackSequence == null) {
399            update = false;
400        }
401        
402        if(update) {
403            this.userVisitTrackSequence = userVisitTrackSequence;
404            userVisitTrackSequenceHasBeenModified = true;
405            clearHashAndString();
406        }
407    }
408    
409    public boolean getUserVisitTrackSequenceHasBeenModified() {
410        return userVisitTrackSequenceHasBeenModified;
411    }
412    
413}