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 * 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
064public class ForumMessageDetail
065        extends BaseEntity
066        implements Serializable {
067    
068    private ForumMessageDetailPK _pk;
069    private ForumMessageDetailValue _value;
070    
071    /** Creates a new instance of ForumMessageDetail */
072    public ForumMessageDetail()
073            throws PersistenceException {
074        super();
075    }
076    
077    /** Creates a new instance of ForumMessageDetail */
078    public ForumMessageDetail(ForumMessageDetailValue value, EntityPermission entityPermission) {
079        super(entityPermission);
080        
081        _value = value;
082        _pk = value.getPrimaryKey();
083    }
084    
085    @Override
086    public ForumMessageDetailFactory getBaseFactoryInstance() {
087        return ForumMessageDetailFactory.getInstance();
088    }
089    
090    @Override
091    public boolean hasBeenModified() {
092        return _value.hasBeenModified();
093    }
094    
095    @Override
096    public int hashCode() {
097        return _pk.hashCode();
098    }
099    
100    @Override
101    public String toString() {
102        return _pk.toString();
103    }
104    
105    @Override
106    public boolean equals(Object other) {
107        if(this == other)
108            return true;
109        
110        if(other instanceof ForumMessageDetail) {
111            ForumMessageDetail that = (ForumMessageDetail)other;
112            
113            ForumMessageDetailValue thatValue = that.getForumMessageDetailValue();
114            return _value.equals(thatValue);
115        } else {
116            return false;
117        }
118    }
119    
120    @Override
121    public void store(Session session)
122            throws PersistenceDatabaseException {
123        getBaseFactoryInstance().store(session, this);
124    }
125    
126    @Override
127    public void remove(Session session)
128            throws PersistenceDatabaseException {
129        getBaseFactoryInstance().remove(session, this);
130    }
131    
132    @Override
133    public void remove()
134            throws PersistenceDatabaseException {
135        getBaseFactoryInstance().remove(ThreadSession.currentSession(), this);
136    }
137    
138    public ForumMessageDetailValue getForumMessageDetailValue() {
139        return _value;
140    }
141    
142    public void setForumMessageDetailValue(ForumMessageDetailValue value)
143            throws PersistenceReadOnlyException {
144        checkReadWrite();
145        _value = value;
146    }
147    
148    @Override
149    public ForumMessageDetailPK getPrimaryKey() {
150        return _pk;
151    }
152    
153    public ForumMessagePK getForumMessagePK() {
154        return _value.getForumMessagePK();
155    }
156    
157    public ForumMessage getForumMessage(Session session, EntityPermission entityPermission) {
158        return ForumMessageFactory.getInstance().getEntityFromPK(session, entityPermission, getForumMessagePK());
159    }
160    
161    public ForumMessage getForumMessage(EntityPermission entityPermission) {
162        return getForumMessage(ThreadSession.currentSession(), entityPermission);
163    }
164    
165    public ForumMessage getForumMessage(Session session) {
166        return getForumMessage(session, EntityPermission.READ_ONLY);
167    }
168    
169    public ForumMessage getForumMessage() {
170        return getForumMessage(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
171    }
172    
173    public ForumMessage getForumMessageForUpdate(Session session) {
174        return getForumMessage(session, EntityPermission.READ_WRITE);
175    }
176    
177    public ForumMessage getForumMessageForUpdate() {
178        return getForumMessage(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
179    }
180    
181    public void setForumMessagePK(ForumMessagePK forumMessagePK)
182            throws PersistenceNotNullException, PersistenceReadOnlyException {
183        checkReadWrite();
184        _value.setForumMessagePK(forumMessagePK);
185    }
186    
187    public void setForumMessage(ForumMessage entity) {
188        setForumMessagePK(entity == null? null: entity.getPrimaryKey());
189    }
190    
191    public boolean getForumMessagePKHasBeenModified() {
192        return _value.getForumMessagePKHasBeenModified();
193    }
194    
195    public String getForumMessageName() {
196        return _value.getForumMessageName();
197    }
198    
199    public void setForumMessageName(String forumMessageName)
200            throws PersistenceNotNullException, PersistenceReadOnlyException {
201        checkReadWrite();
202        _value.setForumMessageName(forumMessageName);
203    }
204    
205    public boolean getForumMessageNameHasBeenModified() {
206        return _value.getForumMessageNameHasBeenModified();
207    }
208    
209    public ForumThreadPK getForumThreadPK() {
210        return _value.getForumThreadPK();
211    }
212    
213    public ForumThread getForumThread(Session session, EntityPermission entityPermission) {
214        return ForumThreadFactory.getInstance().getEntityFromPK(session, entityPermission, getForumThreadPK());
215    }
216    
217    public ForumThread getForumThread(EntityPermission entityPermission) {
218        return getForumThread(ThreadSession.currentSession(), entityPermission);
219    }
220    
221    public ForumThread getForumThread(Session session) {
222        return getForumThread(session, EntityPermission.READ_ONLY);
223    }
224    
225    public ForumThread getForumThread() {
226        return getForumThread(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
227    }
228    
229    public ForumThread getForumThreadForUpdate(Session session) {
230        return getForumThread(session, EntityPermission.READ_WRITE);
231    }
232    
233    public ForumThread getForumThreadForUpdate() {
234        return getForumThread(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
235    }
236    
237    public void setForumThreadPK(ForumThreadPK forumThreadPK)
238            throws PersistenceNotNullException, PersistenceReadOnlyException {
239        checkReadWrite();
240        _value.setForumThreadPK(forumThreadPK);
241    }
242    
243    public void setForumThread(ForumThread entity) {
244        setForumThreadPK(entity == null? null: entity.getPrimaryKey());
245    }
246    
247    public boolean getForumThreadPKHasBeenModified() {
248        return _value.getForumThreadPKHasBeenModified();
249    }
250    
251    public ForumMessageTypePK getForumMessageTypePK() {
252        return _value.getForumMessageTypePK();
253    }
254    
255    public ForumMessageType getForumMessageType(Session session, EntityPermission entityPermission) {
256        return ForumMessageTypeFactory.getInstance().getEntityFromPK(session, entityPermission, getForumMessageTypePK());
257    }
258    
259    public ForumMessageType getForumMessageType(EntityPermission entityPermission) {
260        return getForumMessageType(ThreadSession.currentSession(), entityPermission);
261    }
262    
263    public ForumMessageType getForumMessageType(Session session) {
264        return getForumMessageType(session, EntityPermission.READ_ONLY);
265    }
266    
267    public ForumMessageType getForumMessageType() {
268        return getForumMessageType(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
269    }
270    
271    public ForumMessageType getForumMessageTypeForUpdate(Session session) {
272        return getForumMessageType(session, EntityPermission.READ_WRITE);
273    }
274    
275    public ForumMessageType getForumMessageTypeForUpdate() {
276        return getForumMessageType(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
277    }
278    
279    public void setForumMessageTypePK(ForumMessageTypePK forumMessageTypePK)
280            throws PersistenceNotNullException, PersistenceReadOnlyException {
281        checkReadWrite();
282        _value.setForumMessageTypePK(forumMessageTypePK);
283    }
284    
285    public void setForumMessageType(ForumMessageType entity) {
286        setForumMessageTypePK(entity == null? null: entity.getPrimaryKey());
287    }
288    
289    public boolean getForumMessageTypePKHasBeenModified() {
290        return _value.getForumMessageTypePKHasBeenModified();
291    }
292    
293    public ForumMessagePK getParentForumMessagePK() {
294        return _value.getParentForumMessagePK();
295    }
296    
297    public ForumMessage getParentForumMessage(Session session, EntityPermission entityPermission) {
298        ForumMessagePK pk = getParentForumMessagePK();
299        ForumMessage entity = pk == null? null: ForumMessageFactory.getInstance().getEntityFromPK(session, entityPermission, pk);
300        
301        return entity;
302    }
303    
304    public ForumMessage getParentForumMessage(EntityPermission entityPermission) {
305        return getParentForumMessage(ThreadSession.currentSession(), entityPermission);
306    }
307    
308    public ForumMessage getParentForumMessage(Session session) {
309        return getParentForumMessage(session, EntityPermission.READ_ONLY);
310    }
311    
312    public ForumMessage getParentForumMessage() {
313        return getParentForumMessage(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
314    }
315    
316    public ForumMessage getParentForumMessageForUpdate(Session session) {
317        return getParentForumMessage(session, EntityPermission.READ_WRITE);
318    }
319    
320    public ForumMessage getParentForumMessageForUpdate() {
321        return getParentForumMessage(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
322    }
323    
324    public void setParentForumMessagePK(ForumMessagePK parentForumMessagePK)
325            throws PersistenceNotNullException, PersistenceReadOnlyException {
326        checkReadWrite();
327        _value.setParentForumMessagePK(parentForumMessagePK);
328    }
329    
330    public void setParentForumMessage(ForumMessage entity) {
331        setParentForumMessagePK(entity == null? null: entity.getPrimaryKey());
332    }
333    
334    public boolean getParentForumMessagePKHasBeenModified() {
335        return _value.getParentForumMessagePKHasBeenModified();
336    }
337    
338    public IconPK getIconPK() {
339        return _value.getIconPK();
340    }
341    
342    public Icon getIcon(Session session, EntityPermission entityPermission) {
343        IconPK pk = getIconPK();
344        Icon entity = pk == null? null: IconFactory.getInstance().getEntityFromPK(session, entityPermission, pk);
345        
346        return entity;
347    }
348    
349    public Icon getIcon(EntityPermission entityPermission) {
350        return getIcon(ThreadSession.currentSession(), entityPermission);
351    }
352    
353    public Icon getIcon(Session session) {
354        return getIcon(session, EntityPermission.READ_ONLY);
355    }
356    
357    public Icon getIcon() {
358        return getIcon(ThreadSession.currentSession(), EntityPermission.READ_ONLY);
359    }
360    
361    public Icon getIconForUpdate(Session session) {
362        return getIcon(session, EntityPermission.READ_WRITE);
363    }
364    
365    public Icon getIconForUpdate() {
366        return getIcon(ThreadSession.currentSession(), EntityPermission.READ_WRITE);
367    }
368    
369    public void setIconPK(IconPK iconPK)
370            throws PersistenceNotNullException, PersistenceReadOnlyException {
371        checkReadWrite();
372        _value.setIconPK(iconPK);
373    }
374    
375    public void setIcon(Icon entity) {
376        setIconPK(entity == null? null: entity.getPrimaryKey());
377    }
378    
379    public boolean getIconPKHasBeenModified() {
380        return _value.getIconPKHasBeenModified();
381    }
382    
383    public Long getPostedTime() {
384        return _value.getPostedTime();
385    }
386    
387    public void setPostedTime(Long postedTime)
388            throws PersistenceNotNullException, PersistenceReadOnlyException {
389        checkReadWrite();
390        _value.setPostedTime(postedTime);
391    }
392    
393    public boolean getPostedTimeHasBeenModified() {
394        return _value.getPostedTimeHasBeenModified();
395    }
396    
397    public Long getFromTime() {
398        return _value.getFromTime();
399    }
400    
401    public void setFromTime(Long fromTime)
402            throws PersistenceNotNullException, PersistenceReadOnlyException {
403        checkReadWrite();
404        _value.setFromTime(fromTime);
405    }
406    
407    public boolean getFromTimeHasBeenModified() {
408        return _value.getFromTimeHasBeenModified();
409    }
410    
411    public Long getThruTime() {
412        return _value.getThruTime();
413    }
414    
415    public void setThruTime(Long thruTime)
416            throws PersistenceNotNullException, PersistenceReadOnlyException {
417        checkReadWrite();
418        _value.setThruTime(thruTime);
419    }
420    
421    public boolean getThruTimeHasBeenModified() {
422        return _value.getThruTimeHasBeenModified();
423    }
424    
425}