1 18 package org.apache.roller.pojos; 19 20 import org.apache.roller.RollerException; 21 import org.apache.roller.model.BookmarkManager; 22 import org.apache.roller.model.Roller; 23 import org.apache.roller.model.RollerFactory; 24 25 import java.io.Serializable ; 26 27 40 public class BookmarkData extends PersistentObject 41 implements Serializable , Comparable 42 { 43 static final long serialVersionUID = 2315131256728236003L; 44 45 private FolderData folder; 46 47 private String id = null; 48 private String name; 49 private String description; 50 private String url; 51 private Integer weight; 52 private Integer priority; 53 private String image; 54 private String feedUrl; 55 56 private BookmarkManager bookmarkManager = null; 57 58 60 61 public BookmarkData() 62 { 63 } 64 65 public BookmarkData( 66 FolderData parent, 67 String name, 68 String desc, 69 String url, 70 String feedUrl, 71 Integer weight, 72 Integer priority, 73 String image) 74 { 75 this.folder = parent; 76 this.name = name; 77 this.description = desc; 78 this.url = url; 79 this.feedUrl = feedUrl; 80 this.weight = weight; 81 this.priority = priority; 82 this.image = image; 83 } 84 85 86 public BookmarkData(BookmarkManager bmgr) 87 { 88 bookmarkManager = bmgr; 89 } 90 91 93 101 public String getId() 102 { 103 return this.id; 104 } 105 106 107 public void setId(String id) 108 { 109 this.id = id; 110 } 111 112 124 public String getName() 125 { 126 return this.name; 127 } 128 129 130 public void setName(String name) 131 { 132 this.name = name; 133 } 134 135 144 public String getDescription() 145 { 146 return this.description; 147 } 148 149 150 public void setDescription(String description) 151 { 152 this.description = description; 153 } 154 155 164 public String getUrl() 165 { 166 return this.url; 167 } 168 169 170 public void setUrl(String url) 171 { 172 this.url = url; 173 } 174 175 188 public java.lang.Integer getWeight() 189 { 190 return this.weight; 191 } 192 193 194 public void setWeight(java.lang.Integer weight) 195 { 196 this.weight = weight; 197 } 198 199 212 public java.lang.Integer getPriority() 213 { 214 return this.priority; 215 } 216 217 218 public void setPriority(java.lang.Integer priority) 219 { 220 this.priority = priority; 221 } 222 223 230 public String getImage() 231 { 232 return this.image; 233 } 234 235 236 public void setImage(String image) 237 { 238 this.image = image; 239 } 240 241 248 public String getFeedUrl() 249 { 250 return this.feedUrl; 251 } 252 253 254 public void setFeedUrl(String feedUrl) 255 { 256 this.feedUrl = feedUrl; 257 } 258 259 261 266 public org.apache.roller.pojos.FolderData getFolder() 267 { 268 return this.folder; 269 } 270 271 272 public void setFolder(org.apache.roller.pojos.FolderData folder) 273 { 274 this.folder = folder; 275 } 276 277 279 public String toString() 280 { 281 StringBuffer str = new StringBuffer ("{"); 282 283 str.append("id=" + id + " " + "name=" + name + " " + "description=" + 284 description + " " + "url=" + url + " " + "weight=" + 285 weight + " " + "priority=" + priority + " " + "folderId=" + 286 "image=" + image + " " + "feedUrl=" + 287 feedUrl); 288 str.append('}'); 289 290 return (str.toString()); 291 } 292 293 public boolean equals(Object pOther) 294 { 295 if (pOther instanceof BookmarkData) 296 { 297 BookmarkData lTest = (BookmarkData) pOther; 298 boolean lEquals = true; 299 300 if (this.id == null) 301 { 302 lEquals = lEquals && (lTest.getId() == null); 303 } 304 else 305 { 306 lEquals = lEquals && this.id.equals(lTest.getId()); 307 } 308 309 if (this.name == null) 310 { 311 lEquals = lEquals && (lTest.getName() == null); 312 } 313 else 314 { 315 lEquals = lEquals && this.name.equals(lTest.getName()); 316 } 317 318 if (this.description == null) 319 { 320 lEquals = lEquals && (lTest.getDescription() == null); 321 } 322 else 323 { 324 lEquals = lEquals && 325 this.description.equals(lTest.getDescription()); 326 } 327 328 if (this.url == null) 329 { 330 lEquals = lEquals && (lTest.getUrl() == null); 331 } 332 else 333 { 334 lEquals = lEquals && this.url.equals(lTest.getUrl()); 335 } 336 337 if (this.weight == null) 338 { 339 lEquals = lEquals && (lTest.getWeight() == null); 340 } 341 else 342 { 343 lEquals = lEquals && this.weight.equals(lTest.getWeight()); 344 } 345 346 if (this.priority == null) 347 { 348 lEquals = lEquals && (lTest.getPriority() == null); 349 } 350 else 351 { 352 lEquals = lEquals && this.priority.equals(lTest.getPriority()); 353 } 354 355 if (this.image == null) 365 { 366 lEquals = lEquals && (lTest.getImage() == null); 367 } 368 else 369 { 370 lEquals = lEquals && this.image.equals(lTest.getImage()); 371 } 372 373 if (this.feedUrl == null) 374 { 375 lEquals = lEquals && (lTest.getFeedUrl() == null); 376 } 377 else 378 { 379 lEquals = lEquals && this.feedUrl.equals(lTest.getFeedUrl()); 380 } 381 382 return lEquals; 383 } 384 else 385 { 386 return false; 387 } 388 } 389 390 public int hashCode() 391 { 392 int result = 17; 393 result = (37 * result) + 394 ((this.id != null) ? this.id.hashCode() : 0); 395 result = (37 * result) + 396 ((this.name != null) ? this.name.hashCode() : 0); 397 result = (37 * result) + 398 ((this.description != null) ? this.description.hashCode() : 0); 399 result = (37 * result) + 400 ((this.url != null) ? this.url.hashCode() : 0); 401 result = (37 * result) + 402 ((this.weight != null) ? this.weight.hashCode() : 0); 403 result = (37 * result) + 404 ((this.priority != null) ? this.priority.hashCode() : 0); 405 result = (37 * result) + 406 ((this.folder != null) ? this.folder.hashCode() : 0); 407 result = (37 * result) + 408 ((this.image != null) ? this.image.hashCode() : 0); 409 result = (37 * result) + 410 ((this.feedUrl != null) ? this.feedUrl.hashCode() : 0); 411 412 return result; 413 } 414 415 418 public void setData(org.apache.roller.pojos.PersistentObject otherData) 419 { 420 BookmarkData other = (BookmarkData)otherData; 421 this.id = other.getId(); 422 this.name = other.getName(); 423 this.description = other.getDescription(); 424 this.url = other.getUrl(); 425 this.weight = other.getWeight(); 426 this.priority = other.getPriority(); 427 this.folder = other.getFolder(); 428 this.image = other.getImage(); 429 this.feedUrl = other.getUrl(); 430 } 431 432 435 public int compareTo(Object o) 436 { 437 return bookmarkComparator.compare(this, o); 438 } 439 440 private BookmarkComparator bookmarkComparator = new BookmarkComparator(); 441 442 445 public void setBookmarkManager(BookmarkManager bmgr) 446 { 447 bookmarkManager = bmgr; 448 } 449 450 public WebsiteData getWebsite() 451 { 452 return this.folder.getWebsite(); 453 } 454 455 } | Popular Tags |