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 * PartyBucket.java
021 */
022
023package com.echothree.model.data.inventory.server.entity;
024
025import com.echothree.model.data.inventory.common.pk.PartyBucketPK;
026
027import com.echothree.model.data.party.common.pk.PartyPK;
028import com.echothree.model.data.item.common.pk.ItemPK;
029import com.echothree.model.data.uom.common.pk.UnitOfMeasureTypePK;
030import com.echothree.model.data.inventory.common.pk.InventoryConditionPK;
031import com.echothree.model.data.inventory.common.pk.InventoryBucketTypePK;
032
033import com.echothree.model.data.party.server.entity.Party;
034import com.echothree.model.data.item.server.entity.Item;
035import com.echothree.model.data.uom.server.entity.UnitOfMeasureType;
036import com.echothree.model.data.inventory.server.entity.InventoryCondition;
037import com.echothree.model.data.inventory.server.entity.InventoryBucketType;
038
039import com.echothree.model.data.party.server.factory.PartyFactory;
040import com.echothree.model.data.item.server.factory.ItemFactory;
041import com.echothree.model.data.uom.server.factory.UnitOfMeasureTypeFactory;
042import com.echothree.model.data.inventory.server.factory.InventoryConditionFactory;
043import com.echothree.model.data.inventory.server.factory.InventoryBucketTypeFactory;
044
045import com.echothree.model.data.inventory.common.pk.PartyBucketPK;
046
047import com.echothree.model.data.inventory.server.value.PartyBucketValue;
048
049import com.echothree.model.data.inventory.server.factory.PartyBucketFactory;
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 PartyBucket
071        extends BaseEntity
072        implements Serializable {
073    
074    private PartyBucketPK _pk;
075    private PartyBucketValue _value;
076    
077    /** Creates a new instance of PartyBucket */
078    public PartyBucket()
079            throws PersistenceException {
080        super();
081    }
082    
083    /** Creates a new instance of PartyBucket */
084    public PartyBucket(PartyBucketValue value, EntityPermission entityPermission) {
085        super(entityPermission);
086        
087        _value = value;
088        _pk = value.getPrimaryKey();
089    }
090    
091    @Override
092    @Nonnull
093    public PartyBucketFactory getBaseFactoryInstance() {
094        return PartyBucketFactory.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 PartyBucket that) {
119            PartyBucketValue thatValue = that.getPartyBucketValue();
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 PartyBucketValue getPartyBucketValue() {
140        return _value;
141    }
142    
143    public void setPartyBucketValue(@Nonnull PartyBucketValue value)
144            throws PersistenceReadOnlyException {
145        checkReadWrite();
146        _value = value;
147    }
148    
149    @Override
150    @Nonnull
151    public PartyBucketPK getPrimaryKey() {
152        return _pk;
153    }
154    
155    @Nonnull
156    public PartyPK getPartyPK() {
157        return _value.getPartyPK();
158    }
159    
160    @Nonnull
161    public Party getParty(EntityPermission entityPermission) {
162        return PartyFactory.getInstance().getEntityFromPK(entityPermission, getPartyPK());
163    }
164    
165    @Nonnull
166    public Party getParty() {
167        return getParty(EntityPermission.READ_ONLY);
168    }
169    
170    @Nonnull
171    public Party getPartyForUpdate() {
172        return getParty(EntityPermission.READ_WRITE);
173    }
174    
175    public void setPartyPK(@Nonnull PartyPK partyPK)
176            throws PersistenceNotNullException, PersistenceReadOnlyException {
177        checkReadWrite();
178        _value.setPartyPK(partyPK);
179    }
180    
181    public void setParty(@Nonnull Party entity) {
182        setPartyPK(entity == null ? null : entity.getPrimaryKey());
183    }
184    
185    public boolean getPartyPKHasBeenModified() {
186        return _value.getPartyPKHasBeenModified();
187    }
188    
189    @Nonnull
190    public ItemPK getItemPK() {
191        return _value.getItemPK();
192    }
193    
194    @Nonnull
195    public Item getItem(EntityPermission entityPermission) {
196        return ItemFactory.getInstance().getEntityFromPK(entityPermission, getItemPK());
197    }
198    
199    @Nonnull
200    public Item getItem() {
201        return getItem(EntityPermission.READ_ONLY);
202    }
203    
204    @Nonnull
205    public Item getItemForUpdate() {
206        return getItem(EntityPermission.READ_WRITE);
207    }
208    
209    public void setItemPK(@Nonnull ItemPK itemPK)
210            throws PersistenceNotNullException, PersistenceReadOnlyException {
211        checkReadWrite();
212        _value.setItemPK(itemPK);
213    }
214    
215    public void setItem(@Nonnull Item entity) {
216        setItemPK(entity == null ? null : entity.getPrimaryKey());
217    }
218    
219    public boolean getItemPKHasBeenModified() {
220        return _value.getItemPKHasBeenModified();
221    }
222    
223    @Nonnull
224    public UnitOfMeasureTypePK getUnitOfMeasureTypePK() {
225        return _value.getUnitOfMeasureTypePK();
226    }
227    
228    @Nonnull
229    public UnitOfMeasureType getUnitOfMeasureType(EntityPermission entityPermission) {
230        return UnitOfMeasureTypeFactory.getInstance().getEntityFromPK(entityPermission, getUnitOfMeasureTypePK());
231    }
232    
233    @Nonnull
234    public UnitOfMeasureType getUnitOfMeasureType() {
235        return getUnitOfMeasureType(EntityPermission.READ_ONLY);
236    }
237    
238    @Nonnull
239    public UnitOfMeasureType getUnitOfMeasureTypeForUpdate() {
240        return getUnitOfMeasureType(EntityPermission.READ_WRITE);
241    }
242    
243    public void setUnitOfMeasureTypePK(@Nonnull UnitOfMeasureTypePK unitOfMeasureTypePK)
244            throws PersistenceNotNullException, PersistenceReadOnlyException {
245        checkReadWrite();
246        _value.setUnitOfMeasureTypePK(unitOfMeasureTypePK);
247    }
248    
249    public void setUnitOfMeasureType(@Nonnull UnitOfMeasureType entity) {
250        setUnitOfMeasureTypePK(entity == null ? null : entity.getPrimaryKey());
251    }
252    
253    public boolean getUnitOfMeasureTypePKHasBeenModified() {
254        return _value.getUnitOfMeasureTypePKHasBeenModified();
255    }
256    
257    @Nonnull
258    public InventoryConditionPK getInventoryConditionPK() {
259        return _value.getInventoryConditionPK();
260    }
261    
262    @Nonnull
263    public InventoryCondition getInventoryCondition(EntityPermission entityPermission) {
264        return InventoryConditionFactory.getInstance().getEntityFromPK(entityPermission, getInventoryConditionPK());
265    }
266    
267    @Nonnull
268    public InventoryCondition getInventoryCondition() {
269        return getInventoryCondition(EntityPermission.READ_ONLY);
270    }
271    
272    @Nonnull
273    public InventoryCondition getInventoryConditionForUpdate() {
274        return getInventoryCondition(EntityPermission.READ_WRITE);
275    }
276    
277    public void setInventoryConditionPK(@Nonnull InventoryConditionPK inventoryConditionPK)
278            throws PersistenceNotNullException, PersistenceReadOnlyException {
279        checkReadWrite();
280        _value.setInventoryConditionPK(inventoryConditionPK);
281    }
282    
283    public void setInventoryCondition(@Nonnull InventoryCondition entity) {
284        setInventoryConditionPK(entity == null ? null : entity.getPrimaryKey());
285    }
286    
287    public boolean getInventoryConditionPKHasBeenModified() {
288        return _value.getInventoryConditionPKHasBeenModified();
289    }
290    
291    @Nonnull
292    public InventoryBucketTypePK getInventoryBucketTypePK() {
293        return _value.getInventoryBucketTypePK();
294    }
295    
296    @Nonnull
297    public InventoryBucketType getInventoryBucketType(EntityPermission entityPermission) {
298        return InventoryBucketTypeFactory.getInstance().getEntityFromPK(entityPermission, getInventoryBucketTypePK());
299    }
300    
301    @Nonnull
302    public InventoryBucketType getInventoryBucketType() {
303        return getInventoryBucketType(EntityPermission.READ_ONLY);
304    }
305    
306    @Nonnull
307    public InventoryBucketType getInventoryBucketTypeForUpdate() {
308        return getInventoryBucketType(EntityPermission.READ_WRITE);
309    }
310    
311    public void setInventoryBucketTypePK(@Nonnull InventoryBucketTypePK inventoryBucketTypePK)
312            throws PersistenceNotNullException, PersistenceReadOnlyException {
313        checkReadWrite();
314        _value.setInventoryBucketTypePK(inventoryBucketTypePK);
315    }
316    
317    public void setInventoryBucketType(@Nonnull InventoryBucketType entity) {
318        setInventoryBucketTypePK(entity == null ? null : entity.getPrimaryKey());
319    }
320    
321    public boolean getInventoryBucketTypePKHasBeenModified() {
322        return _value.getInventoryBucketTypePKHasBeenModified();
323    }
324    
325    @Nonnull
326    public Long getQuantity() {
327        return _value.getQuantity();
328    }
329    
330    public void setQuantity(@Nonnull Long quantity)
331            throws PersistenceNotNullException, PersistenceReadOnlyException {
332        checkReadWrite();
333        _value.setQuantity(quantity);
334    }
335    
336    public boolean getQuantityHasBeenModified() {
337        return _value.getQuantityHasBeenModified();
338    }
339    
340}