KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > velocity > demo > om > Message


1 package org.apache.velocity.demo.om;
2
3 /*
4  * Copyright 1999,2004 The Apache Software Foundation.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */

18
19 // Java
20
import java.util.*;
21
22 /**
23  * The actual message in the forum.
24  *
25  * @author <a HREF="mailto:daveb@minceda-data.com">Dave Bryson</a>
26  * @version $Revision: 1.1.14.1 $
27  * $Id: Message.java,v 1.1.14.1 2004/03/04 00:18:29 geirm Exp $
28  */

29 public class Message
30 {
31     private Integer JavaDoc id;
32     private String JavaDoc subject;
33     private String JavaDoc name;
34     private String JavaDoc email;
35     private String JavaDoc contents;
36     private Date submitted;
37     private Vector replies = null;
38
39     /**
40      * Constructor
41      *
42      * Gets the unique ID from the generator.
43      */

44     public Message()
45     {
46         submitted = new Date();
47         replies = new Vector();
48     }
49
50     /**
51      * The index number
52      */

53     public void setId( Integer JavaDoc index )
54     {
55         this.id=index;
56     }
57
58     /**
59      * Get the index number
60      * @return the id
61      */

62     public String JavaDoc getId()
63     {
64         return id.toString();
65     }
66
67     /**
68      * Return replies for this message
69      *
70      * @return Vector
71      */

72     public Vector getReplies()
73     {
74         return replies;
75     }
76
77     /**
78      * Add a reply
79      * @param reply
80      */

81     public void addReply( Message m )
82     {
83         replies.addElement( m );
84     }
85
86     /**
87      * @return a count of the number of replies for this message
88      */

89     public int numberOfReplies()
90     {
91         return replies.size();
92     }
93     
94     /**
95      * Get the value of submitted.
96      * @return value of submitted.
97      */

98     public String JavaDoc getSubmitted()
99     {
100         return submitted.toString();
101     }
102     
103     /**
104      * Set the value of submitted.
105      * @param v Value to assign to submitted.
106      */

107     public void setSubmitted(Date v) {this.submitted = v;}
108     
109     /**
110      * Get the value of contents.
111      * @return value of contents.
112      */

113     public String JavaDoc getContents() {return contents;}
114     
115     /**
116      * Set the value of contents.
117      * @param v Value to assign to contents.
118      */

119     public void setContents(String JavaDoc v) {this.contents = v;}
120     
121     /**
122      * Get the value of email.
123      * @return value of email.
124      */

125     public String JavaDoc getEmail() {return email;}
126     
127     /**
128      * Set the value of email.
129      * @param v Value to assign to email.
130      */

131     public void setEmail(String JavaDoc v) {this.email = v;}
132         
133     /**
134      * Get the value of name.
135      * @return value of name.
136      */

137     public String JavaDoc getName() {return name;}
138     
139     /**
140      * Set the value of name.
141      * @param v Value to assign to name.
142      */

143     public void setName(String JavaDoc v) {this.name = v;}
144         
145     /**
146      * Get the value of subject.
147      * @return value of subject.
148      */

149     public String JavaDoc getSubject() {return subject;}
150     
151     /**
152      * Set the value of subject.
153      * @param v Value to assign to subject.
154      */

155     public void setSubject(String JavaDoc v) {this.subject = v;}
156 }
157
158
Popular Tags