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