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 * UserVisitCampaignValue.java
021 */
022
023package com.echothree.model.data.campaign.server.value;
024
025import com.echothree.model.data.campaign.common.pk.UserVisitCampaignPK;
026
027import com.echothree.model.data.campaign.server.factory.UserVisitCampaignFactory;
028
029import com.echothree.model.data.user.common.pk.UserVisitPK;
030import com.echothree.model.data.campaign.common.pk.CampaignPK;
031import com.echothree.model.data.campaign.common.pk.CampaignSourcePK;
032import com.echothree.model.data.campaign.common.pk.CampaignMediumPK;
033import com.echothree.model.data.campaign.common.pk.CampaignTermPK;
034import com.echothree.model.data.campaign.common.pk.CampaignContentPK;
035
036import com.echothree.util.common.exception.PersistenceCloneException;
037import com.echothree.util.common.exception.PersistenceNotNullException;
038
039import com.echothree.util.server.persistence.BaseValue;
040
041import java.io.Serializable;
042
043import javax.annotation.Nonnull;
044import javax.annotation.Nullable;
045
046public class UserVisitCampaignValue
047        extends BaseValue<UserVisitCampaignPK>
048        implements Cloneable, Serializable {
049    
050    private UserVisitPK userVisitPK;
051    private boolean userVisitPKHasBeenModified = false;
052    private Integer userVisitCampaignSequence;
053    private boolean userVisitCampaignSequenceHasBeenModified = false;
054    private Long time;
055    private boolean timeHasBeenModified = false;
056    private CampaignPK campaignPK;
057    private boolean campaignPKHasBeenModified = false;
058    private CampaignSourcePK campaignSourcePK;
059    private boolean campaignSourcePKHasBeenModified = false;
060    private CampaignMediumPK campaignMediumPK;
061    private boolean campaignMediumPKHasBeenModified = false;
062    private CampaignTermPK campaignTermPK;
063    private boolean campaignTermPKHasBeenModified = false;
064    private CampaignContentPK campaignContentPK;
065    private boolean campaignContentPKHasBeenModified = false;
066    private Long fromTime;
067    private boolean fromTimeHasBeenModified = false;
068    private Long thruTime;
069    private boolean thruTimeHasBeenModified = false;
070    
071    private transient Integer _hashCode = null;
072    private transient String _stringValue = null;
073    
074    private void constructFields(UserVisitPK userVisitPK, Integer userVisitCampaignSequence, Long time, CampaignPK campaignPK, CampaignSourcePK campaignSourcePK, CampaignMediumPK campaignMediumPK, CampaignTermPK campaignTermPK, CampaignContentPK campaignContentPK, Long fromTime, Long thruTime)
075            throws PersistenceNotNullException {
076        checkForNull(userVisitPK);
077        this.userVisitPK = userVisitPK;
078        checkForNull(userVisitCampaignSequence);
079        this.userVisitCampaignSequence = userVisitCampaignSequence;
080        checkForNull(time);
081        this.time = time;
082        this.campaignPK = campaignPK;
083        this.campaignSourcePK = campaignSourcePK;
084        this.campaignMediumPK = campaignMediumPK;
085        this.campaignTermPK = campaignTermPK;
086        this.campaignContentPK = campaignContentPK;
087        checkForNull(fromTime);
088        this.fromTime = fromTime;
089        checkForNull(thruTime);
090        this.thruTime = thruTime;
091    }
092    
093    /** Creates a new instance of UserVisitCampaignValue */
094    public UserVisitCampaignValue(UserVisitCampaignPK userVisitCampaignPK, UserVisitPK userVisitPK, Integer userVisitCampaignSequence, Long time, CampaignPK campaignPK, CampaignSourcePK campaignSourcePK, CampaignMediumPK campaignMediumPK, CampaignTermPK campaignTermPK, CampaignContentPK campaignContentPK, Long fromTime, Long thruTime)
095            throws PersistenceNotNullException {
096        super(userVisitCampaignPK);
097        constructFields(userVisitPK, userVisitCampaignSequence, time, campaignPK, campaignSourcePK, campaignMediumPK, campaignTermPK, campaignContentPK, fromTime, thruTime);
098    }
099    
100    /** Creates a new instance of UserVisitCampaignValue */
101    public UserVisitCampaignValue(UserVisitPK userVisitPK, Integer userVisitCampaignSequence, Long time, CampaignPK campaignPK, CampaignSourcePK campaignSourcePK, CampaignMediumPK campaignMediumPK, CampaignTermPK campaignTermPK, CampaignContentPK campaignContentPK, Long fromTime, Long thruTime)
102            throws PersistenceNotNullException {
103        super();
104        constructFields(userVisitPK, userVisitCampaignSequence, time, campaignPK, campaignSourcePK, campaignMediumPK, campaignTermPK, campaignContentPK, fromTime, thruTime);
105    }
106    
107    @Override
108    @Nonnull
109    public UserVisitCampaignFactory getBaseFactoryInstance() {
110        return UserVisitCampaignFactory.getInstance();
111    }
112    
113    @Override
114    @Nonnull
115    public UserVisitCampaignValue clone() {
116        Object result;
117        
118        try {
119            result = super.clone();
120        } catch (CloneNotSupportedException cnse) {
121            // This shouldn't happen, fail when it does.
122            throw new PersistenceCloneException(cnse);
123        }
124        
125        return (UserVisitCampaignValue)result;
126    }
127    
128    @Override
129    @Nonnull
130    public UserVisitCampaignPK getPrimaryKey() {
131        if(_primaryKey == null) {
132            _primaryKey = new UserVisitCampaignPK(entityId);
133        }
134        
135        return _primaryKey;
136    }
137    
138    private void clearHashAndString() {
139        _hashCode = null;
140        _stringValue = null;
141    }
142    
143    @Override
144    public int hashCode() {
145        if(_hashCode == null) {
146            int hashCode = 17;
147            
148            hashCode = 37 * hashCode + ((entityId != null) ? entityId.hashCode() : 0);
149            
150            hashCode = 37 * hashCode + ((userVisitPK != null) ? userVisitPK.hashCode() : 0);
151            hashCode = 37 * hashCode + ((userVisitCampaignSequence != null) ? userVisitCampaignSequence.hashCode() : 0);
152            hashCode = 37 * hashCode + ((time != null) ? time.hashCode() : 0);
153            hashCode = 37 * hashCode + ((campaignPK != null) ? campaignPK.hashCode() : 0);
154            hashCode = 37 * hashCode + ((campaignSourcePK != null) ? campaignSourcePK.hashCode() : 0);
155            hashCode = 37 * hashCode + ((campaignMediumPK != null) ? campaignMediumPK.hashCode() : 0);
156            hashCode = 37 * hashCode + ((campaignTermPK != null) ? campaignTermPK.hashCode() : 0);
157            hashCode = 37 * hashCode + ((campaignContentPK != null) ? campaignContentPK.hashCode() : 0);
158            hashCode = 37 * hashCode + ((fromTime != null) ? fromTime.hashCode() : 0);
159            hashCode = 37 * hashCode + ((thruTime != null) ? thruTime.hashCode() : 0);
160            
161            _hashCode = hashCode;
162        }
163        
164        return _hashCode;
165    }
166    
167    @Override
168    @Nonnull
169    public String toString() {
170        if(_stringValue == null) {
171            _stringValue = "{" + 
172                    "entityId=" + getEntityId() +
173                    ", userVisitPK=" + getUserVisitPK() +
174                    ", userVisitCampaignSequence=" + getUserVisitCampaignSequence() +
175                    ", time=" + getTime() +
176                    ", campaignPK=" + getCampaignPK() +
177                    ", campaignSourcePK=" + getCampaignSourcePK() +
178                    ", campaignMediumPK=" + getCampaignMediumPK() +
179                    ", campaignTermPK=" + getCampaignTermPK() +
180                    ", campaignContentPK=" + getCampaignContentPK() +
181                    ", fromTime=" + getFromTime() +
182                    ", thruTime=" + getThruTime() +
183                    "}";
184        }
185        return _stringValue;
186    }
187    
188    @Override
189    public boolean equals(Object other) {
190        if(this == other)
191            return true;
192        
193        if(!hasIdentity())
194            return false;
195        
196        if(other instanceof  UserVisitCampaignValue that) {
197            if(!that.hasIdentity())
198                return false;
199            
200            Long thisEntityId = getEntityId();
201            Long thatEntityId = that.getEntityId();
202            
203            boolean objectsEqual = thisEntityId.equals(thatEntityId);
204            if(objectsEqual)
205                objectsEqual = isIdentical(that);
206            
207            return objectsEqual;
208        } else {
209            return false;
210        }
211    }
212    
213    public boolean isIdentical(Object other) {
214        if(other instanceof UserVisitCampaignValue that) {
215            boolean objectsEqual = true;
216            
217            
218            if(objectsEqual) {
219                UserVisitPK thisUserVisitPK = getUserVisitPK();
220                UserVisitPK thatUserVisitPK = that.getUserVisitPK();
221                
222                if(thisUserVisitPK == null) {
223                    objectsEqual = objectsEqual && (thatUserVisitPK == null);
224                } else {
225                    objectsEqual = objectsEqual && thisUserVisitPK.equals(thatUserVisitPK);
226                }
227            }
228            
229            if(objectsEqual) {
230                Integer thisUserVisitCampaignSequence = getUserVisitCampaignSequence();
231                Integer thatUserVisitCampaignSequence = that.getUserVisitCampaignSequence();
232                
233                if(thisUserVisitCampaignSequence == null) {
234                    objectsEqual = objectsEqual && (thatUserVisitCampaignSequence == null);
235                } else {
236                    objectsEqual = objectsEqual && thisUserVisitCampaignSequence.equals(thatUserVisitCampaignSequence);
237                }
238            }
239            
240            if(objectsEqual) {
241                Long thisTime = getTime();
242                Long thatTime = that.getTime();
243                
244                if(thisTime == null) {
245                    objectsEqual = objectsEqual && (thatTime == null);
246                } else {
247                    objectsEqual = objectsEqual && thisTime.equals(thatTime);
248                }
249            }
250            
251            if(objectsEqual) {
252                CampaignPK thisCampaignPK = getCampaignPK();
253                CampaignPK thatCampaignPK = that.getCampaignPK();
254                
255                if(thisCampaignPK == null) {
256                    objectsEqual = objectsEqual && (thatCampaignPK == null);
257                } else {
258                    objectsEqual = objectsEqual && thisCampaignPK.equals(thatCampaignPK);
259                }
260            }
261            
262            if(objectsEqual) {
263                CampaignSourcePK thisCampaignSourcePK = getCampaignSourcePK();
264                CampaignSourcePK thatCampaignSourcePK = that.getCampaignSourcePK();
265                
266                if(thisCampaignSourcePK == null) {
267                    objectsEqual = objectsEqual && (thatCampaignSourcePK == null);
268                } else {
269                    objectsEqual = objectsEqual && thisCampaignSourcePK.equals(thatCampaignSourcePK);
270                }
271            }
272            
273            if(objectsEqual) {
274                CampaignMediumPK thisCampaignMediumPK = getCampaignMediumPK();
275                CampaignMediumPK thatCampaignMediumPK = that.getCampaignMediumPK();
276                
277                if(thisCampaignMediumPK == null) {
278                    objectsEqual = objectsEqual && (thatCampaignMediumPK == null);
279                } else {
280                    objectsEqual = objectsEqual && thisCampaignMediumPK.equals(thatCampaignMediumPK);
281                }
282            }
283            
284            if(objectsEqual) {
285                CampaignTermPK thisCampaignTermPK = getCampaignTermPK();
286                CampaignTermPK thatCampaignTermPK = that.getCampaignTermPK();
287                
288                if(thisCampaignTermPK == null) {
289                    objectsEqual = objectsEqual && (thatCampaignTermPK == null);
290                } else {
291                    objectsEqual = objectsEqual && thisCampaignTermPK.equals(thatCampaignTermPK);
292                }
293            }
294            
295            if(objectsEqual) {
296                CampaignContentPK thisCampaignContentPK = getCampaignContentPK();
297                CampaignContentPK thatCampaignContentPK = that.getCampaignContentPK();
298                
299                if(thisCampaignContentPK == null) {
300                    objectsEqual = objectsEqual && (thatCampaignContentPK == null);
301                } else {
302                    objectsEqual = objectsEqual && thisCampaignContentPK.equals(thatCampaignContentPK);
303                }
304            }
305            
306            if(objectsEqual) {
307                Long thisFromTime = getFromTime();
308                Long thatFromTime = that.getFromTime();
309                
310                if(thisFromTime == null) {
311                    objectsEqual = objectsEqual && (thatFromTime == null);
312                } else {
313                    objectsEqual = objectsEqual && thisFromTime.equals(thatFromTime);
314                }
315            }
316            
317            if(objectsEqual) {
318                Long thisThruTime = getThruTime();
319                Long thatThruTime = that.getThruTime();
320                
321                if(thisThruTime == null) {
322                    objectsEqual = objectsEqual && (thatThruTime == null);
323                } else {
324                    objectsEqual = objectsEqual && thisThruTime.equals(thatThruTime);
325                }
326            }
327            
328            return objectsEqual;
329        } else {
330            return false;
331        }
332    }
333    
334    @Override
335    public boolean hasBeenModified() {
336        return userVisitPKHasBeenModified || userVisitCampaignSequenceHasBeenModified || timeHasBeenModified || campaignPKHasBeenModified || campaignSourcePKHasBeenModified || campaignMediumPKHasBeenModified || campaignTermPKHasBeenModified || campaignContentPKHasBeenModified || fromTimeHasBeenModified || thruTimeHasBeenModified;
337    }
338    
339    @Override
340    public void clearHasBeenModified() {
341        userVisitPKHasBeenModified = false;
342        userVisitCampaignSequenceHasBeenModified = false;
343        timeHasBeenModified = false;
344        campaignPKHasBeenModified = false;
345        campaignSourcePKHasBeenModified = false;
346        campaignMediumPKHasBeenModified = false;
347        campaignTermPKHasBeenModified = false;
348        campaignContentPKHasBeenModified = false;
349        fromTimeHasBeenModified = false;
350        thruTimeHasBeenModified = false;
351    }
352    
353    @Nonnull
354    public UserVisitPK getUserVisitPK() {
355        return userVisitPK;
356    }
357    
358    public void setUserVisitPK(@Nonnull UserVisitPK userVisitPK)
359            throws PersistenceNotNullException {
360        checkForNull(userVisitPK);
361        
362        boolean update = true;
363        
364        if(this.userVisitPK != null) {
365            if(this.userVisitPK.equals(userVisitPK)) {
366                update = false;
367            }
368        } else if(userVisitPK == null) {
369            update = false;
370        }
371        
372        if(update) {
373            this.userVisitPK = userVisitPK;
374            userVisitPKHasBeenModified = true;
375            clearHashAndString();
376        }
377    }
378    
379    public boolean getUserVisitPKHasBeenModified() {
380        return userVisitPKHasBeenModified;
381    }
382    
383    @Nonnull
384    public Integer getUserVisitCampaignSequence() {
385        return userVisitCampaignSequence;
386    }
387    
388    public void setUserVisitCampaignSequence(@Nonnull Integer userVisitCampaignSequence)
389            throws PersistenceNotNullException {
390        checkForNull(userVisitCampaignSequence);
391        
392        boolean update = true;
393        
394        if(this.userVisitCampaignSequence != null) {
395            if(this.userVisitCampaignSequence.equals(userVisitCampaignSequence)) {
396                update = false;
397            }
398        } else if(userVisitCampaignSequence == null) {
399            update = false;
400        }
401        
402        if(update) {
403            this.userVisitCampaignSequence = userVisitCampaignSequence;
404            userVisitCampaignSequenceHasBeenModified = true;
405            clearHashAndString();
406        }
407    }
408    
409    public boolean getUserVisitCampaignSequenceHasBeenModified() {
410        return userVisitCampaignSequenceHasBeenModified;
411    }
412    
413    @Nonnull
414    public Long getTime() {
415        return time;
416    }
417    
418    public void setTime(@Nonnull Long time)
419            throws PersistenceNotNullException {
420        checkForNull(time);
421        
422        boolean update = true;
423        
424        if(this.time != null) {
425            if(this.time.equals(time)) {
426                update = false;
427            }
428        } else if(time == null) {
429            update = false;
430        }
431        
432        if(update) {
433            this.time = time;
434            timeHasBeenModified = true;
435            clearHashAndString();
436        }
437    }
438    
439    public boolean getTimeHasBeenModified() {
440        return timeHasBeenModified;
441    }
442    
443    @Nullable
444    public CampaignPK getCampaignPK() {
445        return campaignPK;
446    }
447    
448    public void setCampaignPK(@Nullable CampaignPK campaignPK) {
449        boolean update = true;
450        
451        if(this.campaignPK != null) {
452            if(this.campaignPK.equals(campaignPK)) {
453                update = false;
454            }
455        } else if(campaignPK == null) {
456            update = false;
457        }
458        
459        if(update) {
460            this.campaignPK = campaignPK;
461            campaignPKHasBeenModified = true;
462            clearHashAndString();
463        }
464    }
465    
466    public boolean getCampaignPKHasBeenModified() {
467        return campaignPKHasBeenModified;
468    }
469    
470    @Nullable
471    public CampaignSourcePK getCampaignSourcePK() {
472        return campaignSourcePK;
473    }
474    
475    public void setCampaignSourcePK(@Nullable CampaignSourcePK campaignSourcePK) {
476        boolean update = true;
477        
478        if(this.campaignSourcePK != null) {
479            if(this.campaignSourcePK.equals(campaignSourcePK)) {
480                update = false;
481            }
482        } else if(campaignSourcePK == null) {
483            update = false;
484        }
485        
486        if(update) {
487            this.campaignSourcePK = campaignSourcePK;
488            campaignSourcePKHasBeenModified = true;
489            clearHashAndString();
490        }
491    }
492    
493    public boolean getCampaignSourcePKHasBeenModified() {
494        return campaignSourcePKHasBeenModified;
495    }
496    
497    @Nullable
498    public CampaignMediumPK getCampaignMediumPK() {
499        return campaignMediumPK;
500    }
501    
502    public void setCampaignMediumPK(@Nullable CampaignMediumPK campaignMediumPK) {
503        boolean update = true;
504        
505        if(this.campaignMediumPK != null) {
506            if(this.campaignMediumPK.equals(campaignMediumPK)) {
507                update = false;
508            }
509        } else if(campaignMediumPK == null) {
510            update = false;
511        }
512        
513        if(update) {
514            this.campaignMediumPK = campaignMediumPK;
515            campaignMediumPKHasBeenModified = true;
516            clearHashAndString();
517        }
518    }
519    
520    public boolean getCampaignMediumPKHasBeenModified() {
521        return campaignMediumPKHasBeenModified;
522    }
523    
524    @Nullable
525    public CampaignTermPK getCampaignTermPK() {
526        return campaignTermPK;
527    }
528    
529    public void setCampaignTermPK(@Nullable CampaignTermPK campaignTermPK) {
530        boolean update = true;
531        
532        if(this.campaignTermPK != null) {
533            if(this.campaignTermPK.equals(campaignTermPK)) {
534                update = false;
535            }
536        } else if(campaignTermPK == null) {
537            update = false;
538        }
539        
540        if(update) {
541            this.campaignTermPK = campaignTermPK;
542            campaignTermPKHasBeenModified = true;
543            clearHashAndString();
544        }
545    }
546    
547    public boolean getCampaignTermPKHasBeenModified() {
548        return campaignTermPKHasBeenModified;
549    }
550    
551    @Nullable
552    public CampaignContentPK getCampaignContentPK() {
553        return campaignContentPK;
554    }
555    
556    public void setCampaignContentPK(@Nullable CampaignContentPK campaignContentPK) {
557        boolean update = true;
558        
559        if(this.campaignContentPK != null) {
560            if(this.campaignContentPK.equals(campaignContentPK)) {
561                update = false;
562            }
563        } else if(campaignContentPK == null) {
564            update = false;
565        }
566        
567        if(update) {
568            this.campaignContentPK = campaignContentPK;
569            campaignContentPKHasBeenModified = true;
570            clearHashAndString();
571        }
572    }
573    
574    public boolean getCampaignContentPKHasBeenModified() {
575        return campaignContentPKHasBeenModified;
576    }
577    
578    @Nonnull
579    public Long getFromTime() {
580        return fromTime;
581    }
582    
583    public void setFromTime(@Nonnull Long fromTime)
584            throws PersistenceNotNullException {
585        checkForNull(fromTime);
586        
587        boolean update = true;
588        
589        if(this.fromTime != null) {
590            if(this.fromTime.equals(fromTime)) {
591                update = false;
592            }
593        } else if(fromTime == null) {
594            update = false;
595        }
596        
597        if(update) {
598            this.fromTime = fromTime;
599            fromTimeHasBeenModified = true;
600            clearHashAndString();
601        }
602    }
603    
604    public boolean getFromTimeHasBeenModified() {
605        return fromTimeHasBeenModified;
606    }
607    
608    @Nonnull
609    public Long getThruTime() {
610        return thruTime;
611    }
612    
613    public void setThruTime(@Nonnull Long thruTime)
614            throws PersistenceNotNullException {
615        checkForNull(thruTime);
616        
617        boolean update = true;
618        
619        if(this.thruTime != null) {
620            if(this.thruTime.equals(thruTime)) {
621                update = false;
622            }
623        } else if(thruTime == null) {
624            update = false;
625        }
626        
627        if(update) {
628            this.thruTime = thruTime;
629            thruTimeHasBeenModified = true;
630            clearHashAndString();
631        }
632    }
633    
634    public boolean getThruTimeHasBeenModified() {
635        return thruTimeHasBeenModified;
636    }
637    
638}