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 * OfferItemPrice.java
021 */
022
023package com.echothree.model.data.offer.server.entity;
024
025import com.echothree.model.data.offer.common.pk.OfferItemPricePK;
026
027import com.echothree.model.data.offer.common.pk.OfferItemPK;
028import com.echothree.model.data.inventory.common.pk.InventoryConditionPK;
029import com.echothree.model.data.uom.common.pk.UnitOfMeasureTypePK;
030import com.echothree.model.data.accounting.common.pk.CurrencyPK;
031
032import com.echothree.model.data.offer.server.entity.OfferItem;
033import com.echothree.model.data.inventory.server.entity.InventoryCondition;
034import com.echothree.model.data.uom.server.entity.UnitOfMeasureType;
035import com.echothree.model.data.accounting.server.entity.Currency;
036
037import com.echothree.model.data.offer.server.factory.OfferItemFactory;
038import com.echothree.model.data.inventory.server.factory.InventoryConditionFactory;
039import com.echothree.model.data.uom.server.factory.UnitOfMeasureTypeFactory;
040import com.echothree.model.data.accounting.server.factory.CurrencyFactory;
041
042import com.echothree.model.data.offer.common.pk.OfferItemPricePK;
043
044import com.echothree.model.data.offer.server.value.OfferItemPriceValue;
045
046import com.echothree.model.data.offer.server.factory.OfferItemPriceFactory;
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 OfferItemPrice
068        extends BaseEntity
069        implements Serializable {
070    
071    private OfferItemPricePK _pk;
072    private OfferItemPriceValue _value;
073    
074    /** Creates a new instance of OfferItemPrice */
075    public OfferItemPrice()
076            throws PersistenceException {
077        super();
078    }
079    
080    /** Creates a new instance of OfferItemPrice */
081    public OfferItemPrice(OfferItemPriceValue value, EntityPermission entityPermission) {
082        super(entityPermission);
083        
084        _value = value;
085        _pk = value.getPrimaryKey();
086    }
087    
088    @Override
089    @Nonnull
090    public OfferItemPriceFactory getBaseFactoryInstance() {
091        return OfferItemPriceFactory.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 OfferItemPrice that) {
116            OfferItemPriceValue thatValue = that.getOfferItemPriceValue();
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 OfferItemPriceValue getOfferItemPriceValue() {
137        return _value;
138    }
139    
140    public void setOfferItemPriceValue(@Nonnull OfferItemPriceValue value)
141            throws PersistenceReadOnlyException {
142        checkReadWrite();
143        _value = value;
144    }
145    
146    @Override
147    @Nonnull
148    public OfferItemPricePK getPrimaryKey() {
149        return _pk;
150    }
151    
152    @Nonnull
153    public OfferItemPK getOfferItemPK() {
154        return _value.getOfferItemPK();
155    }
156    
157    @Nonnull
158    public OfferItem getOfferItem(EntityPermission entityPermission) {
159        return OfferItemFactory.getInstance().getEntityFromPK(entityPermission, getOfferItemPK());
160    }
161    
162    @Nonnull
163    public OfferItem getOfferItem() {
164        return getOfferItem(EntityPermission.READ_ONLY);
165    }
166    
167    @Nonnull
168    public OfferItem getOfferItemForUpdate() {
169        return getOfferItem(EntityPermission.READ_WRITE);
170    }
171    
172    public void setOfferItemPK(@Nonnull OfferItemPK offerItemPK)
173            throws PersistenceNotNullException, PersistenceReadOnlyException {
174        checkReadWrite();
175        _value.setOfferItemPK(offerItemPK);
176    }
177    
178    public void setOfferItem(@Nonnull OfferItem entity) {
179        setOfferItemPK(entity == null ? null : entity.getPrimaryKey());
180    }
181    
182    public boolean getOfferItemPKHasBeenModified() {
183        return _value.getOfferItemPKHasBeenModified();
184    }
185    
186    @Nonnull
187    public InventoryConditionPK getInventoryConditionPK() {
188        return _value.getInventoryConditionPK();
189    }
190    
191    @Nonnull
192    public InventoryCondition getInventoryCondition(EntityPermission entityPermission) {
193        return InventoryConditionFactory.getInstance().getEntityFromPK(entityPermission, getInventoryConditionPK());
194    }
195    
196    @Nonnull
197    public InventoryCondition getInventoryCondition() {
198        return getInventoryCondition(EntityPermission.READ_ONLY);
199    }
200    
201    @Nonnull
202    public InventoryCondition getInventoryConditionForUpdate() {
203        return getInventoryCondition(EntityPermission.READ_WRITE);
204    }
205    
206    public void setInventoryConditionPK(@Nonnull InventoryConditionPK inventoryConditionPK)
207            throws PersistenceNotNullException, PersistenceReadOnlyException {
208        checkReadWrite();
209        _value.setInventoryConditionPK(inventoryConditionPK);
210    }
211    
212    public void setInventoryCondition(@Nonnull InventoryCondition entity) {
213        setInventoryConditionPK(entity == null ? null : entity.getPrimaryKey());
214    }
215    
216    public boolean getInventoryConditionPKHasBeenModified() {
217        return _value.getInventoryConditionPKHasBeenModified();
218    }
219    
220    @Nonnull
221    public UnitOfMeasureTypePK getUnitOfMeasureTypePK() {
222        return _value.getUnitOfMeasureTypePK();
223    }
224    
225    @Nonnull
226    public UnitOfMeasureType getUnitOfMeasureType(EntityPermission entityPermission) {
227        return UnitOfMeasureTypeFactory.getInstance().getEntityFromPK(entityPermission, getUnitOfMeasureTypePK());
228    }
229    
230    @Nonnull
231    public UnitOfMeasureType getUnitOfMeasureType() {
232        return getUnitOfMeasureType(EntityPermission.READ_ONLY);
233    }
234    
235    @Nonnull
236    public UnitOfMeasureType getUnitOfMeasureTypeForUpdate() {
237        return getUnitOfMeasureType(EntityPermission.READ_WRITE);
238    }
239    
240    public void setUnitOfMeasureTypePK(@Nonnull UnitOfMeasureTypePK unitOfMeasureTypePK)
241            throws PersistenceNotNullException, PersistenceReadOnlyException {
242        checkReadWrite();
243        _value.setUnitOfMeasureTypePK(unitOfMeasureTypePK);
244    }
245    
246    public void setUnitOfMeasureType(@Nonnull UnitOfMeasureType entity) {
247        setUnitOfMeasureTypePK(entity == null ? null : entity.getPrimaryKey());
248    }
249    
250    public boolean getUnitOfMeasureTypePKHasBeenModified() {
251        return _value.getUnitOfMeasureTypePKHasBeenModified();
252    }
253    
254    @Nonnull
255    public CurrencyPK getCurrencyPK() {
256        return _value.getCurrencyPK();
257    }
258    
259    @Nonnull
260    public Currency getCurrency(EntityPermission entityPermission) {
261        return CurrencyFactory.getInstance().getEntityFromPK(entityPermission, getCurrencyPK());
262    }
263    
264    @Nonnull
265    public Currency getCurrency() {
266        return getCurrency(EntityPermission.READ_ONLY);
267    }
268    
269    @Nonnull
270    public Currency getCurrencyForUpdate() {
271        return getCurrency(EntityPermission.READ_WRITE);
272    }
273    
274    public void setCurrencyPK(@Nonnull CurrencyPK currencyPK)
275            throws PersistenceNotNullException, PersistenceReadOnlyException {
276        checkReadWrite();
277        _value.setCurrencyPK(currencyPK);
278    }
279    
280    public void setCurrency(@Nonnull Currency entity) {
281        setCurrencyPK(entity == null ? null : entity.getPrimaryKey());
282    }
283    
284    public boolean getCurrencyPKHasBeenModified() {
285        return _value.getCurrencyPKHasBeenModified();
286    }
287    
288    @Nonnull
289    public Long getFromTime() {
290        return _value.getFromTime();
291    }
292    
293    public void setFromTime(@Nonnull Long fromTime)
294            throws PersistenceNotNullException, PersistenceReadOnlyException {
295        checkReadWrite();
296        _value.setFromTime(fromTime);
297    }
298    
299    public boolean getFromTimeHasBeenModified() {
300        return _value.getFromTimeHasBeenModified();
301    }
302    
303    @Nonnull
304    public Long getThruTime() {
305        return _value.getThruTime();
306    }
307    
308    public void setThruTime(@Nonnull Long thruTime)
309            throws PersistenceNotNullException, PersistenceReadOnlyException {
310        checkReadWrite();
311        _value.setThruTime(thruTime);
312    }
313    
314    public boolean getThruTimeHasBeenModified() {
315        return _value.getThruTimeHasBeenModified();
316    }
317    
318}