001// --------------------------------------------------------------------------------
002// Copyright 2002-2025 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(Session session)
123            throws PersistenceDatabaseException {
124        getBaseFactoryInstance().store(session, this);
125    }
126    
127    @Override
128    public void remove(Session session)
129            throws PersistenceDatabaseException {
130        getBaseFactoryInstance().remove(session, this);
131    }
132    
133    @Override
134    public void remove()
135            throws PersistenceDatabaseException {
136        getBaseFactoryInstance().remove(ThreadSession.currentSession(), this);
137    }
138    
139    public InventoryLocationAssignmentValue getInventoryLocationAssignmentValue() {
140        return _value;
141    }
142    
143    public void setInventoryLocationAssignmentValue(InventoryLocationAssignmentValue value)
144            throws PersistenceReadOnlyException {
145        checkReadWrite();
146        _value = value;
147    }
148    
149    @Override
150    public InventoryLocationAssignmentPK getPrimaryKey() {
151        return _pk;
152    }
153    
154    public LocationPK getLocationPK() {
155        return _value.getLocationPK();
156    }
157    
158    public Location getLocation(Session session, EntityPermission entityPermission) {
159        return LocationFactory.getInstance().getEntityFromPK(session, entityPermission, getLocationPK());
160    }
161    
162    public Location getLocation(EntityPermission entityPermission) {
163        return getLocation(ThreadSession.currentSession(), entityPermission);
164    }
165    
166    public Location getLocation(Session session) {
167        return getLocation(session, EntityPermission.READ_ONLY);
168    }
169    
170    public Location getLocation() {
171        return getLocation(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
172    }
173    
174    public Location getLocationForUpdate(Session session) {
175        return getLocation(session, EntityPermission.READ_WRITE);
176    }
177    
178    public Location getLocationForUpdate() {
179        return getLocation(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
180    }
181    
182    public void setLocationPK(LocationPK locationPK)
183            throws PersistenceNotNullException, PersistenceReadOnlyException {
184        checkReadWrite();
185        _value.setLocationPK(locationPK);
186    }
187    
188    public void setLocation(Location entity) {
189        setLocationPK(entity == null? null: entity.getPrimaryKey());
190    }
191    
192    public boolean getLocationPKHasBeenModified() {
193        return _value.getLocationPKHasBeenModified();
194    }
195    
196    public PartyPK getOwnerPartyPK() {
197        return _value.getOwnerPartyPK();
198    }
199    
200    public Party getOwnerParty(Session session, EntityPermission entityPermission) {
201        return PartyFactory.getInstance().getEntityFromPK(session, entityPermission, getOwnerPartyPK());
202    }
203    
204    public Party getOwnerParty(EntityPermission entityPermission) {
205        return getOwnerParty(ThreadSession.currentSession(), entityPermission);
206    }
207    
208    public Party getOwnerParty(Session session) {
209        return getOwnerParty(session, EntityPermission.READ_ONLY);
210    }
211    
212    public Party getOwnerParty() {
213        return getOwnerParty(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
214    }
215    
216    public Party getOwnerPartyForUpdate(Session session) {
217        return getOwnerParty(session, EntityPermission.READ_WRITE);
218    }
219    
220    public Party getOwnerPartyForUpdate() {
221        return getOwnerParty(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
222    }
223    
224    public void setOwnerPartyPK(PartyPK ownerPartyPK)
225            throws PersistenceNotNullException, PersistenceReadOnlyException {
226        checkReadWrite();
227        _value.setOwnerPartyPK(ownerPartyPK);
228    }
229    
230    public void setOwnerParty(Party entity) {
231        setOwnerPartyPK(entity == null? null: entity.getPrimaryKey());
232    }
233    
234    public boolean getOwnerPartyPKHasBeenModified() {
235        return _value.getOwnerPartyPKHasBeenModified();
236    }
237    
238    public ItemPK getItemPK() {
239        return _value.getItemPK();
240    }
241    
242    public Item getItem(Session session, EntityPermission entityPermission) {
243        return ItemFactory.getInstance().getEntityFromPK(session, entityPermission, getItemPK());
244    }
245    
246    public Item getItem(EntityPermission entityPermission) {
247        return getItem(ThreadSession.currentSession(), entityPermission);
248    }
249    
250    public Item getItem(Session session) {
251        return getItem(session, EntityPermission.READ_ONLY);
252    }
253    
254    public Item getItem() {
255        return getItem(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
256    }
257    
258    public Item getItemForUpdate(Session session) {
259        return getItem(session, EntityPermission.READ_WRITE);
260    }
261    
262    public Item getItemForUpdate() {
263        return getItem(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
264    }
265    
266    public void setItemPK(ItemPK itemPK)
267            throws PersistenceNotNullException, PersistenceReadOnlyException {
268        checkReadWrite();
269        _value.setItemPK(itemPK);
270    }
271    
272    public void setItem(Item entity) {
273        setItemPK(entity == null? null: entity.getPrimaryKey());
274    }
275    
276    public boolean getItemPKHasBeenModified() {
277        return _value.getItemPKHasBeenModified();
278    }
279    
280    public UnitOfMeasureTypePK getUnitOfMeasureTypePK() {
281        return _value.getUnitOfMeasureTypePK();
282    }
283    
284    public UnitOfMeasureType getUnitOfMeasureType(Session session, EntityPermission entityPermission) {
285        return UnitOfMeasureTypeFactory.getInstance().getEntityFromPK(session, entityPermission, getUnitOfMeasureTypePK());
286    }
287    
288    public UnitOfMeasureType getUnitOfMeasureType(EntityPermission entityPermission) {
289        return getUnitOfMeasureType(ThreadSession.currentSession(), entityPermission);
290    }
291    
292    public UnitOfMeasureType getUnitOfMeasureType(Session session) {
293        return getUnitOfMeasureType(session, EntityPermission.READ_ONLY);
294    }
295    
296    public UnitOfMeasureType getUnitOfMeasureType() {
297        return getUnitOfMeasureType(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
298    }
299    
300    public UnitOfMeasureType getUnitOfMeasureTypeForUpdate(Session session) {
301        return getUnitOfMeasureType(session, EntityPermission.READ_WRITE);
302    }
303    
304    public UnitOfMeasureType getUnitOfMeasureTypeForUpdate() {
305        return getUnitOfMeasureType(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
306    }
307    
308    public void setUnitOfMeasureTypePK(UnitOfMeasureTypePK unitOfMeasureTypePK)
309            throws PersistenceNotNullException, PersistenceReadOnlyException {
310        checkReadWrite();
311        _value.setUnitOfMeasureTypePK(unitOfMeasureTypePK);
312    }
313    
314    public void setUnitOfMeasureType(UnitOfMeasureType entity) {
315        setUnitOfMeasureTypePK(entity == null? null: entity.getPrimaryKey());
316    }
317    
318    public boolean getUnitOfMeasureTypePKHasBeenModified() {
319        return _value.getUnitOfMeasureTypePKHasBeenModified();
320    }
321    
322    public InventoryConditionPK getInventoryConditionPK() {
323        return _value.getInventoryConditionPK();
324    }
325    
326    public InventoryCondition getInventoryCondition(Session session, EntityPermission entityPermission) {
327        return InventoryConditionFactory.getInstance().getEntityFromPK(session, entityPermission, getInventoryConditionPK());
328    }
329    
330    public InventoryCondition getInventoryCondition(EntityPermission entityPermission) {
331        return getInventoryCondition(ThreadSession.currentSession(), entityPermission);
332    }
333    
334    public InventoryCondition getInventoryCondition(Session session) {
335        return getInventoryCondition(session, EntityPermission.READ_ONLY);
336    }
337    
338    public InventoryCondition getInventoryCondition() {
339        return getInventoryCondition(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
340    }
341    
342    public InventoryCondition getInventoryConditionForUpdate(Session session) {
343        return getInventoryCondition(session, EntityPermission.READ_WRITE);
344    }
345    
346    public InventoryCondition getInventoryConditionForUpdate() {
347        return getInventoryCondition(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
348    }
349    
350    public void setInventoryConditionPK(InventoryConditionPK inventoryConditionPK)
351            throws PersistenceNotNullException, PersistenceReadOnlyException {
352        checkReadWrite();
353        _value.setInventoryConditionPK(inventoryConditionPK);
354    }
355    
356    public void setInventoryCondition(InventoryCondition entity) {
357        setInventoryConditionPK(entity == null? null: entity.getPrimaryKey());
358    }
359    
360    public boolean getInventoryConditionPKHasBeenModified() {
361        return _value.getInventoryConditionPKHasBeenModified();
362    }
363    
364    public Long getFromTime() {
365        return _value.getFromTime();
366    }
367    
368    public void setFromTime(Long fromTime)
369            throws PersistenceNotNullException, PersistenceReadOnlyException {
370        checkReadWrite();
371        _value.setFromTime(fromTime);
372    }
373    
374    public boolean getFromTimeHasBeenModified() {
375        return _value.getFromTimeHasBeenModified();
376    }
377    
378    public Long getThruTime() {
379        return _value.getThruTime();
380    }
381    
382    public void setThruTime(Long thruTime)
383            throws PersistenceNotNullException, PersistenceReadOnlyException {
384        checkReadWrite();
385        _value.setThruTime(thruTime);
386    }
387    
388    public boolean getThruTimeHasBeenModified() {
389        return _value.getThruTimeHasBeenModified();
390    }
391    
392}