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 * 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
067import javax.annotation.Nonnull;
068import javax.annotation.Nullable;
069
070public class ShipmentPackageDetail
071        extends BaseEntity
072        implements Serializable {
073    
074    private ShipmentPackageDetailPK _pk;
075    private ShipmentPackageDetailValue _value;
076    
077    /** Creates a new instance of ShipmentPackageDetail */
078    public ShipmentPackageDetail()
079            throws PersistenceException {
080        super();
081    }
082    
083    /** Creates a new instance of ShipmentPackageDetail */
084    public ShipmentPackageDetail(ShipmentPackageDetailValue value, EntityPermission entityPermission) {
085        super(entityPermission);
086        
087        _value = value;
088        _pk = value.getPrimaryKey();
089    }
090    
091    @Override
092    @Nonnull
093    public ShipmentPackageDetailFactory getBaseFactoryInstance() {
094        return ShipmentPackageDetailFactory.getInstance();
095    }
096    
097    @Override
098    public boolean hasBeenModified() {
099        return _value.hasBeenModified();
100    }
101    
102    @Override
103    public int hashCode() {
104        return _pk.hashCode();
105    }
106    
107    @Override
108    @Nonnull
109    public String toString() {
110        return _pk.toString();
111    }
112    
113    @Override
114    public boolean equals(Object other) {
115        if(this == other)
116            return true;
117        
118        if(other instanceof ShipmentPackageDetail that) {
119            ShipmentPackageDetailValue thatValue = that.getShipmentPackageDetailValue();
120            return _value.equals(thatValue);
121        } else {
122            return false;
123        }
124    }
125    
126    @Override
127    public void store()
128            throws PersistenceDatabaseException {
129        getBaseFactoryInstance().store(this);
130    }
131    
132    @Override
133    public void remove()
134            throws PersistenceDatabaseException {
135        getBaseFactoryInstance().remove(this);
136    }
137    
138    @Nonnull
139    public ShipmentPackageDetailValue getShipmentPackageDetailValue() {
140        return _value;
141    }
142    
143    public void setShipmentPackageDetailValue(@Nonnull ShipmentPackageDetailValue value)
144            throws PersistenceReadOnlyException {
145        checkReadWrite();
146        _value = value;
147    }
148    
149    @Override
150    @Nonnull
151    public ShipmentPackageDetailPK getPrimaryKey() {
152        return _pk;
153    }
154    
155    @Nonnull
156    public ShipmentPackagePK getShipmentPackagePK() {
157        return _value.getShipmentPackagePK();
158    }
159    
160    @Nonnull
161    public ShipmentPackage getShipmentPackage(EntityPermission entityPermission) {
162        return ShipmentPackageFactory.getInstance().getEntityFromPK(entityPermission, getShipmentPackagePK());
163    }
164    
165    @Nonnull
166    public ShipmentPackage getShipmentPackage() {
167        return getShipmentPackage(EntityPermission.READ_ONLY);
168    }
169    
170    @Nonnull
171    public ShipmentPackage getShipmentPackageForUpdate() {
172        return getShipmentPackage(EntityPermission.READ_WRITE);
173    }
174    
175    public void setShipmentPackagePK(@Nonnull ShipmentPackagePK shipmentPackagePK)
176            throws PersistenceNotNullException, PersistenceReadOnlyException {
177        checkReadWrite();
178        _value.setShipmentPackagePK(shipmentPackagePK);
179    }
180    
181    public void setShipmentPackage(@Nonnull ShipmentPackage entity) {
182        setShipmentPackagePK(entity == null ? null : entity.getPrimaryKey());
183    }
184    
185    public boolean getShipmentPackagePKHasBeenModified() {
186        return _value.getShipmentPackagePKHasBeenModified();
187    }
188    
189    @Nonnull
190    public ShipmentTypePK getShipmentTypePK() {
191        return _value.getShipmentTypePK();
192    }
193    
194    @Nonnull
195    public ShipmentType getShipmentType(EntityPermission entityPermission) {
196        return ShipmentTypeFactory.getInstance().getEntityFromPK(entityPermission, getShipmentTypePK());
197    }
198    
199    @Nonnull
200    public ShipmentType getShipmentType() {
201        return getShipmentType(EntityPermission.READ_ONLY);
202    }
203    
204    @Nonnull
205    public ShipmentType getShipmentTypeForUpdate() {
206        return getShipmentType(EntityPermission.READ_WRITE);
207    }
208    
209    public void setShipmentTypePK(@Nonnull ShipmentTypePK shipmentTypePK)
210            throws PersistenceNotNullException, PersistenceReadOnlyException {
211        checkReadWrite();
212        _value.setShipmentTypePK(shipmentTypePK);
213    }
214    
215    public void setShipmentType(@Nonnull ShipmentType entity) {
216        setShipmentTypePK(entity == null ? null : entity.getPrimaryKey());
217    }
218    
219    public boolean getShipmentTypePKHasBeenModified() {
220        return _value.getShipmentTypePKHasBeenModified();
221    }
222    
223    @Nonnull
224    public String getShipmentPackageName() {
225        return _value.getShipmentPackageName();
226    }
227    
228    public void setShipmentPackageName(@Nonnull String shipmentPackageName)
229            throws PersistenceNotNullException, PersistenceReadOnlyException {
230        checkReadWrite();
231        _value.setShipmentPackageName(shipmentPackageName);
232    }
233    
234    public boolean getShipmentPackageNameHasBeenModified() {
235        return _value.getShipmentPackageNameHasBeenModified();
236    }
237    
238    @Nullable
239    public ShipmentPackagePK getParentShipmentPackagePK() {
240        return _value.getParentShipmentPackagePK();
241    }
242    
243    @Nullable
244    public ShipmentPackage getParentShipmentPackage(EntityPermission entityPermission) {
245        ShipmentPackagePK pk = getParentShipmentPackagePK();
246        ShipmentPackage entity = pk == null? null: ShipmentPackageFactory.getInstance().getEntityFromPK(entityPermission, pk);
247        
248        return entity;
249    }
250    
251    @Nullable
252    public ShipmentPackage getParentShipmentPackage() {
253        return getParentShipmentPackage(EntityPermission.READ_ONLY);
254    }
255    
256    @Nullable
257    public ShipmentPackage getParentShipmentPackageForUpdate() {
258        return getParentShipmentPackage(EntityPermission.READ_WRITE);
259    }
260    
261    public void setParentShipmentPackagePK(@Nullable ShipmentPackagePK parentShipmentPackagePK)
262            throws PersistenceNotNullException, PersistenceReadOnlyException {
263        checkReadWrite();
264        _value.setParentShipmentPackagePK(parentShipmentPackagePK);
265    }
266    
267    public void setParentShipmentPackage(@Nullable ShipmentPackage entity) {
268        setParentShipmentPackagePK(entity == null ? null : entity.getPrimaryKey());
269    }
270    
271    public boolean getParentShipmentPackagePKHasBeenModified() {
272        return _value.getParentShipmentPackagePKHasBeenModified();
273    }
274    
275    @Nullable
276    public ShipmentPK getShipmentPK() {
277        return _value.getShipmentPK();
278    }
279    
280    @Nullable
281    public Shipment getShipment(EntityPermission entityPermission) {
282        ShipmentPK pk = getShipmentPK();
283        Shipment entity = pk == null? null: ShipmentFactory.getInstance().getEntityFromPK(entityPermission, pk);
284        
285        return entity;
286    }
287    
288    @Nullable
289    public Shipment getShipment() {
290        return getShipment(EntityPermission.READ_ONLY);
291    }
292    
293    @Nullable
294    public Shipment getShipmentForUpdate() {
295        return getShipment(EntityPermission.READ_WRITE);
296    }
297    
298    public void setShipmentPK(@Nullable ShipmentPK shipmentPK)
299            throws PersistenceNotNullException, PersistenceReadOnlyException {
300        checkReadWrite();
301        _value.setShipmentPK(shipmentPK);
302    }
303    
304    public void setShipment(@Nullable Shipment entity) {
305        setShipmentPK(entity == null ? null : entity.getPrimaryKey());
306    }
307    
308    public boolean getShipmentPKHasBeenModified() {
309        return _value.getShipmentPKHasBeenModified();
310    }
311    
312    @Nullable
313    public PackageTypePK getPackageTypePK() {
314        return _value.getPackageTypePK();
315    }
316    
317    @Nullable
318    public PackageType getPackageType(EntityPermission entityPermission) {
319        PackageTypePK pk = getPackageTypePK();
320        PackageType entity = pk == null? null: PackageTypeFactory.getInstance().getEntityFromPK(entityPermission, pk);
321        
322        return entity;
323    }
324    
325    @Nullable
326    public PackageType getPackageType() {
327        return getPackageType(EntityPermission.READ_ONLY);
328    }
329    
330    @Nullable
331    public PackageType getPackageTypeForUpdate() {
332        return getPackageType(EntityPermission.READ_WRITE);
333    }
334    
335    public void setPackageTypePK(@Nullable PackageTypePK packageTypePK)
336            throws PersistenceNotNullException, PersistenceReadOnlyException {
337        checkReadWrite();
338        _value.setPackageTypePK(packageTypePK);
339    }
340    
341    public void setPackageType(@Nullable PackageType entity) {
342        setPackageTypePK(entity == null ? null : entity.getPrimaryKey());
343    }
344    
345    public boolean getPackageTypePKHasBeenModified() {
346        return _value.getPackageTypePKHasBeenModified();
347    }
348    
349    @Nullable
350    public UnitOfMeasureTypePK getUnitOfMeasureTypePK() {
351        return _value.getUnitOfMeasureTypePK();
352    }
353    
354    @Nullable
355    public UnitOfMeasureType getUnitOfMeasureType(EntityPermission entityPermission) {
356        UnitOfMeasureTypePK pk = getUnitOfMeasureTypePK();
357        UnitOfMeasureType entity = pk == null? null: UnitOfMeasureTypeFactory.getInstance().getEntityFromPK(entityPermission, pk);
358        
359        return entity;
360    }
361    
362    @Nullable
363    public UnitOfMeasureType getUnitOfMeasureType() {
364        return getUnitOfMeasureType(EntityPermission.READ_ONLY);
365    }
366    
367    @Nullable
368    public UnitOfMeasureType getUnitOfMeasureTypeForUpdate() {
369        return getUnitOfMeasureType(EntityPermission.READ_WRITE);
370    }
371    
372    public void setUnitOfMeasureTypePK(@Nullable UnitOfMeasureTypePK unitOfMeasureTypePK)
373            throws PersistenceNotNullException, PersistenceReadOnlyException {
374        checkReadWrite();
375        _value.setUnitOfMeasureTypePK(unitOfMeasureTypePK);
376    }
377    
378    public void setUnitOfMeasureType(@Nullable UnitOfMeasureType entity) {
379        setUnitOfMeasureTypePK(entity == null ? null : entity.getPrimaryKey());
380    }
381    
382    public boolean getUnitOfMeasureTypePKHasBeenModified() {
383        return _value.getUnitOfMeasureTypePKHasBeenModified();
384    }
385    
386    @Nullable
387    public Long getWeight() {
388        return _value.getWeight();
389    }
390    
391    public void setWeight(@Nullable Long weight)
392            throws PersistenceNotNullException, PersistenceReadOnlyException {
393        checkReadWrite();
394        _value.setWeight(weight);
395    }
396    
397    public boolean getWeightHasBeenModified() {
398        return _value.getWeightHasBeenModified();
399    }
400    
401    @Nonnull
402    public Long getFromTime() {
403        return _value.getFromTime();
404    }
405    
406    public void setFromTime(@Nonnull Long fromTime)
407            throws PersistenceNotNullException, PersistenceReadOnlyException {
408        checkReadWrite();
409        _value.setFromTime(fromTime);
410    }
411    
412    public boolean getFromTimeHasBeenModified() {
413        return _value.getFromTimeHasBeenModified();
414    }
415    
416    @Nonnull
417    public Long getThruTime() {
418        return _value.getThruTime();
419    }
420    
421    public void setThruTime(@Nonnull Long thruTime)
422            throws PersistenceNotNullException, PersistenceReadOnlyException {
423        checkReadWrite();
424        _value.setThruTime(thruTime);
425    }
426    
427    public boolean getThruTimeHasBeenModified() {
428        return _value.getThruTimeHasBeenModified();
429    }
430    
431}