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