KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > mvnforum > db > WatchBean


1 /*
2  * $Header: /cvsroot/mvnforum/mvnforum/src/com/mvnforum/db/WatchBean.java,v 1.8 2006/04/14 17:05:26 minhnn Exp $
3  * $Author: minhnn $
4  * $Revision: 1.8 $
5  * $Date: 2006/04/14 17:05:26 $
6  *
7  * ====================================================================
8  *
9  * Copyright (C) 2002-2006 by MyVietnam.net
10  *
11  * All copyright notices regarding mvnForum MUST remain
12  * intact in the scripts and in the outputted HTML.
13  * The "powered by" text/logo with a link back to
14  * http://www.mvnForum.com and http://www.MyVietnam.net in
15  * the footer of the pages MUST remain visible when the pages
16  * are viewed on the internet or intranet.
17  *
18  * This program is free software; you can redistribute it and/or modify
19  * it under the terms of the GNU General Public License as published by
20  * the Free Software Foundation; either version 2 of the License, or
21  * any later version.
22  *
23  * This program is distributed in the hope that it will be useful,
24  * but WITHOUT ANY WARRANTY; without even the implied warranty of
25  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26  * GNU General Public License for more details.
27  *
28  * You should have received a copy of the GNU General Public License
29  * along with this program; if not, write to the Free Software
30  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
31  *
32  * Support can be obtained from support forums at:
33  * http://www.mvnForum.com/mvnforum/index
34  *
35  * Correspondence and Marketing Questions can be sent to:
36  * info at MyVietnam net
37  *
38  * @author: Minh Nguyen
39  * @author: Mai Nguyen
40  */

41 package com.mvnforum.db;
42
43 import java.sql.Timestamp JavaDoc;
44 import java.util.Collection JavaDoc;
45 import java.util.Iterator JavaDoc;
46
47 /*
48  * Included columns: WatchID, MemberID, CategoryID, ForumID, ThreadID,
49  * WatchType, WatchOption, WatchStatus, WatchCreationDate, WatchLastSentDate,
50  * WatchEndDate
51  * Excluded columns:
52  */

