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 * LotDetail.java
021 */
022
023package com.echothree.model.data.inventory.server.entity;
024
025import com.echothree.model.data.inventory.common.pk.LotDetailPK;
026
027import com.echothree.model.data.inventory.common.pk.LotPK;
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;
032import com.echothree.model.data.accounting.common.pk.CurrencyPK;
033
034import com.echothree.model.data.inventory.server.entity.Lot;
035import com.echothree.model.data.party.server.entity.Party;
036import com.echothree.model.data.item.server.entity.Item;
037import com.echothree.model.data.uom.server.entity.UnitOfMeasureType;
038import com.echothree.model.data.inventory.server.entity.InventoryCondition;
039import com.echothree.model.data.accounting.server.entity.Currency;
040
041import com.echothree.model.data.inventory.server.factory.LotFactory;
042import com.echothree.model.data.party.server.factory.PartyFactory;
043import com.echothree.model.data.item.server.factory.ItemFactory;
044import com.echothree.model.data.uom.server.factory.UnitOfMeasureTypeFactory;
045import com.echothree.model.data.inventory.server.factory.InventoryConditionFactory;
046import com.echothree.model.data.accounting.server.factory.CurrencyFactory;
047
048import com.echothree.model.data.inventory.common.pk.LotDetailPK;
049
050import com.echothree.model.data.inventory.server.value.LotDetailValue;
051
052import com.echothree.model.data.inventory.server.factory.LotDetailFactory;
053
054import com.echothree.util.common.exception.PersistenceException;
055import com.echothree.util.common.exception.PersistenceDatabaseException;
056import com.echothree.util.common.exception.PersistenceNotNullException;
057import com.echothree.util.common.exception.PersistenceReadOnlyException;
058
059import com.echothree.util.common.persistence.BasePK;
060
061import com.echothree.util.common.persistence.type.ByteArray;
062
063import com.echothree.util.server.persistence.BaseEntity;
064import com.echothree.util.server.persistence.EntityPermission;
065import com.echothree.util.server.persistence.Session;
066import com.echothree.util.server.persistence.ThreadSession;
067
068import java.io.Serializable;
069
070public class LotDetail
071        extends BaseEntity
072        implements Serializable {
073    
074    private LotDetailPK _pk;
075    private LotDetailValue _value;
076    
077    /** Creates a new instance of LotDetail */
078    public LotDetail()
079            throws PersistenceException {
080        super();
081    }
082    
083    /** Creates a new instance of LotDetail */
084    public LotDetail(LotDetailValue value, EntityPermission entityPermission) {
085        super(entityPermission);
086        
087        _value = value;
088        _pk = value.getPrimaryKey();
089    }
090    
091    @Override
092    public LotDetailFactory getBaseFactoryInstance() {
093        return LotDetailFactory.getInstance();
094    }
095    
096    @Override
097    public boolean hasBeenModified() {
098        return _value.hasBeenModified();
099    }
100    
101    @Override
102    public int hashCode() {
103        return _pk.hashCode();
104    }
105    
106    @Override
107    public String toString() {
108        return _pk.toString();
109    }
110    
111    @Override
112    public boolean equals(Object other) {
113        if(this == other)
114            return true;
115        
116        if(other instanceof LotDetail) {
117            LotDetail that = (LotDetail)other;
118            
119            LotDetailValue thatValue = that.getLotDetailValue();
120            return _value.equals(thatValue);
121        } else {
122            return false;
123        }
124    }
125    
126    @Override
127    public void store(Session session)
128            throws PersistenceDatabaseException {
129        getBaseFactoryInstance().store(session, this);
130    }
131    
132    @Override
133    public void remove(Session session)
134            throws PersistenceDatabaseException {
135        getBaseFactoryInstance().remove(session, this);
136    }
137    
138    @Override
139    public void remove()
140            throws PersistenceDatabaseException {
141        getBaseFactoryInstance().remove(ThreadSession.currentSession(), this);
142    }
143    
144    public LotDetailValue getLotDetailValue() {
145        return _value;
146    }
147    
148    public void setLotDetailValue(LotDetailValue value)
149            throws PersistenceReadOnlyException {
150        checkReadWrite();
151        _value = value;
152    }
153    
154    @Override
155    public LotDetailPK getPrimaryKey() {
156        return _pk;
157    }
158    
159    public LotPK getLotPK() {
160        return _value.getLotPK();
161    }
162    
163    public Lot getLot(Session session, EntityPermission entityPermission) {
164        return LotFactory.getInstance().getEntityFromPK(session, entityPermission, getLotPK());
165    }
166    
167    public Lot getLot(EntityPermission entityPermission) {
168        return getLot(ThreadSession.currentSession(), entityPermission);
169    }
170    
171    public Lot getLot(Session session) {
172        return getLot(session, EntityPermission.READ_ONLY);
173    }
174    
175    public Lot getLot() {
176        return getLot(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
177    }
178    
179    public Lot getLotForUpdate(Session session) {
180        return getLot(session, EntityPermission.READ_WRITE);
181    }
182    
183    public Lot getLotForUpdate() {
184        return getLot(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
185    }
186    
187    public void setLotPK(LotPK lotPK)
188            throws PersistenceNotNullException, PersistenceReadOnlyException {
189        checkReadWrite();
190        _value.setLotPK(lotPK);
191    }
192    
193    public void setLot(Lot entity) {
194        setLotPK(entity == null? null: entity.getPrimaryKey());
195    }
196    
197    public boolean getLotPKHasBeenModified() {
198        return _value.getLotPKHasBeenModified();
199    }
200    
201    public String getLotName() {
202        return _value.getLotName();
203    }
204    
205    public void setLotName(String lotName)
206            throws PersistenceNotNullException, PersistenceReadOnlyException {
207        checkReadWrite();
208        _value.setLotName(lotName);
209    }
210    
211    public boolean getLotNameHasBeenModified() {
212        return _value.getLotNameHasBeenModified();
213    }
214    
215    public PartyPK getOwnerPartyPK() {
216        return _value.getOwnerPartyPK();
217    }
218    
219    public Party getOwnerParty(Session session, EntityPermission entityPermission) {
220        return PartyFactory.getInstance().getEntityFromPK(session, entityPermission, getOwnerPartyPK());
221    }
222    
223    public Party getOwnerParty(EntityPermission entityPermission) {
224        return getOwnerParty(ThreadSession.currentSession(), entityPermission);
225    }
226    
227    public Party getOwnerParty(Session session) {
228        return getOwnerParty(session, EntityPermission.READ_ONLY);
229    }
230    
231    public Party getOwnerParty() {
232        return getOwnerParty(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
233    }
234    
235    public Party getOwnerPartyForUpdate(Session session) {
236        return getOwnerParty(session, EntityPermission.READ_WRITE);
237    }
238    
239    public Party getOwnerPartyForUpdate() {
240        return getOwnerParty(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
241    }
242    
243    public void setOwnerPartyPK(PartyPK ownerPartyPK)
244            throws PersistenceNotNullException, PersistenceReadOnlyException {
245        checkReadWrite();
246        _value.setOwnerPartyPK(ownerPartyPK);
247    }
248    
249    public void setOwnerParty(Party entity) {
250        setOwnerPartyPK(entity == null? null: entity.getPrimaryKey());
251    }
252    
253    public boolean getOwnerPartyPKHasBeenModified() {
254        return _value.getOwnerPartyPKHasBeenModified();
255    }
256    
257    public ItemPK getItemPK() {
258        return _value.getItemPK();
259    }
260    
261    public Item getItem(Session session, EntityPermission entityPermission) {
262        return ItemFactory.getInstance().getEntityFromPK(session, entityPermission, getItemPK());
263    }
264    
265    public Item getItem(EntityPermission entityPermission) {
266        return getItem(ThreadSession.currentSession(), entityPermission);
267    }
268    
269    public Item getItem(Session session) {
270        return getItem(session, EntityPermission.READ_ONLY);
271    }
272    
273    public Item getItem() {
274        return getItem(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
275    }
276    
277    public Item getItemForUpdate(Session session) {
278        return getItem(session, EntityPermission.READ_WRITE);
279    }
280    
281    public Item getItemForUpdate() {
282        return getItem(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
283    }
284    
285    public void setItemPK(ItemPK itemPK)
286            throws PersistenceNotNullException, PersistenceReadOnlyException {
287        checkReadWrite();
288        _value.setItemPK(itemPK);
289    }
290    
291    public void setItem(Item entity) {
292        setItemPK(entity == null? null: entity.getPrimaryKey());
293    }
294    
295    public boolean getItemPKHasBeenModified() {
296        return _value.getItemPKHasBeenModified();
297    }
298    
299    public UnitOfMeasureTypePK getUnitOfMeasureTypePK() {
300        return _value.getUnitOfMeasureTypePK();
301    }
302    
303    public UnitOfMeasureType getUnitOfMeasureType(Session session, EntityPermission entityPermission) {
304        return UnitOfMeasureTypeFactory.getInstance().getEntityFromPK(session, entityPermission, getUnitOfMeasureTypePK());
305    }
306    
307    public UnitOfMeasureType getUnitOfMeasureType(EntityPermission entityPermission) {
308        return getUnitOfMeasureType(ThreadSession.currentSession(), entityPermission);
309    }
310    
311    public UnitOfMeasureType getUnitOfMeasureType(Session session) {
312        return getUnitOfMeasureType(session, EntityPermission.READ_ONLY);
313    }
314    
315    public UnitOfMeasureType getUnitOfMeasureType() {
316        return getUnitOfMeasureType(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
317    }
318    
319    public UnitOfMeasureType getUnitOfMeasureTypeForUpdate(Session session) {
320        return getUnitOfMeasureType(session, EntityPermission.READ_WRITE);
321    }
322    
323    public UnitOfMeasureType getUnitOfMeasureTypeForUpdate() {
324        return getUnitOfMeasureType(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
325    }
326    
327    public void setUnitOfMeasureTypePK(UnitOfMeasureTypePK unitOfMeasureTypePK)
328            throws PersistenceNotNullException, PersistenceReadOnlyException {
329        checkReadWrite();
330        _value.setUnitOfMeasureTypePK(unitOfMeasureTypePK);
331    }
332    
333    public void setUnitOfMeasureType(UnitOfMeasureType entity) {
334        setUnitOfMeasureTypePK(entity == null? null: entity.getPrimaryKey());
335    }
336    
337    public boolean getUnitOfMeasureTypePKHasBeenModified() {
338        return _value.getUnitOfMeasureTypePKHasBeenModified();
339    }
340    
341    public InventoryConditionPK getInventoryConditionPK() {
342        return _value.getInventoryConditionPK();
343    }
344    
345    public InventoryCondition getInventoryCondition(Session session, EntityPermission entityPermission) {
346        return InventoryConditionFactory.getInstance().getEntityFromPK(session, entityPermission, getInventoryConditionPK());
347    }
348    
349    public InventoryCondition getInventoryCondition(EntityPermission entityPermission) {
350        return getInventoryCondition(ThreadSession.currentSession(), entityPermission);
351    }
352    
353    public InventoryCondition getInventoryCondition(Session session) {
354        return getInventoryCondition(session, EntityPermission.READ_ONLY);
355    }
356    
357    public InventoryCondition getInventoryCondition() {
358        return getInventoryCondition(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
359    }
360    
361    public InventoryCondition getInventoryConditionForUpdate(Session session) {
362        return getInventoryCondition(session, EntityPermission.READ_WRITE);
363    }
364    
365    public InventoryCondition getInventoryConditionForUpdate() {
366        return getInventoryCondition(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
367    }
368    
369    public void setInventoryConditionPK(InventoryConditionPK inventoryConditionPK)
370            throws PersistenceNotNullException, PersistenceReadOnlyException {
371        checkReadWrite();
372        _value.setInventoryConditionPK(inventoryConditionPK);
373    }
374    
375    public void setInventoryCondition(InventoryCondition entity) {
376        setInventoryConditionPK(entity == null? null: entity.getPrimaryKey());
377    }
378    
379    public boolean getInventoryConditionPKHasBeenModified() {
380        return _value.getInventoryConditionPKHasBeenModified();
381    }
382    
383    public Long getQuantity() {
384        return _value.getQuantity();
385    }
386    
387    public void setQuantity(Long quantity)
388            throws PersistenceNotNullException, PersistenceReadOnlyException {
389        checkReadWrite();
390        _value.setQuantity(quantity);
391    }
392    
393    public boolean getQuantityHasBeenModified() {
394        return _value.getQuantityHasBeenModified();
395    }
396    
397    public CurrencyPK getCurrencyPK() {
398        return _value.getCurrencyPK();
399    }
400    
401    public Currency getCurrency(Session session, EntityPermission entityPermission) {
402        CurrencyPK pk = getCurrencyPK();
403        Currency entity = pk == null? null: CurrencyFactory.getInstance().getEntityFromPK(session, entityPermission, pk);
404        
405        return entity;
406    }
407    
408    public Currency getCurrency(EntityPermission entityPermission) {
409        return getCurrency(ThreadSession.currentSession(), entityPermission);
410    }
411    
412    public Currency getCurrency(Session session) {
413        return getCurrency(session, EntityPermission.READ_ONLY);
414    }
415    
416    public Currency getCurrency() {
417        return getCurrency(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
418    }
419    
420    public Currency getCurrencyForUpdate(Session session) {
421        return getCurrency(session, EntityPermission.READ_WRITE);
422    }
423    
424    public Currency getCurrencyForUpdate() {
425        return getCurrency(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
426    }
427    
428    public void setCurrencyPK(CurrencyPK currencyPK)
429            throws PersistenceNotNullException, PersistenceReadOnlyException {
430        checkReadWrite();
431        _value.setCurrencyPK(currencyPK);
432    }
433    
434    public void setCurrency(Currency entity) {
435        setCurrencyPK(entity == null? null: entity.getPrimaryKey());
436    }
437    
438    public boolean getCurrencyPKHasBeenModified() {
439        return _value.getCurrencyPKHasBeenModified();
440    }
441    
442    public Long getUnitCost() {
443        return _value.getUnitCost();
444    }
445    
446    public void setUnitCost(Long unitCost)
447            throws PersistenceNotNullException, PersistenceReadOnlyException {
448        checkReadWrite();
449        _value.setUnitCost(unitCost);
450    }
451    
452    public boolean getUnitCostHasBeenModified() {
453        return _value.getUnitCostHasBeenModified();
454    }
455    
456    public Long getFromTime() {
457        return _value.getFromTime();
458    }
459    
460    public void setFromTime(Long fromTime)
461            throws PersistenceNotNullException, PersistenceReadOnlyException {
462        checkReadWrite();
463        _value.setFromTime(fromTime);
464    }
465    
466    public boolean getFromTimeHasBeenModified() {
467        return _value.getFromTimeHasBeenModified();
468    }
469    
470    public Long getThruTime() {
471        return _value.getThruTime();
472    }
473    
474    public void setThruTime(Long thruTime)
475            throws PersistenceNotNullException, PersistenceReadOnlyException {
476        checkReadWrite();
477        _value.setThruTime(thruTime);
478    }
479    
480    public boolean getThruTimeHasBeenModified() {
481        return _value.getThruTimeHasBeenModified();
482    }
483    
484}