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 2006/11/08 20:59:16 UTC
svn commit: r472615 -
/incubator/roller/trunk/src/org/apache/roller/pojos/WeblogCategoryData.java
Author: agilliland
Date: Wed Nov 8 11:59:16 2006
New Revision: 472615
URL: http://svn.apache.org/viewvc?view=rev&rev=472615
Log:
code reformatting and reorg.
Modified:
incubator/roller/trunk/src/org/apache/roller/pojos/WeblogCategoryData.java
Modified: incubator/roller/trunk/src/org/apache/roller/pojos/WeblogCategoryData.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/pojos/WeblogCategoryData.java?view=diff&rev=472615&r1=472614&r2=472615
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/pojos/WeblogCategoryData.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/pojos/WeblogCategoryData.java Wed Nov 8 11:59:16 2006
@@ -15,6 +15,7 @@
* copyright in this work, please see the NOTICE file in the top level
* directory of this distribution.
*/
+
package org.apache.roller.pojos;
import java.util.Iterator;
@@ -27,16 +28,18 @@
import org.apache.roller.business.WeblogManager;
import org.apache.roller.util.PojoUtil;
+
/**
- * WeblogCategory bean.
- * @author David M Johnson
+ * Weblog Category.
*
- * @ejb:bean name="WeblogCategoryData"
* @struts.form include-all="true"
+ *
+ * @ejb:bean name="WeblogCategoryData"
* @hibernate.class lazy="false" table="weblogcategory"
* @hibernate.cache usage="read-write"
*/
public class WeblogCategoryData extends HierarchicalPersistentObject {
+
public static final long serialVersionUID = 1435782148712018954L;
private String id = null;
@@ -90,32 +93,56 @@
}
- /**
- * @see org.apache.roller.pojos.HierarchicalPersistentObject#getAssocClass()
- */
- public Class getAssocClass() {
- return WeblogCategoryAssoc.class;
+ public String toString() {
+ StringBuffer str = new StringBuffer("{");
+
+ str.append(
+ "id="
+ + id
+ + " "
+ + "name="
+ + name
+ + " "
+ + "description="
+ + description
+ + " "
+ + "image="
+ + image);
+ str.append('}');
+
+ return (str.toString());
}
- /**
- * @see org.apache.roller.pojos.HierarchicalPersistentObject#getObjectPropertyName()
- *
- * @roller.wrapPojoMethod type="simple"
- */
- public String getObjectPropertyName() {
- return "category";
+ public boolean equals(Object pOther) {
+ if (pOther == null) return false;
+ if (pOther instanceof WeblogCategoryData) {
+ WeblogCategoryData lTest = (WeblogCategoryData) pOther;
+ boolean lEquals = true;
+ lEquals = PojoUtil.equals(lEquals, this.getId(), lTest.getId());
+ lEquals = PojoUtil.equals(lEquals, this.getName(), lTest.getName());
+ lEquals = PojoUtil.equals(lEquals, this.getDescription(), lTest.getDescription());
+ lEquals = PojoUtil.equals(lEquals, this.getImage(), lTest.getImage());
+ return lEquals;
+ } else {
+ return false;
+ }
}
- /**
- * @see org.apache.roller.pojos.HierarchicalPersistentObject#getAncestorPropertyName()
- *
- * @roller.wrapPojoMethod type="simple"
- */
- public String getAncestorPropertyName() {
- return "ancestorCategory";
+ public int hashCode() {
+ int result = 17;
+ result = 37 * result + ((this.id != null) ? this.id.hashCode() : 0);
+ result =
+ 37 * result
+ + ((this.website != null) ? this.website.hashCode() : 0);
+ result = 37 * result + ((this.name != null) ? this.name.hashCode() : 0);
+ result =
+ 37 * result
+ + ((this.description != null) ? this.description.hashCode() : 0);
+ result =
+ 37 * result + ((this.image != null) ? this.image.hashCode() : 0);
+ return result;
}
- //------------------------------------------------------- Simple properties
/**
* @roller.wrapPojoMethod type="simple"
@@ -131,6 +158,7 @@
this.id = id;
}
+
/**
* @roller.wrapPojoMethod type="simple"
* @ejb:persistent-field
@@ -144,6 +172,7 @@
this.name = name;
}
+
/**
* Description
*
@@ -159,6 +188,7 @@
this.description = description;
}
+
/**
* @roller.wrapPojoMethod type="simple"
* @ejb:persistent-field
@@ -172,6 +202,7 @@
this.image = image;
}
+
/**
* Get path in category hierarhcy.
*
@@ -187,8 +218,9 @@
}
return cachedPath;
}
+ /** TODO: fix formbean generation so this is not needed. */
+ public void setPath(String string) {}
- //------------------------------------------------------------ Associations
/**
* @roller.wrapPojoMethod type="pojo"
@@ -227,6 +259,7 @@
mNewParent = parent;
}
+
/**
* Query to get child categories of this category.
*
@@ -246,13 +279,6 @@
return weblogCategories;
}
- /**
- * @roller.wrapPojoMethod type="simple"
- */
- public boolean descendentOf(WeblogCategoryData ancestor)
- throws RollerException {
- return RollerFactory.getRoller().getWeblogManager().isDescendentOf(this, ancestor);
- }
/**
* Determine if category is in use. Returns true if any weblog entries
@@ -267,27 +293,9 @@
throw new RuntimeException(e);
}
}
-
/** TODO: fix form generation so this is not needed. */
public void setInUse(boolean dummy) {}
- //------------------------------------------------------------------------
-
- /**
- * @see org.apache.roller.pojos.HierarchicalPersistentObject#createAssoc(
- * org.apache.roller.pojos.HierarchicalPersistentObject,
- * org.apache.roller.pojos.HierarchicalPersistentObject, java.lang.String)
- */
- public Assoc createAssoc(
- HierarchicalPersistentObject object,
- HierarchicalPersistentObject associatedObject,
- String relation) throws RollerException {
- return new WeblogCategoryAssoc(null,
- (WeblogCategoryData)object,
- (WeblogCategoryData)associatedObject,
- relation);
- }
-
/**
* Retrieve all weblog entries in this category and, optionally, include
@@ -305,69 +313,68 @@
return wmgr.getWeblogEntries(this, subcats);
}
- //-------------------------------------------------------- Good citizenship
- public String toString() {
- StringBuffer str = new StringBuffer("{");
-
- str.append(
- "id="
- + id
- + " "
- + "name="
- + name
- + " "
- + "description="
- + description
- + " "
- + "image="
- + image);
- str.append('}');
-
- return (str.toString());
+ /**
+ * @roller.wrapPojoMethod type="simple"
+ */
+ public boolean descendentOf(WeblogCategoryData ancestor)
+ throws RollerException {
+ return RollerFactory.getRoller().getWeblogManager().isDescendentOf(this, ancestor);
}
- public boolean equals(Object pOther) {
- if (pOther == null) return false;
- if (pOther instanceof WeblogCategoryData) {
- WeblogCategoryData lTest = (WeblogCategoryData) pOther;
- boolean lEquals = true;
- lEquals = PojoUtil.equals(lEquals, this.getId(), lTest.getId());
- lEquals = PojoUtil.equals(lEquals, this.getName(), lTest.getName());
- lEquals = PojoUtil.equals(lEquals, this.getDescription(), lTest.getDescription());
- lEquals = PojoUtil.equals(lEquals, this.getImage(), lTest.getImage());
- return lEquals;
- } else {
- return false;
- }
+
+ /**
+ * @see org.apache.roller.pojos.HierarchicalPersistentObject#createAssoc(
+ * org.apache.roller.pojos.HierarchicalPersistentObject,
+ * org.apache.roller.pojos.HierarchicalPersistentObject, java.lang.String)
+ */
+ public Assoc createAssoc(
+ HierarchicalPersistentObject object,
+ HierarchicalPersistentObject associatedObject,
+ String relation) throws RollerException {
+ return new WeblogCategoryAssoc(null,
+ (WeblogCategoryData)object,
+ (WeblogCategoryData)associatedObject,
+ relation);
}
- public int hashCode() {
- int result = 17;
- result = 37 * result + ((this.id != null) ? this.id.hashCode() : 0);
- result =
- 37 * result
- + ((this.website != null) ? this.website.hashCode() : 0);
- result = 37 * result + ((this.name != null) ? this.name.hashCode() : 0);
- result =
- 37 * result
- + ((this.description != null) ? this.description.hashCode() : 0);
- result =
- 37 * result + ((this.image != null) ? this.image.hashCode() : 0);
- return result;
+
+ /**
+ * @see org.apache.roller.pojos.HierarchicalPersistentObject#getAssocClass()
+ */
+ public Class getAssocClass() {
+ return WeblogCategoryAssoc.class;
}
/** TODO: fix Struts form generation template so this is not needed. */
public void setAssocClassName(String dummy) {};
+
+ /**
+ * @see org.apache.roller.pojos.HierarchicalPersistentObject#getObjectPropertyName()
+ *
+ * @roller.wrapPojoMethod type="simple"
+ */
+ public String getObjectPropertyName() {
+ return "category";
+ }
+
/** TODO: fix Struts form generation template so this is not needed. */
public void setObjectPropertyName(String dummy) {};
+
+ /**
+ * @see org.apache.roller.pojos.HierarchicalPersistentObject#getAncestorPropertyName()
+ *
+ * @roller.wrapPojoMethod type="simple"
+ */
+ public String getAncestorPropertyName() {
+ return "ancestorCategory";
+ }
+
/** TODO: fix Struts form generation template so this is not needed. */
public void setAncestorPropertyName(String dummy) {};
- /** TODO: fix formbean generation so this is not needed. */
- public void setPath(String string) {}
/**
* @see org.apache.roller.pojos.HierarchicalPersistentObject#getParentAssoc()