53 public class WatchBean {
54     /*************************************************************************
55      * NOTE: below constants MUST NOT be changed IN ALL CASES,
56      * or it will break the compatibility
57      *************************************************************************/

58     public final static int WATCH_OPTION_DEFAULT= 0;
59     public final static int WATCH_OPTION_LIVE = 1;
60     public final static int WATCH_OPTION_HOURLY = 2;
61     public final static int WATCH_OPTION_DAILY = 3;
62     public final static int WATCH_OPTION_WEEKLY = 4;
63
64     private int watchID;
65     private int memberID;
66     private int categoryID;
67     private int forumID;
68     private int threadID;
69     private int watchType;
70     private int watchOption;
71     private int watchStatus;
72     private Timestamp JavaDoc watchCreationDate;
73     private Timestamp JavaDoc watchLastSentDate;
74     private Timestamp JavaDoc watchEndDate;
75
76     public int getWatchID() {
77         return watchID;
78     }
79     public void setWatchID(int watchID) {
80         this.watchID = watchID;
81     }
82
83     public int getMemberID() {
84         return memberID;
85     }
86     public void setMemberID(int memberID) {
87         this.memberID = memberID;
88     }
89
90     public int getCategoryID() {
91         return categoryID;
92     }
93     public void setCategoryID(int categoryID) {
94         this.categoryID = categoryID;
95     }
96
97     public int getForumID() {
98         return forumID;
99     }
100     public void setForumID(int forumID) {
101         this.forumID = forumID;
102     }
103
104     public int getThreadID() {
105         return threadID;
106     }
107     public void setThreadID(int threadID) {
108         this.threadID = threadID;
109     }
110
111     public int getWatchType() {
112         return watchType;
113     }
114     public void setWatchType(int watchType) {
115         this.watchType = watchType;
116     }
117
118     public int getWatchOption() {
119         return watchOption;
120     }
121     public void setWatchOption(int watchOption) {
122         this.watchOption = watchOption;
123     }
124
125     public int getWatchStatus() {
126         return watchStatus;
127     }
128     public void setWatchStatus(int watchStatus) {
129         this.watchStatus = watchStatus;
130     }
131
132     public Timestamp JavaDoc getWatchCreationDate() {
133         return watchCreationDate;
134     }
135     public void setWatchCreationDate(Timestamp JavaDoc watchCreationDate) {
136         this.watchCreationDate = watchCreationDate;
137     }
138
139     public Timestamp JavaDoc getWatchLastSentDate() {
140         return watchLastSentDate;
141     }
142     public void setWatchLastSentDate(Timestamp JavaDoc watchLastSentDate) {
143         this.watchLastSentDate = watchLastSentDate;
144     }
145
146     public Timestamp JavaDoc getWatchEndDate() {
147         return watchEndDate;
148     }
149     public void setWatchEndDate(Timestamp JavaDoc watchEndDate) {
150         this.watchEndDate = watchEndDate;
151     }
152
153     public String JavaDoc getXML() {
154         StringBuffer JavaDoc xml = new StringBuffer JavaDoc(1024);
155         xml.append("<WatchSection>\n");
156         xml.append(" <Rows>\n");
157         xml.append(" <Row>\n");
158         xml.append(" <Column>\n");
159         xml.append(" <Name>WatchID</Name>\n");
160         xml.append(" <Value>").append(String.valueOf(watchID)).append("</Value>\n");
161         xml.append(" </Column>\n");
162         xml.append(" <Column>\n");
163         xml.append(" <Name>MemberID</Name>\n");
164         xml.append(" <Value>").append(String.valueOf(memberID)).append("</Value>\n");
165         xml.append(" </Column>\n");
166         xml.append(" <Column>\n");
167         xml.append(" <Name>CategoryID</Name>\n");
168         xml.append(" <Value>").append(String.valueOf(categoryID)).append("</Value>\n");
169         xml.append(" </Column>\n");
170         xml.append(" <Column>\n");
171         xml.append(" <Name>ForumID</Name>\n");
172         xml.append(" <Value>").append(String.valueOf(forumID)).append("</Value>\n");
173         xml.append(" </Column>\n");
174         xml.append(" <Column>\n");
175         xml.append(" <Name>ThreadID</Name>\n");
176         xml.append(" <Value>").append(String.valueOf(threadID)).append("</Value>\n");
177         xml.append(" </Column>\n");
178         xml.append(" <Column>\n");
179         xml.append(" <Name>WatchType</Name>\n");
180         xml.append(" <Value>").append(String.valueOf(watchType)).append("</Value>\n");
181         xml.append(" </Column>\n");
182         xml.append(" <Column>\n");
183         xml.append(" <Name>WatchOption</Name>\n");
184         xml.append(" <Value>").append(String.valueOf(watchOption)).append("</Value>\n");
185         xml.append(" </Column>\n");
186         xml.append(" <Column>\n");
187         xml.append(" <Name>WatchStatus</Name>\n");
188         xml.append(" <Value>").append(String.valueOf(watchStatus)).append("</Value>\n");
189         xml.append(" </Column>\n");
190         xml.append(" <Column>\n");
191         xml.append(" <Name>WatchCreationDate</Name>\n");
192         xml.append(" <Value>").append(String.valueOf(watchCreationDate)).append("</Value>\n");
193         xml.append(" </Column>\n");
194         xml.append(" <Column>\n");
195         xml.append(" <Name>WatchLastSentDate</Name>\n");
196         xml.append(" <Value>").append(String.valueOf(watchLastSentDate)).append("</Value>\n");
197         xml.append(" </Column>\n");
198         xml.append(" <Column>\n");
199         xml.append(" <Name>WatchEndDate</Name>\n");
200         xml.append(" <Value>").append(String.valueOf(watchEndDate)).append("</Value>\n");
201         xml.append(" </Column>\n");
202         xml.append(" </Row>\n");
203         xml.append(" </Rows>\n");
204         xml.append("</WatchSection>\n");
205         return xml.toString();
206     }
207
208     public static String JavaDoc getXML(Collection JavaDoc objWatchBeans) {
209         StringBuffer JavaDoc xml = new StringBuffer JavaDoc(1024);
210         Iterator JavaDoc iterator = objWatchBeans.iterator();
211         xml.append("<WatchSection>\n");
212         xml.append(" <Rows>\n");
213         while (iterator.hasNext()) {
214             WatchBean objWatchBean = (WatchBean)iterator.next();
215             xml.append(" <Row>\n");
216             xml.append(" <Column>\n");
217             xml.append(" <Name>WatchID</Name>\n");
218             xml.append(" <Value>").append(String.valueOf(objWatchBean.watchID)).append("</Value>\n");
219             xml.append(" </Column>\n");
220             xml.append(" <Column>\n");
221             xml.append(" <Name>MemberID</Name>\n");
222             xml.append(" <Value>").append(String.valueOf(objWatchBean.memberID)).append("</Value>\n");
223             xml.append(" </Column>\n");
224             xml.append(" <Column>\n");
225             xml.append(" <Name>CategoryID</Name>\n");
226             xml.append(" <Value>").append(String.valueOf(objWatchBean.categoryID)).append("</Value>\n");
227             xml.append(" </Column>\n");
228             xml.append(" <Column>\n");
229             xml.append(" <Name>ForumID</Name>\n");
230             xml.append(" <Value>").append(String.valueOf(objWatchBean.forumID)).append("</Value>\n");
231             xml.append(" </Column>\n");
232             xml.append(" <Column>\n");
233             xml.append(" <Name>ThreadID</Name>\n");
234             xml.append(" <Value>").append(String.valueOf(objWatchBean.threadID)).append("</Value>\n");
235             xml.append(" </Column>\n");
236             xml.append(" <Column>\n");
237             xml.append(" <Name>WatchType</Name>\n");
238             xml.append(" <Value>").append(String.valueOf(objWatchBean.watchType)).append("</Value>\n");
239             xml.append(" </Column>\n");
240             xml.append(" <Column>\n");
241             xml.append(" <Name>WatchOption</Name>\n");
242             xml.append(" <Value>").append(String.valueOf(objWatchBean.watchOption)).append("</Value>\n");
243             xml.append(" </Column>\n");
244             xml.append(" <Column>\n");
245             xml.append(" <Name>WatchStatus</Name>\n");
246             xml.append(" <Value>").append(String.valueOf(objWatchBean.watchStatus)).append("</Value>\n");
247             xml.append(" </Column>\n");
248             xml.append(" <Column>\n");
249             xml.append(" <Name>WatchCreationDate</Name>\n");
250             xml.append(" <Value>").append(String.valueOf(objWatchBean.watchCreationDate)).append("</Value>\n");
251             xml.append(" </Column>\n");
252             xml.append(" <Column>\n");
253             xml.append(" <Name>WatchLastSentDate</Name>\n");
254             xml.append(" <Value>").append(String.valueOf(objWatchBean.watchLastSentDate)).append("</Value>\n");
255             xml.append(" </Column>\n");
256             xml.append(" <Column>\n");
257             xml.append(" <Name>WatchEndDate</Name>\n");
258             xml.append(" <Value>").append(String.valueOf(objWatchBean.watchEndDate)).append("</Value>\n");
259             xml.append(" </Column>\n");
260             xml.append(" </Row>\n");
261         }//while
262
xml.append(" </Rows>\n");
263         xml.append("</WatchSection>\n");
264         return xml.toString();
265     }
266
267     // Store the ThreadBean if this is a Thread Watch
268
ThreadBean threadBean = null;
269
270     public ThreadBean getThreadBean() {
271         return threadBean;
272     }
273     public void setThreadBean(ThreadBean threadBean) {
274         this.threadBean = threadBean;
275     }
276
277 } //end of class WatchBean
278
Popular Tags