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