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 * ForumMessageDetail.java
021 */
022
023package com.echothree.model.data.forum.server.entity;
024
025import com.echothree.model.data.forum.common.pk.ForumMessageDetailPK;
026
027import com.echothree.model.data.forum.common.pk.ForumMessagePK;
028import com.echothree.model.data.forum.common.pk.ForumThreadPK;
029import com.echothree.model.data.forum.common.pk.ForumMessageTypePK;
030import com.echothree.model.data.icon.common.pk.IconPK;
031
032import com.echothree.model.data.forum.server.entity.ForumMessage;
033import com.echothree.model.data.forum.server.entity.ForumThread;
034import com.echothree.model.data.forum.server.entity.ForumMessageType;
035import com.echothree.model.data.icon.server.entity.Icon;
036
037import com.echothree.model.data.forum.server.factory.ForumMessageFactory;
038import com.echothree.model.data.forum.server.factory.ForumThreadFactory;
039import com.echothree.model.data.forum.server.factory.ForumMessageTypeFactory;
040import com.echothree.model.data.icon.server.factory.IconFactory;
041
042import com.echothree.model.data.forum.common.pk.ForumMessageDetailPK;
043
044import com.echothree.model.data.forum.server.value.ForumMessageDetailValue;
045
046import com.echothree.model.data.forum.server.factory.ForumMessageDetailFactory;
047
048import com.echothree.util.common.exception.PersistenceException;
049import com.echothree.util.common.exception.PersistenceDatabaseException;
050import com.echothree.util.common.exception.PersistenceNotNullException;
051import com.echothree.util.common.exception.PersistenceReadOnlyException;
052
053import com.echothree.util.common.persistence.BasePK;
054
055import com.echothree.util.common.persistence.type.ByteArray;
056
057import com.echothree.util.server.persistence.BaseEntity;
058import com.echothree.util.server.persistence.EntityPermission;
059import com.echothree.util.server.persistence.Session;
060import com.echothree.util.server.persistence.ThreadSession;
061
062import java.io.Serializable;
063
064import javax.annotation.Nonnull;
065import javax.annotation.Nullable;
066
067public class ForumMessageDetail
068        extends BaseEntity
069        implements Serializable {
070    
071    private ForumMessageDetailPK _pk;
072    private ForumMessageDetailValue _value;
073    
074    /** Creates a new instance of ForumMessageDetail */
075    public ForumMessageDetail()
076            throws PersistenceException {
077        super();
078    }
079    
080    /** Creates a new instance of ForumMessageDetail */
081    public ForumMessageDetail(ForumMessageDetailValue value, EntityPermission entityPermission) {
082        super(entityPermission);
083        
084        _value = value;
085        _pk = value.getPrimaryKey();
086    }
087    
088    @Override
089    @Nonnull
090    public ForumMessageDetailFactory getBaseFactoryInstance() {
091        return ForumMessageDetailFactory.getInstance();
092    }
093    
094    @Override
095    public boolean hasBeenModified() {
096        return _value.hasBeenModified();
097    }
098    
099    @Override
100    public int hashCode() {
101        return _pk.hashCode();
102    }
103    
104    @Override
105    @Nonnull
106    public String toString() {
107        return _pk.toString();
108    }
109    
110    @Override
111    public boolean equals(Object other) {
112        if(this == other)
113            return true;
114        
115        if(other instanceof ForumMessageDetail that) {
116            ForumMessageDetailValue thatValue = that.getForumMessageDetailValue();
117            return _value.equals(thatValue);
118        } else {
119            return false;
120        }
121    }
122    
123    @Override
124    public void store()
125            throws PersistenceDatabaseException {
126        getBaseFactoryInstance().store(this);
127    }
128    
129    @Override
130    public void remove()
131            throws PersistenceDatabaseException {
132        getBaseFactoryInstance().remove(this);
133    }
134    
135    @Nonnull
136    public ForumMessageDetailValue getForumMessageDetailValue() {
137        return _value;
138    }
139    
140    public void setForumMessageDetailValue(@Nonnull ForumMessageDetailValue value)
141            throws PersistenceReadOnlyException {
142        checkReadWrite();
143        _value = value;
144    }
145    
146    @Override
147    @Nonnull
148    public ForumMessageDetailPK getPrimaryKey() {
149        return _pk;
150    }
151    
152    @Nonnull
153    public ForumMessagePK getForumMessagePK() {
154        return _value.getForumMessagePK();
155    }
156    
157    @Nonnull
158    public ForumMessage getForumMessage(EntityPermission entityPermission) {
159        return ForumMessageFactory.getInstance().getEntityFromPK(entityPermission, getForumMessagePK());
160    }
161    
162    @Nonnull
163    public ForumMessage getForumMessage() {
164        return getForumMessage(EntityPermission.READ_ONLY);
165    }
166    
167    @Nonnull
168    public ForumMessage getForumMessageForUpdate() {
169        return getForumMessage(EntityPermission.READ_WRITE);
170    }
171    
172    public void setForumMessagePK(@Nonnull ForumMessagePK forumMessagePK)
173            throws PersistenceNotNullException, PersistenceReadOnlyException {
174        checkReadWrite();
175        _value.setForumMessagePK(forumMessagePK);
176    }
177    
178    public void setForumMessage(@Nonnull ForumMessage entity) {
179        setForumMessagePK(entity == null ? null : entity.getPrimaryKey());
180    }
181    
182    public boolean getForumMessagePKHasBeenModified() {
183        return _value.getForumMessagePKHasBeenModified();
184    }
185    
186    @Nonnull
187    public String getForumMessageName() {
188        return _value.getForumMessageName();
189    }
190    
191    public void setForumMessageName(@Nonnull String forumMessageName)
192            throws PersistenceNotNullException, PersistenceReadOnlyException {
193        checkReadWrite();
194        _value.setForumMessageName(forumMessageName);
195    }
196    
197    public boolean getForumMessageNameHasBeenModified() {
198        return _value.getForumMessageNameHasBeenModified();
199    }
200    
201    @Nonnull
202    public ForumThreadPK getForumThreadPK() {
203        return _value.getForumThreadPK();
204    }
205    
206    @Nonnull
207    public ForumThread getForumThread(EntityPermission entityPermission) {
208        return ForumThreadFactory.getInstance().getEntityFromPK(entityPermission, getForumThreadPK());
209    }
210    
211    @Nonnull
212    public ForumThread getForumThread() {
213        return getForumThread(EntityPermission.READ_ONLY);
214    }
215    
216    @Nonnull
217    public ForumThread getForumThreadForUpdate() {
218        return getForumThread(EntityPermission.READ_WRITE);
219    }
220    
221    public void setForumThreadPK(@Nonnull ForumThreadPK forumThreadPK)
222            throws PersistenceNotNullException, PersistenceReadOnlyException {
223        checkReadWrite();
224        _value.setForumThreadPK(forumThreadPK);
225    }
226    
227    public void setForumThread(@Nonnull ForumThread entity) {
228        setForumThreadPK(entity == null ? null : entity.getPrimaryKey());
229    }
230    
231    public boolean getForumThreadPKHasBeenModified() {
232        return _value.getForumThreadPKHasBeenModified();
233    }
234    
235    @Nonnull
236    public ForumMessageTypePK getForumMessageTypePK() {
237        return _value.getForumMessageTypePK();
238    }
239    
240    @Nonnull
241    public ForumMessageType getForumMessageType(EntityPermission entityPermission) {
242        return ForumMessageTypeFactory.getInstance().getEntityFromPK(entityPermission, getForumMessageTypePK());
243    }
244    
245    @Nonnull
246    public ForumMessageType getForumMessageType() {
247        return getForumMessageType(EntityPermission.READ_ONLY);
248    }
249    
250    @Nonnull
251    public ForumMessageType getForumMessageTypeForUpdate() {
252        return getForumMessageType(EntityPermission.READ_WRITE);
253    }
254    
255    public void setForumMessageTypePK(@Nonnull ForumMessageTypePK forumMessageTypePK)
256            throws PersistenceNotNullException, PersistenceReadOnlyException {
257        checkReadWrite();
258        _value.setForumMessageTypePK(forumMessageTypePK);
259    }
260    
261    public void setForumMessageType(@Nonnull ForumMessageType entity) {
262        setForumMessageTypePK(entity == null ? null : entity.getPrimaryKey());
263    }
264    
265    public boolean getForumMessageTypePKHasBeenModified() {
266        return _value.getForumMessageTypePKHasBeenModified();
267    }
268    
269    @Nullable
270    public ForumMessagePK getParentForumMessagePK() {
271        return _value.getParentForumMessagePK();
272    }
273    
274    @Nullable
275    public ForumMessage getParentForumMessage(EntityPermission entityPermission) {
276        ForumMessagePK pk = getParentForumMessagePK();
277        ForumMessage entity = pk == null? null: ForumMessageFactory.getInstance().getEntityFromPK(entityPermission, pk);
278        
279        return entity;
280    }
281    
282    @Nullable
283    public ForumMessage getParentForumMessage() {
284        return getParentForumMessage(EntityPermission.READ_ONLY);
285    }
286    
287    @Nullable
288    public ForumMessage getParentForumMessageForUpdate() {
289        return getParentForumMessage(EntityPermission.READ_WRITE);
290    }
291    
292    public void setParentForumMessagePK(@Nullable ForumMessagePK parentForumMessagePK)
293            throws PersistenceNotNullException, PersistenceReadOnlyException {
294        checkReadWrite();
295        _value.setParentForumMessagePK(parentForumMessagePK);
296    }
297    
298    public void setParentForumMessage(@Nullable ForumMessage entity) {
299        setParentForumMessagePK(entity == null ? null : entity.getPrimaryKey());
300    }
301    
302    public boolean getParentForumMessagePKHasBeenModified() {
303        return _value.getParentForumMessagePKHasBeenModified();
304    }
305    
306    @Nullable
307    public IconPK getIconPK() {
308        return _value.getIconPK();
309    }
310    
311    @Nullable
312    public Icon getIcon(EntityPermission entityPermission) {
313        IconPK pk = getIconPK();
314        Icon entity = pk == null? null: IconFactory.getInstance().getEntityFromPK(entityPermission, pk);
315        
316        return entity;
317    }
318    
319    @Nullable
320    public Icon getIcon() {
321        return getIcon(EntityPermission.READ_ONLY);
322    }
323    
324    @Nullable
325    public Icon getIconForUpdate() {
326        return getIcon(EntityPermission.READ_WRITE);
327    }
328    
329    public void setIconPK(@Nullable IconPK iconPK)
330            throws PersistenceNotNullException, PersistenceReadOnlyException {
331        checkReadWrite();
332        _value.setIconPK(iconPK);
333    }
334    
335    public void setIcon(@Nullable Icon entity) {
336        setIconPK(entity == null ? null : entity.getPrimaryKey());
337    }
338    
339    public boolean getIconPKHasBeenModified() {
340        return _value.getIconPKHasBeenModified();
341    }
342    
343    @Nonnull
344    public Long getPostedTime() {
345        return _value.getPostedTime();
346    }
347    
348    public void setPostedTime(@Nonnull Long postedTime)
349            throws PersistenceNotNullException, PersistenceReadOnlyException {
350        checkReadWrite();
351        _value.setPostedTime(postedTime);
352    }
353    
354    public boolean getPostedTimeHasBeenModified() {
355        return _value.getPostedTimeHasBeenModified();
356    }
357    
358    @Nonnull
359    public Long getFromTime() {
360        return _value.getFromTime();
361    }
362    
363    public void setFromTime(@Nonnull 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    @Nonnull
374    public Long getThruTime() {
375        return _value.getThruTime();
376    }
377    
378    public void setThruTime(@Nonnull Long thruTime)
379            throws PersistenceNotNullException, PersistenceReadOnlyException {
380        checkReadWrite();
381        _value.setThruTime(thruTime);
382    }
383    
384    public boolean getThruTimeHasBeenModified() {
385        return _value.getThruTimeHasBeenModified();
386    }
387    
388}