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 * UserVisit.java
021 */
022
023package com.echothree.model.data.user.server.entity;
024
025import com.echothree.model.data.user.common.pk.UserVisitPK;
026
027import com.echothree.model.data.user.common.pk.UserVisitGroupPK;
028import com.echothree.model.data.user.common.pk.UserKeyPK;
029import com.echothree.model.data.party.common.pk.LanguagePK;
030import com.echothree.model.data.accounting.common.pk.CurrencyPK;
031import com.echothree.model.data.party.common.pk.TimeZonePK;
032import com.echothree.model.data.party.common.pk.DateTimeFormatPK;
033import com.echothree.model.data.offer.common.pk.OfferUsePK;
034import com.echothree.model.data.associate.common.pk.AssociateReferralPK;
035
036import com.echothree.model.data.user.server.entity.UserVisitGroup;
037import com.echothree.model.data.user.server.entity.UserKey;
038import com.echothree.model.data.party.server.entity.Language;
039import com.echothree.model.data.accounting.server.entity.Currency;
040import com.echothree.model.data.party.server.entity.TimeZone;
041import com.echothree.model.data.party.server.entity.DateTimeFormat;
042import com.echothree.model.data.offer.server.entity.OfferUse;
043import com.echothree.model.data.associate.server.entity.AssociateReferral;
044
045import com.echothree.model.data.user.server.factory.UserVisitGroupFactory;
046import com.echothree.model.data.user.server.factory.UserKeyFactory;
047import com.echothree.model.data.party.server.factory.LanguageFactory;
048import com.echothree.model.data.accounting.server.factory.CurrencyFactory;
049import com.echothree.model.data.party.server.factory.TimeZoneFactory;
050import com.echothree.model.data.party.server.factory.DateTimeFormatFactory;
051import com.echothree.model.data.offer.server.factory.OfferUseFactory;
052import com.echothree.model.data.associate.server.factory.AssociateReferralFactory;
053
054import com.echothree.model.data.user.common.pk.UserVisitPK;
055
056import com.echothree.model.data.user.server.value.UserVisitValue;
057
058import com.echothree.model.data.user.server.factory.UserVisitFactory;
059
060import com.echothree.util.common.exception.PersistenceException;
061import com.echothree.util.common.exception.PersistenceDatabaseException;
062import com.echothree.util.common.exception.PersistenceNotNullException;
063import com.echothree.util.common.exception.PersistenceReadOnlyException;
064
065import com.echothree.util.common.persistence.BasePK;
066
067import com.echothree.util.common.persistence.type.ByteArray;
068
069import com.echothree.util.server.persistence.BaseEntity;
070import com.echothree.util.server.persistence.EntityPermission;
071import com.echothree.util.server.persistence.Session;
072import com.echothree.util.server.persistence.ThreadSession;
073
074import java.io.Serializable;
075
076import javax.annotation.Nonnull;
077import javax.annotation.Nullable;
078
079public class UserVisit
080        extends BaseEntity
081        implements Serializable {
082    
083    private UserVisitPK _pk;
084    private UserVisitValue _value;
085    
086    /** Creates a new instance of UserVisit */
087    public UserVisit()
088            throws PersistenceException {
089        super();
090    }
091    
092    /** Creates a new instance of UserVisit */
093    public UserVisit(UserVisitValue value, EntityPermission entityPermission) {
094        super(entityPermission);
095        
096        _value = value;
097        _pk = value.getPrimaryKey();
098    }
099    
100    @Override
101    @Nonnull
102    public UserVisitFactory getBaseFactoryInstance() {
103        return UserVisitFactory.getInstance();
104    }
105    
106    @Override
107    public boolean hasBeenModified() {
108        return _value.hasBeenModified();
109    }
110    
111    @Override
112    public int hashCode() {
113        return _pk.hashCode();
114    }
115    
116    @Override
117    @Nonnull
118    public String toString() {
119        return _pk.toString();
120    }
121    
122    @Override
123    public boolean equals(Object other) {
124        if(this == other)
125            return true;
126        
127        if(other instanceof UserVisit that) {
128            UserVisitValue thatValue = that.getUserVisitValue();
129            return _value.equals(thatValue);
130        } else {
131            return false;
132        }
133    }
134    
135    @Override
136    public void store()
137            throws PersistenceDatabaseException {
138        getBaseFactoryInstance().store(this);
139    }
140    
141    @Override
142    public void remove()
143            throws PersistenceDatabaseException {
144        getBaseFactoryInstance().remove(this);
145    }
146    
147    @Nonnull
148    public UserVisitValue getUserVisitValue() {
149        return _value;
150    }
151    
152    public void setUserVisitValue(@Nonnull UserVisitValue value)
153            throws PersistenceReadOnlyException {
154        checkReadWrite();
155        _value = value;
156    }
157    
158    @Override
159    @Nonnull
160    public UserVisitPK getPrimaryKey() {
161        return _pk;
162    }
163    
164    @Nullable
165    public UserVisitGroupPK getUserVisitGroupPK() {
166        return _value.getUserVisitGroupPK();
167    }
168    
169    @Nullable
170    public UserVisitGroup getUserVisitGroup(EntityPermission entityPermission) {
171        UserVisitGroupPK pk = getUserVisitGroupPK();
172        UserVisitGroup entity = pk == null? null: UserVisitGroupFactory.getInstance().getEntityFromPK(entityPermission, pk);
173        
174        return entity;
175    }
176    
177    @Nullable
178    public UserVisitGroup getUserVisitGroup() {
179        return getUserVisitGroup(EntityPermission.READ_ONLY);
180    }
181    
182    @Nullable
183    public UserVisitGroup getUserVisitGroupForUpdate() {
184        return getUserVisitGroup(EntityPermission.READ_WRITE);
185    }
186    
187    public void setUserVisitGroupPK(@Nullable UserVisitGroupPK userVisitGroupPK)
188            throws PersistenceNotNullException, PersistenceReadOnlyException {
189        checkReadWrite();
190        _value.setUserVisitGroupPK(userVisitGroupPK);
191    }
192    
193    public void setUserVisitGroup(@Nullable UserVisitGroup entity) {
194        setUserVisitGroupPK(entity == null ? null : entity.getPrimaryKey());
195    }
196    
197    public boolean getUserVisitGroupPKHasBeenModified() {
198        return _value.getUserVisitGroupPKHasBeenModified();
199    }
200    
201    @Nullable
202    public UserKeyPK getUserKeyPK() {
203        return _value.getUserKeyPK();
204    }
205    
206    @Nullable
207    public UserKey getUserKey(EntityPermission entityPermission) {
208        UserKeyPK pk = getUserKeyPK();
209        UserKey entity = pk == null? null: UserKeyFactory.getInstance().getEntityFromPK(entityPermission, pk);
210        
211        return entity;
212    }
213    
214    @Nullable
215    public UserKey getUserKey() {
216        return getUserKey(EntityPermission.READ_ONLY);
217    }
218    
219    @Nullable
220    public UserKey getUserKeyForUpdate() {
221        return getUserKey(EntityPermission.READ_WRITE);
222    }
223    
224    public void setUserKeyPK(@Nullable UserKeyPK userKeyPK)
225            throws PersistenceNotNullException, PersistenceReadOnlyException {
226        checkReadWrite();
227        _value.setUserKeyPK(userKeyPK);
228    }
229    
230    public void setUserKey(@Nullable UserKey entity) {
231        setUserKeyPK(entity == null ? null : entity.getPrimaryKey());
232    }
233    
234    public boolean getUserKeyPKHasBeenModified() {
235        return _value.getUserKeyPKHasBeenModified();
236    }
237    
238    @Nullable
239    public LanguagePK getPreferredLanguagePK() {
240        return _value.getPreferredLanguagePK();
241    }
242    
243    @Nullable
244    public Language getPreferredLanguage(EntityPermission entityPermission) {
245        LanguagePK pk = getPreferredLanguagePK();
246        Language entity = pk == null? null: LanguageFactory.getInstance().getEntityFromPK(entityPermission, pk);
247        
248        return entity;
249    }
250    
251    @Nullable
252    public Language getPreferredLanguage() {
253        return getPreferredLanguage(EntityPermission.READ_ONLY);
254    }
255    
256    @Nullable
257    public Language getPreferredLanguageForUpdate() {
258        return getPreferredLanguage(EntityPermission.READ_WRITE);
259    }
260    
261    public void setPreferredLanguagePK(@Nullable LanguagePK preferredLanguagePK)
262            throws PersistenceNotNullException, PersistenceReadOnlyException {
263        checkReadWrite();
264        _value.setPreferredLanguagePK(preferredLanguagePK);
265    }
266    
267    public void setPreferredLanguage(@Nullable Language entity) {
268        setPreferredLanguagePK(entity == null ? null : entity.getPrimaryKey());
269    }
270    
271    public boolean getPreferredLanguagePKHasBeenModified() {
272        return _value.getPreferredLanguagePKHasBeenModified();
273    }
274    
275    @Nullable
276    public CurrencyPK getPreferredCurrencyPK() {
277        return _value.getPreferredCurrencyPK();
278    }
279    
280    @Nullable
281    public Currency getPreferredCurrency(EntityPermission entityPermission) {
282        CurrencyPK pk = getPreferredCurrencyPK();
283        Currency entity = pk == null? null: CurrencyFactory.getInstance().getEntityFromPK(entityPermission, pk);
284        
285        return entity;
286    }
287    
288    @Nullable
289    public Currency getPreferredCurrency() {
290        return getPreferredCurrency(EntityPermission.READ_ONLY);
291    }
292    
293    @Nullable
294    public Currency getPreferredCurrencyForUpdate() {
295        return getPreferredCurrency(EntityPermission.READ_WRITE);
296    }
297    
298    public void setPreferredCurrencyPK(@Nullable CurrencyPK preferredCurrencyPK)
299            throws PersistenceNotNullException, PersistenceReadOnlyException {
300        checkReadWrite();
301        _value.setPreferredCurrencyPK(preferredCurrencyPK);
302    }
303    
304    public void setPreferredCurrency(@Nullable Currency entity) {
305        setPreferredCurrencyPK(entity == null ? null : entity.getPrimaryKey());
306    }
307    
308    public boolean getPreferredCurrencyPKHasBeenModified() {
309        return _value.getPreferredCurrencyPKHasBeenModified();
310    }
311    
312    @Nullable
313    public TimeZonePK getPreferredTimeZonePK() {
314        return _value.getPreferredTimeZonePK();
315    }
316    
317    @Nullable
318    public TimeZone getPreferredTimeZone(EntityPermission entityPermission) {
319        TimeZonePK pk = getPreferredTimeZonePK();
320        TimeZone entity = pk == null? null: TimeZoneFactory.getInstance().getEntityFromPK(entityPermission, pk);
321        
322        return entity;
323    }
324    
325    @Nullable
326    public TimeZone getPreferredTimeZone() {
327        return getPreferredTimeZone(EntityPermission.READ_ONLY);
328    }
329    
330    @Nullable
331    public TimeZone getPreferredTimeZoneForUpdate() {
332        return getPreferredTimeZone(EntityPermission.READ_WRITE);
333    }
334    
335    public void setPreferredTimeZonePK(@Nullable TimeZonePK preferredTimeZonePK)
336            throws PersistenceNotNullException, PersistenceReadOnlyException {
337        checkReadWrite();
338        _value.setPreferredTimeZonePK(preferredTimeZonePK);
339    }
340    
341    public void setPreferredTimeZone(@Nullable TimeZone entity) {
342        setPreferredTimeZonePK(entity == null ? null : entity.getPrimaryKey());
343    }
344    
345    public boolean getPreferredTimeZonePKHasBeenModified() {
346        return _value.getPreferredTimeZonePKHasBeenModified();
347    }
348    
349    @Nullable
350    public DateTimeFormatPK getPreferredDateTimeFormatPK() {
351        return _value.getPreferredDateTimeFormatPK();
352    }
353    
354    @Nullable
355    public DateTimeFormat getPreferredDateTimeFormat(EntityPermission entityPermission) {
356        DateTimeFormatPK pk = getPreferredDateTimeFormatPK();
357        DateTimeFormat entity = pk == null? null: DateTimeFormatFactory.getInstance().getEntityFromPK(entityPermission, pk);
358        
359        return entity;
360    }
361    
362    @Nullable
363    public DateTimeFormat getPreferredDateTimeFormat() {
364        return getPreferredDateTimeFormat(EntityPermission.READ_ONLY);
365    }
366    
367    @Nullable
368    public DateTimeFormat getPreferredDateTimeFormatForUpdate() {
369        return getPreferredDateTimeFormat(EntityPermission.READ_WRITE);
370    }
371    
372    public void setPreferredDateTimeFormatPK(@Nullable DateTimeFormatPK preferredDateTimeFormatPK)
373            throws PersistenceNotNullException, PersistenceReadOnlyException {
374        checkReadWrite();
375        _value.setPreferredDateTimeFormatPK(preferredDateTimeFormatPK);
376    }
377    
378    public void setPreferredDateTimeFormat(@Nullable DateTimeFormat entity) {
379        setPreferredDateTimeFormatPK(entity == null ? null : entity.getPrimaryKey());
380    }
381    
382    public boolean getPreferredDateTimeFormatPKHasBeenModified() {
383        return _value.getPreferredDateTimeFormatPKHasBeenModified();
384    }
385    
386    @Nonnull
387    public Long getLastCommandTime() {
388        return _value.getLastCommandTime();
389    }
390    
391    public void setLastCommandTime(@Nonnull Long lastCommandTime)
392            throws PersistenceNotNullException, PersistenceReadOnlyException {
393        checkReadWrite();
394        _value.setLastCommandTime(lastCommandTime);
395    }
396    
397    public boolean getLastCommandTimeHasBeenModified() {
398        return _value.getLastCommandTimeHasBeenModified();
399    }
400    
401    @Nullable
402    public OfferUsePK getOfferUsePK() {
403        return _value.getOfferUsePK();
404    }
405    
406    @Nullable
407    public OfferUse getOfferUse(EntityPermission entityPermission) {
408        OfferUsePK pk = getOfferUsePK();
409        OfferUse entity = pk == null? null: OfferUseFactory.getInstance().getEntityFromPK(entityPermission, pk);
410        
411        return entity;
412    }
413    
414    @Nullable
415    public OfferUse getOfferUse() {
416        return getOfferUse(EntityPermission.READ_ONLY);
417    }
418    
419    @Nullable
420    public OfferUse getOfferUseForUpdate() {
421        return getOfferUse(EntityPermission.READ_WRITE);
422    }
423    
424    public void setOfferUsePK(@Nullable OfferUsePK offerUsePK)
425            throws PersistenceNotNullException, PersistenceReadOnlyException {
426        checkReadWrite();
427        _value.setOfferUsePK(offerUsePK);
428    }
429    
430    public void setOfferUse(@Nullable OfferUse entity) {
431        setOfferUsePK(entity == null ? null : entity.getPrimaryKey());
432    }
433    
434    public boolean getOfferUsePKHasBeenModified() {
435        return _value.getOfferUsePKHasBeenModified();
436    }
437    
438    @Nullable
439    public AssociateReferralPK getAssociateReferralPK() {
440        return _value.getAssociateReferralPK();
441    }
442    
443    @Nullable
444    public AssociateReferral getAssociateReferral(EntityPermission entityPermission) {
445        AssociateReferralPK pk = getAssociateReferralPK();
446        AssociateReferral entity = pk == null? null: AssociateReferralFactory.getInstance().getEntityFromPK(entityPermission, pk);
447        
448        return entity;
449    }
450    
451    @Nullable
452    public AssociateReferral getAssociateReferral() {
453        return getAssociateReferral(EntityPermission.READ_ONLY);
454    }
455    
456    @Nullable
457    public AssociateReferral getAssociateReferralForUpdate() {
458        return getAssociateReferral(EntityPermission.READ_WRITE);
459    }
460    
461    public void setAssociateReferralPK(@Nullable AssociateReferralPK associateReferralPK)
462            throws PersistenceNotNullException, PersistenceReadOnlyException {
463        checkReadWrite();
464        _value.setAssociateReferralPK(associateReferralPK);
465    }
466    
467    public void setAssociateReferral(@Nullable AssociateReferral entity) {
468        setAssociateReferralPK(entity == null ? null : entity.getPrimaryKey());
469    }
470    
471    public boolean getAssociateReferralPKHasBeenModified() {
472        return _value.getAssociateReferralPKHasBeenModified();
473    }
474    
475    @Nullable
476    public Long getRetainUntilTime() {
477        return _value.getRetainUntilTime();
478    }
479    
480    public void setRetainUntilTime(@Nullable Long retainUntilTime)
481            throws PersistenceNotNullException, PersistenceReadOnlyException {
482        checkReadWrite();
483        _value.setRetainUntilTime(retainUntilTime);
484    }
485    
486    public boolean getRetainUntilTimeHasBeenModified() {
487        return _value.getRetainUntilTimeHasBeenModified();
488    }
489    
490    @Nonnull
491    public Long getFromTime() {
492        return _value.getFromTime();
493    }
494    
495    public void setFromTime(@Nonnull Long fromTime)
496            throws PersistenceNotNullException, PersistenceReadOnlyException {
497        checkReadWrite();
498        _value.setFromTime(fromTime);
499    }
500    
501    public boolean getFromTimeHasBeenModified() {
502        return _value.getFromTimeHasBeenModified();
503    }
504    
505    @Nonnull
506    public Long getThruTime() {
507        return _value.getThruTime();
508    }
509    
510    public void setThruTime(@Nonnull Long thruTime)
511            throws PersistenceNotNullException, PersistenceReadOnlyException {
512        checkReadWrite();
513        _value.setThruTime(thruTime);
514    }
515    
516    public boolean getThruTimeHasBeenModified() {
517        return _value.getThruTimeHasBeenModified();
518    }
519    
520}