You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@roller.apache.org by ag...@apache.org on 2007/07/05 19:32:14 UTC
svn commit: r553572 [2/2] - in
/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger:
business/hibernate/ pojos/
Modified: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/WeblogReferrer.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/WeblogReferrer.java?view=diff&rev=553572&r1=553571&r2=553572
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/WeblogReferrer.java (original)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/WeblogReferrer.java Thu Jul 5 10:32:12 2007
@@ -1,70 +1,65 @@
/*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-* contributor license agreements. The ASF licenses this file to You
-* under the Apache License, Version 2.0 (the "License"); you may not
-* use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License. For additional information regarding
-* copyright in this work, please see the NOTICE file in the top level
-* directory of this distribution.
-*/
-/*
- * Generated file - Do not edit!
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. The ASF licenses this file to You
+ * under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License. For additional information regarding
+ * copyright in this work, please see the NOTICE file in the top level
+ * directory of this distribution.
*/
+
package org.apache.roller.weblogger.pojos;
+import java.io.Serializable;
import org.apache.commons.lang.StringEscapeUtils;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.roller.util.UUIDGenerator;
+
/**
- * Referer bean.
- * @author David M Johnson
+ * Referrer bean.
*
- * @ejb:bean name="WeblogReferrer"
- * @struts.form include-all="true"
- * @hibernate.class lazy="true" table="referer"
- * @hibernate.cache usage="read-write"
+ * @author David M Johnson
*/
-public class WeblogReferrer
- implements java.io.Serializable
-{
- static final long serialVersionUID = -1817992900602131316L;
- private java.lang.String id = UUIDGenerator.generateUUID();
- private org.apache.roller.weblogger.pojos.Weblog website = null;
- private org.apache.roller.weblogger.pojos.WeblogEntry weblogEntry = null;
- private java.lang.String dateString = null;
- private java.lang.String refererUrl = null;
- private java.lang.String refererPermalink = null;
- private java.lang.String requestUrl = null;
- private java.lang.String title = null;
- private java.lang.String excerpt = null;
- private java.lang.Boolean visible = null;
- private java.lang.Boolean duplicate = null;
- private java.lang.Integer dayHits = null;
- private java.lang.Integer totalHits = null;
-
- public WeblogReferrer()
- {
+public class WeblogReferrer implements Serializable {
+
+ public static final long serialVersionUID = -1817992900602131316L;
+
+ private String id = UUIDGenerator.generateUUID();
+ private Weblog website = null;
+ private WeblogEntry weblogEntry = null;
+ private String dateString = null;
+ private String refererUrl = null;
+ private String refererPermalink = null;
+ private String requestUrl = null;
+ private String title = null;
+ private String excerpt = null;
+ private Boolean visible = null;
+ private Boolean duplicate = null;
+ private Integer dayHits = null;
+ private Integer totalHits = null;
+
+
+ public WeblogReferrer() {
}
-
- public WeblogReferrer(java.lang.String id,
- org.apache.roller.weblogger.pojos.Weblog website,org.apache.roller.weblogger.pojos.WeblogEntry weblogEntry,
- java.lang.String dateString, java.lang.String refererUrl,
- java.lang.String refererPermalink,
- java.lang.String requestUrl, java.lang.String title,
- java.lang.String excerpt, java.lang.Boolean visible,
- java.lang.Boolean duplicate, java.lang.Integer dayHits,
- java.lang.Integer totalHits)
- {
+
+ public WeblogReferrer(String id,
+ org.apache.roller.weblogger.pojos.Weblog website,org.apache.roller.weblogger.pojos.WeblogEntry weblogEntry,
+ String dateString, String refererUrl,
+ String refererPermalink,
+ String requestUrl, String title,
+ String excerpt, Boolean visible,
+ Boolean duplicate, Integer dayHits,
+ Integer totalHits) {
//this.id = id;
this.website = website;
this.weblogEntry = weblogEntry;
@@ -79,352 +74,266 @@
this.dayHits = dayHits;
this.totalHits = totalHits;
}
-
- public WeblogReferrer(WeblogReferrer otherData)
- {
- setData(otherData);
- }
-
+
//------------------------------------------------------- Simple properties
-
- /**
+
+ /**
* Unique ID and primary key of this Referer.
- *
- * @roller.wrapPojoMethod type="simple"
- * @hibernate.id column="id"
- * generator-class="assigned"
*/
- public java.lang.String getId()
- {
+ public String getId() {
return this.id;
}
-
- public void setId(java.lang.String id)
- {
- // Form bean workaround: empty string is never a valid id
- if (id != null && id.trim().length() == 0) return;
+
+ public void setId(String id) {
this.id = id;
}
-
- /**
+
+
+ /**
* ID of website that this referer refers to.
*
* @roller.wrapPojoMethod type="pojo"
* @hibernate.many-to-one column="websiteid" cascade="none" not-null="true"
*/
- public org.apache.roller.weblogger.pojos.Weblog getWebsite()
- {
+ public org.apache.roller.weblogger.pojos.Weblog getWebsite() {
return this.website;
}
-
- public void setWebsite(org.apache.roller.weblogger.pojos.Weblog website)
- {
+
+ public void setWebsite(org.apache.roller.weblogger.pojos.Weblog website) {
this.website = website;
}
-
+
/**
* @roller.wrapPojoMethod type="pojo"
* @hibernate.many-to-one column="entryid" cascade="none"
*/
- public org.apache.roller.weblogger.pojos.WeblogEntry getWeblogEntry()
- {
+ public org.apache.roller.weblogger.pojos.WeblogEntry getWeblogEntry() {
return weblogEntry;
}
-
+
/**
* @param data
*/
- public void setWeblogEntry(org.apache.roller.weblogger.pojos.WeblogEntry data)
- {
+ public void setWeblogEntry(org.apache.roller.weblogger.pojos.WeblogEntry data) {
weblogEntry = data;
}
-
- /**
+
+ /**
* Date string in YYYYMMDD format.
*
* @roller.wrapPojoMethod type="simple"
* @hibernate.property column="datestr" non-null="true" unique="false"
*/
- public java.lang.String getDateString()
- {
+ public String getDateString() {
return this.dateString;
}
-
- public void setDateString(java.lang.String dateString)
- {
+
+ public void setDateString(String dateString) {
this.dateString = dateString;
}
-
- /**
+
+ /**
* URL of the refering page.
*
* @roller.wrapPojoMethod type="simple"
* @hibernate.property column="refurl" non-null="true" unique="false"
*/
- public java.lang.String getRefererUrl()
- {
+ public String getRefererUrl() {
return this.refererUrl;
}
-
- public void setRefererUrl(java.lang.String refererUrl)
- {
+
+ public void setRefererUrl(String refererUrl) {
this.refererUrl = refererUrl;
}
-
- /**
+
+ /**
* Requested URL, the URL linked to by the refering page.
*
* @roller.wrapPojoMethod type="simple"
* @hibernate.property column="refpermalink" non-null="true" unique="false"
*/
- public java.lang.String getRefererPermalink()
- {
+ public String getRefererPermalink() {
return this.refererPermalink;
}
-
- public void setRefererPermalink(java.lang.String refererPermalink)
- {
+
+ public void setRefererPermalink(String refererPermalink) {
this.refererPermalink = refererPermalink;
}
-
- /**
+
+ /**
* Requested URL, the URL linked to by the refering page.
*
* @roller.wrapPojoMethod type="simple"
* @hibernate.property column="requrl" non-null="true" unique="false"
*/
- public java.lang.String getRequestUrl()
- {
+ public String getRequestUrl() {
return this.requestUrl;
}
-
- public void setRequestUrl(java.lang.String requestUrl)
- {
+
+ public void setRequestUrl(String requestUrl) {
this.requestUrl = requestUrl;
}
-
- /**
- * The text on the refering page that surrounds the refering link.
+
+ /**
+ * The text on the refering page that surrounds the refering link.
*
- * @roller.wrapPojoMethod type="simple"
+ * @roller.wrapPojoMethod type="simple"
* @hibernate.property column="title" non-null="true" unique="false"
*/
- public java.lang.String getTitle()
- {
+ public String getTitle() {
return this.title;
}
-
- public void setTitle(java.lang.String title)
- {
+
+ public void setTitle(String title) {
this.title = title;
}
-
- /**
- * The text on the refering page that surrounds the refering link.
+
+ /**
+ * The text on the refering page that surrounds the refering link.
*
* @roller.wrapPojoMethod type="simple"
* @hibernate.property column="excerpt" non-null="true" unique="false"
*/
- public java.lang.String getExcerpt()
- {
+ public String getExcerpt() {
return this.excerpt;
}
-
- public void setExcerpt(java.lang.String excerpt)
- {
+
+ public void setExcerpt(String excerpt) {
this.excerpt = excerpt;
}
-
- /**
+
+ /**
* Should this referer be displayed?
*
* @roller.wrapPojoMethod type="simple"
* @hibernate.property column="visible" non-null="true" unique="false"
*/
- public java.lang.Boolean getVisible()
- {
+ public Boolean getVisible() {
return this.visible;
}
-
- public void setVisible(java.lang.Boolean visible)
- {
+
+ public void setVisible(Boolean visible) {
this.visible = visible;
}
-
- /**
+
+ /**
* Is this referer a duplicate?
*
* @roller.wrapPojoMethod type="simple"
* @hibernate.property column="duplicate" non-null="true" unique="false"
*/
- public java.lang.Boolean getDuplicate()
- {
+ public Boolean getDuplicate() {
return this.duplicate;
}
-
- public void setDuplicate(java.lang.Boolean duplicate)
- {
+
+ public void setDuplicate(Boolean duplicate) {
this.duplicate = duplicate;
}
-
- /**
+
+ /**
* Hits received today from this referer.
*
* @roller.wrapPojoMethod type="simple"
* @hibernate.property column="dayhits" non-null="true" unique="false"
*/
- public java.lang.Integer getDayHits()
- {
+ public Integer getDayHits() {
return this.dayHits;
}
-
- public void setDayHits(java.lang.Integer dayHits)
- {
+
+ public void setDayHits(Integer dayHits) {
this.dayHits = dayHits;
}
-
- /**
+
+ /**
* Total hits received from this referer.
*
* @roller.wrapPojoMethod type="simple"
* @hibernate.property column="totalhits" non-null="true" unique="false"
*/
- public java.lang.Integer getTotalHits()
- {
+ public Integer getTotalHits() {
return this.totalHits;
}
-
- public void setTotalHits(java.lang.Integer totalHits)
- {
+
+ public void setTotalHits(Integer totalHits) {
this.totalHits = totalHits;
}
-
+
//-------------------------------------------------------------------------
/**
* @roller.wrapPojoMethod type="simple"
*/
- public String getDisplayUrl(int maxWidth, boolean includeHits)
- {
+ public String getDisplayUrl(int maxWidth, boolean includeHits) {
StringBuffer sb = new StringBuffer();
-
+
String url = StringEscapeUtils.escapeHtml(getUrl());
String displayUrl = url.trim();
String restOfUrl = null;
-
- if (displayUrl.startsWith("http://"))
- {
+
+ if (displayUrl.startsWith("http://")) {
displayUrl = displayUrl.substring(7);
}
-
- if (displayUrl.length() > maxWidth)
- {
- restOfUrl = "..." +
- displayUrl.substring(maxWidth, displayUrl.length());
+
+ if (displayUrl.length() > maxWidth) {
+ restOfUrl = "..." +
+ displayUrl.substring(maxWidth, displayUrl.length());
displayUrl = displayUrl.substring(0, maxWidth) + "...";
}
-
- if (url.startsWith("http://"))
- {
+
+ if (url.startsWith("http://")) {
sb.append("<a href=\"");
sb.append(url);
}
-
+
// add a title with the rest of the url if it exists
- if (restOfUrl != null)
- {
+ if (restOfUrl != null) {
sb.append("\" title=\"");
sb.append(restOfUrl);
}
-
- if (sb.length() > 0)
- {
+
+ if (sb.length() > 0) {
sb.append("\">");
}
-
+
sb.append(displayUrl);
-
- if (includeHits)
- {
+
+ if (includeHits) {
sb.append(" (");
sb.append(getDayHits());
sb.append(")");
}
-
- if (url.startsWith("http://"))
- {
+
+ if (url.startsWith("http://")) {
sb.append("</a>");
}
-
+
return sb.toString();
}
-
+
//-------------------------------------------------------------------------
/**
* @roller.wrapPojoMethod type="simple"
*/
- public String getUrl()
- {
- if (getRefererPermalink() != null)
- {
+ public String getUrl() {
+ if (getRefererPermalink() != null) {
return getRefererPermalink();
- }
- else
- {
+ } else {
return getRefererUrl();
}
}
-
+
//-------------------------------------------------------------------------
/**
* @roller.wrapPojoMethod type="simple"
*/
- public String getDisplayUrl()
- {
+ public String getDisplayUrl() {
return getDisplayUrl(50, false);
}
-
-
- /**
- * Set bean properties based on other bean.
- */
- public void setData(WeblogReferrer otherData)
- {
- this.id = otherData.getId();
- this.website = otherData.getWebsite();
- this.weblogEntry = otherData.getWeblogEntry();
- this.dateString = otherData.getDateString();
- this.refererUrl = otherData.getRefererUrl();
- this.refererPermalink = otherData.getRefererPermalink();
- this.requestUrl = otherData.getRequestUrl();
- this.title = otherData.getTitle();
- this.excerpt = otherData.getExcerpt();
- this.visible = otherData.getVisible();
- this.duplicate = otherData.getDuplicate();
- this.dayHits = otherData.getDayHits();
- this.totalHits = otherData.getTotalHits();
- }
-
- /**
- * A no-op.
- * TODO: fix formbean generation so this is not needed.
- * @param string
- */
- public void setUrl(String string)
- {
- }
-
- /**
- * A no-op
- */
- public void setDisplayUrl(String string)
- {
- }
//------------------------------------------------------- Good citizenship
-
+
public String toString() {
StringBuffer buf = new StringBuffer();
buf.append("{");
@@ -436,24 +345,24 @@
buf.append("}");
return buf.toString();
}
-
+
public boolean equals(Object other) {
if (other == this) return true;
if (other instanceof WeblogReferrer != true) return false;
WeblogReferrer o = (WeblogReferrer)other;
return new EqualsBuilder()
- .append(getRefererUrl(), o.getRefererUrl())
- .append(getWeblogEntry(), o.getWeblogEntry())
- .append(getWebsite(),o.getWebsite())
- .isEquals();
+ .append(getRefererUrl(), o.getRefererUrl())
+ .append(getWeblogEntry(), o.getWeblogEntry())
+ .append(getWebsite(),o.getWebsite())
+ .isEquals();
}
- public int hashCode() {
+ public int hashCode() {
return new HashCodeBuilder()
- .append(getRefererUrl())
- .append(getWeblogEntry())
- .append(getWebsite())
- .toHashCode();
+ .append(getRefererUrl())
+ .append(getWeblogEntry())
+ .append(getWebsite())
+ .toHashCode();
}
-
+
}
Modified: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/WeblogTemplate.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/WeblogTemplate.java?view=diff&rev=553572&r1=553571&r2=553572
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/WeblogTemplate.java (original)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/WeblogTemplate.java Thu Jul 5 10:32:12 2007
@@ -35,11 +35,6 @@
*
* This template is different from the generic template because it also
* contains a reference to the website it is part of.
- *
- * @ejb:bean name="WeblogTemplate"
- * @struts.form include-all="true"
- * @hibernate.class lazy="true" table="webpage"
- * @hibernate.cache usage="read-write"
*/
public class WeblogTemplate implements ThemeTemplate, Serializable {
@@ -49,6 +44,7 @@
private static Log log = LogFactory.getLog(WeblogTemplate.class);
private static Set requiredTemplates = null;
+ // attributes
private String id = UUIDGenerator.generateUUID();
private String action = null;
private String name = null;
@@ -62,6 +58,7 @@
private String decoratorName = null;
private String outputContentType = null;
+ // associations
private Weblog weblog = null;
@@ -77,11 +74,6 @@
public WeblogTemplate() {}
- public WeblogTemplate( WeblogTemplate otherData ) {
- setData(otherData);
- }
-
-
public ThemeTemplate getDecorator() {
if(decoratorName != null && !id.equals(decoratorName)) {
try {
@@ -95,41 +87,24 @@
}
- /**
- * @ejb:persistent-field
- * @hibernate.id column="id"
- * generator-class="assigned"
- */
- public java.lang.String getId() {
+ public String getId() {
return this.id;
}
- /** @ejb:persistent-field */
- public void setId( java.lang.String id ) {
- // Form bean workaround: empty string is never a valid id
- if (id != null && id.trim().length() == 0) return;
+ public void setId( String id ) {
this.id = id;
}
- /**
- * @ejb:persistent-field
- * @hibernate.many-to-one column="websiteid" cascade="none" not-null="true"
- */
public Weblog getWebsite() {
return this.weblog;
}
- /** @ejb:persistent-field */
public void setWebsite( Weblog website ) {
this.weblog = website;
}
- /**
- * @ejb:persistent-field
- * @hibernate.property column="action" non-null="true" unique="false"
- */
public String getAction() {
return action;
}
@@ -139,147 +114,94 @@
}
- /**
- * @ejb:persistent-field
- * @hibernate.property column="name" non-null="true" unique="false"
- */
- public java.lang.String getName() {
+ public String getName() {
return this.name;
}
- /** @ejb:persistent-field */
- public void setName( java.lang.String name ) {
+ public void setName( String name ) {
this.name = name;
}
- /**
- * Description
- * @ejb:persistent-field
- * @hibernate.property column="description" non-null="true" unique="false"
- */
- public java.lang.String getDescription() {
+ public String getDescription() {
return this.description;
}
- /** @ejb:persistent-field */
- public void setDescription( java.lang.String description ) {
+ public void setDescription( String description ) {
this.description = description;
}
- /**
- * @ejb:persistent-field
- * @hibernate.property column="link" non-null="true" unique="false"
- */
- public java.lang.String getLink() {
+ public String getLink() {
return this.link;
}
- /** @ejb:persistent-field */
- public void setLink( java.lang.String link ) {
+ public void setLink( String link ) {
this.link = link;
}
- /**
- * @ejb:persistent-field
- * @hibernate.property column="template" non-null="true" unique="false"
- */
- public java.lang.String getContents() {
+ public String getContents() {
return this.contents;
}
- /** @ejb:persistent-field */
- public void setContents( java.lang.String template ) {
+ public void setContents( String template ) {
this.contents = template;
}
- /**
- * @ejb:persistent-field
- * @hibernate.property column="updatetime" non-null="true" unique="false"
- */
- public java.util.Date getLastModified() {
- // don't modify fields directly
- //return (Date)this.lastModified.clone();
+ public Date getLastModified() {
return lastModified;
}
- /** @ejb:persistent-field */
- public void setLastModified(final java.util.Date newtime ) {
- //if (newtime != null) {
- // lastModified = (Date)newtime.clone();
- //} else {
- // lastModified = null;
- //}
+ public void setLastModified(final Date newtime ) {
lastModified = newtime;
}
- /**
- * @ejb:persistent-field
- * @hibernate.property column="templatelang" non-null="true" unique="false"
- */
public String getTemplateLanguage() {
return templateLanguage;
}
- /** @ejb:persistent-field */
public void setTemplateLanguage(String templateLanguage) {
this.templateLanguage = templateLanguage;
}
- /**
- * @ejb:persistent-field
- * @hibernate.property column="navbar" non-null="true" unique="false"
- */
public boolean isNavbar() {
return navbar;
}
- /** @ejb:persistent-field */
public void setNavbar(boolean navbar) {
this.navbar = navbar;
}
- /**
- * @ejb:persistent-field
- * @hibernate.property column="hidden" non-null="true" unique="false"
- */
+
public boolean isHidden() {
return hidden;
}
- /** @ejb:persistent-field */
public void setHidden(boolean isHidden) {
this.hidden = isHidden;
}
- /**
- * @ejb:persistent-field
- * @hibernate.property column="decorator" non-null="false" unique="false"
- */
+
public String getDecoratorName() {
return decoratorName;
}
- /** @ejb:persistent-field */
public void setDecoratorName(String decorator) {
this.decoratorName = decorator;
}
+
/**
* Content-type rendered by template or null for auto-detection by link extension.
- * @ejb:persistent-field
- * @hibernate.property column="outputtype" non-null="false" unique="false"
*/
public String getOutputContentType() {
return outputContentType;
}
-
- /** @ejb:persistent-field */
+
public void setOutputContentType(String outputContentType) {
this.outputContentType = outputContentType;
}
@@ -342,24 +264,6 @@
.append(getName())
.append(getWebsite())
.toHashCode();
- }
-
- /**
- * Set bean properties based on other bean.
- */
- public void setData( WeblogTemplate otherData ) {
- WeblogTemplate other = (WeblogTemplate)otherData;
- this.weblog = other.getWebsite();
- this.id = other.getId();
- this.name = other.getName();
- this.description = other.getDescription();
- this.link = other.getLink();
- this.navbar = other.isNavbar();
- this.contents = other.getContents();
- this.lastModified = other.getLastModified()!=null ? (Date)other.getLastModified().clone() : null;
- this.templateLanguage = other.getTemplateLanguage();
- this.hidden = other.isHidden();
- this.decoratorName = other.getDecoratorName();
}
}