KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * $Header: /cvsroot/mvnforum/mvnforum/src/com/mvnforum/db/RankBean.java,v 1.7 2006/04/14 17:05:26 minhnn Exp $
3  * $Author: minhnn $
4  * $Revision: 1.7 $
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.util.Collection JavaDoc;
44 import java.util.Iterator JavaDoc;
45
46 import net.myvietnam.mvncore.util.StringUtil;
47
48 /*
49  * Included columns: RankID, RankMinPosts, RankLevel, RankTitle, RankImage,
50  * RankType, RankOption
51  * Excluded columns:
52  */

53 public class RankBean {
54     private int rankID;
55     private int rankMinPosts;
56     private int rankLevel;
57     private String JavaDoc rankTitle;
58     private String JavaDoc rankImage;
59     private int rankType;
60     private int rankOption;
61
62     public int getRankID() {
63         return rankID;
64     }
65     public void setRankID(int rankID) {
66         this.rankID = rankID;
67     }
68
69     public int getRankMinPosts() {
70         return rankMinPosts;
71     }
72     public void setRankMinPosts(int rankMinPosts) {
73         this.rankMinPosts = rankMinPosts;
74     }
75
76     public int getRankLevel() {
77         return rankLevel;
78     }
79     public void setRankLevel(int rankLevel) {
80         this.rankLevel = rankLevel;
81     }
82
83     public String JavaDoc getRankTitle() {
84         return rankTitle;
85     }
86     public void setRankTitle(String JavaDoc rankTitle) {
87         this.rankTitle = StringUtil.getEmptyStringIfNull(rankTitle);
88     }
89
90     public String JavaDoc getRankImage() {
91         return rankImage;
92     }
93     public void setRankImage(String JavaDoc rankImage) {
94         this.rankImage = StringUtil.getEmptyStringIfNull(rankImage);
95     }
96
97     public int getRankType() {
98         return rankType;
99     }
100     public void setRankType(int rankType) {
101         this.rankType = rankType;
102     }
103
104     public int getRankOption() {
105         return rankOption;
106     }
107     public void setRankOption(int rankOption) {
108         this.rankOption = rankOption;
109     }
110
111     public String JavaDoc getXML() {
112         StringBuffer JavaDoc xml = new StringBuffer JavaDoc(1024);
113         xml.append("<RankSection>\n");
114         xml.append(" <Rows>\n");
115         xml.append(" <Row>\n");
116         xml.append(" <Column>\n");
117         xml.append(" <Name>RankID</Name>\n");
118         xml.append(" <Value>").append(String.valueOf(rankID)).append("</Value>\n");
119         xml.append(" </Column>\n");
120         xml.append(" <Column>\n");
121         xml.append(" <Name>RankMinPosts</Name>\n");
122         xml.append(" <Value>").append(String.valueOf(rankMinPosts)).append("</Value>\n");
123         xml.append(" </Column>\n");
124         xml.append(" <Column>\n");
125         xml.append(" <Name>RankLevel</Name>\n");
126         xml.append(" <Value>").append(String.valueOf(rankLevel)).append("</Value>\n");
127         xml.append(" </Column>\n");
128         xml.append(" <Column>\n");
129         xml.append(" <Name>RankTitle</Name>\n");
130         xml.append(" <Value>").append(String.valueOf(rankTitle)).append("</Value>\n");
131         xml.append(" </Column>\n");
132         xml.append(" <Column>\n");
133         xml.append(" <Name>RankImage</Name>\n");
134         xml.append(" <Value>").append(String.valueOf(rankImage)).append("</Value>\n");
135         xml.append(" </Column>\n");
136         xml.append(" <Column>\n");
137         xml.append(" <Name>RankType</Name>\n");
138         xml.append(" <Value>").append(String.valueOf(rankType)).append("</Value>\n");
139         xml.append(" </Column>\n");
140         xml.append(" <Column>\n");
141         xml.append(" <Name>RankOption</Name>\n");
142         xml.append(" <Value>").append(String.valueOf(rankOption)).append("</Value>\n");
143         xml.append(" </Column>\n");
144         xml.append(" </Row>\n");
145         xml.append(" </Rows>\n");
146         xml.append("</RankSection>\n");
147         return xml.toString();
148     }
149
150     public static String JavaDoc getXML(Collection JavaDoc objRankBeans) {
151         StringBuffer JavaDoc xml = new StringBuffer JavaDoc(1024);
152         Iterator JavaDoc iterator = objRankBeans.iterator();
153         xml.append("<RankSection>\n");
154         xml.append(" <Rows>\n");
155         while (iterator.hasNext()) {
156             RankBean objRankBean = (RankBean)iterator.next();
157             xml.append(" <Row>\n");
158             xml.append(" <Column>\n");
159             xml.append(" <Name>RankID</Name>\n");
160             xml.append(" <Value>").append(String.valueOf(objRankBean.rankID)).append("</Value>\n");
161             xml.append(" </Column>\n");
162             xml.append(" <Column>\n");
163             xml.append(" <Name>RankMinPosts</Name>\n");
164             xml.append(" <Value>").append(String.valueOf(objRankBean.rankMinPosts)).append("</Value>\n");
165             xml.append(" </Column>\n");
166             xml.append(" <Column>\n");
167             xml.append(" <Name>RankLevel</Name>\n");
168             xml.append(" <Value>").append(String.valueOf(objRankBean.rankLevel)).append("</Value>\n");
169             xml.append(" </Column>\n");
170             xml.append(" <Column>\n");
171             xml.append(" <Name>RankTitle</Name>\n");
172             xml.append(" <Value>").append(String.valueOf(objRankBean.rankTitle)).append("</Value>\n");
173             xml.append(" </Column>\n");
174             xml.append(" <Column>\n");
175             xml.append(" <Name>RankImage</Name>\n");
176             xml.append(" <Value>").append(String.valueOf(objRankBean.rankImage)).append("</Value>\n");
177             xml.append(" </Column>\n");
178             xml.append(" <Column>\n");
179             xml.append(" <Name>RankType</Name>\n");
180             xml.append(" <Value>").append(String.valueOf(objRankBean.rankType)).append("</Value>\n");
181             xml.append(" </Column>\n");
182             xml.append(" <Column>\n");
183             xml.append(" <Name>RankOption</Name>\n");
184             xml.append(" <Value>").append(String.valueOf(objRankBean.rankOption)).append("</Value>\n");
185             xml.append(" </Column>\n");
186             xml.append(" </Row>\n");
187         }//while
188
xml.append(" </Rows>\n");
189         xml.append("</RankSection>\n");
190         return xml.toString();
191     }
192 } //end of class RankBean
193
Popular Tags