KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > killingar > forum > internal > Message


1 /* Copyright 2000-2005 Anders Hovmöller
2  *
3  * The person or persons who have associated their work with
4  * this document (the "Dedicator") hereby dedicate the entire
5  * copyright in the work of authorship identified below (the
6  * "Work") to the public domain.
7  *
8  * Dedicator makes this dedication for the benefit of the
9  * public at large and to the detriment of Dedicator's heirs
10  * and successors. Dedicator intends this dedication to be an
11  * overt act of relinquishment in perpetuity of all present
12  * and future rights under copyright law, whether vested or
13  * contingent, in the Work. Dedicator understands that such
14  * relinquishment of all rights includes the relinquishment of
15  * all rights to enforce (by lawsuit or otherwise) those
16  * copyrights in the Work.
17  *
18  * Dedicator recognizes that, once placed in the public
19  * domain, the Work may be freely reproduced, distributed,
20  * transmitted, used, modified, built upon, or otherwise
21  * exploited by anyone for any purpose, commercial or non-
22  * commercial, and in any way, including by methods that have
23  * not yet been invented or conceived.
24  */

25
26 /**
27  * Describes a message in an area.
28  */

29 package net.killingar.forum.internal;
30
31 import java.sql.Timestamp JavaDoc;
32
33 public class Message extends IDItemImpl implements ParentIDItem
34 {
35     public long areaID = -1, parentID = -1, ownerID = -1, noWords;
36     public String JavaDoc subject, body;
37     public Timestamp JavaDoc timecreated, lastChanged;
38     public long lastChangedUserID = -1;
39     public boolean visible;
40
41     FieldData splitBody;
42
43   public Message(
44             long _ID,
45             long _parentID,
46             long _areaID,
47             long _ownerID,
48             Timestamp JavaDoc _timecreated,
49             Timestamp JavaDoc _lastChanged,
50             long _lastChangedUserID,
51             String JavaDoc _subject,
52             String JavaDoc _body,
53             long _noWords,
54             boolean _visible)
55     {
56         super(_ID);
57         parentID = _parentID;
58         areaID = _areaID;
59         ownerID = _ownerID;
60         timecreated = _timecreated;
61         lastChanged = _lastChanged;
62         lastChangedUserID = _lastChangedUserID;
63         subject = _subject;
64         body = _body;
65         noWords = _noWords;
66         visible = _visible;
67     }
68
69   public Message(
70             Message message)
71     {
72         super(message.ID);
73         parentID = message.parentID;
74         areaID = message.areaID;
75         ownerID = message.ownerID;
76         timecreated = message.timecreated;
77         lastChanged = message.lastChanged;
78         lastChangedUserID = message.lastChangedUserID;
79         subject = message.subject;
80         body = message.body;
81         noWords = message.noWords;
82         visible = message.visible;
83     }
84
85   public Message(
86             long _areaID,
87             long _parentID,
88             String JavaDoc _subject,
89             String JavaDoc _body)
90     {
91         super(-1);
92         areaID = _areaID;
93         parentID = _parentID;
94         subject = _subject;
95         body = _body;
96     }
97
98   public Message(long _ID)
99     {
100         super(_ID);
101     }
102
103   public Message()
104     {
105         super(-1);
106     }
107
108   public Message(long _ID, boolean _visible)
109     {
110         super(_ID);
111
112         visible = _visible;
113     }
114
115     public long getAreaID() { return areaID; }
116     public long getParentID() { return parentID; }
117     public long getOwnerID() { return ownerID; }
118     public long getNoWords() { return noWords; }
119     public String JavaDoc getSubject() { return subject; }
120     public String JavaDoc getBody() { return body; }
121     public Timestamp JavaDoc getTimecreated() { return timecreated; }
122     public Timestamp JavaDoc getLastChanged() { return lastChanged; }
123     public long getLastChangedUserID() { return lastChangedUserID; }
124     public boolean getVisible() { return visible; }
125
126     public String JavaDoc toString() { return "{id: "+ID+" subject: '"+subject+"' parentID: "+parentID+" areaID: "+areaID+" ownerID: "+ownerID+"}"; };
127
128     public FieldData getSplitBody()
129     {
130         if (body == null || "".equals(body))
131             return null;
132
133         if (splitBody == null)
134             splitBody = new FieldData(body);
135
136         return splitBody;
137     }
138 }
Popular Tags