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 * ShipmentPackageDetail.java
021 */
022
023package com.echothree.model.data.shipment.server.entity;
024
025import com.echothree.model.data.shipment.common.pk.ShipmentPackageDetailPK;
026
027import com.echothree.model.data.shipment.common.pk.ShipmentPackagePK;
028import com.echothree.model.data.shipment.common.pk.ShipmentTypePK;
029import com.echothree.model.data.shipment.common.pk.ShipmentPK;
030import com.echothree.model.data.warehouse.common.pk.PackageTypePK;
031import com.echothree.model.data.uom.common.pk.UnitOfMeasureTypePK;
032
033import com.echothree.model.data.shipment.server.entity.ShipmentPackage;
034import com.echothree.model.data.shipment.server.entity.ShipmentType;
035import com.echothree.model.data.shipment.server.entity.Shipment;
036import com.echothree.model.data.warehouse.server.entity.PackageType;
037import com.echothree.model.data.uom.server.entity.UnitOfMeasureType;
038
039import com.echothree.model.data.shipment.server.factory.ShipmentPackageFactory;
040import com.echothree.model.data.shipment.server.factory.ShipmentTypeFactory;
041import com.echothree.model.data.shipment.server.factory.ShipmentFactory;
042import com.echothree.model.data.warehouse.server.factory.PackageTypeFactory;
043import com.echothree.model.data.uom.server.factory.UnitOfMeasureTypeFactory;
044
045import com.echothree.model.data.shipment.common.pk.ShipmentPackageDetailPK;
046
047import com.echothree.model.data.shipment.server.value.ShipmentPackageDetailValue;
048
049import com.echothree.model.data.shipment.server.factory.ShipmentPackageDetailFactory;
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 ShipmentPackageDetail
068        extends BaseEntity
069        implements Serializable {
070    
071    private ShipmentPackageDetailPK _pk;
072    private ShipmentPackageDetailValue _value;
073    
074    /** Creates a new instance of ShipmentPackageDetail */
075    public ShipmentPackageDetail()
076            throws PersistenceException {
077        super();
078    }
079    
080    /** Creates a new instance of ShipmentPackageDetail */
081    public ShipmentPackageDetail(ShipmentPackageDetailValue value, EntityPermission entityPermission) {
082        super(entityPermission);
083        
084        _value = value;
085        _pk = value.getPrimaryKey();
086    }
087    
088    @Override
089    public ShipmentPackageDetailFactory getBaseFactoryInstance() {
090        return ShipmentPackageDetailFactory.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 ShipmentPackageDetail) {
114            ShipmentPackageDetail that = (ShipmentPackageDetail)other;
115            
116            ShipmentPackageDetailValue thatValue = that.getShipmentPackageDetailValue();
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 ShipmentPackageDetailValue getShipmentPackageDetailValue() {
142        return _value;
143    }
144    
145    public void setShipmentPackageDetailValue(ShipmentPackageDetailValue value)
146            throws PersistenceReadOnlyException {
147        checkReadWrite();
148        _value = value;
149    }
150    
151    @Override
152    public ShipmentPackageDetailPK getPrimaryKey() {
153        return _pk;
154    }
155    
156    public ShipmentPackagePK getShipmentPackagePK() {
157        return _value.getShipmentPackagePK();
158    }
159    
160    public ShipmentPackage getShipmentPackage(Session session, EntityPermission entityPermission) {
161        return ShipmentPackageFactory.getInstance().getEntityFromPK(session, entityPermission, getShipmentPackagePK());
162    }
163    
164    public ShipmentPackage getShipmentPackage(EntityPermission entityPermission) {
165        return getShipmentPackage(ThreadSession.currentSession(), entityPermission);
166    }
167    
168    public ShipmentPackage getShipmentPackage(Session session) {
169        return getShipmentPackage(session, EntityPermission.READ_ONLY);
170    }
171    
172    public ShipmentPackage getShipmentPackage() {
173        return getShipmentPackage(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
174    }
175    
176    public ShipmentPackage getShipmentPackageForUpdate(Session session) {
177        return getShipmentPackage(session, EntityPermission.READ_WRITE);
178    }
179    
180    public ShipmentPackage getShipmentPackageForUpdate() {
181        return getShipmentPackage(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
182    }
183    
184    public void setShipmentPackagePK(ShipmentPackagePK shipmentPackagePK)
185            throws PersistenceNotNullException, PersistenceReadOnlyException {
186        checkReadWrite();
187        _value.setShipmentPackagePK(shipmentPackagePK);
188    }
189    
190    public void setShipmentPackage(ShipmentPackage entity) {
191        setShipmentPackagePK(entity == null? null: entity.getPrimaryKey());
192    }
193    
194    public boolean getShipmentPackagePKHasBeenModified() {
195        return _value.getShipmentPackagePKHasBeenModified();
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 getShipmentPackageName() {
241        return _value.getShipmentPackageName();
242    }
243    
244    public void setShipmentPackageName(String shipmentPackageName)
245            throws PersistenceNotNullException, PersistenceReadOnlyException {
246        checkReadWrite();
247        _value.setShipmentPackageName(shipmentPackageName);
248    }
249    
250    public boolean getShipmentPackageNameHasBeenModified() {
251        return _value.getShipmentPackageNameHasBeenModified();
252    }
253    
254    public ShipmentPackagePK getParentShipmentPackagePK() {
255        return _value.getParentShipmentPackagePK();
256    }
257    
258    public ShipmentPackage getParentShipmentPackage(Session session, EntityPermission entityPermission) {
259        ShipmentPackagePK pk = getParentShipmentPackagePK();
260        ShipmentPackage entity = pk == null? null: ShipmentPackageFactory.getInstance().getEntityFromPK(session, entityPermission, pk);
261        
262        return entity;
263    }
264    
265    public ShipmentPackage getParentShipmentPackage(EntityPermission entityPermission) {
266        return getParentShipmentPackage(ThreadSession.currentSession(), entityPermission);
267    }
268    
269    public ShipmentPackage getParentShipmentPackage(Session session) {
270        return getParentShipmentPackage(session, EntityPermission.READ_ONLY);
271    }
272    
273    public ShipmentPackage getParentShipmentPackage() {
274        return getParentShipmentPackage(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
275    }
276    
277    public ShipmentPackage getParentShipmentPackageForUpdate(Session session) {
278        return getParentShipmentPackage(session, EntityPermission.READ_WRITE);
279    }
280    
281    public ShipmentPackage getParentShipmentPackageForUpdate() {
282        return getParentShipmentPackage(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
283    }
284    
285    public void setParentShipmentPackagePK(ShipmentPackagePK parentShipmentPackagePK)
286            throws PersistenceNotNullException, PersistenceReadOnlyException {
287        checkReadWrite();
288        _value.setParentShipmentPackagePK(parentShipmentPackagePK);
289    }
290    
291    public void setParentShipmentPackage(ShipmentPackage entity) {
292        setParentShipmentPackagePK(entity == null? null: entity.getPrimaryKey());
293    }
294    
295    public boolean getParentShipmentPackagePKHasBeenModified() {
296        return _value.getParentShipmentPackagePKHasBeenModified();
297    }
298    
299    public ShipmentPK getShipmentPK() {
300        return _value.getShipmentPK();
301    }
302    
303    public Shipment getShipment(Session session, EntityPermission entityPermission) {
304        ShipmentPK pk = getShipmentPK();
305        Shipment entity = pk == null? null: ShipmentFactory.getInstance().getEntityFromPK(session, entityPermission, pk);
306        
307        return entity;
308    }
309    
310    public Shipment getShipment(EntityPermission entityPermission) {
311        return getShipment(ThreadSession.currentSession(), entityPermission);
312    }
313    
314    public Shipment getShipment(Session session) {
315        return getShipment(session, EntityPermission.READ_ONLY);
316    }
317    
318    public Shipment getShipment() {
319        return getShipment(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
320    }
321    
322    public Shipment getShipmentForUpdate(Session session) {
323        return getShipment(session, EntityPermission.READ_WRITE);
324    }
325    
326    public Shipment getShipmentForUpdate() {
327        return getShipment(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
328    }
329    
330    public void setShipmentPK(ShipmentPK shipmentPK)
331            throws PersistenceNotNullException, PersistenceReadOnlyException {
332        checkReadWrite();
333        _value.setShipmentPK(shipmentPK);
334    }
335    
336    public void setShipment(Shipment entity) {
337        setShipmentPK(entity == null? null: entity.getPrimaryKey());
338    }
339    
340    public boolean getShipmentPKHasBeenModified() {
341        return _value.getShipmentPKHasBeenModified();
342    }
343    
344    public PackageTypePK getPackageTypePK() {
345        return _value.getPackageTypePK();
346    }
347    
348    public PackageType getPackageType(Session session, EntityPermission entityPermission) {
349        PackageTypePK pk = getPackageTypePK();
350        PackageType entity = pk == null? null: PackageTypeFactory.getInstance().getEntityFromPK(session, entityPermission, pk);
351        
352        return entity;
353    }
354    
355    public PackageType getPackageType(EntityPermission entityPermission) {
356        return getPackageType(ThreadSession.currentSession(), entityPermission);
357    }
358    
359    public PackageType getPackageType(Session session) {
360        return getPackageType(session, EntityPermission.READ_ONLY);
361    }
362    
363    public PackageType getPackageType() {
364        return getPackageType(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
365    }
366    
367    public PackageType getPackageTypeForUpdate(Session session) {
368        return getPackageType(session, EntityPermission.READ_WRITE);
369    }
370    
371    public PackageType getPackageTypeForUpdate() {
372        return getPackageType(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
373    }
374    
375    public void setPackageTypePK(PackageTypePK packageTypePK)
376            throws PersistenceNotNullException, PersistenceReadOnlyException {
377        checkReadWrite();
378        _value.setPackageTypePK(packageTypePK);
379    }
380    
381    public void setPackageType(PackageType entity) {
382        setPackageTypePK(entity == null? null: entity.getPrimaryKey());
383    }
384    
385    public boolean getPackageTypePKHasBeenModified() {
386        return _value.getPackageTypePKHasBeenModified();
387    }
388    
389    public UnitOfMeasureTypePK getUnitOfMeasureTypePK() {
390        return _value.getUnitOfMeasureTypePK();
391    }
392    
393    public UnitOfMeasureType getUnitOfMeasureType(Session session, EntityPermission entityPermission) {
394        UnitOfMeasureTypePK pk = getUnitOfMeasureTypePK();
395        UnitOfMeasureType entity = pk == null? null: UnitOfMeasureTypeFactory.getInstance().getEntityFromPK(session, entityPermission, pk);
396        
397        return entity;
398    }
399    
400    public UnitOfMeasureType getUnitOfMeasureType(EntityPermission entityPermission) {
401        return getUnitOfMeasureType(ThreadSession.currentSession(), entityPermission);
402    }
403    
404    public UnitOfMeasureType getUnitOfMeasureType(Session session) {
405        return getUnitOfMeasureType(session, EntityPermission.READ_ONLY);
406    }
407    
408    public UnitOfMeasureType getUnitOfMeasureType() {
409        return getUnitOfMeasureType(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
410    }
411    
412    public UnitOfMeasureType getUnitOfMeasureTypeForUpdate(Session session) {
413        return getUnitOfMeasureType(session, EntityPermission.READ_WRITE);
414    }
415    
416    public UnitOfMeasureType getUnitOfMeasureTypeForUpdate() {
417        return getUnitOfMeasureType(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
418    }
419    
420    public void setUnitOfMeasureTypePK(UnitOfMeasureTypePK unitOfMeasureTypePK)
421            throws PersistenceNotNullException, PersistenceReadOnlyException {
422        checkReadWrite();
423        _value.setUnitOfMeasureTypePK(unitOfMeasureTypePK);
424    }
425    
426    public void setUnitOfMeasureType(UnitOfMeasureType entity) {
427        setUnitOfMeasureTypePK(entity == null? null: entity.getPrimaryKey());
428    }
429    
430    public boolean getUnitOfMeasureTypePKHasBeenModified() {
431        return _value.getUnitOfMeasureTypePKHasBeenModified();
432    }
433    
434    public Long getWeight() {
435        return _value.getWeight();
436    }
437    
438    public void setWeight(Long weight)
439            throws PersistenceNotNullException, PersistenceReadOnlyException {
440        checkReadWrite();
441        _value.setWeight(weight);
442    }
443    
444    public boolean getWeightHasBeenModified() {
445        return _value.getWeightHasBeenModified();
446    }
447    
448    public Long getFromTime() {
449        return _value.getFromTime();
450    }
451    
452    public void setFromTime(Long fromTime)
453            throws PersistenceNotNullException, PersistenceReadOnlyException {
454        checkReadWrite();
455        _value.setFromTime(fromTime);
456    }
457    
458    public boolean getFromTimeHasBeenModified() {
459        return _value.getFromTimeHasBeenModified();
460    }
461    
462    public Long getThruTime() {
463        return _value.getThruTime();
464    }
465    
466    public void setThruTime(Long thruTime)
467            throws PersistenceNotNullException, PersistenceReadOnlyException {
468        checkReadWrite();
469        _value.setThruTime(thruTime);
470    }
471    
472    public boolean getThruTimeHasBeenModified() {
473        return _value.getThruTimeHasBeenModified();
474    }
475    
476}