1 18 21 package org.apache.roller.pojos; 22 23 import org.apache.commons.lang.StringEscapeUtils; 24 25 26 35 public class RefererData extends PersistentObject 36 implements java.io.Serializable 37 { 38 static final long serialVersionUID = -1817992900602131316L; 39 private java.lang.String id = null; 40 private org.apache.roller.pojos.WebsiteData website = null; 41 private org.apache.roller.pojos.WeblogEntryData weblogEntry = null; 42 private java.lang.String dateString = null; 43 private java.lang.String refererUrl = null; 44 private java.lang.String refererPermalink = null; 45 private java.lang.String requestUrl = null; 46 private java.lang.String title = null; 47 private java.lang.String excerpt = null; 48 private java.lang.Boolean visible = null; 49 private java.lang.Boolean duplicate = null; 50 private java.lang.Integer dayHits = null; 51 private java.lang.Integer totalHits = null; 52 53 public RefererData() 54 { 55 } 56 57 public RefererData(java.lang.String id, 58 org.apache.roller.pojos.WebsiteData website, 59 org.apache.roller.pojos.WeblogEntryData weblogEntry, 60 java.lang.String dateString, java.lang.String refererUrl, 61 java.lang.String refererPermalink, 62 java.lang.String requestUrl, java.lang.String title, 63 java.lang.String excerpt, java.lang.Boolean visible, 64 java.lang.Boolean duplicate, java.lang.Integer dayHits, 65 java.lang.Integer totalHits) 66 { 67 this.id = id; 68 this.website = website; 69 this.weblogEntry = weblogEntry; 70 this.dateString = dateString; 71 this.refererUrl = refererUrl; 72 this.refererPermalink = refererPermalink; 73 this.requestUrl = requestUrl; 74 this.title = title; 75 this.excerpt = excerpt; 76 this.visible = visible; 77 this.duplicate = duplicate; 78 this.dayHits = dayHits; 79 this.totalHits = totalHits; 80 } 81 82 public RefererData(RefererData otherData) 83 { 84 setData(otherData); 85 } 86 87 89 96 public java.lang.String getId() 97 { 98 return this.id; 99 } 100 101 public void setId(java.lang.String id) 102 { 103 this.id = id; 104 } 105 106 112 public org.apache.roller.pojos.WebsiteData getWebsite() 113 { 114 return this.website; 115 } 116 117 public void setWebsite(org.apache.roller.pojos.WebsiteData website) 118 { 119 this.website = website; 120 } 121 122 126 public org.apache.roller.pojos.WeblogEntryData getWeblogEntry() 127 { 128 return weblogEntry; 129 } 130 131 134 public void setWeblogEntry(org.apache.roller.pojos.WeblogEntryData data) 135 { 136 weblogEntry = data; 137 } 138 139 145 public java.lang.String getDateString() 146 { 147 return this.dateString; 148 } 149 150 public void setDateString(java.lang.String dateString) 151 { 152 this.dateString = dateString; 153 } 154 155 161 public java.lang.String getRefererUrl() 162 { 163 return this.refererUrl; 164 } 165 166 public void setRefererUrl(java.lang.String refererUrl) 167 { 168 this.refererUrl = refererUrl; 169 } 170 171 177 public java.lang.String getRefererPermalink() 178 { 179 return this.refererPermalink; 180 } 181 182 public void setRefererPermalink(java.lang.String refererPermalink) 183 { 184 this.refererPermalink = refererPermalink; 185 } 186 187 193 public java.lang.String getRequestUrl() 194 { 195 return this.requestUrl; 196 } 197 198 public void setRequestUrl(java.lang.String requestUrl) 199 { 200 this.requestUrl = requestUrl; 201 } 202 203 209 public java.lang.String getTitle() 210 { 211 return this.title; 212 } 213 214 public void setTitle(java.lang.String title) 215 { 216 this.title = title; 217 } 218 219 225 public java.lang.String getExcerpt() 226 { 227 return this.excerpt; 228 } 229 230 public void setExcerpt(java.lang.String excerpt) 231 { 232 this.excerpt = excerpt; 233 } 234 235 241 public java.lang.Boolean getVisible() 242 { 243 return this.visible; 244 } 245 246 public void setVisible(java.lang.Boolean visible) 247 { 248 this.visible = visible; 249 } 250 251 257 public java.lang.Boolean getDuplicate() 258 { 259 return this.duplicate; 260 } 261 262 public void setDuplicate(java.lang.Boolean duplicate) 263 { 264 this.duplicate = duplicate; 265 } 266 267 273 public java.lang.Integer getDayHits() 274 { 275 return this.dayHits; 276 } 277 278 public void setDayHits(java.lang.Integer dayHits) 279 { 280 this.dayHits = dayHits; 281 } 282 283 289 public java.lang.Integer getTotalHits() 290 { 291 return this.totalHits; 292 } 293 294 public void setTotalHits(java.lang.Integer totalHits) 295 { 296 this.totalHits = totalHits; 297 } 298 299 301 304 public String getDisplayUrl(int maxWidth, boolean includeHits) 305 { 306 StringBuffer sb = new StringBuffer (); 307 308 String url = StringEscapeUtils.escapeHtml(getUrl()); 309 String displayUrl = url.trim(); 310 String restOfUrl = null; 311 312 if (displayUrl.startsWith("http://")) 313 { 314 displayUrl = displayUrl.substring(7); 315 } 316 317 if (displayUrl.length() > maxWidth) 318 { 319 restOfUrl = "..." + 320 displayUrl.substring(maxWidth, displayUrl.length()); 321 displayUrl = displayUrl.substring(0, maxWidth) + "..."; 322 } 323 324 if (url.startsWith("http://")) 325 { 326 sb.append("<a HREF=\""); 327 sb.append(url); 328 } 329 330 if (restOfUrl != null) 332 { 333 sb.append("\" title=\""); 334 sb.append(restOfUrl); 335 } 336 337 if (sb.length() > 0) 338 { 339 sb.append("\">"); 340 } 341 342 sb.append(displayUrl); 343 344 if (includeHits) 345 { 346 sb.append(" ("); 347 sb.append(getDayHits()); 348 sb.append(")"); 349 } 350 351 if (url.startsWith("http://")) 352 { 353 sb.append("</a>"); 354 } 355 356 return sb.toString(); 357 } 358 359 361 364 public String getUrl() 365 { 366 if (getRefererPermalink() != null) 367 { 368 return getRefererPermalink(); 369 } 370 else 371 { 372 return getRefererUrl(); 373 } 374 } 375 376 378 381 public String getDisplayUrl() 382 { 383 return getDisplayUrl(50, false); 384 } 385 386 public String toString() 388 { 389 StringBuffer str = new StringBuffer ("{"); 390 391 str.append("id=" + id + " " + "website=" + website + " " + 392 "dateString=" + 393 dateString + " " + "refererUrl=" + refererUrl + " " + 394 "refererPermalink=" + refererPermalink + " " + 395 "requestUrl=" + requestUrl + " " + "title=" + title + " " + 396 "excerpt=" + excerpt + " " + "visible=" + visible + " " + 397 "duplicate=" + duplicate + " " + "dayHits=" + dayHits + 398 " " + "totalHits=" + totalHits); 399 str.append('}'); 400 401 return (str.toString()); 402 } 403 404 public boolean equals(Object pOther) 405 { 406 if (pOther instanceof RefererData) 407 { 408 RefererData lTest = (RefererData) pOther; 409 boolean lEquals = true; 410 411 if (this.id == null) 412 { 413 lEquals = lEquals && (lTest.getId() == null); 414 } 415 else 416 { 417 lEquals = lEquals && this.id.equals(lTest.getId()); 418 } 419 420 if (this.website == null) 421 { 422 lEquals = lEquals && (lTest.getWebsite() == null); 423 } 424 else 425 { 426 lEquals = lEquals && this.website.equals(lTest.getWebsite()); 427 } 428 429 if (this.weblogEntry == null) 430 { 431 lEquals = lEquals && (lTest.getWeblogEntry() == null); 432 } 433 else 434 { 435 lEquals = lEquals && 436 this.weblogEntry.equals(lTest.getWeblogEntry()); 437 } 438 439 if (this.dateString == null) 440 { 441 lEquals = lEquals && (lTest.getDateString() == null); 442 } 443 else 444 { 445 lEquals = lEquals && 446 this.dateString.equals(lTest.getDateString()); 447 } 448 449 if (this.refererUrl == null) 450 { 451 lEquals = lEquals && (lTest.getRefererUrl() == null); 452 } 453 else 454 { 455 lEquals = lEquals && 456 this.refererUrl.equals(lTest.getRefererUrl()); 457 } 458 459 if (this.refererPermalink == null) 460 { 461 lEquals = lEquals && (lTest.getRefererPermalink() == null); 462 } 463 else 464 { 465 lEquals = lEquals && 466 this.refererPermalink.equals(lTest.getRefererPermalink()); 467 } 468 469 if (this.requestUrl == null) 470 { 471 lEquals = lEquals && (lTest.getRequestUrl() == null); 472 } 473 else 474 { 475 lEquals = lEquals && 476 this.requestUrl.equals(lTest.getRequestUrl()); 477 } 478 479 if (this.title == null) 480 { 481 lEquals = lEquals && (lTest.getTitle() == null); 482 } 483 else 484 { 485 lEquals = lEquals && this.title.equals(lTest.getTitle()); 486 } 487 488 if (this.excerpt == null) 489 { 490 lEquals = lEquals && (lTest.getExcerpt() == null); 491 } 492 else 493 { 494 lEquals = lEquals && this.excerpt.equals(lTest.getExcerpt()); 495 } 496 497 if (this.visible == null) 498 { 499 lEquals = lEquals && (lTest.getVisible() == null); 500 } 501 else 502 { 503 lEquals = lEquals && this.visible.equals(lTest.getVisible()); 504 } 505 506 if (this.duplicate == null) 507 { 508 lEquals = lEquals && (lTest.getDuplicate() == null); 509 } 510 else 511 { 512 lEquals = lEquals && this.duplicate.equals(lTest.getDuplicate()); 513 } 514 515 if (this.dayHits == null) 516 { 517 lEquals = lEquals && (lTest.getDayHits() == null); 518 } 519 else 520 { 521 lEquals = lEquals && this.dayHits.equals(lTest.getDayHits()); 522 } 523 524 if (this.totalHits == null) 525 { 526 lEquals = lEquals && (lTest.getTotalHits() == null); 527 } 528 else 529 { 530 lEquals = lEquals && this.totalHits.equals(lTest.getTotalHits()); 531 } 532 533 return lEquals; 534 } 535 else 536 { 537 return false; 538 } 539 } 540 541 public int hashCode() 542 { 543 int result = 17; 544 result = (37 * result) + 545 ((this.id != null) ? this.id.hashCode() : 0); 546 result = (37 * result) + 547 ((this.website != null) ? this.website.hashCode() : 0); 548 result = (37 * result) + 549 ((this.weblogEntry != null) ? this.weblogEntry.hashCode() : 0); 550 result = (37 * result) + 551 ((this.dateString != null) ? this.dateString.hashCode() : 0); 552 result = (37 * result) + 553 ((this.refererUrl != null) ? this.refererUrl.hashCode() : 0); 554 result = (37 * result) + 555 ((this.refererPermalink != null) 556 ? this.refererPermalink.hashCode() : 0); 557 result = (37 * result) + 558 ((this.requestUrl != null) ? this.requestUrl.hashCode() : 0); 559 result = (37 * result) + 560 ((this.title != null) ? this.title.hashCode() : 0); 561 result = (37 * result) + 562 ((this.excerpt != null) ? this.excerpt.hashCode() : 0); 563 result = (37 * result) + 564 ((this.visible != null) ? this.visible.hashCode() : 0); 565 result = (37 * result) + 566 ((this.duplicate != null) ? this.duplicate.hashCode() : 0); 567 result = (37 * result) + 568 ((this.dayHits != null) ? this.dayHits.hashCode() : 0); 569 result = (37 * result) + 570 ((this.totalHits != null) ? this.totalHits.hashCode() : 0); 571 572 return result; 573 } 574 575 578 public void setData(org.apache.roller.pojos.PersistentObject otherData) 579 { 580 this.id = ((RefererData) otherData).getId(); 581 this.website = ((RefererData) otherData).getWebsite(); 582 this.weblogEntry = ((RefererData) otherData).getWeblogEntry(); 583 this.dateString = ((RefererData) otherData).getDateString(); 584 this.refererUrl = ((RefererData) otherData).getRefererUrl(); 585 this.refererPermalink = ((RefererData) otherData).getRefererPermalink(); 586 this.requestUrl = ((RefererData) otherData).getRequestUrl(); 587 this.title = ((RefererData) otherData).getTitle(); 588 this.excerpt = ((RefererData) otherData).getExcerpt(); 589 this.visible = ((RefererData) otherData).getVisible(); 590 this.duplicate = ((RefererData) otherData).getDuplicate(); 591 this.dayHits = ((RefererData) otherData).getDayHits(); 592 this.totalHits = ((RefererData) otherData).getTotalHits(); 593 } 594 595 600 public void setUrl(String string) 601 { 602 } 603 604 607 public void setDisplayUrl(String string) 608 { 609 } 610 611 } | Popular Tags |