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 * ItemAdditionalCharge.java
021 */
022
023package com.echothree.model.data.item.server.entity;
024
025import com.echothree.model.data.item.common.pk.ItemAdditionalChargePK;
026
027import com.echothree.model.data.item.common.pk.ItemPK;
028import com.echothree.model.data.item.common.pk.ItemAdditionalChargeTypePK;
029import com.echothree.model.data.uom.common.pk.UnitOfMeasureTypePK;
030import com.echothree.model.data.accounting.common.pk.CurrencyPK;
031
032import com.echothree.model.data.item.server.entity.Item;
033import com.echothree.model.data.item.server.entity.ItemAdditionalChargeType;
034import com.echothree.model.data.uom.server.entity.UnitOfMeasureType;
035import com.echothree.model.data.accounting.server.entity.Currency;
036
037import com.echothree.model.data.item.server.factory.ItemFactory;
038import com.echothree.model.data.item.server.factory.ItemAdditionalChargeTypeFactory;
039import com.echothree.model.data.uom.server.factory.UnitOfMeasureTypeFactory;
040import com.echothree.model.data.accounting.server.factory.CurrencyFactory;
041
042import com.echothree.model.data.item.common.pk.ItemAdditionalChargePK;
043
044import com.echothree.model.data.item.server.value.ItemAdditionalChargeValue;
045
046import com.echothree.model.data.item.server.factory.ItemAdditionalChargeFactory;
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
064public class ItemAdditionalCharge
065        extends BaseEntity
066        implements Serializable {
067    
068    private ItemAdditionalChargePK _pk;
069    private ItemAdditionalChargeValue _value;
070    
071    /** Creates a new instance of ItemAdditionalCharge */
072    public ItemAdditionalCharge()
073            throws PersistenceException {
074        super();
075    }
076    
077    /** Creates a new instance of ItemAdditionalCharge */
078    public ItemAdditionalCharge(ItemAdditionalChargeValue value, EntityPermission entityPermission) {
079        super(entityPermission);
080        
081        _value = value;
082        _pk = value.getPrimaryKey();
083    }
084    
085    @Override
086    public ItemAdditionalChargeFactory getBaseFactoryInstance() {
087        return ItemAdditionalChargeFactory.getInstance();
088    }
089    
090    @Override
091    public boolean hasBeenModified() {
092        return _value.hasBeenModified();
093    }
094    
095    @Override
096    public int hashCode() {
097        return _pk.hashCode();
098    }
099    
100    @Override
101    public String toString() {
102        return _pk.toString();
103    }
104    
105    @Override
106    public boolean equals(Object other) {
107        if(this == other)
108            return true;
109        
110        if(other instanceof ItemAdditionalCharge that) {
111            ItemAdditionalChargeValue thatValue = that.getItemAdditionalChargeValue();
112            return _value.equals(thatValue);
113        } else {
114            return false;
115        }
116    }
117    
118    @Override
119    public void store()
120            throws PersistenceDatabaseException {
121        getBaseFactoryInstance().store(this);
122    }
123    
124    @Override
125    public void remove()
126            throws PersistenceDatabaseException {
127        getBaseFactoryInstance().remove(this);
128    }
129    
130    public ItemAdditionalChargeValue getItemAdditionalChargeValue() {
131        return _value;
132    }
133    
134    public void setItemAdditionalChargeValue(ItemAdditionalChargeValue value)
135            throws PersistenceReadOnlyException {
136        checkReadWrite();
137        _value = value;
138    }
139    
140    @Override
141    public ItemAdditionalChargePK getPrimaryKey() {
142        return _pk;
143    }
144    
145    public ItemPK getItemPK() {
146        return _value.getItemPK();
147    }
148    
149    public Item getItem(EntityPermission entityPermission) {
150        return ItemFactory.getInstance().getEntityFromPK(entityPermission, getItemPK());
151    }
152    
153    public Item getItem() {
154        return getItem(EntityPermission.READ_ONLY);
155    }
156    
157    public Item getItemForUpdate() {
158        return getItem(EntityPermission.READ_WRITE);
159    }
160    
161    public void setItemPK(ItemPK itemPK)
162            throws PersistenceNotNullException, PersistenceReadOnlyException {
163        checkReadWrite();
164        _value.setItemPK(itemPK);
165    }
166    
167    public void setItem(Item entity) {
168        setItemPK(entity == null? null: entity.getPrimaryKey());
169    }
170    
171    public boolean getItemPKHasBeenModified() {
172        return _value.getItemPKHasBeenModified();
173    }
174    
175    public ItemAdditionalChargeTypePK getItemAdditionalChargeTypePK() {
176        return _value.getItemAdditionalChargeTypePK();
177    }
178    
179    public ItemAdditionalChargeType getItemAdditionalChargeType(EntityPermission entityPermission) {
180        return ItemAdditionalChargeTypeFactory.getInstance().getEntityFromPK(entityPermission, getItemAdditionalChargeTypePK());
181    }
182    
183    public ItemAdditionalChargeType getItemAdditionalChargeType() {
184        return getItemAdditionalChargeType(EntityPermission.READ_ONLY);
185    }
186    
187    public ItemAdditionalChargeType getItemAdditionalChargeTypeForUpdate() {
188        return getItemAdditionalChargeType(EntityPermission.READ_WRITE);
189    }
190    
191    public void setItemAdditionalChargeTypePK(ItemAdditionalChargeTypePK itemAdditionalChargeTypePK)
192            throws PersistenceNotNullException, PersistenceReadOnlyException {
193        checkReadWrite();
194        _value.setItemAdditionalChargeTypePK(itemAdditionalChargeTypePK);
195    }
196    
197    public void setItemAdditionalChargeType(ItemAdditionalChargeType entity) {
198        setItemAdditionalChargeTypePK(entity == null? null: entity.getPrimaryKey());
199    }
200    
201    public boolean getItemAdditionalChargeTypePKHasBeenModified() {
202        return _value.getItemAdditionalChargeTypePKHasBeenModified();
203    }
204    
205    public UnitOfMeasureTypePK getUnitOfMeasureTypePK() {
206        return _value.getUnitOfMeasureTypePK();
207    }
208    
209    public UnitOfMeasureType getUnitOfMeasureType(EntityPermission entityPermission) {
210        UnitOfMeasureTypePK pk = getUnitOfMeasureTypePK();
211        UnitOfMeasureType entity = pk == null? null: UnitOfMeasureTypeFactory.getInstance().getEntityFromPK(entityPermission, pk);
212        
213        return entity;
214    }
215    
216    public UnitOfMeasureType getUnitOfMeasureType() {
217        return getUnitOfMeasureType(EntityPermission.READ_ONLY);
218    }
219    
220    public UnitOfMeasureType getUnitOfMeasureTypeForUpdate() {
221        return getUnitOfMeasureType(EntityPermission.READ_WRITE);
222    }
223    
224    public void setUnitOfMeasureTypePK(UnitOfMeasureTypePK unitOfMeasureTypePK)
225            throws PersistenceNotNullException, PersistenceReadOnlyException {
226        checkReadWrite();
227        _value.setUnitOfMeasureTypePK(unitOfMeasureTypePK);
228    }
229    
230    public void setUnitOfMeasureType(UnitOfMeasureType entity) {
231        setUnitOfMeasureTypePK(entity == null? null: entity.getPrimaryKey());
232    }
233    
234    public boolean getUnitOfMeasureTypePKHasBeenModified() {
235        return _value.getUnitOfMeasureTypePKHasBeenModified();
236    }
237    
238    public Long getMinimumQuantity() {
239        return _value.getMinimumQuantity();
240    }
241    
242    public void setMinimumQuantity(Long minimumQuantity)
243            throws PersistenceNotNullException, PersistenceReadOnlyException {
244        checkReadWrite();
245        _value.setMinimumQuantity(minimumQuantity);
246    }
247    
248    public boolean getMinimumQuantityHasBeenModified() {
249        return _value.getMinimumQuantityHasBeenModified();
250    }
251    
252    public Long getMaximumQuantity() {
253        return _value.getMaximumQuantity();
254    }
255    
256    public void setMaximumQuantity(Long maximumQuantity)
257            throws PersistenceNotNullException, PersistenceReadOnlyException {
258        checkReadWrite();
259        _value.setMaximumQuantity(maximumQuantity);
260    }
261    
262    public boolean getMaximumQuantityHasBeenModified() {
263        return _value.getMaximumQuantityHasBeenModified();
264    }
265    
266    public CurrencyPK getCurrencyPK() {
267        return _value.getCurrencyPK();
268    }
269    
270    public Currency getCurrency(EntityPermission entityPermission) {
271        return CurrencyFactory.getInstance().getEntityFromPK(entityPermission, getCurrencyPK());
272    }
273    
274    public Currency getCurrency() {
275        return getCurrency(EntityPermission.READ_ONLY);
276    }
277    
278    public Currency getCurrencyForUpdate() {
279        return getCurrency(EntityPermission.READ_WRITE);
280    }
281    
282    public void setCurrencyPK(CurrencyPK currencyPK)
283            throws PersistenceNotNullException, PersistenceReadOnlyException {
284        checkReadWrite();
285        _value.setCurrencyPK(currencyPK);
286    }
287    
288    public void setCurrency(Currency entity) {
289        setCurrencyPK(entity == null? null: entity.getPrimaryKey());
290    }
291    
292    public boolean getCurrencyPKHasBeenModified() {
293        return _value.getCurrencyPKHasBeenModified();
294    }
295    
296    public Long getUnitPrice() {
297        return _value.getUnitPrice();
298    }
299    
300    public void setUnitPrice(Long unitPrice)
301            throws PersistenceNotNullException, PersistenceReadOnlyException {
302        checkReadWrite();
303        _value.setUnitPrice(unitPrice);
304    }
305    
306    public boolean getUnitPriceHasBeenModified() {
307        return _value.getUnitPriceHasBeenModified();
308    }
309    
310    public Long getFromTime() {
311        return _value.getFromTime();
312    }
313    
314    public void setFromTime(Long fromTime)
315            throws PersistenceNotNullException, PersistenceReadOnlyException {
316        checkReadWrite();
317        _value.setFromTime(fromTime);
318    }
319    
320    public boolean getFromTimeHasBeenModified() {
321        return _value.getFromTimeHasBeenModified();
322    }
323    
324    public Long getThruTime() {
325        return _value.getThruTime();
326    }
327    
328    public void setThruTime(Long thruTime)
329            throws PersistenceNotNullException, PersistenceReadOnlyException {
330        checkReadWrite();
331        _value.setThruTime(thruTime);
332    }
333    
334    public boolean getThruTimeHasBeenModified() {
335        return _value.getThruTimeHasBeenModified();
336    }
337    
338}