KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. The ASF licenses this file to You
4 * under the Apache License, Version 2.0 (the "License"); you may not
5 * use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License. For additional information regarding
15 * copyright in this work, please see the NOTICE file in the top level
16 * directory of this distribution.
17 */

18 /*
19  * Generated file - Do not edit!
20  */

21 package org.apache.roller.pojos;
22
23 import org.apache.commons.lang.StringEscapeUtils;
24
25
26 /**
27  * Referer bean.
28  * @author David M Johnson
29  *
30  * @ejb:bean name="RefererData"
31  * @struts.form include-all="true"
32  * @hibernate.class lazy="false" table="referer"
33  * @hibernate.cache usage="read-write"
34  */

35 public class RefererData extends PersistentObject
36     implements java.io.Serializable JavaDoc
37 {
38     static final long serialVersionUID = -1817992900602131316L;
39     private java.lang.String JavaDoc 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 JavaDoc dateString = null;
43     private java.lang.String JavaDoc refererUrl = null;
44     private java.lang.String JavaDoc refererPermalink = null;
45     private java.lang.String JavaDoc requestUrl = null;
46     private java.lang.String JavaDoc title = null;
47     private java.lang.String JavaDoc excerpt = null;
48     private java.lang.Boolean JavaDoc visible = null;
49     private java.lang.Boolean JavaDoc duplicate = null;
50     private java.lang.Integer JavaDoc dayHits = null;
51     private java.lang.Integer JavaDoc totalHits = null;
52
53     public RefererData()
54     {
55     }
56
57     public RefererData(java.lang.String JavaDoc id,
58                        org.apache.roller.pojos.WebsiteData website,
59                        org.apache.roller.pojos.WeblogEntryData weblogEntry,
60                        java.lang.String JavaDoc dateString, java.lang.String JavaDoc refererUrl,
61                        java.lang.String JavaDoc refererPermalink,
62                        java.lang.String JavaDoc requestUrl, java.lang.String JavaDoc title,
63                        java.lang.String JavaDoc excerpt, java.lang.Boolean JavaDoc visible,
64                        java.lang.Boolean JavaDoc duplicate, java.lang.Integer JavaDoc dayHits,
65                        java.lang.Integer JavaDoc 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     //------------------------------------------------------- Simple properties
88

89     /**
90      * Unique ID and primary key of this Referer.
91      *
92      * @roller.wrapPojoMethod type="simple"
93      * @hibernate.id column="id"
94      * generator-class="uuid.hex" unsaved-value="null"
95      */

96     public java.lang.String JavaDoc getId()
97     {
98         return this.id;
99     }
100
101     public void setId(java.lang.String JavaDoc id)
102     {
103         this.id = id;
104     }
105
106     /**
107      * ID of website that this referer refers to.
108      *
109      * @roller.wrapPojoMethod type="pojo"
110      * @hibernate.many-to-one column="websiteid" cascade="none" not-null="true"
111      */

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     /**
123      * @roller.wrapPojoMethod type="pojo"
124      * @hibernate.many-to-one column="entryid" cascade="none"
125      */

126     public org.apache.roller.pojos.WeblogEntryData getWeblogEntry()
127     {
128         return weblogEntry;
129     }
130
131     /**
132      * @param data
133      */

134     public void setWeblogEntry(org.apache.roller.pojos.WeblogEntryData data)
135     {
136         weblogEntry = data;
137     }
138
139     /**
140      * Date string in YYYYMMDD format.
141      *
142      * @roller.wrapPojoMethod type="simple"
143      * @hibernate.property column="datestr" non-null="true" unique="false"
144      */

145     public java.lang.String JavaDoc getDateString()
146     {
147         return this.dateString;
148     }
149
150     public void setDateString(java.lang.String JavaDoc dateString)
151     {
152         this.dateString = dateString;
153     }
154
155     /**
156      * URL of the refering page.
157      *
158      * @roller.wrapPojoMethod type="simple"
159      * @hibernate.property column="refurl" non-null="true" unique="false"
160      */

161     public java.lang.String JavaDoc getRefererUrl()
162     {
163         return this.refererUrl;
164     }
165
166     public void setRefererUrl(java.lang.String JavaDoc refererUrl)
167     {
168         this.refererUrl = refererUrl;
169     }
170
171     /**
172      * Requested URL, the URL linked to by the refering page.
173      *
174      * @roller.wrapPojoMethod type="simple"
175      * @hibernate.property column="refpermalink" non-null="true" unique="false"
176      */

177     public java.lang.String JavaDoc getRefererPermalink()
178     {
179         return this.refererPermalink;
180     }
181
182     public void setRefererPermalink(java.lang.String JavaDoc refererPermalink)
183     {
184         this.refererPermalink = refererPermalink;
185     }
186
187     /**
188      * Requested URL, the URL linked to by the refering page.
189      *
190      * @roller.wrapPojoMethod type="simple"
191      * @hibernate.property column="requrl" non-null="true" unique="false"
192      */

193     public java.lang.String JavaDoc getRequestUrl()
194     {
195         return this.requestUrl;
196     }
197
198     public void setRequestUrl(java.lang.String JavaDoc requestUrl)
199     {
200         this.requestUrl = requestUrl;
201     }
202
203     /**
204      * The text on the refering page that surrounds the refering link.
205      *
206      * @roller.wrapPojoMethod type="simple"
207      * @hibernate.property column="title" non-null="true" unique="false"
208      */

209     public java.lang.String JavaDoc getTitle()
210     {
211         return this.title;
212     }
213
214     public void setTitle(java.lang.String JavaDoc title)
215     {
216         this.title = title;
217     }
218
219     /**
220      * The text on the refering page that surrounds the refering link.
221      *
222      * @roller.wrapPojoMethod type="simple"
223      * @hibernate.property column="excerpt" non-null="true" unique="false"
224      */

225     public java.lang.String JavaDoc getExcerpt()
226     {
227         return this.excerpt;
228     }
229
230     public void setExcerpt(java.lang.String JavaDoc excerpt)
231     {
232         this.excerpt = excerpt;
233     }
234
235     /**
236      * Should this referer be displayed?
237      *
238      * @roller.wrapPojoMethod type="simple"
239      * @hibernate.property column="visible" non-null="true" unique="false"
240      */

241     public java.lang.Boolean JavaDoc getVisible()
242     {
243         return this.visible;
244     }
245
246     public void setVisible(java.lang.Boolean JavaDoc visible)
247     {
248         this.visible = visible;
249     }
250
251     /**
252      * Is this referer a duplicate?
253      *
254      * @roller.wrapPojoMethod type="simple"
255      * @hibernate.property column="duplicate" non-null="true" unique="false"
256      */

257     public java.lang.Boolean JavaDoc getDuplicate()
258     {
259         return this.duplicate;
260     }
261
262     public void setDuplicate(java.lang.Boolean JavaDoc duplicate)
263     {
264         this.duplicate = duplicate;
265     }
266
267     /**
268      * Hits received today from this referer.
269      *
270      * @roller.wrapPojoMethod type="simple"
271      * @hibernate.property column="dayhits" non-null="true" unique="false"
272      */

273     public java.lang.Integer JavaDoc getDayHits()
274     {
275         return this.dayHits;
276     }
277
278     public void setDayHits(java.lang.Integer JavaDoc dayHits)
279     {
280         this.dayHits = dayHits;
281     }
282
283     /**
284      * Total hits received from this referer.
285      *
286      * @roller.wrapPojoMethod type="simple"
287      * @hibernate.property column="totalhits" non-null="true" unique="false"
288      */

289     public java.lang.Integer JavaDoc getTotalHits()
290     {
291         return this.totalHits;
292     }
293
294     public void setTotalHits(java.lang.Integer JavaDoc totalHits)
295     {
296         this.totalHits = totalHits;
297     }
298
299     //-------------------------------------------------------------------------
300

301     /**
302      * @roller.wrapPojoMethod type="simple"
303      */

304     public String JavaDoc getDisplayUrl(int maxWidth, boolean includeHits)
305     {
306         StringBuffer JavaDoc sb = new StringBuffer JavaDoc();
307
308         String JavaDoc url = StringEscapeUtils.escapeHtml(getUrl());
309         String JavaDoc displayUrl = url.trim();
310         String JavaDoc 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         // add a title with the rest of the url if it exists
331
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     //-------------------------------------------------------------------------
360

361     /**
362      * @roller.wrapPojoMethod type="simple"
363      */

364     public String JavaDoc getUrl()
365     {
366         if (getRefererPermalink() != null)
367         {
368             return getRefererPermalink();
369         }
370         else
371         {
372             return getRefererUrl();
373         }
374     }
375
376     //-------------------------------------------------------------------------
377

378     /**
379      * @roller.wrapPojoMethod type="simple"
380      */

381     public String JavaDoc getDisplayUrl()
382     {
383         return getDisplayUrl(50, false);
384     }
385
386     //-------------------------------------------------------------------------
387
public String JavaDoc toString()
388     {
389         StringBuffer JavaDoc str = new StringBuffer JavaDoc("{");
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 JavaDoc 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     /**
576      * Setter is needed in RollerImpl.storePersistentObject()
577      */

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     /**
596      * A no-op.
597      * TODO: fix formbean generation so this is not needed.
598      * @param string
599      */

600     public void setUrl(String JavaDoc string)
601     {
602     }
603
604     /**
605      * A no-op
606      */

607     public void setDisplayUrl(String JavaDoc string)
608     {
609     }
610
611 }
Popular Tags