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