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 * InventoryTransactionDetail.java
021 */
022
023package com.echothree.model.data.inventory.server.entity;
024
025import com.echothree.model.data.inventory.common.pk.InventoryTransactionDetailPK;
026
027import com.echothree.model.data.inventory.common.pk.InventoryTransactionPK;
028import com.echothree.model.data.inventory.common.pk.InventoryTransactionTypePK;
029import com.echothree.model.data.party.common.pk.PartyPK;
030import com.echothree.model.data.inventory.common.pk.InventoryTransactionReasonPK;
031
032import com.echothree.model.data.inventory.server.entity.InventoryTransaction;
033import com.echothree.model.data.inventory.server.entity.InventoryTransactionType;
034import com.echothree.model.data.party.server.entity.Party;
035import com.echothree.model.data.inventory.server.entity.InventoryTransactionReason;
036
037import com.echothree.model.data.inventory.server.factory.InventoryTransactionFactory;
038import com.echothree.model.data.inventory.server.factory.InventoryTransactionTypeFactory;
039import com.echothree.model.data.party.server.factory.PartyFactory;
040import com.echothree.model.data.inventory.server.factory.InventoryTransactionReasonFactory;
041
042import com.echothree.model.data.inventory.common.pk.InventoryTransactionDetailPK;
043
044import com.echothree.model.data.inventory.server.value.InventoryTransactionDetailValue;
045
046import com.echothree.model.data.inventory.server.factory.InventoryTransactionDetailFactory;
047
048import com.echothree.util.common.exception.PersistenceException;
049import com.echothree.util.common.exception.PersistenceDatabaseException;
050import com.echothree.util.common.exception.PersistenceNotNullException;
051import com.echothree.util.common.exception.PersistenceReadOnlyException;
052
053import com.echothree.util.common.persistence.BasePK;
054
055import com.echothree.util.common.persistence.type.ByteArray;
056
057import com.echothree.util.server.persistence.BaseEntity;
058import com.echothree.util.server.persistence.EntityPermission;
059import com.echothree.util.server.persistence.Session;
060import com.echothree.util.server.persistence.ThreadSession;
061
062import java.io.Serializable;
063
064import javax.annotation.Nonnull;
065import javax.annotation.Nullable;
066
067public class InventoryTransactionDetail
068        extends BaseEntity
069        implements Serializable {
070    
071    private InventoryTransactionDetailPK _pk;
072    private InventoryTransactionDetailValue _value;
073    
074    /** Creates a new instance of InventoryTransactionDetail */
075    public InventoryTransactionDetail()
076            throws PersistenceException {
077        super();
078    }
079    
080    /** Creates a new instance of InventoryTransactionDetail */
081    public InventoryTransactionDetail(InventoryTransactionDetailValue value, EntityPermission entityPermission) {
082        super(entityPermission);
083        
084        _value = value;
085        _pk = value.getPrimaryKey();
086    }
087    
088    @Override
089    @Nonnull
090    public InventoryTransactionDetailFactory getBaseFactoryInstance() {
091        return InventoryTransactionDetailFactory.getInstance();
092    }
093    
094    @Override
095    public boolean hasBeenModified() {
096        return _value.hasBeenModified();
097    }
098    
099    @Override
100    public int hashCode() {
101        return _pk.hashCode();
102    }
103    
104    @Override
105    @Nonnull
106    public String toString() {
107        return _pk.toString();
108    }
109    
110    @Override
111    public boolean equals(Object other) {
112        if(this == other)
113            return true;
114        
115        if(other instanceof InventoryTransactionDetail that) {
116            InventoryTransactionDetailValue thatValue = that.getInventoryTransactionDetailValue();
117            return _value.equals(thatValue);
118        } else {
119            return false;
120        }
121    }
122    
123    @Override
124    public void store()
125            throws PersistenceDatabaseException {
126        getBaseFactoryInstance().store(this);
127    }
128    
129    @Override
130    public void remove()
131            throws PersistenceDatabaseException {
132        getBaseFactoryInstance().remove(this);
133    }
134    
135    @Nonnull
136    public InventoryTransactionDetailValue getInventoryTransactionDetailValue() {
137        return _value;
138    }
139    
140    public void setInventoryTransactionDetailValue(@Nonnull InventoryTransactionDetailValue value)
141            throws PersistenceReadOnlyException {
142        checkReadWrite();
143        _value = value;
144    }
145    
146    @Override
147    @Nonnull
148    public InventoryTransactionDetailPK getPrimaryKey() {
149        return _pk;
150    }
151    
152    @Nonnull
153    public InventoryTransactionPK getInventoryTransactionPK() {
154        return _value.getInventoryTransactionPK();
155    }
156    
157    @Nonnull
158    public InventoryTransaction getInventoryTransaction(EntityPermission entityPermission) {
159        return InventoryTransactionFactory.getInstance().getEntityFromPK(entityPermission, getInventoryTransactionPK());
160    }
161    
162    @Nonnull
163    public InventoryTransaction getInventoryTransaction() {
164        return getInventoryTransaction(EntityPermission.READ_ONLY);
165    }
166    
167    @Nonnull
168    public InventoryTransaction getInventoryTransactionForUpdate() {
169        return getInventoryTransaction(EntityPermission.READ_WRITE);
170    }
171    
172    public void setInventoryTransactionPK(@Nonnull InventoryTransactionPK inventoryTransactionPK)
173            throws PersistenceNotNullException, PersistenceReadOnlyException {
174        checkReadWrite();
175        _value.setInventoryTransactionPK(inventoryTransactionPK);
176    }
177    
178    public void setInventoryTransaction(@Nonnull InventoryTransaction entity) {
179        setInventoryTransactionPK(entity == null ? null : entity.getPrimaryKey());
180    }
181    
182    public boolean getInventoryTransactionPKHasBeenModified() {
183        return _value.getInventoryTransactionPKHasBeenModified();
184    }
185    
186    @Nonnull
187    public InventoryTransactionTypePK getInventoryTransactionTypePK() {
188        return _value.getInventoryTransactionTypePK();
189    }
190    
191    @Nonnull
192    public InventoryTransactionType getInventoryTransactionType(EntityPermission entityPermission) {
193        return InventoryTransactionTypeFactory.getInstance().getEntityFromPK(entityPermission, getInventoryTransactionTypePK());
194    }
195    
196    @Nonnull
197    public InventoryTransactionType getInventoryTransactionType() {
198        return getInventoryTransactionType(EntityPermission.READ_ONLY);
199    }
200    
201    @Nonnull
202    public InventoryTransactionType getInventoryTransactionTypeForUpdate() {
203        return getInventoryTransactionType(EntityPermission.READ_WRITE);
204    }
205    
206    public void setInventoryTransactionTypePK(@Nonnull InventoryTransactionTypePK inventoryTransactionTypePK)
207            throws PersistenceNotNullException, PersistenceReadOnlyException {
208        checkReadWrite();
209        _value.setInventoryTransactionTypePK(inventoryTransactionTypePK);
210    }
211    
212    public void setInventoryTransactionType(@Nonnull InventoryTransactionType entity) {
213        setInventoryTransactionTypePK(entity == null ? null : entity.getPrimaryKey());
214    }
215    
216    public boolean getInventoryTransactionTypePKHasBeenModified() {
217        return _value.getInventoryTransactionTypePKHasBeenModified();
218    }
219    
220    @Nonnull
221    public String getInventoryTransactionName() {
222        return _value.getInventoryTransactionName();
223    }
224    
225    public void setInventoryTransactionName(@Nonnull String inventoryTransactionName)
226            throws PersistenceNotNullException, PersistenceReadOnlyException {
227        checkReadWrite();
228        _value.setInventoryTransactionName(inventoryTransactionName);
229    }
230    
231    public boolean getInventoryTransactionNameHasBeenModified() {
232        return _value.getInventoryTransactionNameHasBeenModified();
233    }
234    
235    @Nonnull
236    public PartyPK getCompanyPartyPK() {
237        return _value.getCompanyPartyPK();
238    }
239    
240    @Nonnull
241    public Party getCompanyParty(EntityPermission entityPermission) {
242        return PartyFactory.getInstance().getEntityFromPK(entityPermission, getCompanyPartyPK());
243    }
244    
245    @Nonnull
246    public Party getCompanyParty() {
247        return getCompanyParty(EntityPermission.READ_ONLY);
248    }
249    
250    @Nonnull
251    public Party getCompanyPartyForUpdate() {
252        return getCompanyParty(EntityPermission.READ_WRITE);
253    }
254    
255    public void setCompanyPartyPK(@Nonnull PartyPK companyPartyPK)
256            throws PersistenceNotNullException, PersistenceReadOnlyException {
257        checkReadWrite();
258        _value.setCompanyPartyPK(companyPartyPK);
259    }
260    
261    public void setCompanyParty(@Nonnull Party entity) {
262        setCompanyPartyPK(entity == null ? null : entity.getPrimaryKey());
263    }
264    
265    public boolean getCompanyPartyPKHasBeenModified() {
266        return _value.getCompanyPartyPKHasBeenModified();
267    }
268    
269    @Nonnull
270    public PartyPK getLocationPartyPK() {
271        return _value.getLocationPartyPK();
272    }
273    
274    @Nonnull
275    public Party getLocationParty(EntityPermission entityPermission) {
276        return PartyFactory.getInstance().getEntityFromPK(entityPermission, getLocationPartyPK());
277    }
278    
279    @Nonnull
280    public Party getLocationParty() {
281        return getLocationParty(EntityPermission.READ_ONLY);
282    }
283    
284    @Nonnull
285    public Party getLocationPartyForUpdate() {
286        return getLocationParty(EntityPermission.READ_WRITE);
287    }
288    
289    public void setLocationPartyPK(@Nonnull PartyPK locationPartyPK)
290            throws PersistenceNotNullException, PersistenceReadOnlyException {
291        checkReadWrite();
292        _value.setLocationPartyPK(locationPartyPK);
293    }
294    
295    public void setLocationParty(@Nonnull Party entity) {
296        setLocationPartyPK(entity == null ? null : entity.getPrimaryKey());
297    }
298    
299    public boolean getLocationPartyPKHasBeenModified() {
300        return _value.getLocationPartyPKHasBeenModified();
301    }
302    
303    @Nullable
304    public InventoryTransactionReasonPK getInventoryTransactionReasonPK() {
305        return _value.getInventoryTransactionReasonPK();
306    }
307    
308    @Nullable
309    public InventoryTransactionReason getInventoryTransactionReason(EntityPermission entityPermission) {
310        InventoryTransactionReasonPK pk = getInventoryTransactionReasonPK();
311        InventoryTransactionReason entity = pk == null? null: InventoryTransactionReasonFactory.getInstance().getEntityFromPK(entityPermission, pk);
312        
313        return entity;
314    }
315    
316    @Nullable
317    public InventoryTransactionReason getInventoryTransactionReason() {
318        return getInventoryTransactionReason(EntityPermission.READ_ONLY);
319    }
320    
321    @Nullable
322    public InventoryTransactionReason getInventoryTransactionReasonForUpdate() {
323        return getInventoryTransactionReason(EntityPermission.READ_WRITE);
324    }
325    
326    public void setInventoryTransactionReasonPK(@Nullable InventoryTransactionReasonPK inventoryTransactionReasonPK)
327            throws PersistenceNotNullException, PersistenceReadOnlyException {
328        checkReadWrite();
329        _value.setInventoryTransactionReasonPK(inventoryTransactionReasonPK);
330    }
331    
332    public void setInventoryTransactionReason(@Nullable InventoryTransactionReason entity) {
333        setInventoryTransactionReasonPK(entity == null ? null : entity.getPrimaryKey());
334    }
335    
336    public boolean getInventoryTransactionReasonPKHasBeenModified() {
337        return _value.getInventoryTransactionReasonPKHasBeenModified();
338    }
339    
340    @Nullable
341    public String getReference() {
342        return _value.getReference();
343    }
344    
345    public void setReference(@Nullable String reference)
346            throws PersistenceNotNullException, PersistenceReadOnlyException {
347        checkReadWrite();
348        _value.setReference(reference);
349    }
350    
351    public boolean getReferenceHasBeenModified() {
352        return _value.getReferenceHasBeenModified();
353    }
354    
355    @Nullable
356    public String getDescription() {
357        return _value.getDescription();
358    }
359    
360    public void setDescription(@Nullable String description)
361            throws PersistenceNotNullException, PersistenceReadOnlyException {
362        checkReadWrite();
363        _value.setDescription(description);
364    }
365    
366    public boolean getDescriptionHasBeenModified() {
367        return _value.getDescriptionHasBeenModified();
368    }
369    
370    @Nonnull
371    public Long getFromTime() {
372        return _value.getFromTime();
373    }
374    
375    public void setFromTime(@Nonnull Long fromTime)
376            throws PersistenceNotNullException, PersistenceReadOnlyException {
377        checkReadWrite();
378        _value.setFromTime(fromTime);
379    }
380    
381    public boolean getFromTimeHasBeenModified() {
382        return _value.getFromTimeHasBeenModified();
383    }
384    
385    @Nonnull
386    public Long getThruTime() {
387        return _value.getThruTime();
388    }
389    
390    public void setThruTime(@Nonnull Long thruTime)
391            throws PersistenceNotNullException, PersistenceReadOnlyException {
392        checkReadWrite();
393        _value.setThruTime(thruTime);
394    }
395    
396    public boolean getThruTimeHasBeenModified() {
397        return _value.getThruTimeHasBeenModified();
398    }
399    
400}