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 * 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) {
111            ItemAdditionalCharge that = (ItemAdditionalCharge)other;
112            
113            ItemAdditionalChargeValue thatValue = that.getItemAdditionalChargeValue();
114            return _value.equals(thatValue);
115        } else {
116            return false;
117        }
118    }
119    
120    @Override
121    public void store(Session session)
122            throws PersistenceDatabaseException {
123        getBaseFactoryInstance().store(session, this);
124    }
125    
126    @Override
127    public void remove(Session session)
128            throws PersistenceDatabaseException {
129        getBaseFactoryInstance().remove(session, this);
130    }
131    
132    @Override
133    public void remove()
134            throws PersistenceDatabaseException {
135        getBaseFactoryInstance().remove(ThreadSession.currentSession(), this);
136    }
137    
138    public ItemAdditionalChargeValue getItemAdditionalChargeValue() {
139        return _value;
140    }
141    
142    public void setItemAdditionalChargeValue(ItemAdditionalChargeValue value)
143            throws PersistenceReadOnlyException {
144        checkReadWrite();
145        _value = value;
146    }
147    
148    @Override
149    public ItemAdditionalChargePK getPrimaryKey() {
150        return _pk;
151    }
152    
153    public ItemPK getItemPK() {
154        return _value.getItemPK();
155    }
156    
157    public Item getItem(Session session, EntityPermission entityPermission) {
158        return ItemFactory.getInstance().getEntityFromPK(session, entityPermission, getItemPK());
159    }
160    
161    public Item getItem(EntityPermission entityPermission) {
162        return getItem(ThreadSession.currentSession(), entityPermission);
163    }
164    
165    public Item getItem(Session session) {
166        return getItem(session, EntityPermission.READ_ONLY);
167    }
168    
169    public Item getItem() {
170        return getItem(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
171    }
172    
173    public Item getItemForUpdate(Session session) {
174        return getItem(session, EntityPermission.READ_WRITE);
175    }
176    
177    public Item getItemForUpdate() {
178        return getItem(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
179    }
180    
181    public void setItemPK(ItemPK itemPK)
182            throws PersistenceNotNullException, PersistenceReadOnlyException {
183        checkReadWrite();
184        _value.setItemPK(itemPK);
185    }
186    
187    public void setItem(Item entity) {
188        setItemPK(entity == null? null: entity.getPrimaryKey());
189    }
190    
191    public boolean getItemPKHasBeenModified() {
192        return _value.getItemPKHasBeenModified();
193    }
194    
195    public ItemAdditionalChargeTypePK getItemAdditionalChargeTypePK() {
196        return _value.getItemAdditionalChargeTypePK();
197    }
198    
199    public ItemAdditionalChargeType getItemAdditionalChargeType(Session session, EntityPermission entityPermission) {
200        return ItemAdditionalChargeTypeFactory.getInstance().getEntityFromPK(session, entityPermission, getItemAdditionalChargeTypePK());
201    }
202    
203    public ItemAdditionalChargeType getItemAdditionalChargeType(EntityPermission entityPermission) {
204        return getItemAdditionalChargeType(ThreadSession.currentSession(), entityPermission);
205    }
206    
207    public ItemAdditionalChargeType getItemAdditionalChargeType(Session session) {
208        return getItemAdditionalChargeType(session, EntityPermission.READ_ONLY);
209    }
210    
211    public ItemAdditionalChargeType getItemAdditionalChargeType() {
212        return getItemAdditionalChargeType(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
213    }
214    
215    public ItemAdditionalChargeType getItemAdditionalChargeTypeForUpdate(Session session) {
216        return getItemAdditionalChargeType(session, EntityPermission.READ_WRITE);
217    }
218    
219    public ItemAdditionalChargeType getItemAdditionalChargeTypeForUpdate() {
220        return getItemAdditionalChargeType(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
221    }
222    
223    public void setItemAdditionalChargeTypePK(ItemAdditionalChargeTypePK itemAdditionalChargeTypePK)
224            throws PersistenceNotNullException, PersistenceReadOnlyException {
225        checkReadWrite();
226        _value.setItemAdditionalChargeTypePK(itemAdditionalChargeTypePK);
227    }
228    
229    public void setItemAdditionalChargeType(ItemAdditionalChargeType entity) {
230        setItemAdditionalChargeTypePK(entity == null? null: entity.getPrimaryKey());
231    }
232    
233    public boolean getItemAdditionalChargeTypePKHasBeenModified() {
234        return _value.getItemAdditionalChargeTypePKHasBeenModified();
235    }
236    
237    public UnitOfMeasureTypePK getUnitOfMeasureTypePK() {
238        return _value.getUnitOfMeasureTypePK();
239    }
240    
241    public UnitOfMeasureType getUnitOfMeasureType(Session session, EntityPermission entityPermission) {
242        UnitOfMeasureTypePK pk = getUnitOfMeasureTypePK();
243        UnitOfMeasureType entity = pk == null? null: UnitOfMeasureTypeFactory.getInstance().getEntityFromPK(session, entityPermission, pk);
244        
245        return entity;
246    }
247    
248    public UnitOfMeasureType getUnitOfMeasureType(EntityPermission entityPermission) {
249        return getUnitOfMeasureType(ThreadSession.currentSession(), entityPermission);
250    }
251    
252    public UnitOfMeasureType getUnitOfMeasureType(Session session) {
253        return getUnitOfMeasureType(session, EntityPermission.READ_ONLY);
254    }
255    
256    public UnitOfMeasureType getUnitOfMeasureType() {
257        return getUnitOfMeasureType(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
258    }
259    
260    public UnitOfMeasureType getUnitOfMeasureTypeForUpdate(Session session) {
261        return getUnitOfMeasureType(session, EntityPermission.READ_WRITE);
262    }
263    
264    public UnitOfMeasureType getUnitOfMeasureTypeForUpdate() {
265        return getUnitOfMeasureType(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
266    }
267    
268    public void setUnitOfMeasureTypePK(UnitOfMeasureTypePK unitOfMeasureTypePK)
269            throws PersistenceNotNullException, PersistenceReadOnlyException {
270        checkReadWrite();
271        _value.setUnitOfMeasureTypePK(unitOfMeasureTypePK);
272    }
273    
274    public void setUnitOfMeasureType(UnitOfMeasureType entity) {
275        setUnitOfMeasureTypePK(entity == null? null: entity.getPrimaryKey());
276    }
277    
278    public boolean getUnitOfMeasureTypePKHasBeenModified() {
279        return _value.getUnitOfMeasureTypePKHasBeenModified();
280    }
281    
282    public Long getMinimumQuantity() {
283        return _value.getMinimumQuantity();
284    }
285    
286    public void setMinimumQuantity(Long minimumQuantity)
287            throws PersistenceNotNullException, PersistenceReadOnlyException {
288        checkReadWrite();
289        _value.setMinimumQuantity(minimumQuantity);
290    }
291    
292    public boolean getMinimumQuantityHasBeenModified() {
293        return _value.getMinimumQuantityHasBeenModified();
294    }
295    
296    public Long getMaximumQuantity() {
297        return _value.getMaximumQuantity();
298    }
299    
300    public void setMaximumQuantity(Long maximumQuantity)
301            throws PersistenceNotNullException, PersistenceReadOnlyException {
302        checkReadWrite();
303        _value.setMaximumQuantity(maximumQuantity);
304    }
305    
306    public boolean getMaximumQuantityHasBeenModified() {
307        return _value.getMaximumQuantityHasBeenModified();
308    }
309    
310    public CurrencyPK getCurrencyPK() {
311        return _value.getCurrencyPK();
312    }
313    
314    public Currency getCurrency(Session session, EntityPermission entityPermission) {
315        return CurrencyFactory.getInstance().getEntityFromPK(session, entityPermission, getCurrencyPK());
316    }
317    
318    public Currency getCurrency(EntityPermission entityPermission) {
319        return getCurrency(ThreadSession.currentSession(), entityPermission);
320    }
321    
322    public Currency getCurrency(Session session) {
323        return getCurrency(session, EntityPermission.READ_ONLY);
324    }
325    
326    public Currency getCurrency() {
327        return getCurrency(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
328    }
329    
330    public Currency getCurrencyForUpdate(Session session) {
331        return getCurrency(session, EntityPermission.READ_WRITE);
332    }
333    
334    public Currency getCurrencyForUpdate() {
335        return getCurrency(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
336    }
337    
338    public void setCurrencyPK(CurrencyPK currencyPK)
339            throws PersistenceNotNullException, PersistenceReadOnlyException {
340        checkReadWrite();
341        _value.setCurrencyPK(currencyPK);
342    }
343    
344    public void setCurrency(Currency entity) {
345        setCurrencyPK(entity == null? null: entity.getPrimaryKey());
346    }
347    
348    public boolean getCurrencyPKHasBeenModified() {
349        return _value.getCurrencyPKHasBeenModified();
350    }
351    
352    public Long getUnitPrice() {
353        return _value.getUnitPrice();
354    }
355    
356    public void setUnitPrice(Long unitPrice)
357            throws PersistenceNotNullException, PersistenceReadOnlyException {
358        checkReadWrite();
359        _value.setUnitPrice(unitPrice);
360    }
361    
362    public boolean getUnitPriceHasBeenModified() {
363        return _value.getUnitPriceHasBeenModified();
364    }
365    
366    public Long getFromTime() {
367        return _value.getFromTime();
368    }
369    
370    public void setFromTime(Long fromTime)
371            throws PersistenceNotNullException, PersistenceReadOnlyException {
372        checkReadWrite();
373        _value.setFromTime(fromTime);
374    }
375    
376    public boolean getFromTimeHasBeenModified() {
377        return _value.getFromTimeHasBeenModified();
378    }
379    
380    public Long getThruTime() {
381        return _value.getThruTime();
382    }
383    
384    public void setThruTime(Long thruTime)
385            throws PersistenceNotNullException, PersistenceReadOnlyException {
386        checkReadWrite();
387        _value.setThruTime(thruTime);
388    }
389    
390    public boolean getThruTimeHasBeenModified() {
391        return _value.getThruTimeHasBeenModified();
392    }
393    
394}