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