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
067import javax.annotation.Nonnull;
068import javax.annotation.Nullable;
069
070public class CommentDetail
071        extends BaseEntity
072        implements Serializable {
073    
074    private CommentDetailPK _pk;
075    private CommentDetailValue _value;
076    
077    /** Creates a new instance of CommentDetail */
078    public CommentDetail()
079            throws PersistenceException {
080        super();
081    }
082    
083    /** Creates a new instance of CommentDetail */
084    public CommentDetail(CommentDetailValue value, EntityPermission entityPermission) {
085        super(entityPermission);
086        
087        _value = value;
088        _pk = value.getPrimaryKey();
089    }
090    
091    @Override
092    @Nonnull
093    public CommentDetailFactory getBaseFactoryInstance() {
094        return CommentDetailFactory.getInstance();
095    }
096    
097    @Override
098    public boolean hasBeenModified() {
099        return _value.hasBeenModified();
100    }
101    
102    @Override
103    public int hashCode() {
104        return _pk.hashCode();
105    }
106    
107    @Override
108    @Nonnull
109    public String toString() {
110        return _pk.toString();
111    }
112    
113    @Override
114    public boolean equals(Object other) {
115        if(this == other)
116            return true;
117        
118        if(other instanceof CommentDetail that) {
119            CommentDetailValue thatValue = that.getCommentDetailValue();
120            return _value.equals(thatValue);
121        } else {
122            return false;
123        }
124    }
125    
126    @Override
127    public void store()
128            throws PersistenceDatabaseException {
129        getBaseFactoryInstance().store(this);
130    }
131    
132    @Override
133    public void remove()
134            throws PersistenceDatabaseException {
135        getBaseFactoryInstance().remove(this);
136    }
137    
138    @Nonnull
139    public CommentDetailValue getCommentDetailValue() {
140        return _value;
141    }
142    
143    public void setCommentDetailValue(@Nonnull CommentDetailValue value)
144            throws PersistenceReadOnlyException {
145        checkReadWrite();
146        _value = value;
147    }
148    
149    @Override
150    @Nonnull
151    public CommentDetailPK getPrimaryKey() {
152        return _pk;
153    }
154    
155    @Nonnull
156    public CommentPK getCommentPK() {
157        return _value.getCommentPK();
158    }
159    
160    @Nonnull
161    public Comment getComment(EntityPermission entityPermission) {
162        return CommentFactory.getInstance().getEntityFromPK(entityPermission, getCommentPK());
163    }
164    
165    @Nonnull
166    public Comment getComment() {
167        return getComment(EntityPermission.READ_ONLY);
168    }
169    
170    @Nonnull
171    public Comment getCommentForUpdate() {
172        return getComment(EntityPermission.READ_WRITE);
173    }
174    
175    public void setCommentPK(@Nonnull CommentPK commentPK)
176            throws PersistenceNotNullException, PersistenceReadOnlyException {
177        checkReadWrite();
178        _value.setCommentPK(commentPK);
179    }
180    
181    public void setComment(@Nonnull Comment entity) {
182        setCommentPK(entity == null ? null : entity.getPrimaryKey());
183    }
184    
185    public boolean getCommentPKHasBeenModified() {
186        return _value.getCommentPKHasBeenModified();
187    }
188    
189    @Nonnull
190    public String getCommentName() {
191        return _value.getCommentName();
192    }
193    
194    public void setCommentName(@Nonnull String commentName)
195            throws PersistenceNotNullException, PersistenceReadOnlyException {
196        checkReadWrite();
197        _value.setCommentName(commentName);
198    }
199    
200    public boolean getCommentNameHasBeenModified() {
201        return _value.getCommentNameHasBeenModified();
202    }
203    
204    @Nonnull
205    public CommentTypePK getCommentTypePK() {
206        return _value.getCommentTypePK();
207    }
208    
209    @Nonnull
210    public CommentType getCommentType(EntityPermission entityPermission) {
211        return CommentTypeFactory.getInstance().getEntityFromPK(entityPermission, getCommentTypePK());
212    }
213    
214    @Nonnull
215    public CommentType getCommentType() {
216        return getCommentType(EntityPermission.READ_ONLY);
217    }
218    
219    @Nonnull
220    public CommentType getCommentTypeForUpdate() {
221        return getCommentType(EntityPermission.READ_WRITE);
222    }
223    
224    public void setCommentTypePK(@Nonnull CommentTypePK commentTypePK)
225            throws PersistenceNotNullException, PersistenceReadOnlyException {
226        checkReadWrite();
227        _value.setCommentTypePK(commentTypePK);
228    }
229    
230    public void setCommentType(@Nonnull CommentType entity) {
231        setCommentTypePK(entity == null ? null : entity.getPrimaryKey());
232    }
233    
234    public boolean getCommentTypePKHasBeenModified() {
235        return _value.getCommentTypePKHasBeenModified();
236    }
237    
238    @Nonnull
239    public EntityInstancePK getCommentedEntityInstancePK() {
240        return _value.getCommentedEntityInstancePK();
241    }
242    
243    @Nonnull
244    public EntityInstance getCommentedEntityInstance(EntityPermission entityPermission) {
245        return EntityInstanceFactory.getInstance().getEntityFromPK(entityPermission, getCommentedEntityInstancePK());
246    }
247    
248    @Nonnull
249    public EntityInstance getCommentedEntityInstance() {
250        return getCommentedEntityInstance(EntityPermission.READ_ONLY);
251    }
252    
253    @Nonnull
254    public EntityInstance getCommentedEntityInstanceForUpdate() {
255        return getCommentedEntityInstance(EntityPermission.READ_WRITE);
256    }
257    
258    public void setCommentedEntityInstancePK(@Nonnull EntityInstancePK commentedEntityInstancePK)
259            throws PersistenceNotNullException, PersistenceReadOnlyException {
260        checkReadWrite();
261        _value.setCommentedEntityInstancePK(commentedEntityInstancePK);
262    }
263    
264    public void setCommentedEntityInstance(@Nonnull EntityInstance entity) {
265        setCommentedEntityInstancePK(entity == null ? null : entity.getPrimaryKey());
266    }
267    
268    public boolean getCommentedEntityInstancePKHasBeenModified() {
269        return _value.getCommentedEntityInstancePKHasBeenModified();
270    }
271    
272    @Nonnull
273    public EntityInstancePK getCommentedByEntityInstancePK() {
274        return _value.getCommentedByEntityInstancePK();
275    }
276    
277    @Nonnull
278    public EntityInstance getCommentedByEntityInstance(EntityPermission entityPermission) {
279        return EntityInstanceFactory.getInstance().getEntityFromPK(entityPermission, getCommentedByEntityInstancePK());
280    }
281    
282    @Nonnull
283    public EntityInstance getCommentedByEntityInstance() {
284        return getCommentedByEntityInstance(EntityPermission.READ_ONLY);
285    }
286    
287    @Nonnull
288    public EntityInstance getCommentedByEntityInstanceForUpdate() {
289        return getCommentedByEntityInstance(EntityPermission.READ_WRITE);
290    }
291    
292    public void setCommentedByEntityInstancePK(@Nonnull EntityInstancePK commentedByEntityInstancePK)
293            throws PersistenceNotNullException, PersistenceReadOnlyException {
294        checkReadWrite();
295        _value.setCommentedByEntityInstancePK(commentedByEntityInstancePK);
296    }
297    
298    public void setCommentedByEntityInstance(@Nonnull EntityInstance entity) {
299        setCommentedByEntityInstancePK(entity == null ? null : entity.getPrimaryKey());
300    }
301    
302    public boolean getCommentedByEntityInstancePKHasBeenModified() {
303        return _value.getCommentedByEntityInstancePKHasBeenModified();
304    }
305    
306    @Nonnull
307    public LanguagePK getLanguagePK() {
308        return _value.getLanguagePK();
309    }
310    
311    @Nonnull
312    public Language getLanguage(EntityPermission entityPermission) {
313        return LanguageFactory.getInstance().getEntityFromPK(entityPermission, getLanguagePK());
314    }
315    
316    @Nonnull
317    public Language getLanguage() {
318        return getLanguage(EntityPermission.READ_ONLY);
319    }
320    
321    @Nonnull
322    public Language getLanguageForUpdate() {
323        return getLanguage(EntityPermission.READ_WRITE);
324    }
325    
326    public void setLanguagePK(@Nonnull LanguagePK languagePK)
327            throws PersistenceNotNullException, PersistenceReadOnlyException {
328        checkReadWrite();
329        _value.setLanguagePK(languagePK);
330    }
331    
332    public void setLanguage(@Nonnull Language entity) {
333        setLanguagePK(entity == null ? null : entity.getPrimaryKey());
334    }
335    
336    public boolean getLanguagePKHasBeenModified() {
337        return _value.getLanguagePKHasBeenModified();
338    }
339    
340    @Nullable
341    public String getDescription() {
342        return _value.getDescription();
343    }
344    
345    public void setDescription(@Nullable String description)
346            throws PersistenceNotNullException, PersistenceReadOnlyException {
347        checkReadWrite();
348        _value.setDescription(description);
349    }
350    
351    public boolean getDescriptionHasBeenModified() {
352        return _value.getDescriptionHasBeenModified();
353    }
354    
355    @Nullable
356    public MimeTypePK getMimeTypePK() {
357        return _value.getMimeTypePK();
358    }
359    
360    @Nullable
361    public MimeType getMimeType(EntityPermission entityPermission) {
362        MimeTypePK pk = getMimeTypePK();
363        MimeType entity = pk == null? null: MimeTypeFactory.getInstance().getEntityFromPK(entityPermission, pk);
364        
365        return entity;
366    }
367    
368    @Nullable
369    public MimeType getMimeType() {
370        return getMimeType(EntityPermission.READ_ONLY);
371    }
372    
373    @Nullable
374    public MimeType getMimeTypeForUpdate() {
375        return getMimeType(EntityPermission.READ_WRITE);
376    }
377    
378    public void setMimeTypePK(@Nullable MimeTypePK mimeTypePK)
379            throws PersistenceNotNullException, PersistenceReadOnlyException {
380        checkReadWrite();
381        _value.setMimeTypePK(mimeTypePK);
382    }
383    
384    public void setMimeType(@Nullable MimeType entity) {
385        setMimeTypePK(entity == null ? null : entity.getPrimaryKey());
386    }
387    
388    public boolean getMimeTypePKHasBeenModified() {
389        return _value.getMimeTypePKHasBeenModified();
390    }
391    
392    @Nonnull
393    public Long getFromTime() {
394        return _value.getFromTime();
395    }
396    
397    public void setFromTime(@Nonnull Long fromTime)
398            throws PersistenceNotNullException, PersistenceReadOnlyException {
399        checkReadWrite();
400        _value.setFromTime(fromTime);
401    }
402    
403    public boolean getFromTimeHasBeenModified() {
404        return _value.getFromTimeHasBeenModified();
405    }
406    
407    @Nonnull
408    public Long getThruTime() {
409        return _value.getThruTime();
410    }
411    
412    public void setThruTime(@Nonnull Long thruTime)
413            throws PersistenceNotNullException, PersistenceReadOnlyException {
414        checkReadWrite();
415        _value.setThruTime(thruTime);
416    }
417    
418    public boolean getThruTimeHasBeenModified() {
419        return _value.getThruTimeHasBeenModified();
420    }
421    
422}