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 * CommentDetail.java
021 */
022
023package com.echothree.model.data.comment.server.entity;
024
025import com.echothree.model.data.comment.common.pk.CommentDetailPK;
026
027import com.echothree.model.data.comment.common.pk.CommentPK;
028import com.echothree.model.data.comment.common.pk.CommentTypePK;
029import com.echothree.model.data.core.common.pk.EntityInstancePK;
030import com.echothree.model.data.party.common.pk.LanguagePK;
031import com.echothree.model.data.core.common.pk.MimeTypePK;
032
033import com.echothree.model.data.comment.server.entity.Comment;
034import com.echothree.model.data.comment.server.entity.CommentType;
035import com.echothree.model.data.core.server.entity.EntityInstance;
036import com.echothree.model.data.party.server.entity.Language;
037import com.echothree.model.data.core.server.entity.MimeType;
038
039import com.echothree.model.data.comment.server.factory.CommentFactory;
040import com.echothree.model.data.comment.server.factory.CommentTypeFactory;
041import com.echothree.model.data.core.server.factory.EntityInstanceFactory;
042import com.echothree.model.data.party.server.factory.LanguageFactory;
043import com.echothree.model.data.core.server.factory.MimeTypeFactory;
044
045import com.echothree.model.data.comment.common.pk.CommentDetailPK;
046
047import com.echothree.model.data.comment.server.value.CommentDetailValue;
048
049import com.echothree.model.data.comment.server.factory.CommentDetailFactory;
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 CommentDetail
068        extends BaseEntity
069        implements Serializable {
070    
071    private CommentDetailPK _pk;
072    private CommentDetailValue _value;
073    
074    /** Creates a new instance of CommentDetail */
075    public CommentDetail()
076            throws PersistenceException {
077        super();
078    }
079    
080    /** Creates a new instance of CommentDetail */
081    public CommentDetail(CommentDetailValue value, EntityPermission entityPermission) {
082        super(entityPermission);
083        
084        _value = value;
085        _pk = value.getPrimaryKey();
086    }
087    
088    @Override
089    public CommentDetailFactory getBaseFactoryInstance() {
090        return CommentDetailFactory.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 CommentDetail that) {
114            CommentDetailValue thatValue = that.getCommentDetailValue();
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 CommentDetailValue getCommentDetailValue() {
140        return _value;
141    }
142    
143    public void setCommentDetailValue(CommentDetailValue value)
144            throws PersistenceReadOnlyException {
145        checkReadWrite();
146        _value = value;
147    }
148    
149    @Override
150    public CommentDetailPK getPrimaryKey() {
151        return _pk;
152    }
153    
154    public CommentPK getCommentPK() {
155        return _value.getCommentPK();
156    }
157    
158    public Comment getComment(Session session, EntityPermission entityPermission) {
159        return CommentFactory.getInstance().getEntityFromPK(session, entityPermission, getCommentPK());
160    }
161    
162    public Comment getComment(EntityPermission entityPermission) {
163        return getComment(ThreadSession.currentSession(), entityPermission);
164    }
165    
166    public Comment getComment(Session session) {
167        return getComment(session, EntityPermission.READ_ONLY);
168    }
169    
170    public Comment getComment() {
171        return getComment(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
172    }
173    
174    public Comment getCommentForUpdate(Session session) {
175        return getComment(session, EntityPermission.READ_WRITE);
176    }
177    
178    public Comment getCommentForUpdate() {
179        return getComment(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
180    }
181    
182    public void setCommentPK(CommentPK commentPK)
183            throws PersistenceNotNullException, PersistenceReadOnlyException {
184        checkReadWrite();
185        _value.setCommentPK(commentPK);
186    }
187    
188    public void setComment(Comment entity) {
189        setCommentPK(entity == null? null: entity.getPrimaryKey());
190    }
191    
192    public boolean getCommentPKHasBeenModified() {
193        return _value.getCommentPKHasBeenModified();
194    }
195    
196    public String getCommentName() {
197        return _value.getCommentName();
198    }
199    
200    public void setCommentName(String commentName)
201            throws PersistenceNotNullException, PersistenceReadOnlyException {
202        checkReadWrite();
203        _value.setCommentName(commentName);
204    }
205    
206    public boolean getCommentNameHasBeenModified() {
207        return _value.getCommentNameHasBeenModified();
208    }
209    
210    public CommentTypePK getCommentTypePK() {
211        return _value.getCommentTypePK();
212    }
213    
214    public CommentType getCommentType(Session session, EntityPermission entityPermission) {
215        return CommentTypeFactory.getInstance().getEntityFromPK(session, entityPermission, getCommentTypePK());
216    }
217    
218    public CommentType getCommentType(EntityPermission entityPermission) {
219        return getCommentType(ThreadSession.currentSession(), entityPermission);
220    }
221    
222    public CommentType getCommentType(Session session) {
223        return getCommentType(session, EntityPermission.READ_ONLY);
224    }
225    
226    public CommentType getCommentType() {
227        return getCommentType(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
228    }
229    
230    public CommentType getCommentTypeForUpdate(Session session) {
231        return getCommentType(session, EntityPermission.READ_WRITE);
232    }
233    
234    public CommentType getCommentTypeForUpdate() {
235        return getCommentType(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
236    }
237    
238    public void setCommentTypePK(CommentTypePK commentTypePK)
239            throws PersistenceNotNullException, PersistenceReadOnlyException {
240        checkReadWrite();
241        _value.setCommentTypePK(commentTypePK);
242    }
243    
244    public void setCommentType(CommentType entity) {
245        setCommentTypePK(entity == null? null: entity.getPrimaryKey());
246    }
247    
248    public boolean getCommentTypePKHasBeenModified() {
249        return _value.getCommentTypePKHasBeenModified();
250    }
251    
252    public EntityInstancePK getCommentedEntityInstancePK() {
253        return _value.getCommentedEntityInstancePK();
254    }
255    
256    public EntityInstance getCommentedEntityInstance(Session session, EntityPermission entityPermission) {
257        return EntityInstanceFactory.getInstance().getEntityFromPK(session, entityPermission, getCommentedEntityInstancePK());
258    }
259    
260    public EntityInstance getCommentedEntityInstance(EntityPermission entityPermission) {
261        return getCommentedEntityInstance(ThreadSession.currentSession(), entityPermission);
262    }
263    
264    public EntityInstance getCommentedEntityInstance(Session session) {
265        return getCommentedEntityInstance(session, EntityPermission.READ_ONLY);
266    }
267    
268    public EntityInstance getCommentedEntityInstance() {
269        return getCommentedEntityInstance(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
270    }
271    
272    public EntityInstance getCommentedEntityInstanceForUpdate(Session session) {
273        return getCommentedEntityInstance(session, EntityPermission.READ_WRITE);
274    }
275    
276    public EntityInstance getCommentedEntityInstanceForUpdate() {
277        return getCommentedEntityInstance(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
278    }
279    
280    public void setCommentedEntityInstancePK(EntityInstancePK commentedEntityInstancePK)
281            throws PersistenceNotNullException, PersistenceReadOnlyException {
282        checkReadWrite();
283        _value.setCommentedEntityInstancePK(commentedEntityInstancePK);
284    }
285    
286    public void setCommentedEntityInstance(EntityInstance entity) {
287        setCommentedEntityInstancePK(entity == null? null: entity.getPrimaryKey());
288    }
289    
290    public boolean getCommentedEntityInstancePKHasBeenModified() {
291        return _value.getCommentedEntityInstancePKHasBeenModified();
292    }
293    
294    public EntityInstancePK getCommentedByEntityInstancePK() {
295        return _value.getCommentedByEntityInstancePK();
296    }
297    
298    public EntityInstance getCommentedByEntityInstance(Session session, EntityPermission entityPermission) {
299        return EntityInstanceFactory.getInstance().getEntityFromPK(session, entityPermission, getCommentedByEntityInstancePK());
300    }
301    
302    public EntityInstance getCommentedByEntityInstance(EntityPermission entityPermission) {
303        return getCommentedByEntityInstance(ThreadSession.currentSession(), entityPermission);
304    }
305    
306    public EntityInstance getCommentedByEntityInstance(Session session) {
307        return getCommentedByEntityInstance(session, EntityPermission.READ_ONLY);
308    }
309    
310    public EntityInstance getCommentedByEntityInstance() {
311        return getCommentedByEntityInstance(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
312    }
313    
314    public EntityInstance getCommentedByEntityInstanceForUpdate(Session session) {
315        return getCommentedByEntityInstance(session, EntityPermission.READ_WRITE);
316    }
317    
318    public EntityInstance getCommentedByEntityInstanceForUpdate() {
319        return getCommentedByEntityInstance(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
320    }
321    
322    public void setCommentedByEntityInstancePK(EntityInstancePK commentedByEntityInstancePK)
323            throws PersistenceNotNullException, PersistenceReadOnlyException {
324        checkReadWrite();
325        _value.setCommentedByEntityInstancePK(commentedByEntityInstancePK);
326    }
327    
328    public void setCommentedByEntityInstance(EntityInstance entity) {
329        setCommentedByEntityInstancePK(entity == null? null: entity.getPrimaryKey());
330    }
331    
332    public boolean getCommentedByEntityInstancePKHasBeenModified() {
333        return _value.getCommentedByEntityInstancePKHasBeenModified();
334    }
335    
336    public LanguagePK getLanguagePK() {
337        return _value.getLanguagePK();
338    }
339    
340    public Language getLanguage(Session session, EntityPermission entityPermission) {
341        return LanguageFactory.getInstance().getEntityFromPK(session, entityPermission, getLanguagePK());
342    }
343    
344    public Language getLanguage(EntityPermission entityPermission) {
345        return getLanguage(ThreadSession.currentSession(), entityPermission);
346    }
347    
348    public Language getLanguage(Session session) {
349        return getLanguage(session, EntityPermission.READ_ONLY);
350    }
351    
352    public Language getLanguage() {
353        return getLanguage(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
354    }
355    
356    public Language getLanguageForUpdate(Session session) {
357        return getLanguage(session, EntityPermission.READ_WRITE);
358    }
359    
360    public Language getLanguageForUpdate() {
361        return getLanguage(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
362    }
363    
364    public void setLanguagePK(LanguagePK languagePK)
365            throws PersistenceNotNullException, PersistenceReadOnlyException {
366        checkReadWrite();
367        _value.setLanguagePK(languagePK);
368    }
369    
370    public void setLanguage(Language entity) {
371        setLanguagePK(entity == null? null: entity.getPrimaryKey());
372    }
373    
374    public boolean getLanguagePKHasBeenModified() {
375        return _value.getLanguagePKHasBeenModified();
376    }
377    
378    public String getDescription() {
379        return _value.getDescription();
380    }
381    
382    public void setDescription(String description)
383            throws PersistenceNotNullException, PersistenceReadOnlyException {
384        checkReadWrite();
385        _value.setDescription(description);
386    }
387    
388    public boolean getDescriptionHasBeenModified() {
389        return _value.getDescriptionHasBeenModified();
390    }
391    
392    public MimeTypePK getMimeTypePK() {
393        return _value.getMimeTypePK();
394    }
395    
396    public MimeType getMimeType(Session session, EntityPermission entityPermission) {
397        MimeTypePK pk = getMimeTypePK();
398        MimeType entity = pk == null? null: MimeTypeFactory.getInstance().getEntityFromPK(session, entityPermission, pk);
399        
400        return entity;
401    }
402    
403    public MimeType getMimeType(EntityPermission entityPermission) {
404        return getMimeType(ThreadSession.currentSession(), entityPermission);
405    }
406    
407    public MimeType getMimeType(Session session) {
408        return getMimeType(session, EntityPermission.READ_ONLY);
409    }
410    
411    public MimeType getMimeType() {
412        return getMimeType(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
413    }
414    
415    public MimeType getMimeTypeForUpdate(Session session) {
416        return getMimeType(session, EntityPermission.READ_WRITE);
417    }
418    
419    public MimeType getMimeTypeForUpdate() {
420        return getMimeType(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
421    }
422    
423    public void setMimeTypePK(MimeTypePK mimeTypePK)
424            throws PersistenceNotNullException, PersistenceReadOnlyException {
425        checkReadWrite();
426        _value.setMimeTypePK(mimeTypePK);
427    }
428    
429    public void setMimeType(MimeType entity) {
430        setMimeTypePK(entity == null? null: entity.getPrimaryKey());
431    }
432    
433    public boolean getMimeTypePKHasBeenModified() {
434        return _value.getMimeTypePKHasBeenModified();
435    }
436    
437    public Long getFromTime() {
438        return _value.getFromTime();
439    }
440    
441    public void setFromTime(Long fromTime)
442            throws PersistenceNotNullException, PersistenceReadOnlyException {
443        checkReadWrite();
444        _value.setFromTime(fromTime);
445    }
446    
447    public boolean getFromTimeHasBeenModified() {
448        return _value.getFromTimeHasBeenModified();
449    }
450    
451    public Long getThruTime() {
452        return _value.getThruTime();
453    }
454    
455    public void setThruTime(Long thruTime)
456            throws PersistenceNotNullException, PersistenceReadOnlyException {
457        checkReadWrite();
458        _value.setThruTime(thruTime);
459    }
460    
461    public boolean getThruTimeHasBeenModified() {
462        return _value.getThruTimeHasBeenModified();
463    }
464    
465}