KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * $Header: /cvsroot/mvnforum/mvnforum/src/com/mvnforum/db/CategoryBean.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.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: CategoryID, ParentCategoryID, CategoryName, CategoryDesc, CategoryCreationDate,
51  * CategoryModifiedDate, CategoryOrder, CategoryOption, CategoryStatus
52  * Excluded columns:
53  */

54 public class CategoryBean {
55     private int categoryID;
56     private int parentCategoryID;
57     private String JavaDoc categoryName;
58     private String JavaDoc categoryDesc;
59     private Timestamp JavaDoc categoryCreationDate;
60     private Timestamp JavaDoc categoryModifiedDate;
61     private int categoryOrder;
62     private int categoryOption;
63     private int categoryStatus;
64
65     public int getCategoryID() {
66         return categoryID;
67     }
68     public void setCategoryID(int categoryID) {
69         this.categoryID = categoryID;
70     }
71
72     public int getParentCategoryID() {
73         return parentCategoryID;
74     }
75     public void setParentCategoryID(int parentCategoryID) {
76         this.parentCategoryID = parentCategoryID;
77     }
78
79     public String JavaDoc getCategoryName() {
80         return categoryName;
81     }
82     public void setCategoryName(String JavaDoc categoryName) {
83         this.categoryName = categoryName;
84     }
85
86     public String JavaDoc getCategoryDesc() {
87         return categoryDesc;
88     }
89     public void setCategoryDesc(String JavaDoc categoryDesc) {
90         this.categoryDesc = StringUtil.getEmptyStringIfNull(categoryDesc);
91     }
92
93     public Timestamp JavaDoc getCategoryCreationDate() {
94         return categoryCreationDate;
95     }
96     public void setCategoryCreationDate(Timestamp JavaDoc categoryCreationDate) {
97         this.categoryCreationDate = categoryCreationDate;
98     }
99
100     public Timestamp JavaDoc getCategoryModifiedDate() {
101         return categoryModifiedDate;
102     }
103     public void setCategoryModifiedDate(Timestamp JavaDoc categoryModifiedDate) {
104         this.categoryModifiedDate = categoryModifiedDate;
105     }
106
107     public int getCategoryOrder() {
108         return categoryOrder;
109     }
110     public void setCategoryOrder(int categoryOrder) {
111         this.categoryOrder = categoryOrder;
112     }
113
114     public int getCategoryOption() {
115         return categoryOption;
116     }
117     public void setCategoryOption(int categoryOption) {
118         this.categoryOption = categoryOption;
119     }
120
121     public int getCategoryStatus() {
122         return categoryStatus;
123     }
124     public void setCategoryStatus(int categoryStatus) {
125         this.categoryStatus = categoryStatus;
126     }
127
128     public String JavaDoc getXMLTag() {
129         StringBuffer JavaDoc xml = new StringBuffer JavaDoc(1024);
130         xml.append("<Category");
131         xml.append(" categoryID=\"").append(String.valueOf(categoryID)).append("\"");
132         xml.append(" parentCategoryID=\"").append(String.valueOf(parentCategoryID)).append("\"");
133         xml.append(" categoryName=\"").append(String.valueOf(categoryName)).append("\"");
134         xml.append(" categoryDesc=\"").append(String.valueOf(categoryDesc)).append("\"");
135         xml.append(" categoryCreationDate=\"").append(String.valueOf(categoryCreationDate)).append("\"");
136         xml.append(" categoryModifiedDate=\"").append(String.valueOf(categoryModifiedDate)).append("\"");
137         xml.append(" categoryOrder=\"").append(String.valueOf(categoryOrder)).append("\"");
138         xml.append(" categoryOption=\"").append(String.valueOf(categoryOption)).append("\"");
139         xml.append(" categoryStatus=\"").append(String.valueOf(categoryStatus)).append("\"");
140         xml.append(">");
141         return xml.toString();
142     }
143
144     public String JavaDoc getXML() {
145         StringBuffer JavaDoc xml = new StringBuffer JavaDoc(1024);
146         xml.append("<CategorySection>\n");
147         xml.append(" <Rows>\n");
148         xml.append(" <Row>\n");
149         xml.append(" <Column>\n");
150         xml.append(" <Name>CategoryID</Name>\n");
151         xml.append(" <Value>").append(String.valueOf(categoryID)).append("</Value>\n");
152         xml.append(" </Column>\n");
153         xml.append(" <Column>\n");
154         xml.append(" <Name>ParentCategoryID</Name>\n");
155         xml.append(" <Value>").append(String.valueOf(parentCategoryID)).append("</Value>\n");
156         xml.append(" </Column>\n");
157         xml.append(" <Column>\n");
158         xml.append(" <Name>CategoryName</Name>\n");
159         xml.append(" <Value>").append(String.valueOf(categoryName)).append("</Value>\n");
160         xml.append(" </Column>\n");
161         xml.append(" <Column>\n");
162         xml.append(" <Name>CategoryDesc</Name>\n");
163         xml.append(" <Value>").append(String.valueOf(categoryDesc)).append("</Value>\n");
164         xml.append(" </Column>\n");
165         xml.append(" <Column>\n");
166         xml.append(" <Name>CategoryCreationDate</Name>\n");
167         xml.append(" <Value>").append(String.valueOf(categoryCreationDate)).append("</Value>\n");
168         xml.append(" </Column>\n");
169         xml.append(" <Column>\n");
170         xml.append(" <Name>CategoryModifiedDate</Name>\n");
171         xml.append(" <Value>").append(String.valueOf(categoryModifiedDate)).append("</Value>\n");
172         xml.append(" </Column>\n");
173         xml.append(" <Column>\n");
174         xml.append(" <Name>CategoryOrder</Name>\n");
175         xml.append(" <Value>").append(String.valueOf(categoryOrder)).append("</Value>\n");
176         xml.append(" </Column>\n");
177         xml.append(" <Column>\n");
178         xml.append(" <Name>CategoryOption</Name>\n");
179         xml.append(" <Value>").append(String.valueOf(categoryOption)).append("</Value>\n");
180         xml.append(" </Column>\n");
181         xml.append(" <Column>\n");
182         xml.append(" <Name>CategoryStatus</Name>\n");
183         xml.append(" <Value>").append(String.valueOf(categoryStatus)).append("</Value>\n");
184         xml.append(" </Column>\n");
185         xml.append(" </Row>\n");
186         xml.append(" </Rows>\n");
187         xml.append("</CategorySection>\n");
188         return xml.toString();
189     }
190
191     public static String JavaDoc getXML(Collection JavaDoc objCategoryBeans) {
192         StringBuffer JavaDoc xml = new StringBuffer JavaDoc(1024);
193         Iterator JavaDoc iterator = objCategoryBeans.iterator();
194         xml.append("<CategorySection>\n");
195         xml.append(" <Rows>\n");
196         while (iterator.hasNext()) {
197             CategoryBean objCategoryBean = (CategoryBean)iterator.next();
198             xml.append(" <Row>\n");
199             xml.append(" <Column>\n");
200             xml.append(" <Name>CategoryID</Name>\n");
201             xml.append(" <Value>").append(String.valueOf(objCategoryBean.categoryID)).append("</Value>\n");
202             xml.append(" </Column>\n");
203             xml.append(" <Column>\n");
204             xml.append(" <Name>ParentCategoryID</Name>\n");
205             xml.append(" <Value>").append(String.valueOf(objCategoryBean.parentCategoryID)).append("</Value>\n");
206             xml.append(" </Column>\n");
207             xml.append(" <Column>\n");
208             xml.append(" <Name>CategoryName</Name>\n");
209             xml.append(" <Value>").append(String.valueOf(objCategoryBean.categoryName)).append("</Value>\n");
210             xml.append(" </Column>\n");
211             xml.append(" <Column>\n");
212             xml.append(" <Name>CategoryDesc</Name>\n");
213             xml.append(" <Value>").append(String.valueOf(objCategoryBean.categoryDesc)).append("</Value>\n");
214             xml.append(" </Column>\n");
215             xml.append(" <Column>\n");
216             xml.append(" <Name>CategoryCreationDate</Name>\n");
217             xml.append(" <Value>").append(String.valueOf(objCategoryBean.categoryCreationDate)).append("</Value>\n");
218             xml.append(" </Column>\n");
219             xml.append(" <Column>\n");
220             xml.append(" <Name>CategoryModifiedDate</Name>\n");
221             xml.append(" <Value>").append(String.valueOf(objCategoryBean.categoryModifiedDate)).append("</Value>\n");
222             xml.append(" </Column>\n");
223             xml.append(" <Column>\n");
224             xml.append(" <Name>CategoryOrder</Name>\n");
225             xml.append(" <Value>").append(String.valueOf(objCategoryBean.categoryOrder)).append("</Value>\n");
226             xml.append(" </Column>\n");
227             xml.append(" <Column>\n");
228             xml.append(" <Name>CategoryOption</Name>\n");
229             xml.append(" <Value>").append(String.valueOf(objCategoryBean.categoryOption)).append("</Value>\n");
230             xml.append(" </Column>\n");
231             xml.append(" <Column>\n");
232             xml.append(" <Name>CategoryStatus</Name>\n");
233             xml.append(" <Value>").append(String.valueOf(objCategoryBean.categoryStatus)).append("</Value>\n");
234             xml.append(" </Column>\n");
235             xml.append(" </Row>\n");
236         }//while
237
xml.append(" </Rows>\n");
238         xml.append("</CategorySection>\n");
239         return xml.toString();
240     }
241 } //end of class CategoryBean
242
Popular Tags