1 /*
2 * The SmartWeb Framework
3 * Copyright (C) 2004-2006
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 *
19 * For further informations on the SmartWeb Framework please visit
20 *
21 * http://smartweb.sourceforge.net
22 */
23
24 package net.smartlab.web.forum;
25
26 import java.sql.Timestamp;
27
28 import net.smartlab.web.Enumeration;
29 import net.smartlab.web.BusinessObject;
30
31 /**
32 * TODO documentation
33 * @author rlogiacco
34 * @hibernate.class schema="forum" name="`message`"
35 */
36 public class Message extends BusinessObject {
37
38 private final static long serialVersionUID = -395300752934082623L;
39
40 private long id;
41 private String title;
42 private String body;
43 private Type type; //FIXME enumeration: sticky, important
44 private Timestamp posted;
45
46 /**
47 * TODO documentation
48 * @return
49 * @hibernate.id unsaved-value="0" generator-class="native"
50 */
51 public long getId() {
52 return id;
53 }
54
55 /**
56 * TODO documentation
57 * @param id
58 */
59 private void setId(long id) {
60 this.id = id;
61 }
62
63 /**
64 * TODO documentation
65 * @author rlogiacco
66 */
67 public static class Type extends Enumeration {
68
69 private static final long serialVersionUID = -6143219175949237605L;
70
71 /**
72 * TODO documentation
73 */
74 public final static Type NORMAL = new Type('N', "message.type.normal");
75 /**
76 * TODO documentation
77 */
78 public final static Type STICKY = new Type('S', "message.type.sticky");
79 /**
80 * TODO documentation
81 */
82 public final static Type IMPORTANT = new Type('I', "message.type.important");
83
84 /**
85 * TODO documentation
86 * @param id
87 * @param display
88 */
89 public Type(int id, String display) {
90 super(id, display);
91 }
92
93 /**
94 * @see net.smartlab.web.Enumeration#decode(int)
95 */
96 public Enumeration decode(int id) {
97 switch (id) {
98 case 'N':
99 return NORMAL;
100 case 'S':
101 return STICKY;
102 case 'I':
103 return IMPORTANT;
104 default:
105 return null;
106 }
107 }
108
109 }
110 }