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 * OrderDetail.java
021 */
022
023package com.echothree.model.data.order.server.entity;
024
025import com.echothree.model.data.order.common.pk.OrderDetailPK;
026
027import com.echothree.model.data.order.common.pk.OrderPK;
028import com.echothree.model.data.order.common.pk.OrderTypePK;
029import com.echothree.model.data.order.common.pk.OrderPriorityPK;
030import com.echothree.model.data.accounting.common.pk.CurrencyPK;
031import com.echothree.model.data.term.common.pk.TermPK;
032import com.echothree.model.data.shipment.common.pk.FreeOnBoardPK;
033import com.echothree.model.data.cancellationpolicy.common.pk.CancellationPolicyPK;
034import com.echothree.model.data.returnpolicy.common.pk.ReturnPolicyPK;
035
036import com.echothree.model.data.order.server.entity.Order;
037import com.echothree.model.data.order.server.entity.OrderType;
038import com.echothree.model.data.order.server.entity.OrderPriority;
039import com.echothree.model.data.accounting.server.entity.Currency;
040import com.echothree.model.data.term.server.entity.Term;
041import com.echothree.model.data.shipment.server.entity.FreeOnBoard;
042import com.echothree.model.data.cancellationpolicy.server.entity.CancellationPolicy;
043import com.echothree.model.data.returnpolicy.server.entity.ReturnPolicy;
044
045import com.echothree.model.data.order.server.factory.OrderFactory;
046import com.echothree.model.data.order.server.factory.OrderTypeFactory;
047import com.echothree.model.data.order.server.factory.OrderPriorityFactory;
048import com.echothree.model.data.accounting.server.factory.CurrencyFactory;
049import com.echothree.model.data.term.server.factory.TermFactory;
050import com.echothree.model.data.shipment.server.factory.FreeOnBoardFactory;
051import com.echothree.model.data.cancellationpolicy.server.factory.CancellationPolicyFactory;
052import com.echothree.model.data.returnpolicy.server.factory.ReturnPolicyFactory;
053
054import com.echothree.model.data.order.common.pk.OrderDetailPK;
055
056import com.echothree.model.data.order.server.value.OrderDetailValue;
057
058import com.echothree.model.data.order.server.factory.OrderDetailFactory;
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
076public class OrderDetail
077        extends BaseEntity
078        implements Serializable {
079    
080    private OrderDetailPK _pk;
081    private OrderDetailValue _value;
082    
083    /** Creates a new instance of OrderDetail */
084    public OrderDetail()
085            throws PersistenceException {
086        super();
087    }
088    
089    /** Creates a new instance of OrderDetail */
090    public OrderDetail(OrderDetailValue value, EntityPermission entityPermission) {
091        super(entityPermission);
092        
093        _value = value;
094        _pk = value.getPrimaryKey();
095    }
096    
097    @Override
098    public OrderDetailFactory getBaseFactoryInstance() {
099        return OrderDetailFactory.getInstance();
100    }
101    
102    @Override
103    public boolean hasBeenModified() {
104        return _value.hasBeenModified();
105    }
106    
107    @Override
108    public int hashCode() {
109        return _pk.hashCode();
110    }
111    
112    @Override
113    public String toString() {
114        return _pk.toString();
115    }
116    
117    @Override
118    public boolean equals(Object other) {
119        if(this == other)
120            return true;
121        
122        if(other instanceof OrderDetail) {
123            OrderDetail that = (OrderDetail)other;
124            
125            OrderDetailValue thatValue = that.getOrderDetailValue();
126            return _value.equals(thatValue);
127        } else {
128            return false;
129        }
130    }
131    
132    @Override
133    public void store(Session session)
134            throws PersistenceDatabaseException {
135        getBaseFactoryInstance().store(session, this);
136    }
137    
138    @Override
139    public void remove(Session session)
140            throws PersistenceDatabaseException {
141        getBaseFactoryInstance().remove(session, this);
142    }
143    
144    @Override
145    public void remove()
146            throws PersistenceDatabaseException {
147        getBaseFactoryInstance().remove(ThreadSession.currentSession(), this);
148    }
149    
150    public OrderDetailValue getOrderDetailValue() {
151        return _value;
152    }
153    
154    public void setOrderDetailValue(OrderDetailValue value)
155            throws PersistenceReadOnlyException {
156        checkReadWrite();
157        _value = value;
158    }
159    
160    @Override
161    public OrderDetailPK getPrimaryKey() {
162        return _pk;
163    }
164    
165    public OrderPK getOrderPK() {
166        return _value.getOrderPK();
167    }
168    
169    public Order getOrder(Session session, EntityPermission entityPermission) {
170        return OrderFactory.getInstance().getEntityFromPK(session, entityPermission, getOrderPK());
171    }
172    
173    public Order getOrder(EntityPermission entityPermission) {
174        return getOrder(ThreadSession.currentSession(), entityPermission);
175    }
176    
177    public Order getOrder(Session session) {
178        return getOrder(session, EntityPermission.READ_ONLY);
179    }
180    
181    public Order getOrder() {
182        return getOrder(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
183    }
184    
185    public Order getOrderForUpdate(Session session) {
186        return getOrder(session, EntityPermission.READ_WRITE);
187    }
188    
189    public Order getOrderForUpdate() {
190        return getOrder(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
191    }
192    
193    public void setOrderPK(OrderPK orderPK)
194            throws PersistenceNotNullException, PersistenceReadOnlyException {
195        checkReadWrite();
196        _value.setOrderPK(orderPK);
197    }
198    
199    public void setOrder(Order entity) {
200        setOrderPK(entity == null? null: entity.getPrimaryKey());
201    }
202    
203    public boolean getOrderPKHasBeenModified() {
204        return _value.getOrderPKHasBeenModified();
205    }
206    
207    public OrderTypePK getOrderTypePK() {
208        return _value.getOrderTypePK();
209    }
210    
211    public OrderType getOrderType(Session session, EntityPermission entityPermission) {
212        return OrderTypeFactory.getInstance().getEntityFromPK(session, entityPermission, getOrderTypePK());
213    }
214    
215    public OrderType getOrderType(EntityPermission entityPermission) {
216        return getOrderType(ThreadSession.currentSession(), entityPermission);
217    }
218    
219    public OrderType getOrderType(Session session) {
220        return getOrderType(session, EntityPermission.READ_ONLY);
221    }
222    
223    public OrderType getOrderType() {
224        return getOrderType(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
225    }
226    
227    public OrderType getOrderTypeForUpdate(Session session) {
228        return getOrderType(session, EntityPermission.READ_WRITE);
229    }
230    
231    public OrderType getOrderTypeForUpdate() {
232        return getOrderType(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
233    }
234    
235    public void setOrderTypePK(OrderTypePK orderTypePK)
236            throws PersistenceNotNullException, PersistenceReadOnlyException {
237        checkReadWrite();
238        _value.setOrderTypePK(orderTypePK);
239    }
240    
241    public void setOrderType(OrderType entity) {
242        setOrderTypePK(entity == null? null: entity.getPrimaryKey());
243    }
244    
245    public boolean getOrderTypePKHasBeenModified() {
246        return _value.getOrderTypePKHasBeenModified();
247    }
248    
249    public String getOrderName() {
250        return _value.getOrderName();
251    }
252    
253    public void setOrderName(String orderName)
254            throws PersistenceNotNullException, PersistenceReadOnlyException {
255        checkReadWrite();
256        _value.setOrderName(orderName);
257    }
258    
259    public boolean getOrderNameHasBeenModified() {
260        return _value.getOrderNameHasBeenModified();
261    }
262    
263    public OrderPriorityPK getOrderPriorityPK() {
264        return _value.getOrderPriorityPK();
265    }
266    
267    public OrderPriority getOrderPriority(Session session, EntityPermission entityPermission) {
268        OrderPriorityPK pk = getOrderPriorityPK();
269        OrderPriority entity = pk == null? null: OrderPriorityFactory.getInstance().getEntityFromPK(session, entityPermission, pk);
270        
271        return entity;
272    }
273    
274    public OrderPriority getOrderPriority(EntityPermission entityPermission) {
275        return getOrderPriority(ThreadSession.currentSession(), entityPermission);
276    }
277    
278    public OrderPriority getOrderPriority(Session session) {
279        return getOrderPriority(session, EntityPermission.READ_ONLY);
280    }
281    
282    public OrderPriority getOrderPriority() {
283        return getOrderPriority(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
284    }
285    
286    public OrderPriority getOrderPriorityForUpdate(Session session) {
287        return getOrderPriority(session, EntityPermission.READ_WRITE);
288    }
289    
290    public OrderPriority getOrderPriorityForUpdate() {
291        return getOrderPriority(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
292    }
293    
294    public void setOrderPriorityPK(OrderPriorityPK orderPriorityPK)
295            throws PersistenceNotNullException, PersistenceReadOnlyException {
296        checkReadWrite();
297        _value.setOrderPriorityPK(orderPriorityPK);
298    }
299    
300    public void setOrderPriority(OrderPriority entity) {
301        setOrderPriorityPK(entity == null? null: entity.getPrimaryKey());
302    }
303    
304    public boolean getOrderPriorityPKHasBeenModified() {
305        return _value.getOrderPriorityPKHasBeenModified();
306    }
307    
308    public CurrencyPK getCurrencyPK() {
309        return _value.getCurrencyPK();
310    }
311    
312    public Currency getCurrency(Session session, EntityPermission entityPermission) {
313        return CurrencyFactory.getInstance().getEntityFromPK(session, entityPermission, getCurrencyPK());
314    }
315    
316    public Currency getCurrency(EntityPermission entityPermission) {
317        return getCurrency(ThreadSession.currentSession(), entityPermission);
318    }
319    
320    public Currency getCurrency(Session session) {
321        return getCurrency(session, EntityPermission.READ_ONLY);
322    }
323    
324    public Currency getCurrency() {
325        return getCurrency(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
326    }
327    
328    public Currency getCurrencyForUpdate(Session session) {
329        return getCurrency(session, EntityPermission.READ_WRITE);
330    }
331    
332    public Currency getCurrencyForUpdate() {
333        return getCurrency(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
334    }
335    
336    public void setCurrencyPK(CurrencyPK currencyPK)
337            throws PersistenceNotNullException, PersistenceReadOnlyException {
338        checkReadWrite();
339        _value.setCurrencyPK(currencyPK);
340    }
341    
342    public void setCurrency(Currency entity) {
343        setCurrencyPK(entity == null? null: entity.getPrimaryKey());
344    }
345    
346    public boolean getCurrencyPKHasBeenModified() {
347        return _value.getCurrencyPKHasBeenModified();
348    }
349    
350    public Boolean getHoldUntilComplete() {
351        return _value.getHoldUntilComplete();
352    }
353    
354    public void setHoldUntilComplete(Boolean holdUntilComplete)
355            throws PersistenceNotNullException, PersistenceReadOnlyException {
356        checkReadWrite();
357        _value.setHoldUntilComplete(holdUntilComplete);
358    }
359    
360    public boolean getHoldUntilCompleteHasBeenModified() {
361        return _value.getHoldUntilCompleteHasBeenModified();
362    }
363    
364    public Boolean getAllowBackorders() {
365        return _value.getAllowBackorders();
366    }
367    
368    public void setAllowBackorders(Boolean allowBackorders)
369            throws PersistenceNotNullException, PersistenceReadOnlyException {
370        checkReadWrite();
371        _value.setAllowBackorders(allowBackorders);
372    }
373    
374    public boolean getAllowBackordersHasBeenModified() {
375        return _value.getAllowBackordersHasBeenModified();
376    }
377    
378    public Boolean getAllowSubstitutions() {
379        return _value.getAllowSubstitutions();
380    }
381    
382    public void setAllowSubstitutions(Boolean allowSubstitutions)
383            throws PersistenceNotNullException, PersistenceReadOnlyException {
384        checkReadWrite();
385        _value.setAllowSubstitutions(allowSubstitutions);
386    }
387    
388    public boolean getAllowSubstitutionsHasBeenModified() {
389        return _value.getAllowSubstitutionsHasBeenModified();
390    }
391    
392    public Boolean getAllowCombiningShipments() {
393        return _value.getAllowCombiningShipments();
394    }
395    
396    public void setAllowCombiningShipments(Boolean allowCombiningShipments)
397            throws PersistenceNotNullException, PersistenceReadOnlyException {
398        checkReadWrite();
399        _value.setAllowCombiningShipments(allowCombiningShipments);
400    }
401    
402    public boolean getAllowCombiningShipmentsHasBeenModified() {
403        return _value.getAllowCombiningShipmentsHasBeenModified();
404    }
405    
406    public TermPK getTermPK() {
407        return _value.getTermPK();
408    }
409    
410    public Term getTerm(Session session, EntityPermission entityPermission) {
411        TermPK pk = getTermPK();
412        Term entity = pk == null? null: TermFactory.getInstance().getEntityFromPK(session, entityPermission, pk);
413        
414        return entity;
415    }
416    
417    public Term getTerm(EntityPermission entityPermission) {
418        return getTerm(ThreadSession.currentSession(), entityPermission);
419    }
420    
421    public Term getTerm(Session session) {
422        return getTerm(session, EntityPermission.READ_ONLY);
423    }
424    
425    public Term getTerm() {
426        return getTerm(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
427    }
428    
429    public Term getTermForUpdate(Session session) {
430        return getTerm(session, EntityPermission.READ_WRITE);
431    }
432    
433    public Term getTermForUpdate() {
434        return getTerm(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
435    }
436    
437    public void setTermPK(TermPK termPK)
438            throws PersistenceNotNullException, PersistenceReadOnlyException {
439        checkReadWrite();
440        _value.setTermPK(termPK);
441    }
442    
443    public void setTerm(Term entity) {
444        setTermPK(entity == null? null: entity.getPrimaryKey());
445    }
446    
447    public boolean getTermPKHasBeenModified() {
448        return _value.getTermPKHasBeenModified();
449    }
450    
451    public FreeOnBoardPK getFreeOnBoardPK() {
452        return _value.getFreeOnBoardPK();
453    }
454    
455    public FreeOnBoard getFreeOnBoard(Session session, EntityPermission entityPermission) {
456        FreeOnBoardPK pk = getFreeOnBoardPK();
457        FreeOnBoard entity = pk == null? null: FreeOnBoardFactory.getInstance().getEntityFromPK(session, entityPermission, pk);
458        
459        return entity;
460    }
461    
462    public FreeOnBoard getFreeOnBoard(EntityPermission entityPermission) {
463        return getFreeOnBoard(ThreadSession.currentSession(), entityPermission);
464    }
465    
466    public FreeOnBoard getFreeOnBoard(Session session) {
467        return getFreeOnBoard(session, EntityPermission.READ_ONLY);
468    }
469    
470    public FreeOnBoard getFreeOnBoard() {
471        return getFreeOnBoard(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
472    }
473    
474    public FreeOnBoard getFreeOnBoardForUpdate(Session session) {
475        return getFreeOnBoard(session, EntityPermission.READ_WRITE);
476    }
477    
478    public FreeOnBoard getFreeOnBoardForUpdate() {
479        return getFreeOnBoard(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
480    }
481    
482    public void setFreeOnBoardPK(FreeOnBoardPK freeOnBoardPK)
483            throws PersistenceNotNullException, PersistenceReadOnlyException {
484        checkReadWrite();
485        _value.setFreeOnBoardPK(freeOnBoardPK);
486    }
487    
488    public void setFreeOnBoard(FreeOnBoard entity) {
489        setFreeOnBoardPK(entity == null? null: entity.getPrimaryKey());
490    }
491    
492    public boolean getFreeOnBoardPKHasBeenModified() {
493        return _value.getFreeOnBoardPKHasBeenModified();
494    }
495    
496    public String getReference() {
497        return _value.getReference();
498    }
499    
500    public void setReference(String reference)
501            throws PersistenceNotNullException, PersistenceReadOnlyException {
502        checkReadWrite();
503        _value.setReference(reference);
504    }
505    
506    public boolean getReferenceHasBeenModified() {
507        return _value.getReferenceHasBeenModified();
508    }
509    
510    public String getDescription() {
511        return _value.getDescription();
512    }
513    
514    public void setDescription(String description)
515            throws PersistenceNotNullException, PersistenceReadOnlyException {
516        checkReadWrite();
517        _value.setDescription(description);
518    }
519    
520    public boolean getDescriptionHasBeenModified() {
521        return _value.getDescriptionHasBeenModified();
522    }
523    
524    public CancellationPolicyPK getCancellationPolicyPK() {
525        return _value.getCancellationPolicyPK();
526    }
527    
528    public CancellationPolicy getCancellationPolicy(Session session, EntityPermission entityPermission) {
529        CancellationPolicyPK pk = getCancellationPolicyPK();
530        CancellationPolicy entity = pk == null? null: CancellationPolicyFactory.getInstance().getEntityFromPK(session, entityPermission, pk);
531        
532        return entity;
533    }
534    
535    public CancellationPolicy getCancellationPolicy(EntityPermission entityPermission) {
536        return getCancellationPolicy(ThreadSession.currentSession(), entityPermission);
537    }
538    
539    public CancellationPolicy getCancellationPolicy(Session session) {
540        return getCancellationPolicy(session, EntityPermission.READ_ONLY);
541    }
542    
543    public CancellationPolicy getCancellationPolicy() {
544        return getCancellationPolicy(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
545    }
546    
547    public CancellationPolicy getCancellationPolicyForUpdate(Session session) {
548        return getCancellationPolicy(session, EntityPermission.READ_WRITE);
549    }
550    
551    public CancellationPolicy getCancellationPolicyForUpdate() {
552        return getCancellationPolicy(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
553    }
554    
555    public void setCancellationPolicyPK(CancellationPolicyPK cancellationPolicyPK)
556            throws PersistenceNotNullException, PersistenceReadOnlyException {
557        checkReadWrite();
558        _value.setCancellationPolicyPK(cancellationPolicyPK);
559    }
560    
561    public void setCancellationPolicy(CancellationPolicy entity) {
562        setCancellationPolicyPK(entity == null? null: entity.getPrimaryKey());
563    }
564    
565    public boolean getCancellationPolicyPKHasBeenModified() {
566        return _value.getCancellationPolicyPKHasBeenModified();
567    }
568    
569    public ReturnPolicyPK getReturnPolicyPK() {
570        return _value.getReturnPolicyPK();
571    }
572    
573    public ReturnPolicy getReturnPolicy(Session session, EntityPermission entityPermission) {
574        ReturnPolicyPK pk = getReturnPolicyPK();
575        ReturnPolicy entity = pk == null? null: ReturnPolicyFactory.getInstance().getEntityFromPK(session, entityPermission, pk);
576        
577        return entity;
578    }
579    
580    public ReturnPolicy getReturnPolicy(EntityPermission entityPermission) {
581        return getReturnPolicy(ThreadSession.currentSession(), entityPermission);
582    }
583    
584    public ReturnPolicy getReturnPolicy(Session session) {
585        return getReturnPolicy(session, EntityPermission.READ_ONLY);
586    }
587    
588    public ReturnPolicy getReturnPolicy() {
589        return getReturnPolicy(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
590    }
591    
592    public ReturnPolicy getReturnPolicyForUpdate(Session session) {
593        return getReturnPolicy(session, EntityPermission.READ_WRITE);
594    }
595    
596    public ReturnPolicy getReturnPolicyForUpdate() {
597        return getReturnPolicy(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
598    }
599    
600    public void setReturnPolicyPK(ReturnPolicyPK returnPolicyPK)
601            throws PersistenceNotNullException, PersistenceReadOnlyException {
602        checkReadWrite();
603        _value.setReturnPolicyPK(returnPolicyPK);
604    }
605    
606    public void setReturnPolicy(ReturnPolicy entity) {
607        setReturnPolicyPK(entity == null? null: entity.getPrimaryKey());
608    }
609    
610    public boolean getReturnPolicyPKHasBeenModified() {
611        return _value.getReturnPolicyPKHasBeenModified();
612    }
613    
614    public Boolean getTaxable() {
615        return _value.getTaxable();
616    }
617    
618    public void setTaxable(Boolean taxable)
619            throws PersistenceNotNullException, PersistenceReadOnlyException {
620        checkReadWrite();
621        _value.setTaxable(taxable);
622    }
623    
624    public boolean getTaxableHasBeenModified() {
625        return _value.getTaxableHasBeenModified();
626    }
627    
628    public Long getFromTime() {
629        return _value.getFromTime();
630    }
631    
632    public void setFromTime(Long fromTime)
633            throws PersistenceNotNullException, PersistenceReadOnlyException {
634        checkReadWrite();
635        _value.setFromTime(fromTime);
636    }
637    
638    public boolean getFromTimeHasBeenModified() {
639        return _value.getFromTimeHasBeenModified();
640    }
641    
642    public Long getThruTime() {
643        return _value.getThruTime();
644    }
645    
646    public void setThruTime(Long thruTime)
647            throws PersistenceNotNullException, PersistenceReadOnlyException {
648        checkReadWrite();
649        _value.setThruTime(thruTime);
650    }
651    
652    public boolean getThruTimeHasBeenModified() {
653        return _value.getThruTimeHasBeenModified();
654    }
655    
656}