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 * ItemUnitPriceLimit.java
021 */
022
023package com.echothree.model.data.item.server.entity;
024
025import com.echothree.model.data.item.common.pk.ItemUnitPriceLimitPK;
026
027import com.echothree.model.data.item.common.pk.ItemPK;
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.item.server.entity.Item;
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.item.server.factory.ItemFactory;
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.item.common.pk.ItemUnitPriceLimitPK;
043
044import com.echothree.model.data.item.server.value.ItemUnitPriceLimitValue;
045
046import com.echothree.model.data.item.server.factory.ItemUnitPriceLimitFactory;
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 ItemUnitPriceLimit
065        extends BaseEntity
066        implements Serializable {
067    
068    private ItemUnitPriceLimitPK _pk;
069    private ItemUnitPriceLimitValue _value;
070    
071    /** Creates a new instance of ItemUnitPriceLimit */
072    public ItemUnitPriceLimit()
073            throws PersistenceException {
074        super();
075    }
076    
077    /** Creates a new instance of ItemUnitPriceLimit */
078    public ItemUnitPriceLimit(ItemUnitPriceLimitValue value, EntityPermission entityPermission) {
079        super(entityPermission);
080        
081        _value = value;
082        _pk = value.getPrimaryKey();
083    }
084    
085    @Override
086    public ItemUnitPriceLimitFactory getBaseFactoryInstance() {
087        return ItemUnitPriceLimitFactory.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 ItemUnitPriceLimit) {
111            ItemUnitPriceLimit that = (ItemUnitPriceLimit)other;
112            
113            ItemUnitPriceLimitValue thatValue = that.getItemUnitPriceLimitValue();
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 ItemUnitPriceLimitValue getItemUnitPriceLimitValue() {
139        return _value;
140    }
141    
142    public void setItemUnitPriceLimitValue(ItemUnitPriceLimitValue value)
143            throws PersistenceReadOnlyException {
144        checkReadWrite();
145        _value = value;
146    }
147    
148    @Override
149    public ItemUnitPriceLimitPK 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 InventoryConditionPK getInventoryConditionPK() {
196        return _value.getInventoryConditionPK();
197    }
198    
199    public InventoryCondition getInventoryCondition(Session session, EntityPermission entityPermission) {
200        return InventoryConditionFactory.getInstance().getEntityFromPK(session, entityPermission, getInventoryConditionPK());
201    }
202    
203    public InventoryCondition getInventoryCondition(EntityPermission entityPermission) {
204        return getInventoryCondition(ThreadSession.currentSession(), entityPermission);
205    }
206    
207    public InventoryCondition getInventoryCondition(Session session) {
208        return getInventoryCondition(session, EntityPermission.READ_ONLY);
209    }
210    
211    public InventoryCondition getInventoryCondition() {
212        return getInventoryCondition(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
213    }
214    
215    public InventoryCondition getInventoryConditionForUpdate(Session session) {
216        return getInventoryCondition(session, EntityPermission.READ_WRITE);
217    }
218    
219    public InventoryCondition getInventoryConditionForUpdate() {
220        return getInventoryCondition(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
221    }
222    
223    public void setInventoryConditionPK(InventoryConditionPK inventoryConditionPK)
224            throws PersistenceNotNullException, PersistenceReadOnlyException {
225        checkReadWrite();
226        _value.setInventoryConditionPK(inventoryConditionPK);
227    }
228    
229    public void setInventoryCondition(InventoryCondition entity) {
230        setInventoryConditionPK(entity == null? null: entity.getPrimaryKey());
231    }
232    
233    public boolean getInventoryConditionPKHasBeenModified() {
234        return _value.getInventoryConditionPKHasBeenModified();
235    }
236    
237    public UnitOfMeasureTypePK getUnitOfMeasureTypePK() {
238        return _value.getUnitOfMeasureTypePK();
239    }
240    
241    public UnitOfMeasureType getUnitOfMeasureType(Session session, EntityPermission entityPermission) {
242        return UnitOfMeasureTypeFactory.getInstance().getEntityFromPK(session, entityPermission, getUnitOfMeasureTypePK());
243    }
244    
245    public UnitOfMeasureType getUnitOfMeasureType(EntityPermission entityPermission) {
246        return getUnitOfMeasureType(ThreadSession.currentSession(), entityPermission);
247    }
248    
249    public UnitOfMeasureType getUnitOfMeasureType(Session session) {
250        return getUnitOfMeasureType(session, EntityPermission.READ_ONLY);
251    }
252    
253    public UnitOfMeasureType getUnitOfMeasureType() {
254        return getUnitOfMeasureType(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
255    }
256    
257    public UnitOfMeasureType getUnitOfMeasureTypeForUpdate(Session session) {
258        return getUnitOfMeasureType(session, EntityPermission.READ_WRITE);
259    }
260    
261    public UnitOfMeasureType getUnitOfMeasureTypeForUpdate() {
262        return getUnitOfMeasureType(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
263    }
264    
265    public void setUnitOfMeasureTypePK(UnitOfMeasureTypePK unitOfMeasureTypePK)
266            throws PersistenceNotNullException, PersistenceReadOnlyException {
267        checkReadWrite();
268        _value.setUnitOfMeasureTypePK(unitOfMeasureTypePK);
269    }
270    
271    public void setUnitOfMeasureType(UnitOfMeasureType entity) {
272        setUnitOfMeasureTypePK(entity == null? null: entity.getPrimaryKey());
273    }
274    
275    public boolean getUnitOfMeasureTypePKHasBeenModified() {
276        return _value.getUnitOfMeasureTypePKHasBeenModified();
277    }
278    
279    public CurrencyPK getCurrencyPK() {
280        return _value.getCurrencyPK();
281    }
282    
283    public Currency getCurrency(Session session, EntityPermission entityPermission) {
284        return CurrencyFactory.getInstance().getEntityFromPK(session, entityPermission, getCurrencyPK());
285    }
286    
287    public Currency getCurrency(EntityPermission entityPermission) {
288        return getCurrency(ThreadSession.currentSession(), entityPermission);
289    }
290    
291    public Currency getCurrency(Session session) {
292        return getCurrency(session, EntityPermission.READ_ONLY);
293    }
294    
295    public Currency getCurrency() {
296        return getCurrency(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
297    }
298    
299    public Currency getCurrencyForUpdate(Session session) {
300        return getCurrency(session, EntityPermission.READ_WRITE);
301    }
302    
303    public Currency getCurrencyForUpdate() {
304        return getCurrency(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
305    }
306    
307    public void setCurrencyPK(CurrencyPK currencyPK)
308            throws PersistenceNotNullException, PersistenceReadOnlyException {
309        checkReadWrite();
310        _value.setCurrencyPK(currencyPK);
311    }
312    
313    public void setCurrency(Currency entity) {
314        setCurrencyPK(entity == null? null: entity.getPrimaryKey());
315    }
316    
317    public boolean getCurrencyPKHasBeenModified() {
318        return _value.getCurrencyPKHasBeenModified();
319    }
320    
321    public Long getMinimumUnitPrice() {
322        return _value.getMinimumUnitPrice();
323    }
324    
325    public void setMinimumUnitPrice(Long minimumUnitPrice)
326            throws PersistenceNotNullException, PersistenceReadOnlyException {
327        checkReadWrite();
328        _value.setMinimumUnitPrice(minimumUnitPrice);
329    }
330    
331    public boolean getMinimumUnitPriceHasBeenModified() {
332        return _value.getMinimumUnitPriceHasBeenModified();
333    }
334    
335    public Long getMaximumUnitPrice() {
336        return _value.getMaximumUnitPrice();
337    }
338    
339    public void setMaximumUnitPrice(Long maximumUnitPrice)
340            throws PersistenceNotNullException, PersistenceReadOnlyException {
341        checkReadWrite();
342        _value.setMaximumUnitPrice(maximumUnitPrice);
343    }
344    
345    public boolean getMaximumUnitPriceHasBeenModified() {
346        return _value.getMaximumUnitPriceHasBeenModified();
347    }
348    
349    public Long getFromTime() {
350        return _value.getFromTime();
351    }
352    
353    public void setFromTime(Long fromTime)
354            throws PersistenceNotNullException, PersistenceReadOnlyException {
355        checkReadWrite();
356        _value.setFromTime(fromTime);
357    }
358    
359    public boolean getFromTimeHasBeenModified() {
360        return _value.getFromTimeHasBeenModified();
361    }
362    
363    public Long getThruTime() {
364        return _value.getThruTime();
365    }
366    
367    public void setThruTime(Long thruTime)
368            throws PersistenceNotNullException, PersistenceReadOnlyException {
369        checkReadWrite();
370        _value.setThruTime(thruTime);
371    }
372    
373    public boolean getThruTimeHasBeenModified() {
374        return _value.getThruTimeHasBeenModified();
375    }
376    
377}