KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > killingar > forum > actions > area > MessageData


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 package net.killingar.forum.actions.area;
27
28 import net.killingar.forum.actions.Utils;
29 import net.killingar.forum.internal.Message;
30 import net.killingar.forum.internal.User;
31 import net.killingar.forum.internal.managers.ForumManager;
32
33 import java.sql.SQLException JavaDoc;
34
35 public class MessageData extends Message
36 {
37     User owner;
38     boolean deleteAccess;
39     boolean firstNew;
40     boolean expand;
41     boolean unread;
42     String JavaDoc time;
43     long colspan;
44     boolean bodyEmpty;
45     long test;
46
47     public MessageData(MessageData message)
48         throws SQLException JavaDoc
49     {
50         super(message);
51         this.firstNew = message.firstNew;
52         this.unread = message.unread;
53         this.time = message.time;
54         this.colspan = message.colspan;
55         this.bodyEmpty = message.bodyEmpty;
56         this.owner = message.owner;
57         this.deleteAccess = message.deleteAccess;
58     }
59
60     public MessageData(ForumManager manager, Message message, boolean firstNew, boolean unread, long indent, long colspan)
61         throws SQLException JavaDoc
62     {
63         super(message);
64         this.firstNew = firstNew;
65         this.unread = unread;
66         this.time = Utils.formatDate(message.timecreated);
67         this.colspan = colspan;
68         this.bodyEmpty = message.body == null || message.body.length() == 0;
69         this.owner = manager.getUser(message.ownerID);
70         this.deleteAccess = message.ownerID == manager.getUserID() || manager.hasAccess(manager.getUserID(), 0x40000L);
71
72         if (subject != null)
73             subject = message.subject.trim();
74         if (body != null)
75             body = message.body.trim();
76     }
77
78     public MessageData(ForumManager manager, Message message, boolean firstNew, boolean unread)
79         throws SQLException JavaDoc
80     {
81         this(manager, message, firstNew, unread, 0L, 1L);
82     }
83
84     public MessageData(ForumManager manager, Message message)
85         throws SQLException JavaDoc
86     {
87         this(manager, message, false, false, 0L, 1L);
88     }
89
90     public User getOwner() { return owner; }
91     public boolean getDeleteAccess() { return deleteAccess; }
92     public boolean getFirstNew() { return firstNew; }
93     public boolean getUnread() { return unread; }
94     public String JavaDoc getTime() { return time; }
95     public int getColspan() { return (int)colspan; }
96     public boolean getBodyEmpty() { return bodyEmpty; }
97
98     public int getIndent() { return 0; }
99
100     //public long getTest() { return test; }
101
}
102
Popular Tags