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 * 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()
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 CommentDetailValue getCommentDetailValue() {
134        return _value;
135    }
136    
137    public void setCommentDetailValue(CommentDetailValue value)
138            throws PersistenceReadOnlyException {
139        checkReadWrite();
140        _value = value;
141    }
142    
143    @Override
144    public CommentDetailPK getPrimaryKey() {
145        return _pk;
146    }
147    
148    public CommentPK getCommentPK() {
149        return _value.getCommentPK();
150    }
151    
152    public Comment getComment(EntityPermission entityPermission) {
153        return CommentFactory.getInstance().getEntityFromPK(entityPermission, getCommentPK());
154    }
155    
156    public Comment getComment() {
157        return getComment(EntityPermission.READ_ONLY);
158    }
159    
160    public Comment getCommentForUpdate() {
161        return getComment(EntityPermission.READ_WRITE);
162    }
163    
164    public void setCommentPK(CommentPK commentPK)
165            throws PersistenceNotNullException, PersistenceReadOnlyException {
166        checkReadWrite();
167        _value.setCommentPK(commentPK);
168    }
169    
170    public void setComment(Comment entity) {
171        setCommentPK(entity == null? null: entity.getPrimaryKey());
172    }
173    
174    public boolean getCommentPKHasBeenModified() {
175        return _value.getCommentPKHasBeenModified();
176    }
177    
178    public String getCommentName() {
179        return _value.getCommentName();
180    }
181    
182    public void setCommentName(String commentName)
183            throws PersistenceNotNullException, PersistenceReadOnlyException {
184        checkReadWrite();
185        _value.setCommentName(commentName);
186    }
187    
188    public boolean getCommentNameHasBeenModified() {
189        return _value.getCommentNameHasBeenModified();
190    }
191    
192    public CommentTypePK getCommentTypePK() {
193        return _value.getCommentTypePK();
194    }
195    
196    public CommentType getCommentType(EntityPermission entityPermission) {
197        return CommentTypeFactory.getInstance().getEntityFromPK(entityPermission, getCommentTypePK());
198    }
199    
200    public CommentType getCommentType() {
201        return getCommentType(EntityPermission.READ_ONLY);
202    }
203    
204    public CommentType getCommentTypeForUpdate() {
205        return getCommentType(EntityPermission.READ_WRITE);
206    }
207    
208    public void setCommentTypePK(CommentTypePK commentTypePK)
209            throws PersistenceNotNullException, PersistenceReadOnlyException {
210        checkReadWrite();
211        _value.setCommentTypePK(commentTypePK);
212    }
213    
214    public void setCommentType(CommentType entity) {
215        setCommentTypePK(entity == null? null: entity.getPrimaryKey());
216    }
217    
218    public boolean getCommentTypePKHasBeenModified() {
219        return _value.getCommentTypePKHasBeenModified();
220    }
221    
222    public EntityInstancePK getCommentedEntityInstancePK() {
223        return _value.getCommentedEntityInstancePK();
224    }
225    
226    public EntityInstance getCommentedEntityInstance(EntityPermission entityPermission) {
227        return EntityInstanceFactory.getInstance().getEntityFromPK(entityPermission, getCommentedEntityInstancePK());
228    }
229    
230    public EntityInstance getCommentedEntityInstance() {
231        return getCommentedEntityInstance(EntityPermission.READ_ONLY);
232    }
233    
234    public EntityInstance getCommentedEntityInstanceForUpdate() {
235        return getCommentedEntityInstance(EntityPermission.READ_WRITE);
236    }
237    
238    public void setCommentedEntityInstancePK(EntityInstancePK commentedEntityInstancePK)
239            throws PersistenceNotNullException, PersistenceReadOnlyException {
240        checkReadWrite();
241        _value.setCommentedEntityInstancePK(commentedEntityInstancePK);
242    }
243    
244    public void setCommentedEntityInstance(EntityInstance entity) {
245        setCommentedEntityInstancePK(entity == null? null: entity.getPrimaryKey());
246    }
247    
248    public boolean getCommentedEntityInstancePKHasBeenModified() {
249        return _value.getCommentedEntityInstancePKHasBeenModified();
250    }
251    
252    public EntityInstancePK getCommentedByEntityInstancePK() {
253        return _value.getCommentedByEntityInstancePK();
254    }
255    
256    public EntityInstance getCommentedByEntityInstance(EntityPermission entityPermission) {
257        return EntityInstanceFactory.getInstance().getEntityFromPK(entityPermission, getCommentedByEntityInstancePK());
258    }
259    
260    public EntityInstance getCommentedByEntityInstance() {
261        return getCommentedByEntityInstance(EntityPermission.READ_ONLY);
262    }
263    
264    public EntityInstance getCommentedByEntityInstanceForUpdate() {
265        return getCommentedByEntityInstance(EntityPermission.READ_WRITE);
266    }
267    
268    public void setCommentedByEntityInstancePK(EntityInstancePK commentedByEntityInstancePK)
269            throws PersistenceNotNullException, PersistenceReadOnlyException {
270        checkReadWrite();
271        _value.setCommentedByEntityInstancePK(commentedByEntityInstancePK);
272    }
273    
274    public void setCommentedByEntityInstance(EntityInstance entity) {
275        setCommentedByEntityInstancePK(entity == null? null: entity.getPrimaryKey());
276    }
277    
278    public boolean getCommentedByEntityInstancePKHasBeenModified() {
279        return _value.getCommentedByEntityInstancePKHasBeenModified();
280    }
281    
282    public LanguagePK getLanguagePK() {
283        return _value.getLanguagePK();
284    }
285    
286    public Language getLanguage(EntityPermission entityPermission) {
287        return LanguageFactory.getInstance().getEntityFromPK(entityPermission, getLanguagePK());
288    }
289    
290    public Language getLanguage() {
291        return getLanguage(EntityPermission.READ_ONLY);
292    }
293    
294    public Language getLanguageForUpdate() {
295        return getLanguage(EntityPermission.READ_WRITE);
296    }
297    
298    public void setLanguagePK(LanguagePK languagePK)
299            throws PersistenceNotNullException, PersistenceReadOnlyException {
300        checkReadWrite();
301        _value.setLanguagePK(languagePK);
302    }
303    
304    public void setLanguage(Language entity) {
305        setLanguagePK(entity == null? null: entity.getPrimaryKey());
306    }
307    
308    public boolean getLanguagePKHasBeenModified() {
309        return _value.getLanguagePKHasBeenModified();
310    }
311    
312    public String getDescription() {
313        return _value.getDescription();
314    }
315    
316    public void setDescription(String description)
317            throws PersistenceNotNullException, PersistenceReadOnlyException {
318        checkReadWrite();
319        _value.setDescription(description);
320    }
321    
322    public boolean getDescriptionHasBeenModified() {
323        return _value.getDescriptionHasBeenModified();
324    }
325    
326    public MimeTypePK getMimeTypePK() {
327        return _value.getMimeTypePK();
328    }
329    
330    public MimeType getMimeType(EntityPermission entityPermission) {
331        MimeTypePK pk = getMimeTypePK();
332        MimeType entity = pk == null? null: MimeTypeFactory.getInstance().getEntityFromPK(entityPermission, pk);
333        
334        return entity;
335    }
336    
337    public MimeType getMimeType() {
338        return getMimeType(EntityPermission.READ_ONLY);
339    }
340    
341    public MimeType getMimeTypeForUpdate() {
342        return getMimeType(EntityPermission.READ_WRITE);
343    }
344    
345    public void setMimeTypePK(MimeTypePK mimeTypePK)
346            throws PersistenceNotNullException, PersistenceReadOnlyException {
347        checkReadWrite();
348        _value.setMimeTypePK(mimeTypePK);
349    }
350    
351    public void setMimeType(MimeType entity) {
352        setMimeTypePK(entity == null? null: entity.getPrimaryKey());
353    }
354    
355    public boolean getMimeTypePKHasBeenModified() {
356        return _value.getMimeTypePKHasBeenModified();
357    }
358    
359    public Long getFromTime() {
360        return _value.getFromTime();
361    }
362    
363    public void setFromTime(Long fromTime)
364            throws PersistenceNotNullException, PersistenceReadOnlyException {
365        checkReadWrite();
366        _value.setFromTime(fromTime);
367    }
368    
369    public boolean getFromTimeHasBeenModified() {
370        return _value.getFromTimeHasBeenModified();
371    }
372    
373    public Long getThruTime() {
374        return _value.getThruTime();
375    }
376    
377    public void setThruTime(Long thruTime)
378            throws PersistenceNotNullException, PersistenceReadOnlyException {
379        checkReadWrite();
380        _value.setThruTime(thruTime);
381    }
382    
383    public boolean getThruTimeHasBeenModified() {
384        return _value.getThruTimeHasBeenModified();
385    }
386    
387}