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 * InventoryTransactionLineSource.java
021 */
022
023package com.echothree.model.data.inventory.server.entity;
024
025import com.echothree.model.data.inventory.common.pk.InventoryTransactionLineSourcePK;
026
027import com.echothree.model.data.inventory.common.pk.InventoryTransactionLinePK;
028import com.echothree.model.data.party.common.pk.PartyPK;
029import com.echothree.model.data.warehouse.common.pk.LocationPK;
030import com.echothree.model.data.inventory.common.pk.InventoryConditionPK;
031import com.echothree.model.data.uom.common.pk.UnitOfMeasureTypePK;
032
033import com.echothree.model.data.inventory.server.entity.InventoryTransactionLine;
034import com.echothree.model.data.party.server.entity.Party;
035import com.echothree.model.data.warehouse.server.entity.Location;
036import com.echothree.model.data.inventory.server.entity.InventoryCondition;
037import com.echothree.model.data.uom.server.entity.UnitOfMeasureType;
038
039import com.echothree.model.data.inventory.server.factory.InventoryTransactionLineFactory;
040import com.echothree.model.data.party.server.factory.PartyFactory;
041import com.echothree.model.data.warehouse.server.factory.LocationFactory;
042import com.echothree.model.data.inventory.server.factory.InventoryConditionFactory;
043import com.echothree.model.data.uom.server.factory.UnitOfMeasureTypeFactory;
044
045import com.echothree.model.data.inventory.common.pk.InventoryTransactionLineSourcePK;
046
047import com.echothree.model.data.inventory.server.value.InventoryTransactionLineSourceValue;
048
049import com.echothree.model.data.inventory.server.factory.InventoryTransactionLineSourceFactory;
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 InventoryTransactionLineSource
071        extends BaseEntity
072        implements Serializable {
073    
074    private InventoryTransactionLineSourcePK _pk;
075    private InventoryTransactionLineSourceValue _value;
076    
077    /** Creates a new instance of InventoryTransactionLineSource */
078    public InventoryTransactionLineSource()
079            throws PersistenceException {
080        super();
081    }
082    
083    /** Creates a new instance of InventoryTransactionLineSource */
084    public InventoryTransactionLineSource(InventoryTransactionLineSourceValue value, EntityPermission entityPermission) {
085        super(entityPermission);
086        
087        _value = value;
088        _pk = value.getPrimaryKey();
089    }
090    
091    @Override
092    @Nonnull
093    public InventoryTransactionLineSourceFactory getBaseFactoryInstance() {
094        return InventoryTransactionLineSourceFactory.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 InventoryTransactionLineSource that) {
119            InventoryTransactionLineSourceValue thatValue = that.getInventoryTransactionLineSourceValue();
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 InventoryTransactionLineSourceValue getInventoryTransactionLineSourceValue() {
140        return _value;
141    }
142    
143    public void setInventoryTransactionLineSourceValue(@Nonnull InventoryTransactionLineSourceValue value)
144            throws PersistenceReadOnlyException {
145        checkReadWrite();
146        _value = value;
147    }
148    
149    @Override
150    @Nonnull
151    public InventoryTransactionLineSourcePK getPrimaryKey() {
152        return _pk;
153    }
154    
155    @Nonnull
156    public InventoryTransactionLinePK getInventoryTransactionLinePK() {
157        return _value.getInventoryTransactionLinePK();
158    }
159    
160    @Nonnull
161    public InventoryTransactionLine getInventoryTransactionLine(EntityPermission entityPermission) {
162        return InventoryTransactionLineFactory.getInstance().getEntityFromPK(entityPermission, getInventoryTransactionLinePK());
163    }
164    
165    @Nonnull
166    public InventoryTransactionLine getInventoryTransactionLine() {
167        return getInventoryTransactionLine(EntityPermission.READ_ONLY);
168    }
169    
170    @Nonnull
171    public InventoryTransactionLine getInventoryTransactionLineForUpdate() {
172        return getInventoryTransactionLine(EntityPermission.READ_WRITE);
173    }
174    
175    public void setInventoryTransactionLinePK(@Nonnull InventoryTransactionLinePK inventoryTransactionLinePK)
176            throws PersistenceNotNullException, PersistenceReadOnlyException {
177        checkReadWrite();
178        _value.setInventoryTransactionLinePK(inventoryTransactionLinePK);
179    }
180    
181    public void setInventoryTransactionLine(@Nonnull InventoryTransactionLine entity) {
182        setInventoryTransactionLinePK(entity == null ? null : entity.getPrimaryKey());
183    }
184    
185    public boolean getInventoryTransactionLinePKHasBeenModified() {
186        return _value.getInventoryTransactionLinePKHasBeenModified();
187    }
188    
189    @Nullable
190    public PartyPK getSourceOwnerPartyPK() {
191        return _value.getSourceOwnerPartyPK();
192    }
193    
194    @Nullable
195    public Party getSourceOwnerParty(EntityPermission entityPermission) {
196        PartyPK pk = getSourceOwnerPartyPK();
197        Party entity = pk == null? null: PartyFactory.getInstance().getEntityFromPK(entityPermission, pk);
198        
199        return entity;
200    }
201    
202    @Nullable
203    public Party getSourceOwnerParty() {
204        return getSourceOwnerParty(EntityPermission.READ_ONLY);
205    }
206    
207    @Nullable
208    public Party getSourceOwnerPartyForUpdate() {
209        return getSourceOwnerParty(EntityPermission.READ_WRITE);
210    }
211    
212    public void setSourceOwnerPartyPK(@Nullable PartyPK sourceOwnerPartyPK)
213            throws PersistenceNotNullException, PersistenceReadOnlyException {
214        checkReadWrite();
215        _value.setSourceOwnerPartyPK(sourceOwnerPartyPK);
216    }
217    
218    public void setSourceOwnerParty(@Nullable Party entity) {
219        setSourceOwnerPartyPK(entity == null ? null : entity.getPrimaryKey());
220    }
221    
222    public boolean getSourceOwnerPartyPKHasBeenModified() {
223        return _value.getSourceOwnerPartyPKHasBeenModified();
224    }
225    
226    @Nullable
227    public LocationPK getSourceLocationPK() {
228        return _value.getSourceLocationPK();
229    }
230    
231    @Nullable
232    public Location getSourceLocation(EntityPermission entityPermission) {
233        LocationPK pk = getSourceLocationPK();
234        Location entity = pk == null? null: LocationFactory.getInstance().getEntityFromPK(entityPermission, pk);
235        
236        return entity;
237    }
238    
239    @Nullable
240    public Location getSourceLocation() {
241        return getSourceLocation(EntityPermission.READ_ONLY);
242    }
243    
244    @Nullable
245    public Location getSourceLocationForUpdate() {
246        return getSourceLocation(EntityPermission.READ_WRITE);
247    }
248    
249    public void setSourceLocationPK(@Nullable LocationPK sourceLocationPK)
250            throws PersistenceNotNullException, PersistenceReadOnlyException {
251        checkReadWrite();
252        _value.setSourceLocationPK(sourceLocationPK);
253    }
254    
255    public void setSourceLocation(@Nullable Location entity) {
256        setSourceLocationPK(entity == null ? null : entity.getPrimaryKey());
257    }
258    
259    public boolean getSourceLocationPKHasBeenModified() {
260        return _value.getSourceLocationPKHasBeenModified();
261    }
262    
263    @Nullable
264    public InventoryConditionPK getSourceInventoryConditionPK() {
265        return _value.getSourceInventoryConditionPK();
266    }
267    
268    @Nullable
269    public InventoryCondition getSourceInventoryCondition(EntityPermission entityPermission) {
270        InventoryConditionPK pk = getSourceInventoryConditionPK();
271        InventoryCondition entity = pk == null? null: InventoryConditionFactory.getInstance().getEntityFromPK(entityPermission, pk);
272        
273        return entity;
274    }
275    
276    @Nullable
277    public InventoryCondition getSourceInventoryCondition() {
278        return getSourceInventoryCondition(EntityPermission.READ_ONLY);
279    }
280    
281    @Nullable
282    public InventoryCondition getSourceInventoryConditionForUpdate() {
283        return getSourceInventoryCondition(EntityPermission.READ_WRITE);
284    }
285    
286    public void setSourceInventoryConditionPK(@Nullable InventoryConditionPK sourceInventoryConditionPK)
287            throws PersistenceNotNullException, PersistenceReadOnlyException {
288        checkReadWrite();
289        _value.setSourceInventoryConditionPK(sourceInventoryConditionPK);
290    }
291    
292    public void setSourceInventoryCondition(@Nullable InventoryCondition entity) {
293        setSourceInventoryConditionPK(entity == null ? null : entity.getPrimaryKey());
294    }
295    
296    public boolean getSourceInventoryConditionPKHasBeenModified() {
297        return _value.getSourceInventoryConditionPKHasBeenModified();
298    }
299    
300    @Nullable
301    public UnitOfMeasureTypePK getSourceUnitOfMeasureTypePK() {
302        return _value.getSourceUnitOfMeasureTypePK();
303    }
304    
305    @Nullable
306    public UnitOfMeasureType getSourceUnitOfMeasureType(EntityPermission entityPermission) {
307        UnitOfMeasureTypePK pk = getSourceUnitOfMeasureTypePK();
308        UnitOfMeasureType entity = pk == null? null: UnitOfMeasureTypeFactory.getInstance().getEntityFromPK(entityPermission, pk);
309        
310        return entity;
311    }
312    
313    @Nullable
314    public UnitOfMeasureType getSourceUnitOfMeasureType() {
315        return getSourceUnitOfMeasureType(EntityPermission.READ_ONLY);
316    }
317    
318    @Nullable
319    public UnitOfMeasureType getSourceUnitOfMeasureTypeForUpdate() {
320        return getSourceUnitOfMeasureType(EntityPermission.READ_WRITE);
321    }
322    
323    public void setSourceUnitOfMeasureTypePK(@Nullable UnitOfMeasureTypePK sourceUnitOfMeasureTypePK)
324            throws PersistenceNotNullException, PersistenceReadOnlyException {
325        checkReadWrite();
326        _value.setSourceUnitOfMeasureTypePK(sourceUnitOfMeasureTypePK);
327    }
328    
329    public void setSourceUnitOfMeasureType(@Nullable UnitOfMeasureType entity) {
330        setSourceUnitOfMeasureTypePK(entity == null ? null : entity.getPrimaryKey());
331    }
332    
333    public boolean getSourceUnitOfMeasureTypePKHasBeenModified() {
334        return _value.getSourceUnitOfMeasureTypePKHasBeenModified();
335    }
336    
337    @Nonnull
338    public Long getFromTime() {
339        return _value.getFromTime();
340    }
341    
342    public void setFromTime(@Nonnull Long fromTime)
343            throws PersistenceNotNullException, PersistenceReadOnlyException {
344        checkReadWrite();
345        _value.setFromTime(fromTime);
346    }
347    
348    public boolean getFromTimeHasBeenModified() {
349        return _value.getFromTimeHasBeenModified();
350    }
351    
352    @Nonnull
353    public Long getThruTime() {
354        return _value.getThruTime();
355    }
356    
357    public void setThruTime(@Nonnull Long thruTime)
358            throws PersistenceNotNullException, PersistenceReadOnlyException {
359        checkReadWrite();
360        _value.setThruTime(thruTime);
361    }
362    
363    public boolean getThruTimeHasBeenModified() {
364        return _value.getThruTimeHasBeenModified();
365    }
366    
367}