KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > roller > pojos > RefererData


1 /*
2  * Generated file - Do not edit!
3  */

4 package org.roller.pojos;
5
6 import org.roller.util.Utilities;
7
8
9 /**
10  * Referer bean.
11  * @author David M Johnson
12  *
13  * @ejb:bean name="RefererData"
14  * @struts.form include-all="true"
15  * @hibernate.class table="referer"
16  * hibernate.jcs-cache usage="read-write"
17  */

18 public class RefererData extends org.roller.pojos.PersistentObject
19     implements java.io.Serializable JavaDoc
20 {
21     static final long serialVersionUID = -1817992900602131316L;
22     protected java.lang.String JavaDoc id = null;
23     protected org.roller.pojos.WebsiteData website = null;
24     protected org.roller.pojos.WeblogEntryData weblogEntry = null;
25     protected java.lang.String JavaDoc dateString = null;
26     protected java.lang.String JavaDoc refererUrl = null;
27     protected java.lang.String JavaDoc refererPermalink = null;
28     protected java.lang.String JavaDoc requestUrl = null;
29     protected java.lang.String JavaDoc title = null;
30     protected java.lang.String JavaDoc excerpt = null;
31     protected java.lang.Boolean JavaDoc visible = null;
32     protected java.lang.Boolean JavaDoc duplicate = null;
33     protected java.lang.Integer JavaDoc dayHits = null;
34     protected java.lang.Integer JavaDoc totalHits = null;
35
36     public RefererData()
37     {
38     }
39
40     public RefererData(java.lang.String JavaDoc id,
41                        org.roller.pojos.WebsiteData website,
42                        org.roller.pojos.WeblogEntryData weblogEntry,
43                        java.lang.String JavaDoc dateString, java.lang.String JavaDoc refererUrl,
44                        java.lang.String JavaDoc refererPermalink,
45                        java.lang.String JavaDoc requestUrl, java.lang.String JavaDoc title,
46                        java.lang.String JavaDoc excerpt, java.lang.Boolean JavaDoc visible,
47                        java.lang.Boolean JavaDoc duplicate, java.lang.Integer JavaDoc dayHits,
48                        java.lang.Integer JavaDoc 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     //------------------------------------------------------- Simple properties
83

84     /**
85      * Unique ID and primary key of this Referer.
86      * @hibernate.id column="id" type="string"
87      * generator-class="uuid.hex" unsaved-value="null"
88      */

89     public java.lang.String JavaDoc getId()
90     {
91         return this.id;
92     }
93
94     public void setId(java.lang.String JavaDoc id)
95     {
96         this.id = id;
97     }
98
99     /**
100      * ID of website that this referer refers to.
101      * @hibernate.many-to-one column="websiteid" cascade="none" not-null="true"
102      */

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     /**
114      * @hibernate.many-to-one column="entryid" cascade="none"
115      */

116     public org.roller.pojos.WeblogEntryData getWeblogEntry()
117     {
118         return weblogEntry;
119     }
120
121     /**
122      * @param data
123      */

124     public void setWeblogEntry(org.roller.pojos.WeblogEntryData data)
125     {
126         weblogEntry = data;
127     }
128
129     /**
130      * Date string in YYYYMMDD format.
131      * @hibernate.property column="datestr" non-null="true" unique="false"
132      */

133     public java.lang.String JavaDoc getDateString()
134     {
135         return this.dateString;
136     }
137
138     public void setDateString(java.lang.String JavaDoc dateString)
139     {
140         this.dateString = dateString;
141     }
142
143     /**
144      * URL of the refering page.
145      * @hibernate.property column="refurl" non-null="true" unique="false"
146      */

147     public java.lang.String JavaDoc getRefererUrl()
148     {
149         return this.refererUrl;
150     }
151
152     public void setRefererUrl(java.lang.String JavaDoc refererUrl)
153     {
154         this.refererUrl = refererUrl;
155     }
156
157     /**
158      * Requested URL, the URL linked to by the refering page.
159      * @hibernate.property column="refpermalink" non-null="true" unique="false"
160      */

161     public java.lang.String JavaDoc getRefererPermalink()
162     {
163         return this.refererPermalink;
164     }
165
166     public void setRefererPermalink(java.lang.String JavaDoc refererPermalink)
167     {
168         this.refererPermalink = refererPermalink;
169     }
170
171     /**
172      * Requested URL, the URL linked to by the refering page.
173      * @hibernate.property column="requrl" non-null="true" unique="false"
174      */

175     public java.lang.String JavaDoc getRequestUrl()
176     {
177         return this.requestUrl;
178     }
179
180     public void setRequestUrl(java.lang.String JavaDoc requestUrl)
181     {
182         this.requestUrl = requestUrl;
183     }
184
185     /**
186      * The text on the refering page that surrounds the refering link.
187      * @hibernate.property column="title" non-null="true" unique="false"
188      */

189     public java.lang.String JavaDoc getTitle()
190     {
191         return this.title;
192     }
193
194     public void setTitle(java.lang.String JavaDoc title)
195     {
196         this.title = title;
197     }
198
199     /**
200      * The text on the refering page that surrounds the refering link.
201      * @hibernate.property column="excerpt" non-null="true" unique="false"
202      */

203     public java.lang.String JavaDoc getExcerpt()
204     {
205         return this.excerpt;
206     }
207
208     public void setExcerpt(java.lang.String JavaDoc excerpt)
209     {
210         this.excerpt = excerpt;
211     }
212
213     /**
214      * Should this referer be displayed?
215      * @hibernate.property column="visible" non-null="true" unique="false"
216      */

217     public java.lang.Boolean JavaDoc getVisible()
218     {
219         return this.visible;
220     }
221
222     public void setVisible(java.lang.Boolean JavaDoc visible)
223     {
224         this.visible = visible;
225     }
226
227     /**
228      * Is this referer a duplicate?
229      * @hibernate.property column="duplicate" non-null="true" unique="false"
230      */

231     public java.lang.Boolean JavaDoc getDuplicate()
232     {
233         return this.duplicate;
234     }
235
236     public void setDuplicate(java.lang.Boolean JavaDoc duplicate)
237     {
238         this.duplicate = duplicate;
239     }
240
241     /**
242      * Hits received today from this referer.
243      * @hibernate.property column="dayhits" non-null="true" unique="false"
244      */

245     public java.lang.Integer JavaDoc getDayHits()
246     {
247         return this.dayHits;
248     }
249
250     public void setDayHits(java.lang.Integer JavaDoc dayHits)
251     {
252         this.dayHits = dayHits;
253     }
254
255     /**
256      * Total hits received from this referer.
257      * @hibernate.property column="totalhits" non-null="true" unique="false"
258      */

259     public java.lang.Integer JavaDoc getTotalHits()
260     {
261         return this.totalHits;
262     }
263
264     public void setTotalHits(java.lang.Integer JavaDoc totalHits)
265     {
266         this.totalHits = totalHits;
267     }
268
269     //-------------------------------------------------------------------------
270
public String JavaDoc getDisplayUrl(int maxWidth, boolean includeHits)
271     {
272         StringBuffer JavaDoc sb = new StringBuffer JavaDoc();
273
274         String JavaDoc url = Utilities.escapeHTML(getUrl());
275         String JavaDoc displayUrl = url.trim();
276         String JavaDoc 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         // add a title with the rest of the url if it exists
297
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     //-------------------------------------------------------------------------
326
public String JavaDoc getUrl()
327     {
328         if (getRefererPermalink() != null)
329         {
330             return getRefererPermalink();
331         }
332         else
333         {
334             return getRefererUrl();
335         }
336     }
337
338     //-------------------------------------------------------------------------
339
public String JavaDoc getDisplayUrl()
340     {
341         return getDisplayUrl(50, false);
342     }
343
344     //-------------------------------------------------------------------------
345
public String JavaDoc toString()
346     {
347         StringBuffer JavaDoc str = new StringBuffer JavaDoc("{");
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 JavaDoc 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     /**
534      * Setter is needed in RollerImpl.storePersistentObject()
535      */

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     /**
554      * A no-op.
555      * TODO: fix formbean generation so this is not needed.
556      * @param string
557      */

558     public void setUrl(String JavaDoc string)
559     {
560     }
561
562     /**
563      * A no-op
564      */

565     public void setDisplayUrl(String JavaDoc string)
566     {
567     }
568
569 }
Popular Tags