1 package org.tigris.scarab.util.word; 2 3 48 49 import java.util.List ; 50 import java.util.ArrayList ; 51 import java.util.Iterator ; 52 import org.apache.torque.TorqueException; 53 import org.tigris.scarab.om.Module; 54 import org.tigris.scarab.om.RModuleIssueType; 55 56 64 public class QueryResult 65 { 66 67 private final IssueSearch search; 68 private String issueId; 69 private String idPrefix; 70 private String idCount; 71 private String uniqueId; 72 private List attributeValues; 73 private Integer moduleId; 74 private Integer issueTypeId; 75 76 81 QueryResult(IssueSearch search) 82 { 83 this.search = search; 84 } 85 86 90 public final String getIssueId() 91 { 92 return issueId; 93 } 94 95 99 public final void setIssueId(String newIssueId) 100 { 101 this.issueId = newIssueId; 102 } 103 104 108 public final String getIdPrefix() 109 { 110 return idPrefix; 111 } 112 113 117 public final void setIdPrefix(String newIdPrefix) 118 { 119 this.idPrefix = newIdPrefix; 120 } 121 122 126 public final String getIdCount() 127 { 128 return idCount; 129 } 130 131 135 public final void setIdCount(String newIdCount) 136 { 137 this.idCount = newIdCount; 138 } 139 140 141 144 public final String getUniqueId() 145 { 146 if (uniqueId == null) 147 { 148 uniqueId = getIdPrefix() + getIdCount(); 149 } 150 151 return uniqueId; 152 } 153 154 158 public final List getAttributeValues() 159 { 160 return attributeValues; 161 } 162 163 167 public final List getAttributeValuesAsCSV() 168 { 169 List result = null; 170 if (attributeValues != null) 171 { 172 result = new ArrayList (attributeValues.size()); 173 for (Iterator i = attributeValues.iterator(); i.hasNext();) 174 { 175 String csv = null; 176 List multiVal = (List )i.next(); 177 if (multiVal.size() == 1) 178 { 179 csv = (String )multiVal.get(0); 180 if (csv == null) 181 { 182 csv = ""; 183 } 184 } 185 else 186 { 187 StringBuffer sb = new StringBuffer (); 188 boolean addComma = false; 189 for (Iterator j = multiVal.iterator(); j.hasNext();) 190 { 191 if (addComma) 192 { 193 sb.append(", "); 194 } 195 else 196 { 197 addComma = true; 198 } 199 200 sb.append(j.next().toString()); 201 } 202 csv = sb.toString(); 203 } 204 result.add(csv); 205 } 206 } 207 208 return result; 209 } 210 211 215 public final void setAttributeValues(List newAttributeValues) 216 { 217 this.attributeValues = newAttributeValues; 218 } 219 220 221 225 public final Integer getModuleId() 226 { 227 return moduleId; 228 } 229 230 234 public final void setModuleId(Integer newModuleId) 235 { 236 this.moduleId = newModuleId; 237 } 238 239 244 public final Module getModule() 245 throws TorqueException 246 { 247 return search.getModule(moduleId); 248 } 249 250 254 public final Integer getIssueTypeId() 255 { 256 return issueTypeId; 257 } 258 259 263 public final void setIssueTypeId(Integer newIssueTypeId) 264 { 265 this.issueTypeId = newIssueTypeId; 266 } 267 268 273 public final RModuleIssueType getRModuleIssueType() 274 throws TorqueException 275 { 276 return search.getRModuleIssueType(moduleId, issueTypeId); 277 } 278 } 279 | Popular Tags |