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