1 4 package org.roller.pojos; 5 6 import org.roller.util.Utilities; 7 8 9 18 public class RefererData extends org.roller.pojos.PersistentObject 19 implements java.io.Serializable 20 { 21 static final long serialVersionUID = -1817992900602131316L; 22 protected java.lang.String id = null; 23 protected org.roller.pojos.WebsiteData website = null; 24 protected org.roller.pojos.WeblogEntryData weblogEntry = null; 25 protected java.lang.String dateString = null; 26 protected java.lang.String refererUrl = null; 27 protected java.lang.String refererPermalink = null; 28 protected java.lang.String requestUrl = null; 29 protected java.lang.String title = null; 30 protected java.lang.String excerpt = null; 31 protected java.lang.Boolean visible = null; 32 protected java.lang.Boolean duplicate = null; 33 protected java.lang.Integer dayHits = null; 34 protected java.lang.Integer totalHits = null; 35 36 public RefererData() 37 { 38 } 39 40 public RefererData(java.lang.String id, 41 org.roller.pojos.WebsiteData website, 42 org.roller.pojos.WeblogEntryData weblogEntry, 43 java.lang.String dateString, java.lang.String refererUrl, 44 java.lang.String refererPermalink, 45 java.lang.String requestUrl, java.lang.String title, 46 java.lang.String excerpt, java.lang.Boolean visible, 47 java.lang.Boolean duplicate, java.lang.Integer dayHits, 48 java.lang.Integer totalHits) 49 { 50 this.id = id; 51 this.website = website; 52 this.weblogEntry = weblogEntry; 53 this.dateString = dateString; 54 this.refererUrl = refererUrl; 55 this.refererPermalink = refererPermalink; 56 this.requestUrl = requestUrl; 57 this.title = title; 58 this.excerpt = excerpt; 59 this.visible = visible; 60 this.duplicate = duplicate; 61 this.dayHits = dayHits; 62 this.totalHits = totalHits; 63 } 64 65 public RefererData(RefererData otherData) 66 { 67 this.id = otherData.id; 68 this.website = otherData.website; 69 this.weblogEntry = otherData.weblogEntry; 70 this.dateString = otherData.dateString; 71 this.refererUrl = otherData.refererUrl; 72 this.refererPermalink = otherData.refererPermalink; 73 this.requestUrl = otherData.requestUrl; 74 this.title = otherData.title; 75 this.excerpt = otherData.excerpt; 76 this.visible = otherData.visible; 77 this.duplicate = otherData.duplicate; 78 this.dayHits = otherData.dayHits; 79 this.totalHits = otherData.totalHits; 80 } 81 82 84 89 public java.lang.String getId() 90 { 91 return this.id; 92 } 93 94 public void setId(java.lang.String id) 95 { 96 this.id = id; 97 } 98 99 103 public org.roller.pojos.WebsiteData getWebsite() 104 { 105 return this.website; 106 } 107 108 public void setWebsite(org.roller.pojos.WebsiteData website) 109 { 110 this.website = website; 111 } 112 113 116 public org.roller.pojos.WeblogEntryData getWeblogEntry() 117 { 118 return weblogEntry; 119 } 120 121 124 public void setWeblogEntry(org.roller.pojos.WeblogEntryData data) 125 { 126 weblogEntry = data; 127 } 128 129 133 public java.lang.String getDateString() 134 { 135 return this.dateString; 136 } 137 138 public void setDateString(java.lang.String dateString) 139 { 140 this.dateString = dateString; 141 } 142 143 147 public java.lang.String getRefererUrl() 148 { 149 return this.refererUrl; 150 } 151 152 public void setRefererUrl(java.lang.String refererUrl) 153 { 154 this.refererUrl = refererUrl; 155 } 156 157 161 public java.lang.String getRefererPermalink() 162 { 163 return this.refererPermalink; 164 } 165 166 public void setRefererPermalink(java.lang.String refererPermalink) 167 { 168 this.refererPermalink = refererPermalink; 169 } 170 171 175 public java.lang.String getRequestUrl() 176 { 177 return this.requestUrl; 178 } 179 180 public void setRequestUrl(java.lang.String requestUrl) 181 { 182 this.requestUrl = requestUrl; 183 } 184 185 189 public java.lang.String getTitle() 190 { 191 return this.title; 192 } 193 194 public void setTitle(java.lang.String title) 195 { 196 this.title = title; 197 } 198 199 203 public java.lang.String getExcerpt() 204 { 205 return this.excerpt; 206 } 207 208 public void setExcerpt(java.lang.String excerpt) 209 { 210 this.excerpt = excerpt; 211 } 212 213 217 public java.lang.Boolean getVisible() 218 { 219 return this.visible; 220 } 221 222 public void setVisible(java.lang.Boolean visible) 223 { 224 this.visible = visible; 225 } 226 227 231 public java.lang.Boolean getDuplicate() 232 { 233 return this.duplicate; 234 } 235 236 public void setDuplicate(java.lang.Boolean duplicate) 237 { 238 this.duplicate = duplicate; 239 } 240 241 245 public java.lang.Integer getDayHits() 246 { 247 return this.dayHits; 248 } 249 250 public void setDayHits(java.lang.Integer dayHits) 251 { 252 this.dayHits = dayHits; 253 } 254 255 259 public java.lang.Integer getTotalHits() 260 { 261 return this.totalHits; 262 } 263 264 public void setTotalHits(java.lang.Integer totalHits) 265 { 266 this.totalHits = totalHits; 267 } 268 269 public String getDisplayUrl(int maxWidth, boolean includeHits) 271 { 272 StringBuffer sb = new StringBuffer (); 273 274 String url = Utilities.escapeHTML(getUrl()); 275 String displayUrl = url.trim(); 276 String restOfUrl = null; 277 278 if (displayUrl.startsWith("http://")) 279 { 280 displayUrl = displayUrl.substring(7); 281 } 282 283 if (displayUrl.length() > maxWidth) 284 { 285 restOfUrl = "..." + 286 displayUrl.substring(maxWidth, displayUrl.length()); 287 displayUrl = displayUrl.substring(0, maxWidth) + "..."; 288 } 289 290 if (url.startsWith("http://")) 291 { 292 sb.append("<a HREF=\""); 293 sb.append(url); 294 } 295 296 if (restOfUrl != null) 298 { 299 sb.append("\" title=\""); 300 sb.append(restOfUrl); 301 } 302 303 if (sb.length() > 0) 304 { 305 sb.append("\">"); 306 } 307 308 sb.append(displayUrl); 309 310 if (includeHits) 311 { 312 sb.append(" ("); 313 sb.append(getDayHits()); 314 sb.append(")"); 315 } 316 317 if (url.startsWith("http://")) 318 { 319 sb.append("</a>"); 320 } 321 322 return sb.toString(); 323 } 324 325 public String getUrl() 327 { 328 if (getRefererPermalink() != null) 329 { 330 return getRefererPermalink(); 331 } 332 else 333 { 334 return getRefererUrl(); 335 } 336 } 337 338 public String getDisplayUrl() 340 { 341 return getDisplayUrl(50, false); 342 } 343 344 public String toString() 346 { 347 StringBuffer str = new StringBuffer ("{"); 348 349 str.append("id=" + id + " " + "website=" + website + " " + 350 "dateString=" + 351 dateString + " " + "refererUrl=" + refererUrl + " " + 352 "refererPermalink=" + refererPermalink + " " + 353 "requestUrl=" + requestUrl + " " + "title=" + title + " " + 354 "excerpt=" + excerpt + " " + "visible=" + visible + " " + 355 "duplicate=" + duplicate + " " + "dayHits=" + dayHits + 356 " " + "totalHits=" + totalHits); 357 str.append('}'); 358 359 return (str.toString()); 360 } 361 362 public boolean equals(Object pOther) 363 { 364 if (pOther instanceof RefererData) 365 { 366 RefererData lTest = (RefererData) pOther; 367 boolean lEquals = true; 368 369 if (this.id == null) 370 { 371 lEquals = lEquals && (lTest.id == null); 372 } 373 else 374 { 375 lEquals = lEquals && this.id.equals(lTest.id); 376 } 377 378 if (this.website == null) 379 { 380 lEquals = lEquals && (lTest.website == null); 381 } 382 else 383 { 384 lEquals = lEquals && this.website.equals(lTest.website); 385 } 386 387 if (this.weblogEntry == null) 388 { 389 lEquals = lEquals && (lTest.weblogEntry == null); 390 } 391 else 392 { 393 lEquals = lEquals && 394 this.weblogEntry.equals(lTest.weblogEntry); 395 } 396 397 if (this.dateString == null) 398 { 399 lEquals = lEquals && (lTest.dateString == null); 400 } 401 else 402 { 403 lEquals = lEquals && 404 this.dateString.equals(lTest.dateString); 405 } 406 407 if (this.refererUrl == null) 408 { 409 lEquals = lEquals && (lTest.refererUrl == null); 410 } 411 else 412 { 413 lEquals = lEquals && 414 this.refererUrl.equals(lTest.refererUrl); 415 } 416 417 if (this.refererPermalink == null) 418 { 419 lEquals = lEquals && (lTest.refererPermalink == null); 420 } 421 else 422 { 423 lEquals = lEquals && 424 this.refererPermalink.equals(lTest.refererPermalink); 425 } 426 427 if (this.requestUrl == null) 428 { 429 lEquals = lEquals && (lTest.requestUrl == null); 430 } 431 else 432 { 433 lEquals = lEquals && 434 this.requestUrl.equals(lTest.requestUrl); 435 } 436 437 if (this.title == null) 438 { 439 lEquals = lEquals && (lTest.title == null); 440 } 441 else 442 { 443 lEquals = lEquals && this.title.equals(lTest.title); 444 } 445 446 if (this.excerpt == null) 447 { 448 lEquals = lEquals && (lTest.excerpt == null); 449 } 450 else 451 { 452 lEquals = lEquals && this.excerpt.equals(lTest.excerpt); 453 } 454 455 if (this.visible == null) 456 { 457 lEquals = lEquals && (lTest.visible == null); 458 } 459 else 460 { 461 lEquals = lEquals && this.visible.equals(lTest.visible); 462 } 463 464 if (this.duplicate == null) 465 { 466 lEquals = lEquals && (lTest.duplicate == null); 467 } 468 else 469 { 470 lEquals = lEquals && this.duplicate.equals(lTest.duplicate); 471 } 472 473 if (this.dayHits == null) 474 { 475 lEquals = lEquals && (lTest.dayHits == null); 476 } 477 else 478 { 479 lEquals = lEquals && this.dayHits.equals(lTest.dayHits); 480 } 481 482 if (this.totalHits == null) 483 { 484 lEquals = lEquals && (lTest.totalHits == null); 485 } 486 else 487 { 488 lEquals = lEquals && this.totalHits.equals(lTest.totalHits); 489 } 490 491 return lEquals; 492 } 493 else 494 { 495 return false; 496 } 497 } 498 499 public int hashCode() 500 { 501 int result = 17; 502 result = (37 * result) + 503 ((this.id != null) ? this.id.hashCode() : 0); 504 result = (37 * result) + 505 ((this.website != null) ? this.website.hashCode() : 0); 506 result = (37 * result) + 507 ((this.weblogEntry != null) ? this.weblogEntry.hashCode() : 0); 508 result = (37 * result) + 509 ((this.dateString != null) ? this.dateString.hashCode() : 0); 510 result = (37 * result) + 511 ((this.refererUrl != null) ? this.refererUrl.hashCode() : 0); 512 result = (37 * result) + 513 ((this.refererPermalink != null) 514 ? this.refererPermalink.hashCode() : 0); 515 result = (37 * result) + 516 ((this.requestUrl != null) ? this.requestUrl.hashCode() : 0); 517 result = (37 * result) + 518 ((this.title != null) ? this.title.hashCode() : 0); 519 result = (37 * result) + 520 ((this.excerpt != null) ? this.excerpt.hashCode() : 0); 521 result = (37 * result) + 522 ((this.visible != null) ? this.visible.hashCode() : 0); 523 result = (37 * result) + 524 ((this.duplicate != null) ? this.duplicate.hashCode() : 0); 525 result = (37 * result) + 526 ((this.dayHits != null) ? this.dayHits.hashCode() : 0); 527 result = (37 * result) + 528 ((this.totalHits != null) ? this.totalHits.hashCode() : 0); 529 530 return result; 531 } 532 533 536 public void setData(org.roller.pojos.PersistentObject otherData) 537 { 538 this.id = ((RefererData) otherData).id; 539 this.website = ((RefererData) otherData).website; 540 this.weblogEntry = ((RefererData) otherData).weblogEntry; 541 this.dateString = ((RefererData) otherData).dateString; 542 this.refererUrl = ((RefererData) otherData).refererUrl; 543 this.refererPermalink = ((RefererData) otherData).refererPermalink; 544 this.requestUrl = ((RefererData) otherData).requestUrl; 545 this.title = ((RefererData) otherData).title; 546 this.excerpt = ((RefererData) otherData).excerpt; 547 this.visible = ((RefererData) otherData).visible; 548 this.duplicate = ((RefererData) otherData).duplicate; 549 this.dayHits = ((RefererData) otherData).dayHits; 550 this.totalHits = ((RefererData) otherData).totalHits; 551 } 552 553 558 public void setUrl(String string) 559 { 560 } 561 562 565 public void setDisplayUrl(String string) 566 { 567 } 568 569 } | Popular Tags |