1 41 package com.mvnforum.db; 42 43 import java.util.Collection ; 44 import java.util.Iterator ; 45 46 import net.myvietnam.mvncore.util.StringUtil; 47 48 53 public class RankBean { 54 private int rankID; 55 private int rankMinPosts; 56 private int rankLevel; 57 private String rankTitle; 58 private String 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 getRankTitle() { 84 return rankTitle; 85 } 86 public void setRankTitle(String rankTitle) { 87 this.rankTitle = StringUtil.getEmptyStringIfNull(rankTitle); 88 } 89 90 public String getRankImage() { 91 return rankImage; 92 } 93 public void setRankImage(String 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 getXML() { 112 StringBuffer xml = new StringBuffer (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 getXML(Collection objRankBeans) { 151 StringBuffer xml = new StringBuffer (1024); 152 Iterator 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 } xml.append(" </Rows>\n"); 189 xml.append("</RankSection>\n"); 190 return xml.toString(); 191 } 192 } | Popular Tags |