001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. The ASF licenses this file to You
004: * under the Apache License, Version 2.0 (the "License"); you may not
005: * use this file except in compliance with the License.
006: * You may obtain a copy of the License at
007: *
008: * http://www.apache.org/licenses/LICENSE-2.0
009: *
010: * Unless required by applicable law or agreed to in writing, software
011: * distributed under the License is distributed on an "AS IS" BASIS,
012: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013: * See the License for the specific language governing permissions and
014: * limitations under the License. For additional information regarding
015: * copyright in this work, please see the NOTICE file in the top level
016: * directory of this distribution.
017: */
018: /*
019: * Generated file - Do not edit!
020: */
021: package org.apache.roller.pojos;
022:
023: import org.apache.commons.lang.StringEscapeUtils;
024:
025: /**
026: * Referer bean.
027: * @author David M Johnson
028: *
029: * @ejb:bean name="RefererData"
030: * @struts.form include-all="true"
031: * @hibernate.class lazy="false" table="referer"
032: * @hibernate.cache usage="read-write"
033: */
034: public class RefererData extends PersistentObject implements
035: java.io.Serializable {
036: static final long serialVersionUID = -1817992900602131316L;
037: private java.lang.String id = null;
038: private org.apache.roller.pojos.WebsiteData website = null;
039: private org.apache.roller.pojos.WeblogEntryData weblogEntry = null;
040: private java.lang.String dateString = null;
041: private java.lang.String refererUrl = null;
042: private java.lang.String refererPermalink = null;
043: private java.lang.String requestUrl = null;
044: private java.lang.String title = null;
045: private java.lang.String excerpt = null;
046: private java.lang.Boolean visible = null;
047: private java.lang.Boolean duplicate = null;
048: private java.lang.Integer dayHits = null;
049: private java.lang.Integer totalHits = null;
050:
051: public RefererData() {
052: }
053:
054: public RefererData(java.lang.String id,
055: org.apache.roller.pojos.WebsiteData website,
056: org.apache.roller.pojos.WeblogEntryData weblogEntry,
057: java.lang.String dateString, java.lang.String refererUrl,
058: java.lang.String refererPermalink,
059: java.lang.String requestUrl, java.lang.String title,
060: java.lang.String excerpt, java.lang.Boolean visible,
061: java.lang.Boolean duplicate, java.lang.Integer dayHits,
062: java.lang.Integer totalHits) {
063: this .id = id;
064: this .website = website;
065: this .weblogEntry = weblogEntry;
066: this .dateString = dateString;
067: this .refererUrl = refererUrl;
068: this .refererPermalink = refererPermalink;
069: this .requestUrl = requestUrl;
070: this .title = title;
071: this .excerpt = excerpt;
072: this .visible = visible;
073: this .duplicate = duplicate;
074: this .dayHits = dayHits;
075: this .totalHits = totalHits;
076: }
077:
078: public RefererData(RefererData otherData) {
079: setData(otherData);
080: }
081:
082: //------------------------------------------------------- Simple properties
083:
084: /**
085: * Unique ID and primary key of this Referer.
086: *
087: * @roller.wrapPojoMethod type="simple"
088: * @hibernate.id column="id"
089: * generator-class="uuid.hex" unsaved-value="null"
090: */
091: public java.lang.String getId() {
092: return this .id;
093: }
094:
095: public void setId(java.lang.String id) {
096: this .id = id;
097: }
098:
099: /**
100: * ID of website that this referer refers to.
101: *
102: * @roller.wrapPojoMethod type="pojo"
103: * @hibernate.many-to-one column="websiteid" cascade="none" not-null="true"
104: */
105: public org.apache.roller.pojos.WebsiteData getWebsite() {
106: return this .website;
107: }
108:
109: public void setWebsite(org.apache.roller.pojos.WebsiteData website) {
110: this .website = website;
111: }
112:
113: /**
114: * @roller.wrapPojoMethod type="pojo"
115: * @hibernate.many-to-one column="entryid" cascade="none"
116: */
117: public org.apache.roller.pojos.WeblogEntryData getWeblogEntry() {
118: return weblogEntry;
119: }
120:
121: /**
122: * @param data
123: */
124: public void setWeblogEntry(
125: org.apache.roller.pojos.WeblogEntryData data) {
126: weblogEntry = data;
127: }
128:
129: /**
130: * Date string in YYYYMMDD format.
131: *
132: * @roller.wrapPojoMethod type="simple"
133: * @hibernate.property column="datestr" non-null="true" unique="false"
134: */
135: public java.lang.String getDateString() {
136: return this .dateString;
137: }
138:
139: public void setDateString(java.lang.String dateString) {
140: this .dateString = dateString;
141: }
142:
143: /**
144: * URL of the refering page.
145: *
146: * @roller.wrapPojoMethod type="simple"
147: * @hibernate.property column="refurl" non-null="true" unique="false"
148: */
149: public java.lang.String getRefererUrl() {
150: return this .refererUrl;
151: }
152:
153: public void setRefererUrl(java.lang.String refererUrl) {
154: this .refererUrl = refererUrl;
155: }
156:
157: /**
158: * Requested URL, the URL linked to by the refering page.
159: *
160: * @roller.wrapPojoMethod type="simple"
161: * @hibernate.property column="refpermalink" non-null="true" unique="false"
162: */
163: public java.lang.String getRefererPermalink() {
164: return this .refererPermalink;
165: }
166:
167: public void setRefererPermalink(java.lang.String refererPermalink) {
168: this .refererPermalink = refererPermalink;
169: }
170:
171: /**
172: * Requested URL, the URL linked to by the refering page.
173: *
174: * @roller.wrapPojoMethod type="simple"
175: * @hibernate.property column="requrl" non-null="true" unique="false"
176: */
177: public java.lang.String getRequestUrl() {
178: return this .requestUrl;
179: }
180:
181: public void setRequestUrl(java.lang.String requestUrl) {
182: this .requestUrl = requestUrl;
183: }
184:
185: /**
186: * The text on the refering page that surrounds the refering link.
187: *
188: * @roller.wrapPojoMethod type="simple"
189: * @hibernate.property column="title" non-null="true" unique="false"
190: */
191: public java.lang.String getTitle() {
192: return this .title;
193: }
194:
195: public void setTitle(java.lang.String title) {
196: this .title = title;
197: }
198:
199: /**
200: * The text on the refering page that surrounds the refering link.
201: *
202: * @roller.wrapPojoMethod type="simple"
203: * @hibernate.property column="excerpt" non-null="true" unique="false"
204: */
205: public java.lang.String getExcerpt() {
206: return this .excerpt;
207: }
208:
209: public void setExcerpt(java.lang.String excerpt) {
210: this .excerpt = excerpt;
211: }
212:
213: /**
214: * Should this referer be displayed?
215: *
216: * @roller.wrapPojoMethod type="simple"
217: * @hibernate.property column="visible" non-null="true" unique="false"
218: */
219: public java.lang.Boolean getVisible() {
220: return this .visible;
221: }
222:
223: public void setVisible(java.lang.Boolean visible) {
224: this .visible = visible;
225: }
226:
227: /**
228: * Is this referer a duplicate?
229: *
230: * @roller.wrapPojoMethod type="simple"
231: * @hibernate.property column="duplicate" non-null="true" unique="false"
232: */
233: public java.lang.Boolean getDuplicate() {
234: return this .duplicate;
235: }
236:
237: public void setDuplicate(java.lang.Boolean duplicate) {
238: this .duplicate = duplicate;
239: }
240:
241: /**
242: * Hits received today from this referer.
243: *
244: * @roller.wrapPojoMethod type="simple"
245: * @hibernate.property column="dayhits" non-null="true" unique="false"
246: */
247: public java.lang.Integer getDayHits() {
248: return this .dayHits;
249: }
250:
251: public void setDayHits(java.lang.Integer dayHits) {
252: this .dayHits = dayHits;
253: }
254:
255: /**
256: * Total hits received from this referer.
257: *
258: * @roller.wrapPojoMethod type="simple"
259: * @hibernate.property column="totalhits" non-null="true" unique="false"
260: */
261: public java.lang.Integer getTotalHits() {
262: return this .totalHits;
263: }
264:
265: public void setTotalHits(java.lang.Integer totalHits) {
266: this .totalHits = totalHits;
267: }
268:
269: //-------------------------------------------------------------------------
270:
271: /**
272: * @roller.wrapPojoMethod type="simple"
273: */
274: public String getDisplayUrl(int maxWidth, boolean includeHits) {
275: StringBuffer sb = new StringBuffer();
276:
277: String url = StringEscapeUtils.escapeHtml(getUrl());
278: String displayUrl = url.trim();
279: String restOfUrl = null;
280:
281: if (displayUrl.startsWith("http://")) {
282: displayUrl = displayUrl.substring(7);
283: }
284:
285: if (displayUrl.length() > maxWidth) {
286: restOfUrl = "..."
287: + displayUrl.substring(maxWidth, displayUrl
288: .length());
289: displayUrl = displayUrl.substring(0, maxWidth) + "...";
290: }
291:
292: if (url.startsWith("http://")) {
293: sb.append("<a href=\"");
294: sb.append(url);
295: }
296:
297: // add a title with the rest of the url if it exists
298: if (restOfUrl != null) {
299: sb.append("\" title=\"");
300: sb.append(restOfUrl);
301: }
302:
303: if (sb.length() > 0) {
304: sb.append("\">");
305: }
306:
307: sb.append(displayUrl);
308:
309: if (includeHits) {
310: sb.append(" (");
311: sb.append(getDayHits());
312: sb.append(")");
313: }
314:
315: if (url.startsWith("http://")) {
316: sb.append("</a>");
317: }
318:
319: return sb.toString();
320: }
321:
322: //-------------------------------------------------------------------------
323:
324: /**
325: * @roller.wrapPojoMethod type="simple"
326: */
327: public String getUrl() {
328: if (getRefererPermalink() != null) {
329: return getRefererPermalink();
330: } else {
331: return getRefererUrl();
332: }
333: }
334:
335: //-------------------------------------------------------------------------
336:
337: /**
338: * @roller.wrapPojoMethod type="simple"
339: */
340: public String getDisplayUrl() {
341: return getDisplayUrl(50, false);
342: }
343:
344: //-------------------------------------------------------------------------
345: public String toString() {
346: StringBuffer str = new StringBuffer("{");
347:
348: str.append("id=" + id + " " + "website=" + website + " "
349: + "dateString=" + dateString + " " + "refererUrl="
350: + refererUrl + " " + "refererPermalink="
351: + refererPermalink + " " + "requestUrl=" + requestUrl
352: + " " + "title=" + title + " " + "excerpt=" + excerpt
353: + " " + "visible=" + visible + " " + "duplicate="
354: + duplicate + " " + "dayHits=" + dayHits + " "
355: + "totalHits=" + totalHits);
356: str.append('}');
357:
358: return (str.toString());
359: }
360:
361: public boolean equals(Object pOther) {
362: if (pOther instanceof RefererData) {
363: RefererData lTest = (RefererData) pOther;
364: boolean lEquals = true;
365:
366: if (this .id == null) {
367: lEquals = lEquals && (lTest.getId() == null);
368: } else {
369: lEquals = lEquals && this .id.equals(lTest.getId());
370: }
371:
372: if (this .website == null) {
373: lEquals = lEquals && (lTest.getWebsite() == null);
374: } else {
375: lEquals = lEquals
376: && this .website.equals(lTest.getWebsite());
377: }
378:
379: if (this .weblogEntry == null) {
380: lEquals = lEquals && (lTest.getWeblogEntry() == null);
381: } else {
382: lEquals = lEquals
383: && this .weblogEntry.equals(lTest
384: .getWeblogEntry());
385: }
386:
387: if (this .dateString == null) {
388: lEquals = lEquals && (lTest.getDateString() == null);
389: } else {
390: lEquals = lEquals
391: && this .dateString
392: .equals(lTest.getDateString());
393: }
394:
395: if (this .refererUrl == null) {
396: lEquals = lEquals && (lTest.getRefererUrl() == null);
397: } else {
398: lEquals = lEquals
399: && this .refererUrl
400: .equals(lTest.getRefererUrl());
401: }
402:
403: if (this .refererPermalink == null) {
404: lEquals = lEquals
405: && (lTest.getRefererPermalink() == null);
406: } else {
407: lEquals = lEquals
408: && this .refererPermalink.equals(lTest
409: .getRefererPermalink());
410: }
411:
412: if (this .requestUrl == null) {
413: lEquals = lEquals && (lTest.getRequestUrl() == null);
414: } else {
415: lEquals = lEquals
416: && this .requestUrl
417: .equals(lTest.getRequestUrl());
418: }
419:
420: if (this .title == null) {
421: lEquals = lEquals && (lTest.getTitle() == null);
422: } else {
423: lEquals = lEquals
424: && this .title.equals(lTest.getTitle());
425: }
426:
427: if (this .excerpt == null) {
428: lEquals = lEquals && (lTest.getExcerpt() == null);
429: } else {
430: lEquals = lEquals
431: && this .excerpt.equals(lTest.getExcerpt());
432: }
433:
434: if (this .visible == null) {
435: lEquals = lEquals && (lTest.getVisible() == null);
436: } else {
437: lEquals = lEquals
438: && this .visible.equals(lTest.getVisible());
439: }
440:
441: if (this .duplicate == null) {
442: lEquals = lEquals && (lTest.getDuplicate() == null);
443: } else {
444: lEquals = lEquals
445: && this .duplicate.equals(lTest.getDuplicate());
446: }
447:
448: if (this .dayHits == null) {
449: lEquals = lEquals && (lTest.getDayHits() == null);
450: } else {
451: lEquals = lEquals
452: && this .dayHits.equals(lTest.getDayHits());
453: }
454:
455: if (this .totalHits == null) {
456: lEquals = lEquals && (lTest.getTotalHits() == null);
457: } else {
458: lEquals = lEquals
459: && this .totalHits.equals(lTest.getTotalHits());
460: }
461:
462: return lEquals;
463: } else {
464: return false;
465: }
466: }
467:
468: public int hashCode() {
469: int result = 17;
470: result = (37 * result)
471: + ((this .id != null) ? this .id.hashCode() : 0);
472: result = (37 * result)
473: + ((this .website != null) ? this .website.hashCode() : 0);
474: result = (37 * result)
475: + ((this .weblogEntry != null) ? this .weblogEntry
476: .hashCode() : 0);
477: result = (37 * result)
478: + ((this .dateString != null) ? this .dateString
479: .hashCode() : 0);
480: result = (37 * result)
481: + ((this .refererUrl != null) ? this .refererUrl
482: .hashCode() : 0);
483: result = (37 * result)
484: + ((this .refererPermalink != null) ? this .refererPermalink
485: .hashCode()
486: : 0);
487: result = (37 * result)
488: + ((this .requestUrl != null) ? this .requestUrl
489: .hashCode() : 0);
490: result = (37 * result)
491: + ((this .title != null) ? this .title.hashCode() : 0);
492: result = (37 * result)
493: + ((this .excerpt != null) ? this .excerpt.hashCode() : 0);
494: result = (37 * result)
495: + ((this .visible != null) ? this .visible.hashCode() : 0);
496: result = (37 * result)
497: + ((this .duplicate != null) ? this .duplicate.hashCode()
498: : 0);
499: result = (37 * result)
500: + ((this .dayHits != null) ? this .dayHits.hashCode() : 0);
501: result = (37 * result)
502: + ((this .totalHits != null) ? this .totalHits.hashCode()
503: : 0);
504:
505: return result;
506: }
507:
508: /**
509: * Setter is needed in RollerImpl.storePersistentObject()
510: */
511: public void setData(
512: org.apache.roller.pojos.PersistentObject otherData) {
513: this .id = ((RefererData) otherData).getId();
514: this .website = ((RefererData) otherData).getWebsite();
515: this .weblogEntry = ((RefererData) otherData).getWeblogEntry();
516: this .dateString = ((RefererData) otherData).getDateString();
517: this .refererUrl = ((RefererData) otherData).getRefererUrl();
518: this .refererPermalink = ((RefererData) otherData)
519: .getRefererPermalink();
520: this .requestUrl = ((RefererData) otherData).getRequestUrl();
521: this .title = ((RefererData) otherData).getTitle();
522: this .excerpt = ((RefererData) otherData).getExcerpt();
523: this .visible = ((RefererData) otherData).getVisible();
524: this .duplicate = ((RefererData) otherData).getDuplicate();
525: this .dayHits = ((RefererData) otherData).getDayHits();
526: this .totalHits = ((RefererData) otherData).getTotalHits();
527: }
528:
529: /**
530: * A no-op.
531: * TODO: fix formbean generation so this is not needed.
532: * @param string
533: */
534: public void setUrl(String string) {
535: }
536:
537: /**
538: * A no-op
539: */
540: public void setDisplayUrl(String string) {
541: }
542:
543: }
|