KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * $Header: /cvsroot/mvnforum/mvnforum/src/com/mvnforum/db/AttachmentBean.java,v 1.6 2006/04/14 17:05:26 minhnn Exp $
3  * $Author: minhnn $
4  * $Revision: 1.6 $
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 import net.myvietnam.mvncore.util.StringUtil;
48
49 /*
50  * Included columns: AttachID, PostID, MemberID, AttachFilename, AttachFileSize,
51  * AttachMimeType, AttachDesc, AttachCreationIP, AttachCreationDate, AttachModifiedDate,
52  * AttachDownloadCount, AttachOption, AttachStatus
53  * Excluded columns:
54  */

55 public class AttachmentBean {
56     private int attachID;
57     private int postID;
58     private int memberID;
59     private String JavaDoc attachFilename;
60     private int attachFileSize;
61     private String JavaDoc attachMimeType;
62     private String JavaDoc attachDesc;
63     private String JavaDoc attachCreationIP;
64     private Timestamp JavaDoc attachCreationDate;
65     private Timestamp JavaDoc attachModifiedDate;
66     private int attachDownloadCount;
67     private int attachOption;
68     private int attachStatus;
69
70     public int getAttachID() {
71         return attachID;
72     }
73     public void setAttachID(int attachID) {
74         this.attachID = attachID;
75     }
76
77     public int getPostID() {
78         return postID;
79     }
80     public void setPostID(int postID) {
81         this.postID = postID;
82     }
83
84     public int getMemberID() {
85         return memberID;
86     }
87     public void setMemberID(int memberID) {
88         this.memberID = memberID;
89     }
90
91     public String JavaDoc getAttachFilename() {
92         return attachFilename;
93     }
94     public void setAttachFilename(String JavaDoc attachFilename) {
95         this.attachFilename = StringUtil.getEmptyStringIfNull(attachFilename);
96     }
97
98     public int getAttachFileSize() {
99         return attachFileSize;
100     }
101     public void setAttachFileSize(int attachFileSize) {
102         this.attachFileSize = attachFileSize;
103     }
104
105     public String JavaDoc getAttachMimeType() {
106         return attachMimeType;
107     }
108     public void setAttachMimeType(String JavaDoc attachMimeType) {
109         this.attachMimeType = StringUtil.getEmptyStringIfNull(attachMimeType);
110     }
111
112     public String JavaDoc getAttachDesc() {
113         return attachDesc;
114     }
115     public void setAttachDesc(String JavaDoc attachDesc) {
116         this.attachDesc = StringUtil.getEmptyStringIfNull(attachDesc);
117     }
118
119     public String JavaDoc getAttachCreationIP() {
120         return attachCreationIP;
121     }
122     public void setAttachCreationIP(String JavaDoc attachCreationIP) {
123         this.attachCreationIP = StringUtil.getEmptyStringIfNull(attachCreationIP);
124     }
125
126     public Timestamp JavaDoc getAttachCreationDate() {
127         return attachCreationDate;
128     }
129     public void setAttachCreationDate(Timestamp JavaDoc attachCreationDate) {
130         this.attachCreationDate = attachCreationDate;
131     }
132
133     public Timestamp JavaDoc getAttachModifiedDate() {
134         return attachModifiedDate;
135     }
136     public void setAttachModifiedDate(Timestamp JavaDoc attachModifiedDate) {
137         this.attachModifiedDate = attachModifiedDate;
138     }
139
140     public int getAttachDownloadCount() {
141         return attachDownloadCount;
142     }
143     public void setAttachDownloadCount(int attachDownloadCount) {
144         this.attachDownloadCount = attachDownloadCount;
145     }
146
147     public int getAttachOption() {
148         return attachOption;
149     }
150     public void setAttachOption(int attachOption) {
151         this.attachOption = attachOption;
152     }
153
154     public int getAttachStatus() {
155         return attachStatus;
156     }
157     public void setAttachStatus(int attachStatus) {
158         this.attachStatus = attachStatus;
159     }
160
161     public String JavaDoc getXML() {
162         StringBuffer JavaDoc xml = new StringBuffer JavaDoc(1024);
163         xml.append("<AttachmentSection>\n");
164         xml.append(" <Rows>\n");
165         xml.append(" <Row>\n");
166         xml.append(" <Column>\n");
167         xml.append(" <Name>AttachID</Name>\n");
168         xml.append(" <Value>").append(String.valueOf(attachID)).append("</Value>\n");
169         xml.append(" </Column>\n");
170         xml.append(" <Column>\n");
171         xml.append(" <Name>PostID</Name>\n");
172         xml.append(" <Value>").append(String.valueOf(postID)).append("</Value>\n");
173         xml.append(" </Column>\n");
174         xml.append(" <Column>\n");
175         xml.append(" <Name>MemberID</Name>\n");
176         xml.append(" <Value>").append(String.valueOf(memberID)).append("</Value>\n");
177         xml.append(" </Column>\n");
178         xml.append(" <Column>\n");
179         xml.append(" <Name>AttachFilename</Name>\n");
180         xml.append(" <Value>").append(String.valueOf(attachFilename)).append("</Value>\n");
181         xml.append(" </Column>\n");
182         xml.append(" <Column>\n");
183         xml.append(" <Name>AttachFileSize</Name>\n");
184         xml.append(" <Value>").append(String.valueOf(attachFileSize)).append("</Value>\n");
185         xml.append(" </Column>\n");
186         xml.append(" <Column>\n");
187         xml.append(" <Name>AttachMimeType</Name>\n");
188         xml.append(" <Value>").append(String.valueOf(attachMimeType)).append("</Value>\n");
189         xml.append(" </Column>\n");
190         xml.append(" <Column>\n");
191         xml.append(" <Name>AttachDesc</Name>\n");
192         xml.append(" <Value>").append(String.valueOf(attachDesc)).append("</Value>\n");
193         xml.append(" </Column>\n");
194         xml.append(" <Column>\n");
195         xml.append(" <Name>AttachCreationIP</Name>\n");
196         xml.append(" <Value>").append(String.valueOf(attachCreationIP)).append("</Value>\n");
197         xml.append(" </Column>\n");
198         xml.append(" <Column>\n");
199         xml.append(" <Name>AttachCreationDate</Name>\n");
200         xml.append(" <Value>").append(String.valueOf(attachCreationDate)).append("</Value>\n");
201         xml.append(" </Column>\n");
202         xml.append(" <Column>\n");
203         xml.append(" <Name>AttachModifiedDate</Name>\n");
204         xml.append(" <Value>").append(String.valueOf(attachModifiedDate)).append("</Value>\n");
205         xml.append(" </Column>\n");
206         xml.append(" <Column>\n");
207         xml.append(" <Name>AttachDownloadCount</Name>\n");
208         xml.append(" <Value>").append(String.valueOf(attachDownloadCount)).append("</Value>\n");
209         xml.append(" </Column>\n");
210         xml.append(" <Column>\n");
211         xml.append(" <Name>AttachOption</Name>\n");
212         xml.append(" <Value>").append(String.valueOf(attachOption)).append("</Value>\n");
213         xml.append(" </Column>\n");
214         xml.append(" <Column>\n");
215         xml.append(" <Name>AttachStatus</Name>\n");
216         xml.append(" <Value>").append(String.valueOf(attachStatus)).append("</Value>\n");
217         xml.append(" </Column>\n");
218         xml.append(" </Row>\n");
219         xml.append(" </Rows>\n");
220         xml.append("</AttachmentSection>\n");
221         return xml.toString();
222     }
223
224     public static String JavaDoc getXML(Collection JavaDoc objAttachmentBeans) {
225         StringBuffer JavaDoc xml = new StringBuffer JavaDoc(1024);
226         Iterator JavaDoc iterator = objAttachmentBeans.iterator();
227         xml.append("<AttachmentSection>\n");
228         xml.append(" <Rows>\n");
229         while (iterator.hasNext()) {
230             AttachmentBean objAttachmentBean = (AttachmentBean)iterator.next();
231             xml.append(" <Row>\n");
232             xml.append(" <Column>\n");
233             xml.append(" <Name>AttachID</Name>\n");
234             xml.append(" <Value>").append(String.valueOf(objAttachmentBean.attachID)).append("</Value>\n");
235             xml.append(" </Column>\n");
236             xml.append(" <Column>\n");
237             xml.append(" <Name>PostID</Name>\n");
238             xml.append(" <Value>").append(String.valueOf(objAttachmentBean.postID)).append("</Value>\n");
239             xml.append(" </Column>\n");
240             xml.append(" <Column>\n");
241             xml.append(" <Name>MemberID</Name>\n");
242             xml.append(" <Value>").append(String.valueOf(objAttachmentBean.memberID)).append("</Value>\n");
243             xml.append(" </Column>\n");
244             xml.append(" <Column>\n");
245             xml.append(" <Name>AttachFilename</Name>\n");
246             xml.append(" <Value>").append(String.valueOf(objAttachmentBean.attachFilename)).append("</Value>\n");
247             xml.append(" </Column>\n");
248             xml.append(" <Column>\n");
249             xml.append(" <Name>AttachFileSize</Name>\n");
250             xml.append(" <Value>").append(String.valueOf(objAttachmentBean.attachFileSize)).append("</Value>\n");
251             xml.append(" </Column>\n");
252             xml.append(" <Column>\n");
253             xml.append(" <Name>AttachMimeType</Name>\n");
254             xml.append(" <Value>").append(String.valueOf(objAttachmentBean.attachMimeType)).append("</Value>\n");
255             xml.append(" </Column>\n");
256             xml.append(" <Column>\n");
257             xml.append(" <Name>AttachDesc</Name>\n");
258             xml.append(" <Value>").append(String.valueOf(objAttachmentBean.attachDesc)).append("</Value>\n");
259             xml.append(" </Column>\n");
260             xml.append(" <Column>\n");
261             xml.append(" <Name>AttachCreationIP</Name>\n");
262             xml.append(" <Value>").append(String.valueOf(objAttachmentBean.attachCreationIP)).append("</Value>\n");
263             xml.append(" </Column>\n");
264             xml.append(" <Column>\n");
265             xml.append(" <Name>AttachCreationDate</Name>\n");
266             xml.append(" <Value>").append(String.valueOf(objAttachmentBean.attachCreationDate)).append("</Value>\n");
267             xml.append(" </Column>\n");
268             xml.append(" <Column>\n");
269             xml.append(" <Name>AttachModifiedDate</Name>\n");
270             xml.append(" <Value>").append(String.valueOf(objAttachmentBean.attachModifiedDate)).append("</Value>\n");
271             xml.append(" </Column>\n");
272             xml.append(" <Column>\n");
273             xml.append(" <Name>AttachDownloadCount</Name>\n");
274             xml.append(" <Value>").append(String.valueOf(objAttachmentBean.attachDownloadCount)).append("</Value>\n");
275             xml.append(" </Column>\n");
276             xml.append(" <Column>\n");
277             xml.append(" <Name>AttachOption</Name>\n");
278             xml.append(" <Value>").append(String.valueOf(objAttachmentBean.attachOption)).append("</Value>\n");
279             xml.append(" </Column>\n");
280             xml.append(" <Column>\n");
281             xml.append(" <Name>AttachStatus</Name>\n");
282             xml.append(" <Value>").append(String.valueOf(objAttachmentBean.attachStatus)).append("</Value>\n");
283             xml.append(" </Column>\n");
284             xml.append(" </Row>\n");
285         }//while
286
xml.append(" </Rows>\n");
287         xml.append("</AttachmentSection>\n");
288         return xml.toString();
289     }
290 } //end of class AttachmentBean
291
Popular Tags