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 * ShipmentDetail.java
021 */
022
023package com.echothree.model.data.shipment.server.entity;
024
025import com.echothree.model.data.shipment.common.pk.ShipmentDetailPK;
026
027import com.echothree.model.data.shipment.common.pk.ShipmentPK;
028import com.echothree.model.data.shipment.common.pk.ShipmentTypePK;
029import com.echothree.model.data.party.common.pk.PartyPK;
030import com.echothree.model.data.contact.common.pk.PartyContactMechanismPK;
031import com.echothree.model.data.shipping.common.pk.ShippingMethodPK;
032
033import com.echothree.model.data.shipment.server.entity.Shipment;
034import com.echothree.model.data.shipment.server.entity.ShipmentType;
035import com.echothree.model.data.party.server.entity.Party;
036import com.echothree.model.data.contact.server.entity.PartyContactMechanism;
037import com.echothree.model.data.shipping.server.entity.ShippingMethod;
038
039import com.echothree.model.data.shipment.server.factory.ShipmentFactory;
040import com.echothree.model.data.shipment.server.factory.ShipmentTypeFactory;
041import com.echothree.model.data.party.server.factory.PartyFactory;
042import com.echothree.model.data.contact.server.factory.PartyContactMechanismFactory;
043import com.echothree.model.data.shipping.server.factory.ShippingMethodFactory;
044
045import com.echothree.model.data.shipment.common.pk.ShipmentDetailPK;
046
047import com.echothree.model.data.shipment.server.value.ShipmentDetailValue;
048
049import com.echothree.model.data.shipment.server.factory.ShipmentDetailFactory;
050
051import com.echothree.util.common.exception.PersistenceException;
052import com.echothree.util.common.exception.PersistenceDatabaseException;
053import com.echothree.util.common.exception.PersistenceNotNullException;
054import com.echothree.util.common.exception.PersistenceReadOnlyException;
055
056import com.echothree.util.common.persistence.BasePK;
057
058import com.echothree.util.common.persistence.type.ByteArray;
059
060import com.echothree.util.server.persistence.BaseEntity;
061import com.echothree.util.server.persistence.EntityPermission;
062import com.echothree.util.server.persistence.Session;
063import com.echothree.util.server.persistence.ThreadSession;
064
065import java.io.Serializable;
066
067public class ShipmentDetail
068        extends BaseEntity
069        implements Serializable {
070    
071    private ShipmentDetailPK _pk;
072    private ShipmentDetailValue _value;
073    
074    /** Creates a new instance of ShipmentDetail */
075    public ShipmentDetail()
076            throws PersistenceException {
077        super();
078    }
079    
080    /** Creates a new instance of ShipmentDetail */
081    public ShipmentDetail(ShipmentDetailValue value, EntityPermission entityPermission) {
082        super(entityPermission);
083        
084        _value = value;
085        _pk = value.getPrimaryKey();
086    }
087    
088    @Override
089    public ShipmentDetailFactory getBaseFactoryInstance() {
090        return ShipmentDetailFactory.getInstance();
091    }
092    
093    @Override
094    public boolean hasBeenModified() {
095        return _value.hasBeenModified();
096    }
097    
098    @Override
099    public int hashCode() {
100        return _pk.hashCode();
101    }
102    
103    @Override
104    public String toString() {
105        return _pk.toString();
106    }
107    
108    @Override
109    public boolean equals(Object other) {
110        if(this == other)
111            return true;
112        
113        if(other instanceof ShipmentDetail) {
114            ShipmentDetail that = (ShipmentDetail)other;
115            
116            ShipmentDetailValue thatValue = that.getShipmentDetailValue();
117            return _value.equals(thatValue);
118        } else {
119            return false;
120        }
121    }
122    
123    @Override
124    public void store(Session session)
125            throws PersistenceDatabaseException {
126        getBaseFactoryInstance().store(session, this);
127    }
128    
129    @Override
130    public void remove(Session session)
131            throws PersistenceDatabaseException {
132        getBaseFactoryInstance().remove(session, this);
133    }
134    
135    @Override
136    public void remove()
137            throws PersistenceDatabaseException {
138        getBaseFactoryInstance().remove(ThreadSession.currentSession(), this);
139    }
140    
141    public ShipmentDetailValue getShipmentDetailValue() {
142        return _value;
143    }
144    
145    public void setShipmentDetailValue(ShipmentDetailValue value)
146            throws PersistenceReadOnlyException {
147        checkReadWrite();
148        _value = value;
149    }
150    
151    @Override
152    public ShipmentDetailPK getPrimaryKey() {
153        return _pk;
154    }
155    
156    public ShipmentPK getShipmentPK() {
157        return _value.getShipmentPK();
158    }
159    
160    public Shipment getShipment(Session session, EntityPermission entityPermission) {
161        return ShipmentFactory.getInstance().getEntityFromPK(session, entityPermission, getShipmentPK());
162    }
163    
164    public Shipment getShipment(EntityPermission entityPermission) {
165        return getShipment(ThreadSession.currentSession(), entityPermission);
166    }
167    
168    public Shipment getShipment(Session session) {
169        return getShipment(session, EntityPermission.READ_ONLY);
170    }
171    
172    public Shipment getShipment() {
173        return getShipment(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
174    }
175    
176    public Shipment getShipmentForUpdate(Session session) {
177        return getShipment(session, EntityPermission.READ_WRITE);
178    }
179    
180    public Shipment getShipmentForUpdate() {
181        return getShipment(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
182    }
183    
184    public void setShipmentPK(ShipmentPK shipmentPK)
185            throws PersistenceNotNullException, PersistenceReadOnlyException {
186        checkReadWrite();
187        _value.setShipmentPK(shipmentPK);
188    }
189    
190    public void setShipment(Shipment entity) {
191        setShipmentPK(entity == null? null: entity.getPrimaryKey());
192    }
193    
194    public boolean getShipmentPKHasBeenModified() {
195        return _value.getShipmentPKHasBeenModified();
196    }
197    
198    public ShipmentTypePK getShipmentTypePK() {
199        return _value.getShipmentTypePK();
200    }
201    
202    public ShipmentType getShipmentType(Session session, EntityPermission entityPermission) {
203        return ShipmentTypeFactory.getInstance().getEntityFromPK(session, entityPermission, getShipmentTypePK());
204    }
205    
206    public ShipmentType getShipmentType(EntityPermission entityPermission) {
207        return getShipmentType(ThreadSession.currentSession(), entityPermission);
208    }
209    
210    public ShipmentType getShipmentType(Session session) {
211        return getShipmentType(session, EntityPermission.READ_ONLY);
212    }
213    
214    public ShipmentType getShipmentType() {
215        return getShipmentType(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
216    }
217    
218    public ShipmentType getShipmentTypeForUpdate(Session session) {
219        return getShipmentType(session, EntityPermission.READ_WRITE);
220    }
221    
222    public ShipmentType getShipmentTypeForUpdate() {
223        return getShipmentType(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
224    }
225    
226    public void setShipmentTypePK(ShipmentTypePK shipmentTypePK)
227            throws PersistenceNotNullException, PersistenceReadOnlyException {
228        checkReadWrite();
229        _value.setShipmentTypePK(shipmentTypePK);
230    }
231    
232    public void setShipmentType(ShipmentType entity) {
233        setShipmentTypePK(entity == null? null: entity.getPrimaryKey());
234    }
235    
236    public boolean getShipmentTypePKHasBeenModified() {
237        return _value.getShipmentTypePKHasBeenModified();
238    }
239    
240    public String getShipmentName() {
241        return _value.getShipmentName();
242    }
243    
244    public void setShipmentName(String shipmentName)
245            throws PersistenceNotNullException, PersistenceReadOnlyException {
246        checkReadWrite();
247        _value.setShipmentName(shipmentName);
248    }
249    
250    public boolean getShipmentNameHasBeenModified() {
251        return _value.getShipmentNameHasBeenModified();
252    }
253    
254    public PartyPK getOriginPartyPK() {
255        return _value.getOriginPartyPK();
256    }
257    
258    public Party getOriginParty(Session session, EntityPermission entityPermission) {
259        return PartyFactory.getInstance().getEntityFromPK(session, entityPermission, getOriginPartyPK());
260    }
261    
262    public Party getOriginParty(EntityPermission entityPermission) {
263        return getOriginParty(ThreadSession.currentSession(), entityPermission);
264    }
265    
266    public Party getOriginParty(Session session) {
267        return getOriginParty(session, EntityPermission.READ_ONLY);
268    }
269    
270    public Party getOriginParty() {
271        return getOriginParty(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
272    }
273    
274    public Party getOriginPartyForUpdate(Session session) {
275        return getOriginParty(session, EntityPermission.READ_WRITE);
276    }
277    
278    public Party getOriginPartyForUpdate() {
279        return getOriginParty(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
280    }
281    
282    public void setOriginPartyPK(PartyPK originPartyPK)
283            throws PersistenceNotNullException, PersistenceReadOnlyException {
284        checkReadWrite();
285        _value.setOriginPartyPK(originPartyPK);
286    }
287    
288    public void setOriginParty(Party entity) {
289        setOriginPartyPK(entity == null? null: entity.getPrimaryKey());
290    }
291    
292    public boolean getOriginPartyPKHasBeenModified() {
293        return _value.getOriginPartyPKHasBeenModified();
294    }
295    
296    public PartyPK getOriginWarehousePartyPK() {
297        return _value.getOriginWarehousePartyPK();
298    }
299    
300    public Party getOriginWarehouseParty(Session session, EntityPermission entityPermission) {
301        PartyPK pk = getOriginWarehousePartyPK();
302        Party entity = pk == null? null: PartyFactory.getInstance().getEntityFromPK(session, entityPermission, pk);
303        
304        return entity;
305    }
306    
307    public Party getOriginWarehouseParty(EntityPermission entityPermission) {
308        return getOriginWarehouseParty(ThreadSession.currentSession(), entityPermission);
309    }
310    
311    public Party getOriginWarehouseParty(Session session) {
312        return getOriginWarehouseParty(session, EntityPermission.READ_ONLY);
313    }
314    
315    public Party getOriginWarehouseParty() {
316        return getOriginWarehouseParty(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
317    }
318    
319    public Party getOriginWarehousePartyForUpdate(Session session) {
320        return getOriginWarehouseParty(session, EntityPermission.READ_WRITE);
321    }
322    
323    public Party getOriginWarehousePartyForUpdate() {
324        return getOriginWarehouseParty(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
325    }
326    
327    public void setOriginWarehousePartyPK(PartyPK originWarehousePartyPK)
328            throws PersistenceNotNullException, PersistenceReadOnlyException {
329        checkReadWrite();
330        _value.setOriginWarehousePartyPK(originWarehousePartyPK);
331    }
332    
333    public void setOriginWarehouseParty(Party entity) {
334        setOriginWarehousePartyPK(entity == null? null: entity.getPrimaryKey());
335    }
336    
337    public boolean getOriginWarehousePartyPKHasBeenModified() {
338        return _value.getOriginWarehousePartyPKHasBeenModified();
339    }
340    
341    public PartyContactMechanismPK getOriginPartyContactMechanismPK() {
342        return _value.getOriginPartyContactMechanismPK();
343    }
344    
345    public PartyContactMechanism getOriginPartyContactMechanism(Session session, EntityPermission entityPermission) {
346        PartyContactMechanismPK pk = getOriginPartyContactMechanismPK();
347        PartyContactMechanism entity = pk == null? null: PartyContactMechanismFactory.getInstance().getEntityFromPK(session, entityPermission, pk);
348        
349        return entity;
350    }
351    
352    public PartyContactMechanism getOriginPartyContactMechanism(EntityPermission entityPermission) {
353        return getOriginPartyContactMechanism(ThreadSession.currentSession(), entityPermission);
354    }
355    
356    public PartyContactMechanism getOriginPartyContactMechanism(Session session) {
357        return getOriginPartyContactMechanism(session, EntityPermission.READ_ONLY);
358    }
359    
360    public PartyContactMechanism getOriginPartyContactMechanism() {
361        return getOriginPartyContactMechanism(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
362    }
363    
364    public PartyContactMechanism getOriginPartyContactMechanismForUpdate(Session session) {
365        return getOriginPartyContactMechanism(session, EntityPermission.READ_WRITE);
366    }
367    
368    public PartyContactMechanism getOriginPartyContactMechanismForUpdate() {
369        return getOriginPartyContactMechanism(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
370    }
371    
372    public void setOriginPartyContactMechanismPK(PartyContactMechanismPK originPartyContactMechanismPK)
373            throws PersistenceNotNullException, PersistenceReadOnlyException {
374        checkReadWrite();
375        _value.setOriginPartyContactMechanismPK(originPartyContactMechanismPK);
376    }
377    
378    public void setOriginPartyContactMechanism(PartyContactMechanism entity) {
379        setOriginPartyContactMechanismPK(entity == null? null: entity.getPrimaryKey());
380    }
381    
382    public boolean getOriginPartyContactMechanismPKHasBeenModified() {
383        return _value.getOriginPartyContactMechanismPKHasBeenModified();
384    }
385    
386    public PartyPK getDestinationPartyPK() {
387        return _value.getDestinationPartyPK();
388    }
389    
390    public Party getDestinationParty(Session session, EntityPermission entityPermission) {
391        return PartyFactory.getInstance().getEntityFromPK(session, entityPermission, getDestinationPartyPK());
392    }
393    
394    public Party getDestinationParty(EntityPermission entityPermission) {
395        return getDestinationParty(ThreadSession.currentSession(), entityPermission);
396    }
397    
398    public Party getDestinationParty(Session session) {
399        return getDestinationParty(session, EntityPermission.READ_ONLY);
400    }
401    
402    public Party getDestinationParty() {
403        return getDestinationParty(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
404    }
405    
406    public Party getDestinationPartyForUpdate(Session session) {
407        return getDestinationParty(session, EntityPermission.READ_WRITE);
408    }
409    
410    public Party getDestinationPartyForUpdate() {
411        return getDestinationParty(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
412    }
413    
414    public void setDestinationPartyPK(PartyPK destinationPartyPK)
415            throws PersistenceNotNullException, PersistenceReadOnlyException {
416        checkReadWrite();
417        _value.setDestinationPartyPK(destinationPartyPK);
418    }
419    
420    public void setDestinationParty(Party entity) {
421        setDestinationPartyPK(entity == null? null: entity.getPrimaryKey());
422    }
423    
424    public boolean getDestinationPartyPKHasBeenModified() {
425        return _value.getDestinationPartyPKHasBeenModified();
426    }
427    
428    public PartyPK getDestinationWarehousePartyPK() {
429        return _value.getDestinationWarehousePartyPK();
430    }
431    
432    public Party getDestinationWarehouseParty(Session session, EntityPermission entityPermission) {
433        PartyPK pk = getDestinationWarehousePartyPK();
434        Party entity = pk == null? null: PartyFactory.getInstance().getEntityFromPK(session, entityPermission, pk);
435        
436        return entity;
437    }
438    
439    public Party getDestinationWarehouseParty(EntityPermission entityPermission) {
440        return getDestinationWarehouseParty(ThreadSession.currentSession(), entityPermission);
441    }
442    
443    public Party getDestinationWarehouseParty(Session session) {
444        return getDestinationWarehouseParty(session, EntityPermission.READ_ONLY);
445    }
446    
447    public Party getDestinationWarehouseParty() {
448        return getDestinationWarehouseParty(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
449    }
450    
451    public Party getDestinationWarehousePartyForUpdate(Session session) {
452        return getDestinationWarehouseParty(session, EntityPermission.READ_WRITE);
453    }
454    
455    public Party getDestinationWarehousePartyForUpdate() {
456        return getDestinationWarehouseParty(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
457    }
458    
459    public void setDestinationWarehousePartyPK(PartyPK destinationWarehousePartyPK)
460            throws PersistenceNotNullException, PersistenceReadOnlyException {
461        checkReadWrite();
462        _value.setDestinationWarehousePartyPK(destinationWarehousePartyPK);
463    }
464    
465    public void setDestinationWarehouseParty(Party entity) {
466        setDestinationWarehousePartyPK(entity == null? null: entity.getPrimaryKey());
467    }
468    
469    public boolean getDestinationWarehousePartyPKHasBeenModified() {
470        return _value.getDestinationWarehousePartyPKHasBeenModified();
471    }
472    
473    public PartyContactMechanismPK getDestinationPartyContactMechanismPK() {
474        return _value.getDestinationPartyContactMechanismPK();
475    }
476    
477    public PartyContactMechanism getDestinationPartyContactMechanism(Session session, EntityPermission entityPermission) {
478        PartyContactMechanismPK pk = getDestinationPartyContactMechanismPK();
479        PartyContactMechanism entity = pk == null? null: PartyContactMechanismFactory.getInstance().getEntityFromPK(session, entityPermission, pk);
480        
481        return entity;
482    }
483    
484    public PartyContactMechanism getDestinationPartyContactMechanism(EntityPermission entityPermission) {
485        return getDestinationPartyContactMechanism(ThreadSession.currentSession(), entityPermission);
486    }
487    
488    public PartyContactMechanism getDestinationPartyContactMechanism(Session session) {
489        return getDestinationPartyContactMechanism(session, EntityPermission.READ_ONLY);
490    }
491    
492    public PartyContactMechanism getDestinationPartyContactMechanism() {
493        return getDestinationPartyContactMechanism(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
494    }
495    
496    public PartyContactMechanism getDestinationPartyContactMechanismForUpdate(Session session) {
497        return getDestinationPartyContactMechanism(session, EntityPermission.READ_WRITE);
498    }
499    
500    public PartyContactMechanism getDestinationPartyContactMechanismForUpdate() {
501        return getDestinationPartyContactMechanism(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
502    }
503    
504    public void setDestinationPartyContactMechanismPK(PartyContactMechanismPK destinationPartyContactMechanismPK)
505            throws PersistenceNotNullException, PersistenceReadOnlyException {
506        checkReadWrite();
507        _value.setDestinationPartyContactMechanismPK(destinationPartyContactMechanismPK);
508    }
509    
510    public void setDestinationPartyContactMechanism(PartyContactMechanism entity) {
511        setDestinationPartyContactMechanismPK(entity == null? null: entity.getPrimaryKey());
512    }
513    
514    public boolean getDestinationPartyContactMechanismPKHasBeenModified() {
515        return _value.getDestinationPartyContactMechanismPKHasBeenModified();
516    }
517    
518    public ShippingMethodPK getShippingMethodPK() {
519        return _value.getShippingMethodPK();
520    }
521    
522    public ShippingMethod getShippingMethod(Session session, EntityPermission entityPermission) {
523        ShippingMethodPK pk = getShippingMethodPK();
524        ShippingMethod entity = pk == null? null: ShippingMethodFactory.getInstance().getEntityFromPK(session, entityPermission, pk);
525        
526        return entity;
527    }
528    
529    public ShippingMethod getShippingMethod(EntityPermission entityPermission) {
530        return getShippingMethod(ThreadSession.currentSession(), entityPermission);
531    }
532    
533    public ShippingMethod getShippingMethod(Session session) {
534        return getShippingMethod(session, EntityPermission.READ_ONLY);
535    }
536    
537    public ShippingMethod getShippingMethod() {
538        return getShippingMethod(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
539    }
540    
541    public ShippingMethod getShippingMethodForUpdate(Session session) {
542        return getShippingMethod(session, EntityPermission.READ_WRITE);
543    }
544    
545    public ShippingMethod getShippingMethodForUpdate() {
546        return getShippingMethod(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
547    }
548    
549    public void setShippingMethodPK(ShippingMethodPK shippingMethodPK)
550            throws PersistenceNotNullException, PersistenceReadOnlyException {
551        checkReadWrite();
552        _value.setShippingMethodPK(shippingMethodPK);
553    }
554    
555    public void setShippingMethod(ShippingMethod entity) {
556        setShippingMethodPK(entity == null? null: entity.getPrimaryKey());
557    }
558    
559    public boolean getShippingMethodPKHasBeenModified() {
560        return _value.getShippingMethodPKHasBeenModified();
561    }
562    
563    public Long getFromTime() {
564        return _value.getFromTime();
565    }
566    
567    public void setFromTime(Long fromTime)
568            throws PersistenceNotNullException, PersistenceReadOnlyException {
569        checkReadWrite();
570        _value.setFromTime(fromTime);
571    }
572    
573    public boolean getFromTimeHasBeenModified() {
574        return _value.getFromTimeHasBeenModified();
575    }
576    
577    public Long getThruTime() {
578        return _value.getThruTime();
579    }
580    
581    public void setThruTime(Long thruTime)
582            throws PersistenceNotNullException, PersistenceReadOnlyException {
583        checkReadWrite();
584        _value.setThruTime(thruTime);
585    }
586    
587    public boolean getThruTimeHasBeenModified() {
588        return _value.getThruTimeHasBeenModified();
589    }
590    
591}