1 41 package com.mvnforum.db; 42 43 import java.sql.Timestamp ; 44 import java.util.Collection ; 45 import java.util.Iterator ; 46 47 import net.myvietnam.mvncore.util.StringUtil; 48 49 54 public class CategoryBean { 55 private int categoryID; 56 private int parentCategoryID; 57 private String categoryName; 58 private String categoryDesc; 59 private Timestamp categoryCreationDate; 60 private Timestamp 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 getCategoryName() { 80 return categoryName; 81 } 82 public void setCategoryName(String categoryName) { 83 this.categoryName = categoryName; 84 } 85 86 public String getCategoryDesc() { 87 return categoryDesc; 88 } 89 public void setCategoryDesc(String categoryDesc) { 90 this.categoryDesc = StringUtil.getEmptyStringIfNull(categoryDesc); 91 } 92 93 public Timestamp getCategoryCreationDate() { 94 return categoryCreationDate; 95 } 96 public void setCategoryCreationDate(Timestamp categoryCreationDate) { 97 this.categoryCreationDate = categoryCreationDate; 98 } 99 100 public Timestamp getCategoryModifiedDate() { 101 return categoryModifiedDate; 102 } 103 public void setCategoryModifiedDate(Timestamp 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 getXMLTag() { 129 StringBuffer xml = new StringBuffer (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 getXML() { 145 StringBuffer xml = new StringBuffer (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 getXML(Collection objCategoryBeans) { 192 StringBuffer xml = new StringBuffer (1024); 193 Iterator 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 } xml.append(" </Rows>\n"); 238 xml.append("</CategorySection>\n"); 239 return xml.toString(); 240 } 241 } | Popular Tags |