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 * ItemDescriptionDetail.java
021 */
022
023package com.echothree.model.data.item.server.entity;
024
025import com.echothree.model.data.item.common.pk.ItemDescriptionDetailPK;
026
027import com.echothree.model.data.item.common.pk.ItemDescriptionPK;
028import com.echothree.model.data.item.common.pk.ItemDescriptionTypePK;
029import com.echothree.model.data.item.common.pk.ItemPK;
030import com.echothree.model.data.party.common.pk.LanguagePK;
031import com.echothree.model.data.core.common.pk.MimeTypePK;
032
033import com.echothree.model.data.item.server.entity.ItemDescription;
034import com.echothree.model.data.item.server.entity.ItemDescriptionType;
035import com.echothree.model.data.item.server.entity.Item;
036import com.echothree.model.data.party.server.entity.Language;
037import com.echothree.model.data.core.server.entity.MimeType;
038
039import com.echothree.model.data.item.server.factory.ItemDescriptionFactory;
040import com.echothree.model.data.item.server.factory.ItemDescriptionTypeFactory;
041import com.echothree.model.data.item.server.factory.ItemFactory;
042import com.echothree.model.data.party.server.factory.LanguageFactory;
043import com.echothree.model.data.core.server.factory.MimeTypeFactory;
044
045import com.echothree.model.data.item.common.pk.ItemDescriptionDetailPK;
046
047import com.echothree.model.data.item.server.value.ItemDescriptionDetailValue;
048
049import com.echothree.model.data.item.server.factory.ItemDescriptionDetailFactory;
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 ItemDescriptionDetail
068        extends BaseEntity
069        implements Serializable {
070    
071    private ItemDescriptionDetailPK _pk;
072    private ItemDescriptionDetailValue _value;
073    
074    /** Creates a new instance of ItemDescriptionDetail */
075    public ItemDescriptionDetail()
076            throws PersistenceException {
077        super();
078    }
079    
080    /** Creates a new instance of ItemDescriptionDetail */
081    public ItemDescriptionDetail(ItemDescriptionDetailValue value, EntityPermission entityPermission) {
082        super(entityPermission);
083        
084        _value = value;
085        _pk = value.getPrimaryKey();
086    }
087    
088    @Override
089    public ItemDescriptionDetailFactory getBaseFactoryInstance() {
090        return ItemDescriptionDetailFactory.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 ItemDescriptionDetail) {
114            ItemDescriptionDetail that = (ItemDescriptionDetail)other;
115            
116            ItemDescriptionDetailValue thatValue = that.getItemDescriptionDetailValue();
117            return _value.equals(thatValue);
118        } else {
119            return false;
120        }
121    }
122    
123    @Override
124    public void store(Session session)
125            throws PersistenceDatabaseException {
126        getBaseFactoryInstance().store(session, this);
127    }
128    
129    @Override
130    public void remove(Session session)
131            throws PersistenceDatabaseException {
132        getBaseFactoryInstance().remove(session, this);
133    }
134    
135    @Override
136    public void remove()
137            throws PersistenceDatabaseException {
138        getBaseFactoryInstance().remove(ThreadSession.currentSession(), this);
139    }
140    
141    public ItemDescriptionDetailValue getItemDescriptionDetailValue() {
142        return _value;
143    }
144    
145    public void setItemDescriptionDetailValue(ItemDescriptionDetailValue value)
146            throws PersistenceReadOnlyException {
147        checkReadWrite();
148        _value = value;
149    }
150    
151    @Override
152    public ItemDescriptionDetailPK getPrimaryKey() {
153        return _pk;
154    }
155    
156    public ItemDescriptionPK getItemDescriptionPK() {
157        return _value.getItemDescriptionPK();
158    }
159    
160    public ItemDescription getItemDescription(Session session, EntityPermission entityPermission) {
161        return ItemDescriptionFactory.getInstance().getEntityFromPK(session, entityPermission, getItemDescriptionPK());
162    }
163    
164    public ItemDescription getItemDescription(EntityPermission entityPermission) {
165        return getItemDescription(ThreadSession.currentSession(), entityPermission);
166    }
167    
168    public ItemDescription getItemDescription(Session session) {
169        return getItemDescription(session, EntityPermission.READ_ONLY);
170    }
171    
172    public ItemDescription getItemDescription() {
173        return getItemDescription(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
174    }
175    
176    public ItemDescription getItemDescriptionForUpdate(Session session) {
177        return getItemDescription(session, EntityPermission.READ_WRITE);
178    }
179    
180    public ItemDescription getItemDescriptionForUpdate() {
181        return getItemDescription(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
182    }
183    
184    public void setItemDescriptionPK(ItemDescriptionPK itemDescriptionPK)
185            throws PersistenceNotNullException, PersistenceReadOnlyException {
186        checkReadWrite();
187        _value.setItemDescriptionPK(itemDescriptionPK);
188    }
189    
190    public void setItemDescription(ItemDescription entity) {
191        setItemDescriptionPK(entity == null? null: entity.getPrimaryKey());
192    }
193    
194    public boolean getItemDescriptionPKHasBeenModified() {
195        return _value.getItemDescriptionPKHasBeenModified();
196    }
197    
198    public ItemDescriptionTypePK getItemDescriptionTypePK() {
199        return _value.getItemDescriptionTypePK();
200    }
201    
202    public ItemDescriptionType getItemDescriptionType(Session session, EntityPermission entityPermission) {
203        return ItemDescriptionTypeFactory.getInstance().getEntityFromPK(session, entityPermission, getItemDescriptionTypePK());
204    }
205    
206    public ItemDescriptionType getItemDescriptionType(EntityPermission entityPermission) {
207        return getItemDescriptionType(ThreadSession.currentSession(), entityPermission);
208    }
209    
210    public ItemDescriptionType getItemDescriptionType(Session session) {
211        return getItemDescriptionType(session, EntityPermission.READ_ONLY);
212    }
213    
214    public ItemDescriptionType getItemDescriptionType() {
215        return getItemDescriptionType(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
216    }
217    
218    public ItemDescriptionType getItemDescriptionTypeForUpdate(Session session) {
219        return getItemDescriptionType(session, EntityPermission.READ_WRITE);
220    }
221    
222    public ItemDescriptionType getItemDescriptionTypeForUpdate() {
223        return getItemDescriptionType(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
224    }
225    
226    public void setItemDescriptionTypePK(ItemDescriptionTypePK itemDescriptionTypePK)
227            throws PersistenceNotNullException, PersistenceReadOnlyException {
228        checkReadWrite();
229        _value.setItemDescriptionTypePK(itemDescriptionTypePK);
230    }
231    
232    public void setItemDescriptionType(ItemDescriptionType entity) {
233        setItemDescriptionTypePK(entity == null? null: entity.getPrimaryKey());
234    }
235    
236    public boolean getItemDescriptionTypePKHasBeenModified() {
237        return _value.getItemDescriptionTypePKHasBeenModified();
238    }
239    
240    public ItemPK getItemPK() {
241        return _value.getItemPK();
242    }
243    
244    public Item getItem(Session session, EntityPermission entityPermission) {
245        return ItemFactory.getInstance().getEntityFromPK(session, entityPermission, getItemPK());
246    }
247    
248    public Item getItem(EntityPermission entityPermission) {
249        return getItem(ThreadSession.currentSession(), entityPermission);
250    }
251    
252    public Item getItem(Session session) {
253        return getItem(session, EntityPermission.READ_ONLY);
254    }
255    
256    public Item getItem() {
257        return getItem(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
258    }
259    
260    public Item getItemForUpdate(Session session) {
261        return getItem(session, EntityPermission.READ_WRITE);
262    }
263    
264    public Item getItemForUpdate() {
265        return getItem(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
266    }
267    
268    public void setItemPK(ItemPK itemPK)
269            throws PersistenceNotNullException, PersistenceReadOnlyException {
270        checkReadWrite();
271        _value.setItemPK(itemPK);
272    }
273    
274    public void setItem(Item entity) {
275        setItemPK(entity == null? null: entity.getPrimaryKey());
276    }
277    
278    public boolean getItemPKHasBeenModified() {
279        return _value.getItemPKHasBeenModified();
280    }
281    
282    public LanguagePK getLanguagePK() {
283        return _value.getLanguagePK();
284    }
285    
286    public Language getLanguage(Session session, EntityPermission entityPermission) {
287        return LanguageFactory.getInstance().getEntityFromPK(session, entityPermission, getLanguagePK());
288    }
289    
290    public Language getLanguage(EntityPermission entityPermission) {
291        return getLanguage(ThreadSession.currentSession(), entityPermission);
292    }
293    
294    public Language getLanguage(Session session) {
295        return getLanguage(session, EntityPermission.READ_ONLY);
296    }
297    
298    public Language getLanguage() {
299        return getLanguage(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
300    }
301    
302    public Language getLanguageForUpdate(Session session) {
303        return getLanguage(session, EntityPermission.READ_WRITE);
304    }
305    
306    public Language getLanguageForUpdate() {
307        return getLanguage(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
308    }
309    
310    public void setLanguagePK(LanguagePK languagePK)
311            throws PersistenceNotNullException, PersistenceReadOnlyException {
312        checkReadWrite();
313        _value.setLanguagePK(languagePK);
314    }
315    
316    public void setLanguage(Language entity) {
317        setLanguagePK(entity == null? null: entity.getPrimaryKey());
318    }
319    
320    public boolean getLanguagePKHasBeenModified() {
321        return _value.getLanguagePKHasBeenModified();
322    }
323    
324    public MimeTypePK getMimeTypePK() {
325        return _value.getMimeTypePK();
326    }
327    
328    public MimeType getMimeType(Session session, EntityPermission entityPermission) {
329        MimeTypePK pk = getMimeTypePK();
330        MimeType entity = pk == null? null: MimeTypeFactory.getInstance().getEntityFromPK(session, entityPermission, pk);
331        
332        return entity;
333    }
334    
335    public MimeType getMimeType(EntityPermission entityPermission) {
336        return getMimeType(ThreadSession.currentSession(), entityPermission);
337    }
338    
339    public MimeType getMimeType(Session session) {
340        return getMimeType(session, EntityPermission.READ_ONLY);
341    }
342    
343    public MimeType getMimeType() {
344        return getMimeType(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
345    }
346    
347    public MimeType getMimeTypeForUpdate(Session session) {
348        return getMimeType(session, EntityPermission.READ_WRITE);
349    }
350    
351    public MimeType getMimeTypeForUpdate() {
352        return getMimeType(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
353    }
354    
355    public void setMimeTypePK(MimeTypePK mimeTypePK)
356            throws PersistenceNotNullException, PersistenceReadOnlyException {
357        checkReadWrite();
358        _value.setMimeTypePK(mimeTypePK);
359    }
360    
361    public void setMimeType(MimeType entity) {
362        setMimeTypePK(entity == null? null: entity.getPrimaryKey());
363    }
364    
365    public boolean getMimeTypePKHasBeenModified() {
366        return _value.getMimeTypePKHasBeenModified();
367    }
368    
369    public Long getFromTime() {
370        return _value.getFromTime();
371    }
372    
373    public void setFromTime(Long fromTime)
374            throws PersistenceNotNullException, PersistenceReadOnlyException {
375        checkReadWrite();
376        _value.setFromTime(fromTime);
377    }
378    
379    public boolean getFromTimeHasBeenModified() {
380        return _value.getFromTimeHasBeenModified();
381    }
382    
383    public Long getThruTime() {
384        return _value.getThruTime();
385    }
386    
387    public void setThruTime(Long thruTime)
388            throws PersistenceNotNullException, PersistenceReadOnlyException {
389        checkReadWrite();
390        _value.setThruTime(thruTime);
391    }
392    
393    public boolean getThruTimeHasBeenModified() {
394        return _value.getThruTimeHasBeenModified();
395    }
396    
397}