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 * InventoryLocationAssignment.java
021 */
022
023package com.echothree.model.data.inventory.server.entity;
024
025import com.echothree.model.data.inventory.common.pk.InventoryLocationAssignmentPK;
026
027import com.echothree.model.data.warehouse.common.pk.LocationPK;
028import com.echothree.model.data.party.common.pk.PartyPK;
029import com.echothree.model.data.item.common.pk.ItemPK;
030import com.echothree.model.data.uom.common.pk.UnitOfMeasureTypePK;
031import com.echothree.model.data.inventory.common.pk.InventoryConditionPK;
032
033import com.echothree.model.data.warehouse.server.entity.Location;
034import com.echothree.model.data.party.server.entity.Party;
035import com.echothree.model.data.item.server.entity.Item;
036import com.echothree.model.data.uom.server.entity.UnitOfMeasureType;
037import com.echothree.model.data.inventory.server.entity.InventoryCondition;
038
039import com.echothree.model.data.warehouse.server.factory.LocationFactory;
040import com.echothree.model.data.party.server.factory.PartyFactory;
041import com.echothree.model.data.item.server.factory.ItemFactory;
042import com.echothree.model.data.uom.server.factory.UnitOfMeasureTypeFactory;
043import com.echothree.model.data.inventory.server.factory.InventoryConditionFactory;
044
045import com.echothree.model.data.inventory.common.pk.InventoryLocationAssignmentPK;
046
047import com.echothree.model.data.inventory.server.value.InventoryLocationAssignmentValue;
048
049import com.echothree.model.data.inventory.server.factory.InventoryLocationAssignmentFactory;
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 InventoryLocationAssignment
068        extends BaseEntity
069        implements Serializable {
070    
071    private InventoryLocationAssignmentPK _pk;
072    private InventoryLocationAssignmentValue _value;
073    
074    /** Creates a new instance of InventoryLocationAssignment */
075    public InventoryLocationAssignment()
076            throws PersistenceException {
077        super();
078    }
079    
080    /** Creates a new instance of InventoryLocationAssignment */
081    public InventoryLocationAssignment(InventoryLocationAssignmentValue value, EntityPermission entityPermission) {
082        super(entityPermission);
083        
084        _value = value;
085        _pk = value.getPrimaryKey();
086    }
087    
088    @Override
089    public InventoryLocationAssignmentFactory getBaseFactoryInstance() {
090        return InventoryLocationAssignmentFactory.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 InventoryLocationAssignment that) {
114            InventoryLocationAssignmentValue thatValue = that.getInventoryLocationAssignmentValue();
115            return _value.equals(thatValue);
116        } else {
117            return false;
118        }
119    }
120    
121    @Override
122    public void store()
123            throws PersistenceDatabaseException {
124        getBaseFactoryInstance().store(this);
125    }
126    
127    @Override
128    public void remove()
129            throws PersistenceDatabaseException {
130        getBaseFactoryInstance().remove(this);
131    }
132    
133    public InventoryLocationAssignmentValue getInventoryLocationAssignmentValue() {
134        return _value;
135    }
136    
137    public void setInventoryLocationAssignmentValue(InventoryLocationAssignmentValue value)
138            throws PersistenceReadOnlyException {
139        checkReadWrite();
140        _value = value;
141    }
142    
143    @Override
144    public InventoryLocationAssignmentPK getPrimaryKey() {
145        return _pk;
146    }
147    
148    public LocationPK getLocationPK() {
149        return _value.getLocationPK();
150    }
151    
152    public Location getLocation(EntityPermission entityPermission) {
153        return LocationFactory.getInstance().getEntityFromPK(entityPermission, getLocationPK());
154    }
155    
156    public Location getLocation() {
157        return getLocation(EntityPermission.READ_ONLY);
158    }
159    
160    public Location getLocationForUpdate() {
161        return getLocation(EntityPermission.READ_WRITE);
162    }
163    
164    public void setLocationPK(LocationPK locationPK)
165            throws PersistenceNotNullException, PersistenceReadOnlyException {
166        checkReadWrite();
167        _value.setLocationPK(locationPK);
168    }
169    
170    public void setLocation(Location entity) {
171        setLocationPK(entity == null? null: entity.getPrimaryKey());
172    }
173    
174    public boolean getLocationPKHasBeenModified() {
175        return _value.getLocationPKHasBeenModified();
176    }
177    
178    public PartyPK getOwnerPartyPK() {
179        return _value.getOwnerPartyPK();
180    }
181    
182    public Party getOwnerParty(EntityPermission entityPermission) {
183        return PartyFactory.getInstance().getEntityFromPK(entityPermission, getOwnerPartyPK());
184    }
185    
186    public Party getOwnerParty() {
187        return getOwnerParty(EntityPermission.READ_ONLY);
188    }
189    
190    public Party getOwnerPartyForUpdate() {
191        return getOwnerParty(EntityPermission.READ_WRITE);
192    }
193    
194    public void setOwnerPartyPK(PartyPK ownerPartyPK)
195            throws PersistenceNotNullException, PersistenceReadOnlyException {
196        checkReadWrite();
197        _value.setOwnerPartyPK(ownerPartyPK);
198    }
199    
200    public void setOwnerParty(Party entity) {
201        setOwnerPartyPK(entity == null? null: entity.getPrimaryKey());
202    }
203    
204    public boolean getOwnerPartyPKHasBeenModified() {
205        return _value.getOwnerPartyPKHasBeenModified();
206    }
207    
208    public ItemPK getItemPK() {
209        return _value.getItemPK();
210    }
211    
212    public Item getItem(EntityPermission entityPermission) {
213        return ItemFactory.getInstance().getEntityFromPK(entityPermission, getItemPK());
214    }
215    
216    public Item getItem() {
217        return getItem(EntityPermission.READ_ONLY);
218    }
219    
220    public Item getItemForUpdate() {
221        return getItem(EntityPermission.READ_WRITE);
222    }
223    
224    public void setItemPK(ItemPK itemPK)
225            throws PersistenceNotNullException, PersistenceReadOnlyException {
226        checkReadWrite();
227        _value.setItemPK(itemPK);
228    }
229    
230    public void setItem(Item entity) {
231        setItemPK(entity == null? null: entity.getPrimaryKey());
232    }
233    
234    public boolean getItemPKHasBeenModified() {
235        return _value.getItemPKHasBeenModified();
236    }
237    
238    public UnitOfMeasureTypePK getUnitOfMeasureTypePK() {
239        return _value.getUnitOfMeasureTypePK();
240    }
241    
242    public UnitOfMeasureType getUnitOfMeasureType(EntityPermission entityPermission) {
243        return UnitOfMeasureTypeFactory.getInstance().getEntityFromPK(entityPermission, getUnitOfMeasureTypePK());
244    }
245    
246    public UnitOfMeasureType getUnitOfMeasureType() {
247        return getUnitOfMeasureType(EntityPermission.READ_ONLY);
248    }
249    
250    public UnitOfMeasureType getUnitOfMeasureTypeForUpdate() {
251        return getUnitOfMeasureType(EntityPermission.READ_WRITE);
252    }
253    
254    public void setUnitOfMeasureTypePK(UnitOfMeasureTypePK unitOfMeasureTypePK)
255            throws PersistenceNotNullException, PersistenceReadOnlyException {
256        checkReadWrite();
257        _value.setUnitOfMeasureTypePK(unitOfMeasureTypePK);
258    }
259    
260    public void setUnitOfMeasureType(UnitOfMeasureType entity) {
261        setUnitOfMeasureTypePK(entity == null? null: entity.getPrimaryKey());
262    }
263    
264    public boolean getUnitOfMeasureTypePKHasBeenModified() {
265        return _value.getUnitOfMeasureTypePKHasBeenModified();
266    }
267    
268    public InventoryConditionPK getInventoryConditionPK() {
269        return _value.getInventoryConditionPK();
270    }
271    
272    public InventoryCondition getInventoryCondition(EntityPermission entityPermission) {
273        return InventoryConditionFactory.getInstance().getEntityFromPK(entityPermission, getInventoryConditionPK());
274    }
275    
276    public InventoryCondition getInventoryCondition() {
277        return getInventoryCondition(EntityPermission.READ_ONLY);
278    }
279    
280    public InventoryCondition getInventoryConditionForUpdate() {
281        return getInventoryCondition(EntityPermission.READ_WRITE);
282    }
283    
284    public void setInventoryConditionPK(InventoryConditionPK inventoryConditionPK)
285            throws PersistenceNotNullException, PersistenceReadOnlyException {
286        checkReadWrite();
287        _value.setInventoryConditionPK(inventoryConditionPK);
288    }
289    
290    public void setInventoryCondition(InventoryCondition entity) {
291        setInventoryConditionPK(entity == null? null: entity.getPrimaryKey());
292    }
293    
294    public boolean getInventoryConditionPKHasBeenModified() {
295        return _value.getInventoryConditionPKHasBeenModified();
296    }
297    
298    public Long getFromTime() {
299        return _value.getFromTime();
300    }
301    
302    public void setFromTime(Long fromTime)
303            throws PersistenceNotNullException, PersistenceReadOnlyException {
304        checkReadWrite();
305        _value.setFromTime(fromTime);
306    }
307    
308    public boolean getFromTimeHasBeenModified() {
309        return _value.getFromTimeHasBeenModified();
310    }
311    
312    public Long getThruTime() {
313        return _value.getThruTime();
314    }
315    
316    public void setThruTime(Long thruTime)
317            throws PersistenceNotNullException, PersistenceReadOnlyException {
318        checkReadWrite();
319        _value.setThruTime(thruTime);
320    }
321    
322    public boolean getThruTimeHasBeenModified() {
323        return _value.getThruTimeHasBeenModified();
324    }
325    
326}