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 * WishlistLine.java
021 */
022
023package com.echothree.model.data.wishlist.server.entity;
024
025import com.echothree.model.data.wishlist.common.pk.WishlistLinePK;
026
027import com.echothree.model.data.order.common.pk.OrderLinePK;
028import com.echothree.model.data.offer.common.pk.OfferUsePK;
029import com.echothree.model.data.wishlist.common.pk.WishlistPriorityPK;
030import com.echothree.model.data.associate.common.pk.AssociateReferralPK;
031
032import com.echothree.model.data.order.server.entity.OrderLine;
033import com.echothree.model.data.offer.server.entity.OfferUse;
034import com.echothree.model.data.wishlist.server.entity.WishlistPriority;
035import com.echothree.model.data.associate.server.entity.AssociateReferral;
036
037import com.echothree.model.data.order.server.factory.OrderLineFactory;
038import com.echothree.model.data.offer.server.factory.OfferUseFactory;
039import com.echothree.model.data.wishlist.server.factory.WishlistPriorityFactory;
040import com.echothree.model.data.associate.server.factory.AssociateReferralFactory;
041
042import com.echothree.model.data.wishlist.common.pk.WishlistLinePK;
043
044import com.echothree.model.data.wishlist.server.value.WishlistLineValue;
045
046import com.echothree.model.data.wishlist.server.factory.WishlistLineFactory;
047
048import com.echothree.util.common.exception.PersistenceException;
049import com.echothree.util.common.exception.PersistenceDatabaseException;
050import com.echothree.util.common.exception.PersistenceNotNullException;
051import com.echothree.util.common.exception.PersistenceReadOnlyException;
052
053import com.echothree.util.common.persistence.BasePK;
054
055import com.echothree.util.common.persistence.type.ByteArray;
056
057import com.echothree.util.server.persistence.BaseEntity;
058import com.echothree.util.server.persistence.EntityPermission;
059import com.echothree.util.server.persistence.Session;
060import com.echothree.util.server.persistence.ThreadSession;
061
062import java.io.Serializable;
063
064import javax.annotation.Nonnull;
065import javax.annotation.Nullable;
066
067public class WishlistLine
068        extends BaseEntity
069        implements Serializable {
070    
071    private WishlistLinePK _pk;
072    private WishlistLineValue _value;
073    
074    /** Creates a new instance of WishlistLine */
075    public WishlistLine()
076            throws PersistenceException {
077        super();
078    }
079    
080    /** Creates a new instance of WishlistLine */
081    public WishlistLine(WishlistLineValue value, EntityPermission entityPermission) {
082        super(entityPermission);
083        
084        _value = value;
085        _pk = value.getPrimaryKey();
086    }
087    
088    @Override
089    @Nonnull
090    public WishlistLineFactory getBaseFactoryInstance() {
091        return WishlistLineFactory.getInstance();
092    }
093    
094    @Override
095    public boolean hasBeenModified() {
096        return _value.hasBeenModified();
097    }
098    
099    @Override
100    public int hashCode() {
101        return _pk.hashCode();
102    }
103    
104    @Override
105    @Nonnull
106    public String toString() {
107        return _pk.toString();
108    }
109    
110    @Override
111    public boolean equals(Object other) {
112        if(this == other)
113            return true;
114        
115        if(other instanceof WishlistLine that) {
116            WishlistLineValue thatValue = that.getWishlistLineValue();
117            return _value.equals(thatValue);
118        } else {
119            return false;
120        }
121    }
122    
123    @Override
124    public void store()
125            throws PersistenceDatabaseException {
126        getBaseFactoryInstance().store(this);
127    }
128    
129    @Override
130    public void remove()
131            throws PersistenceDatabaseException {
132        getBaseFactoryInstance().remove(this);
133    }
134    
135    @Nonnull
136    public WishlistLineValue getWishlistLineValue() {
137        return _value;
138    }
139    
140    public void setWishlistLineValue(@Nonnull WishlistLineValue value)
141            throws PersistenceReadOnlyException {
142        checkReadWrite();
143        _value = value;
144    }
145    
146    @Override
147    @Nonnull
148    public WishlistLinePK getPrimaryKey() {
149        return _pk;
150    }
151    
152    @Nonnull
153    public OrderLinePK getOrderLinePK() {
154        return _value.getOrderLinePK();
155    }
156    
157    @Nonnull
158    public OrderLine getOrderLine(EntityPermission entityPermission) {
159        return OrderLineFactory.getInstance().getEntityFromPK(entityPermission, getOrderLinePK());
160    }
161    
162    @Nonnull
163    public OrderLine getOrderLine() {
164        return getOrderLine(EntityPermission.READ_ONLY);
165    }
166    
167    @Nonnull
168    public OrderLine getOrderLineForUpdate() {
169        return getOrderLine(EntityPermission.READ_WRITE);
170    }
171    
172    public void setOrderLinePK(@Nonnull OrderLinePK orderLinePK)
173            throws PersistenceNotNullException, PersistenceReadOnlyException {
174        checkReadWrite();
175        _value.setOrderLinePK(orderLinePK);
176    }
177    
178    public void setOrderLine(@Nonnull OrderLine entity) {
179        setOrderLinePK(entity == null ? null : entity.getPrimaryKey());
180    }
181    
182    public boolean getOrderLinePKHasBeenModified() {
183        return _value.getOrderLinePKHasBeenModified();
184    }
185    
186    @Nonnull
187    public OfferUsePK getOfferUsePK() {
188        return _value.getOfferUsePK();
189    }
190    
191    @Nonnull
192    public OfferUse getOfferUse(EntityPermission entityPermission) {
193        return OfferUseFactory.getInstance().getEntityFromPK(entityPermission, getOfferUsePK());
194    }
195    
196    @Nonnull
197    public OfferUse getOfferUse() {
198        return getOfferUse(EntityPermission.READ_ONLY);
199    }
200    
201    @Nonnull
202    public OfferUse getOfferUseForUpdate() {
203        return getOfferUse(EntityPermission.READ_WRITE);
204    }
205    
206    public void setOfferUsePK(@Nonnull OfferUsePK offerUsePK)
207            throws PersistenceNotNullException, PersistenceReadOnlyException {
208        checkReadWrite();
209        _value.setOfferUsePK(offerUsePK);
210    }
211    
212    public void setOfferUse(@Nonnull OfferUse entity) {
213        setOfferUsePK(entity == null ? null : entity.getPrimaryKey());
214    }
215    
216    public boolean getOfferUsePKHasBeenModified() {
217        return _value.getOfferUsePKHasBeenModified();
218    }
219    
220    @Nonnull
221    public WishlistPriorityPK getWishlistPriorityPK() {
222        return _value.getWishlistPriorityPK();
223    }
224    
225    @Nonnull
226    public WishlistPriority getWishlistPriority(EntityPermission entityPermission) {
227        return WishlistPriorityFactory.getInstance().getEntityFromPK(entityPermission, getWishlistPriorityPK());
228    }
229    
230    @Nonnull
231    public WishlistPriority getWishlistPriority() {
232        return getWishlistPriority(EntityPermission.READ_ONLY);
233    }
234    
235    @Nonnull
236    public WishlistPriority getWishlistPriorityForUpdate() {
237        return getWishlistPriority(EntityPermission.READ_WRITE);
238    }
239    
240    public void setWishlistPriorityPK(@Nonnull WishlistPriorityPK wishlistPriorityPK)
241            throws PersistenceNotNullException, PersistenceReadOnlyException {
242        checkReadWrite();
243        _value.setWishlistPriorityPK(wishlistPriorityPK);
244    }
245    
246    public void setWishlistPriority(@Nonnull WishlistPriority entity) {
247        setWishlistPriorityPK(entity == null ? null : entity.getPrimaryKey());
248    }
249    
250    public boolean getWishlistPriorityPKHasBeenModified() {
251        return _value.getWishlistPriorityPKHasBeenModified();
252    }
253    
254    @Nullable
255    public AssociateReferralPK getAssociateReferralPK() {
256        return _value.getAssociateReferralPK();
257    }
258    
259    @Nullable
260    public AssociateReferral getAssociateReferral(EntityPermission entityPermission) {
261        AssociateReferralPK pk = getAssociateReferralPK();
262        AssociateReferral entity = pk == null? null: AssociateReferralFactory.getInstance().getEntityFromPK(entityPermission, pk);
263        
264        return entity;
265    }
266    
267    @Nullable
268    public AssociateReferral getAssociateReferral() {
269        return getAssociateReferral(EntityPermission.READ_ONLY);
270    }
271    
272    @Nullable
273    public AssociateReferral getAssociateReferralForUpdate() {
274        return getAssociateReferral(EntityPermission.READ_WRITE);
275    }
276    
277    public void setAssociateReferralPK(@Nullable AssociateReferralPK associateReferralPK)
278            throws PersistenceNotNullException, PersistenceReadOnlyException {
279        checkReadWrite();
280        _value.setAssociateReferralPK(associateReferralPK);
281    }
282    
283    public void setAssociateReferral(@Nullable AssociateReferral entity) {
284        setAssociateReferralPK(entity == null ? null : entity.getPrimaryKey());
285    }
286    
287    public boolean getAssociateReferralPKHasBeenModified() {
288        return _value.getAssociateReferralPKHasBeenModified();
289    }
290    
291    @Nullable
292    public String getComment() {
293        return _value.getComment();
294    }
295    
296    public void setComment(@Nullable String comment)
297            throws PersistenceNotNullException, PersistenceReadOnlyException {
298        checkReadWrite();
299        _value.setComment(comment);
300    }
301    
302    public boolean getCommentHasBeenModified() {
303        return _value.getCommentHasBeenModified();
304    }
305    
306    @Nonnull
307    public Long getFromTime() {
308        return _value.getFromTime();
309    }
310    
311    public void setFromTime(@Nonnull Long fromTime)
312            throws PersistenceNotNullException, PersistenceReadOnlyException {
313        checkReadWrite();
314        _value.setFromTime(fromTime);
315    }
316    
317    public boolean getFromTimeHasBeenModified() {
318        return _value.getFromTimeHasBeenModified();
319    }
320    
321    @Nonnull
322    public Long getThruTime() {
323        return _value.getThruTime();
324    }
325    
326    public void setThruTime(@Nonnull Long thruTime)
327            throws PersistenceNotNullException, PersistenceReadOnlyException {
328        checkReadWrite();
329        _value.setThruTime(thruTime);
330    }
331    
332    public boolean getThruTimeHasBeenModified() {
333        return _value.getThruTimeHasBeenModified();
334    }
335    
336}