roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From snoopd...@apache.org
Subject svn commit: r497459 [1/2] - in /incubator/roller/trunk: src/org/apache/roller/business/hibernate/ src/org/apache/roller/business/referrers/ src/org/apache/roller/pojos/ src/org/apache/roller/ui/authoring/struts/actions/ src/org/apache/roller/ui/authori...
Date Thu, 18 Jan 2007 15:35:42 GMT
Author: snoopdave
Date: Thu Jan 18 07:35:39 2007
New Revision: 497459

URL: http://svn.apache.org/viewvc?view=rev&rev=497459
Log:

* Completely eliminated PersistentObject, so POJOs no longer need to extend
a common base class and setId() and getId() methods are no longer mandated.

* Ensured all POJO equals() and hashcode() methods use "natural keys" as 
recommended in Hibernate in Action. Used Jakarta Commons EqualsBuilder and
HashBuilder to simplify implementations.

* De-kludged our Hibernate store() implemenation, it now uses saveOrUpdate().

* All unit tests pass, BUT had to comment out subfolder creation code. I'm 
still trying to figure out why test teardown fails when subfolders are created
in testFolderCRUD() but not in the other BookmarkTest tests. Removing a weblog
with folders and subfolders works fine through the UI too.

Removed:
    incubator/roller/trunk/src/org/apache/roller/pojos/PersistentObject.java
    incubator/roller/trunk/src/org/apache/roller/pojos/WebsiteDisplayData.java
Modified:
    incubator/roller/trunk/src/org/apache/roller/business/hibernate/HibernatePersistenceStrategy.java
    incubator/roller/trunk/src/org/apache/roller/business/hibernate/HibernateRefererManagerImpl.java
    incubator/roller/trunk/src/org/apache/roller/business/hibernate/HibernateUserManagerImpl.java
    incubator/roller/trunk/src/org/apache/roller/business/hibernate/HibernateWeblogManagerImpl.java
    incubator/roller/trunk/src/org/apache/roller/business/referrers/RefererManager.java
    incubator/roller/trunk/src/org/apache/roller/pojos/AutoPingData.java
    incubator/roller/trunk/src/org/apache/roller/pojos/BookmarkData.java
    incubator/roller/trunk/src/org/apache/roller/pojos/CommentData.java
    incubator/roller/trunk/src/org/apache/roller/pojos/EntryAttributeData.java
    incubator/roller/trunk/src/org/apache/roller/pojos/FolderData.java
    incubator/roller/trunk/src/org/apache/roller/pojos/HitCountData.java
    incubator/roller/trunk/src/org/apache/roller/pojos/ObjectAuditData.java
    incubator/roller/trunk/src/org/apache/roller/pojos/PermissionsData.java
    incubator/roller/trunk/src/org/apache/roller/pojos/PingCategoryRestrictionData.java
    incubator/roller/trunk/src/org/apache/roller/pojos/PingQueueEntryData.java
    incubator/roller/trunk/src/org/apache/roller/pojos/PingTargetData.java
    incubator/roller/trunk/src/org/apache/roller/pojos/RefererData.java
    incubator/roller/trunk/src/org/apache/roller/pojos/RoleData.java
    incubator/roller/trunk/src/org/apache/roller/pojos/RollerConfigData.java
    incubator/roller/trunk/src/org/apache/roller/pojos/RollerPropertyData.java
    incubator/roller/trunk/src/org/apache/roller/pojos/StatCount.java
    incubator/roller/trunk/src/org/apache/roller/pojos/StaticTemplate.java
    incubator/roller/trunk/src/org/apache/roller/pojos/TaskLockData.java
    incubator/roller/trunk/src/org/apache/roller/pojos/Theme.java
    incubator/roller/trunk/src/org/apache/roller/pojos/ThemeTemplate.java
    incubator/roller/trunk/src/org/apache/roller/pojos/UserData.java
    incubator/roller/trunk/src/org/apache/roller/pojos/WeblogCategoryData.java
    incubator/roller/trunk/src/org/apache/roller/pojos/WeblogEntryData.java
    incubator/roller/trunk/src/org/apache/roller/pojos/WeblogEntryTagAggregateData.java
    incubator/roller/trunk/src/org/apache/roller/pojos/WeblogEntryTagData.java
    incubator/roller/trunk/src/org/apache/roller/pojos/WeblogTemplate.java
    incubator/roller/trunk/src/org/apache/roller/pojos/WebsiteData.java
    incubator/roller/trunk/src/org/apache/roller/pojos/package.html
    incubator/roller/trunk/src/org/apache/roller/ui/authoring/struts/actions/WeblogEntryFormAction.java
    incubator/roller/trunk/src/org/apache/roller/ui/authoring/struts/formbeans/WeblogEntryFormEx.java
    incubator/roller/trunk/tests/org/apache/roller/business/BookmarkTest.java
    incubator/roller/trunk/tests/org/apache/roller/business/CommentTest.java
    incubator/roller/trunk/tests/org/apache/roller/business/RefererTest.java
    incubator/roller/trunk/tests/org/apache/roller/business/WeblogCategoryTest.java
    incubator/roller/trunk/tests/org/apache/roller/business/WeblogEntryTest.java

Modified: incubator/roller/trunk/src/org/apache/roller/business/hibernate/HibernatePersistenceStrategy.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/business/hibernate/HibernatePersistenceStrategy.java?view=diff&rev=497459&r1=497458&r2=497459
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/business/hibernate/HibernatePersistenceStrategy.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/business/hibernate/HibernatePersistenceStrategy.java Thu Jan 18 07:35:39 2007
@@ -30,7 +30,6 @@
 import org.hibernate.Transaction;
 import org.hibernate.cfg.Configuration;
 import org.apache.roller.RollerException;
-import org.apache.roller.pojos.PersistentObject;
 import org.jdom.Attribute;
 import org.jdom.Document;
 import org.jdom.Element;
@@ -280,20 +279,20 @@
     /**
      * Retrieve object.  We return null if the object is not found.
      */
-    public PersistentObject load(String id, Class clazz) throws RollerException {
+    public Object load(String id, Class clazz) throws RollerException {
         
         if(id == null || clazz == null) {
             throw new RollerException("Cannot load objects when value is null");
         }
         
-        return (PersistentObject) getSession().get(clazz, id);
+        return (Object) getSession().get(clazz, id);
     }
     
     
     /**
      * Store object.
      */
-    public void store(PersistentObject obj) throws HibernateException {
+    public void store(Object obj) throws HibernateException {
         
         if(obj == null) {
             throw new HibernateException("Cannot save null object");
@@ -301,77 +300,20 @@
         
         Session session = getSession();
         
-        // TODO BACKEND: this is wacky, we should double check logic here
-        
-        // TODO BACKEND: better to use session.saveOrUpdate() here, if possible
-        if ( obj.getId() == null || obj.getId().trim().equals("") ) {
-            // Object has never been written to database, so save it.
-            // This makes obj into a persistent instance.
-            session.save(obj);
-        }
-        
-        /*
-         * technically we shouldn't have any reason to support the saving
-         * of detached objects, so at some point we should re-evaluate this.
-         *
-         * objects should be re-attached before being saved again. it would
-         * be more appropriate to reject these kinds of saves because they are
-         * not really safe.
-         *
-         * NOTE: this may be coming from the way we use formbeans on the UI.
-         *   we very commonly repopulate all data in a pojo (including id) from
-         *   form data rather than properly loading the object from a Session
-         *   then modifying its properties.
-         */
-        if ( !session.contains(obj) ) {
-            
-            log.debug("storing detached object: "+obj.toString());
-            
-            // Object has been written to database, but instance passed in
-            // is not a persistent instance, so must be loaded into session.
-            PersistentObject vo =
-                    (PersistentObject)session.load(obj.getClass(),obj.getId());
-            vo.setData(obj);
-            obj = vo;
-        }
-        
-    }
-    
-    
-    /**
-     * Remove object.
-     *
-     * TODO BACKEND: force the use of remove(Object) moving forward.
-     */
-    public void remove(String id, Class clazz) throws HibernateException {
-        
-        if(id == null || clazz == null) {
-            throw new HibernateException("Cannot remove object when values are null");
-        }
-        
-        Session session = getSession();
-        
-        PersistentObject obj = (PersistentObject) session.load(clazz,id);
-        session.delete(obj);
+        session.saveOrUpdate(obj);
     }
     
     
     /**
      * Remove object.
      */
-    public void remove(PersistentObject obj) throws HibernateException {
+    public void remove(Object obj) throws HibernateException {
         
         if(obj == null) {
             throw new HibernateException("Cannot remove null object");
         }
         
-        // TODO BACKEND: can hibernate take care of this check for us?
-        //               what happens if object does not use id?
-        // can't remove transient objects
-        if (obj.getId() != null) {
-            
-            getSession().delete(obj);
-        }
+        getSession().delete(obj);
     }
     
 }

Modified: incubator/roller/trunk/src/org/apache/roller/business/hibernate/HibernateRefererManagerImpl.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/business/hibernate/HibernateRefererManagerImpl.java?view=diff&rev=497459&r1=497458&r2=497459
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/business/hibernate/HibernateRefererManagerImpl.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/business/hibernate/HibernateRefererManagerImpl.java Thu Jan 18 07:35:39 2007
@@ -41,7 +41,6 @@
 import org.apache.roller.pojos.RefererData;
 import org.apache.roller.pojos.WeblogEntryData;
 import org.apache.roller.pojos.WebsiteData;
-import org.apache.roller.pojos.WebsiteDisplayData;
 import org.hibernate.dialect.OracleDialect;
 import org.hibernate.dialect.SQLServerDialect;
 import org.hibernate.engine.SessionFactoryImplementor;
@@ -308,53 +307,6 @@
         }
     }
     
-    /**
-     * @deprecated Replaced by getHotWeblogs().
-     */
-    public List getDaysPopularWebsites(int offset, int length) 
-        throws RollerException {
-        // TODO: ATLAS getDaysPopularWebsites DONE TESTED
-        String msg = "Getting popular websites";
-        ArrayList result = new ArrayList();
-        try {      
-            Session session = 
-                ((HibernatePersistenceStrategy)strategy).getSession();            
-            Query query = session.createQuery(
-                "select sum(r.dayHits) as s, w.id, w.name, w.handle  "
-               +"from WebsiteData w, RefererData r "
-               +"where r.website=w and w.enabled=true and w.active=true "
-               +"group by w.name, w.handle, w.id order by col_0_0_ desc"); 
-            
-              // +"group by w.name, w.handle, w.id order by s desc");
-              // The above would be *much* better but "HQL parser does not   
-              // resolve alias in ORDER BY clause" (See Hibernate issue HHH-892)
-            
-            if (offset != 0) {
-                query.setFirstResult(offset);
-            }
-            if (length != -1) {
-                query.setMaxResults(length);
-            }
-            Iterator rawResults = query.list().iterator();
-            for (Iterator it = query.list().iterator(); it.hasNext();) {
-                Object[] row = (Object[])it.next();
-                Integer hits = (Integer)row[0];
-                String websiteId = (String)row[1];
-                String websiteName = (String)row[2];
-                String websiteHandle = (String)row[3];
-                result.add(new WebsiteDisplayData(
-                    websiteId,
-                    websiteName,
-                    websiteHandle,
-                    hits));              
-            }
-            return result;
-            
-        } catch (Throwable pe) {
-            log.error(msg, pe);
-            throw new RollerException(msg, pe);
-        }
-    }
         
     /**
      * Use raw SQL because Hibernate can't handle the query.

Modified: incubator/roller/trunk/src/org/apache/roller/business/hibernate/HibernateUserManagerImpl.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/business/hibernate/HibernateUserManagerImpl.java?view=diff&rev=497459&r1=497458&r2=497459
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/business/hibernate/HibernateUserManagerImpl.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/business/hibernate/HibernateUserManagerImpl.java Thu Jan 18 07:35:39 2007
@@ -195,14 +195,6 @@
         FolderData rootFolder = bmgr.getRootFolder(website);
         if (null != rootFolder) {
             this.strategy.remove(rootFolder);
-            
-            // Still cannot get all Bookmarks cleared!
-//            Iterator allFolders = bmgr.getAllFolders(website).iterator();
-//            while (allFolders.hasNext()) {
-//                FolderData aFolder = (FolderData)allFolders.next();
-//                bmgr.removeFolderContents(aFolder);
-//                this.strategy.remove(aFolder);
-//            }
         }
         
         // remove categories

Modified: incubator/roller/trunk/src/org/apache/roller/business/hibernate/HibernateWeblogManagerImpl.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/business/hibernate/HibernateWeblogManagerImpl.java?view=diff&rev=497459&r1=497458&r2=497459
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/business/hibernate/HibernateWeblogManagerImpl.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/business/hibernate/HibernateWeblogManagerImpl.java Thu Jan 18 07:35:39 2007
@@ -251,8 +251,19 @@
         for(Iterator it = entry.getRemovedTags().iterator(); it.hasNext();) {
             String name = (String) it.next();
             updateTagCount(name, entry.getWebsite(), -1);
-        }  
+        } 
         
+        // if the entry was published to future, set status as SCHEDULED
+        // we only consider an entry future published if it is scheduled
+        // more than 1 minute into the future
+        if ("PUBLISHED".equals(entry.getStatus()) && 
+                entry.getPubTime().after(new Date(System.currentTimeMillis() + 60000))) {
+            entry.setStatus(WeblogEntryData.SCHEDULED);
+        }
+        
+        // Store value object (creates new or updates existing)
+        entry.setUpdateTime(new Timestamp(new Date().getTime()));
+
         this.strategy.store(entry);        
         
         // update weblog last modified date.  date updated by saveWebsite()

Modified: incubator/roller/trunk/src/org/apache/roller/business/referrers/RefererManager.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/business/referrers/RefererManager.java?view=diff&rev=497459&r1=497458&r2=497459
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/business/referrers/RefererManager.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/business/referrers/RefererManager.java Thu Jan 18 07:35:39 2007
@@ -76,18 +76,7 @@
      */
     public List getReferersToDate(WebsiteData website, String date) 
         throws RollerException;    
-    
-    /**
-     * Get most popular websites based on referer day hits.
-     * @param offset    Offset into results (for paging)
-     * @param len       Maximum number of results to return (for paging)
-     * @return List of WebsiteDisplayData objects.
-     */
-    public List getDaysPopularWebsites(
-            int offset, 
-            int length) 
-        throws RollerException;   
-    
+        
     /**
      * Returns hot weblogs as StatCount objects, in descending order by today's hits.
      * @param sinceDays Restrict to last X days (or -1 for all)

Modified: incubator/roller/trunk/src/org/apache/roller/pojos/AutoPingData.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/pojos/AutoPingData.java?view=diff&rev=497459&r1=497458&r2=497459
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/pojos/AutoPingData.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/pojos/AutoPingData.java Thu Jan 18 07:35:39 2007
@@ -19,6 +19,9 @@
 package org.apache.roller.pojos;
 
 import java.io.Serializable;
+import org.apache.commons.lang.builder.EqualsBuilder;
+import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.apache.commons.lang.builder.ToStringBuilder;
 
 /**
  * Automatic ping configuration.  An instance of this class relates a website and ping target; it indicates that the specified
@@ -31,7 +34,7 @@
  * @hibernate.class lazy="true" table="autoping"
  * @hibernate.cache usage="read-write"
  */
-public class AutoPingData extends PersistentObject implements Serializable {
+public class AutoPingData implements Serializable {
     private String id = null;
     private PingTargetData pingTarget = null;
     private WebsiteData website = null;
@@ -58,11 +61,9 @@
     }
 
     /**
-     * Setter needed by RollerImpl.storePersistentObject()
+     * Set bean properties based on other bean.
      */
-    public void setData(PersistentObject vo) {
-        AutoPingData other = (AutoPingData) vo;
-
+    public void setData(AutoPingData other) {
         id = other.getId();
         website = other.getWebsite();
         pingTarget = other.getPingTarget();
@@ -86,6 +87,8 @@
      * @ejb:persistent-field
      */
     public void setId(String id) {
+        // Form bean workaround: empty string is never a valid id
+        if (id != null && id.trim().length() == 0) return; 
         this.id = id;
     }
 
@@ -133,41 +136,24 @@
         this.pingTarget = pingtarget;
     }
 
-    /**
-     * @see Object#equals(Object)
-     */
-    public boolean equals(Object o) {
-        if (this == o) return true;
-        if (!(o instanceof AutoPingData)) return false;
-
-        final AutoPingData autoPingData = (AutoPingData) o;
+    //------------------------------------------------------- Good citizenship
 
-        if (id != null ? !id.equals(autoPingData.getId()) : autoPingData.getId() != null) return false;
-        if (pingTarget != null ? !pingTarget.equals(autoPingData.getPingTarget()) : autoPingData.getPingTarget() != null)
-        {
-            return false;
-        }
-        if (getWebsite() != null ? !getWebsite().equals(autoPingData.getWebsite()) : autoPingData.getWebsite() != null) {
-            return false;
-        }
-
-        return true;
-    }
-
-    /**
-     * @see Object#hashCode()
-     */
-    public int hashCode() {
-        return (id != null ? id.hashCode() : 0);
-    }
-
-    /**
-     * Generate a string form of the object appropriate for logging or debugging.
-     *
-     * @return a string form of the object appropriate for logging or debugging.
-     * @see Object#toString()
-     */
     public String toString() {
-        return "AutoPingData{" + "id='" + id + "'" + ", pingTarget=" + pingTarget + "}";
+        return ToStringBuilder.reflectionToString(this);
+    }
+    
+    public boolean equals(Object other) {
+        if (other == this) return true;
+        if (other instanceof AutoPingData != true) return false;
+        AutoPingData o = (AutoPingData)other;
+        return new EqualsBuilder()
+            .append(getId(), o.getId())
+            .append(getPingTarget(), o.getPingTarget()) 
+            .append(getWebsite(), o.getWebsite()) 
+            .isEquals();
+    }
+    
+    public int hashCode() { 
+        return new HashCodeBuilder().append(getId()).toHashCode();
     }
 }

Modified: incubator/roller/trunk/src/org/apache/roller/pojos/BookmarkData.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/pojos/BookmarkData.java?view=diff&rev=497459&r1=497458&r2=497459
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/pojos/BookmarkData.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/pojos/BookmarkData.java Thu Jan 18 07:35:39 2007
@@ -18,12 +18,12 @@
 
 package org.apache.roller.pojos;
 
-import org.apache.roller.RollerException;
+import org.apache.commons.lang.builder.ToStringBuilder;
 import org.apache.roller.business.BookmarkManager;
-import org.apache.roller.business.Roller;
-import org.apache.roller.business.RollerFactory;
 
 import java.io.Serializable;
+import org.apache.commons.lang.builder.EqualsBuilder;
+import org.apache.commons.lang.builder.HashCodeBuilder;
 
 
 /**
@@ -39,7 +39,7 @@
  * @hibernate.class lazy="true" table="bookmark"
  * @hibernate.cache usage="read-write"
  */
-public class BookmarkData extends PersistentObject
+public class BookmarkData
     implements Serializable, Comparable
 {
     static final long serialVersionUID = 2315131256728236003L;
@@ -108,6 +108,8 @@
     /** @ejb:persistent-field */
     public void setId(String id)
     {
+        // Form bean workaround: empty string is never a valid id
+        if (id != null && id.trim().length() == 0) return; 
         this.id = id;
     }
 
@@ -278,148 +280,32 @@
 
     //------------------------------------------------------- Good citizenship
 
-    public String toString()
-    {
-        StringBuffer str = new StringBuffer("{");
-
-        str.append("id=" + id + " " + "name=" + name + " " + "description=" + 
-                   description + " " + "url=" + url + " " + "weight=" + 
-                   weight + " " + "priority=" + priority + " " + "folderId=" + 
-                   "image=" + image + " " + "feedUrl=" + 
-                   feedUrl);
-        str.append('}');
-
-        return (str.toString());
-    }
-
-    public boolean equals(Object pOther)
-    {
-        if (pOther instanceof BookmarkData)
-        {
-            BookmarkData lTest = (BookmarkData) pOther;
-            boolean lEquals = true;
-
-            if (this.id == null)
-            {
-                lEquals = lEquals && (lTest.getId() == null);
-            }
-            else
-            {
-                lEquals = lEquals && this.id.equals(lTest.getId());
-            }
-
-            if (this.name == null)
-            {
-                lEquals = lEquals && (lTest.getName() == null);
-            }
-            else
-            {
-                lEquals = lEquals && this.name.equals(lTest.getName());
-            }
-
-            if (this.description == null)
-            {
-                lEquals = lEquals && (lTest.getDescription() == null);
-            }
-            else
-            {
-                lEquals = lEquals && 
-                          this.description.equals(lTest.getDescription());
-            }
-
-            if (this.url == null)
-            {
-                lEquals = lEquals && (lTest.getUrl() == null);
-            }
-            else
-            {
-                lEquals = lEquals && this.url.equals(lTest.getUrl());
-            }
-
-            if (this.weight == null)
-            {
-                lEquals = lEquals && (lTest.getWeight() == null);
-            }
-            else
-            {
-                lEquals = lEquals && this.weight.equals(lTest.getWeight());
-            }
-
-            if (this.priority == null)
-            {
-                lEquals = lEquals && (lTest.getPriority() == null);
-            }
-            else
-            {
-                lEquals = lEquals && this.priority.equals(lTest.getPriority());
-            }
-
-//            if (this.mFolder == null)
-//            {
-//                lEquals = lEquals && (lTest.mFolder == null);
-//            }
-//            else
-//            {
-//                lEquals = lEquals && this.mFolder.equals(lTest.mFolder);
-//            }
-//
-            if (this.image == null)
-            {
-                lEquals = lEquals && (lTest.getImage() == null);
-            }
-            else
-            {
-                lEquals = lEquals && this.image.equals(lTest.getImage());
-            }
-
-            if (this.feedUrl == null)
-            {
-                lEquals = lEquals && (lTest.getFeedUrl() == null);
-            }
-            else
-            {
-                lEquals = lEquals && this.feedUrl.equals(lTest.getFeedUrl());
-            }
-
-            return lEquals;
-        }
-        else
-        {
-            return false;
-        }
-    }
-
-    public int hashCode()
-    {
-        int result = 17;
-        result = (37 * result) + 
-                 ((this.id != null) ? this.id.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.url != null) ? this.url.hashCode() : 0);
-        result = (37 * result) + 
-                 ((this.weight != null) ? this.weight.hashCode() : 0);
-        result = (37 * result) + 
-                 ((this.priority != null) ? this.priority.hashCode() : 0);
-        result = (37 * result) + 
-                 ((this.folder != null) ? this.folder.hashCode() : 0);
-        result = (37 * result) + 
-                 ((this.image != null) ? this.image.hashCode() : 0);
-        result = (37 * result) + 
-                 ((this.feedUrl != null) ? this.feedUrl.hashCode() : 0);
-
-        return result;
+    public String toString() {
+        return ToStringBuilder.reflectionToString(this);
     }
 
+    public boolean equals(Object other) {
+        if (other == this) return true;
+        if (other instanceof BookmarkData != true) return false;
+        BookmarkData o = (BookmarkData)other;
+        return new EqualsBuilder()
+            .append(getName(), o.getName()) 
+            .append(getFolder(), o.getFolder()) 
+            .isEquals();
+    }
+    
+    public int hashCode() { 
+        return new HashCodeBuilder()
+            .append(getName())
+            .append(getFolder())
+            .toHashCode();
+    }
+    
     /**
-     * Setter is needed in RollerImpl.storePersistentObject()
+     * Set bean properties based on other bean.
      */
-    public void setData(org.apache.roller.pojos.PersistentObject otherData)
+    public void setData(BookmarkData other)
     {
-        BookmarkData other = (BookmarkData)otherData;
         this.id = other.getId();
         this.name = other.getName();
         this.description = other.getDescription();

Modified: incubator/roller/trunk/src/org/apache/roller/pojos/CommentData.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/pojos/CommentData.java?view=diff&rev=497459&r1=497458&r2=497459
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/pojos/CommentData.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/pojos/CommentData.java Thu Jan 18 07:35:39 2007
@@ -20,7 +20,9 @@
 
 import java.io.Serializable;
 import java.sql.Timestamp;
-import org.apache.roller.util.PojoUtil;
+import org.apache.commons.lang.builder.EqualsBuilder;
+import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.apache.commons.lang.builder.ToStringBuilder;
 
 
 /**
@@ -32,7 +34,7 @@
  * @hibernate.class lazy="true" table="roller_comment"
  * @hibernate.cache usage="read-write"
  */
-public class CommentData extends PersistentObject implements Serializable {
+public class CommentData implements Serializable {
     
     public static final long serialVersionUID = -6668122596726478462L;
     
@@ -93,6 +95,8 @@
      * @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; 
         this.id = id;
     }
     
@@ -347,69 +351,35 @@
     /** No-op to please XDoclet */
     public void setTimestamp(String timeStamp) {}
     
+    //------------------------------------------------------- Good citizenship
+
     public String toString() {
-        
-        StringBuffer str = new StringBuffer("{");
-        str.append("id=" + id + ", " +
-                "name=" + name + ", " +
-                "email=" + email + ", " +
-                "url=" + url + ", " +
-                "postTime=" + postTime + ", " +
-                "status=" + status);
-        str.append("}");
-        
-        return str.toString();
+        return ToStringBuilder.reflectionToString(this);
     }
-    
-    /**
-     * TODO: figure out business key.  entry, status, posttime, name?
-     */
-    public boolean equals(Object pOther) {
-        if (pOther instanceof CommentData) {
-            CommentData lTest = (CommentData) pOther;
-            boolean lEquals = true;
-            
-            lEquals = PojoUtil.equals(lEquals, this.id, lTest.getId());
-            lEquals = PojoUtil.equals(lEquals, this.weblogEntry, lTest.getWeblogEntry());
-            lEquals = PojoUtil.equals(lEquals, this.name, lTest.getName());
-            lEquals = PojoUtil.equals(lEquals, this.email, lTest.getEmail());
-            lEquals = PojoUtil.equals(lEquals, this.url, lTest.getUrl());
-            lEquals = PojoUtil.equals(lEquals, this.content, lTest.getContent());
-            lEquals = PojoUtil.equals(lEquals, this.postTime, lTest.getPostTime());
-            lEquals = PojoUtil.equals(lEquals, this.status, lTest.getStatus());
-            lEquals = PojoUtil.equals(lEquals, this.notify, lTest.getNotify());
-            lEquals = PojoUtil.equals(lEquals, this.getReferrer(), lTest.getApproved());
-            lEquals = PojoUtil.equals(lEquals, this.getUserAgent(), lTest.getUserAgent());
-            return lEquals;
-        } else {
-            return false;
-        }
+
+    public boolean equals(Object other) {
+        if (other == this) return true;
+        if (other instanceof CommentData != true) return false;
+        CommentData o = (CommentData)other;
+        return new EqualsBuilder()
+            .append(getName(), o.getName()) 
+            .append(getPostTime(), o.getPostTime()) 
+            .append(getWeblogEntry(), o.getWeblogEntry()) 
+            .isEquals();
     }
     
-    /**
-     * TODO: figure out business key.  entry, status, posttime, name?
-     */
-    public int hashCode() {
-        int result = 17;
-        result = PojoUtil.addHashCode(result, this.id);
-        result = PojoUtil.addHashCode(result, this.weblogEntry);
-        result = PojoUtil.addHashCode(result, this.name);
-        result = PojoUtil.addHashCode(result, this.email);
-        result = PojoUtil.addHashCode(result, this.url);
-        result = PojoUtil.addHashCode(result, this.content);
-        result = PojoUtil.addHashCode(result, this.postTime);
-        result = PojoUtil.addHashCode(result, this.status);
-        result = PojoUtil.addHashCode(result, this.notify);
-        result = PojoUtil.addHashCode(result, this.getReferrer());
-        result = PojoUtil.addHashCode(result, this.getUserAgent());
-        return result;
+    public int hashCode() { 
+        return new HashCodeBuilder()
+            .append(getName())
+            .append(getPostTime())
+            .append(getWeblogEntry())
+            .toHashCode();
     }
     
     /**
-     * Setter is needed in RollerImpl.storePersistentObject()
+     * Set bean properties based on other bean.
      */
-    public void setData(org.apache.roller.pojos.PersistentObject otherData) {
-        CommentData otherComment = (CommentData) otherData;
+    public void setData(CommentData otherComment) {
         
         this.id = otherComment.getId();
         this.weblogEntry = otherComment.getWeblogEntry();

Modified: incubator/roller/trunk/src/org/apache/roller/pojos/EntryAttributeData.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/pojos/EntryAttributeData.java?view=diff&rev=497459&r1=497458&r2=497459
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/pojos/EntryAttributeData.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/pojos/EntryAttributeData.java Thu Jan 18 07:35:39 2007
@@ -16,13 +16,17 @@
 * directory of this distribution.
 */
 package org.apache.roller.pojos;
+
+import org.apache.commons.lang.builder.EqualsBuilder;
+import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.apache.commons.lang.builder.ToStringBuilder;
 /**
  * @author David M Johnson
  * @ejb:bean name="EntryAttribute"
  * @hibernate.class lazy="true" table="entryattribute"
  * @hibernate.cache usage="read-write"
  */
-public class EntryAttributeData extends PersistentObject implements java.lang.Comparable
+public class EntryAttributeData implements java.lang.Comparable
 {
     private String id;
     private WeblogEntryData entry;
@@ -63,18 +67,21 @@
     /** @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; 
+
         this.id = id;
     }
 
     /**
-     * Setter is needed in RollerImpl.storePersistentObject()
+     * Set bean properties based on other bean.
      */
-    public void setData(org.apache.roller.pojos.PersistentObject otherData)
+    public void setData(EntryAttributeData otherData)
     {
         this.id = otherData.getId();
-        this.entry = ((EntryAttributeData) otherData).getEntry();
-        this.name = ((EntryAttributeData) otherData).getName();
-        this.value = ((EntryAttributeData) otherData).getValue();
+        this.entry = otherData.getEntry();
+        this.name = otherData.getName();
+        this.value = otherData.getValue();
     }
 
     /** 
@@ -125,5 +132,28 @@
     public int compareTo(Object o) {
         EntryAttributeData att = (EntryAttributeData)o;
         return getName().compareTo(att.getName());
+    }
+    
+    //------------------------------------------------------- Good citizenship
+
+    public String toString() {
+        return ToStringBuilder.reflectionToString(this);
+    }
+    
+    public boolean equals(Object other) {
+        if (other == this) return true;
+        if (other instanceof EntryAttributeData != true) return false;
+        EntryAttributeData o = (EntryAttributeData)other;
+        return new EqualsBuilder()
+            .append(getName(), o.getName()) 
+            .append(getEntry(), o.getEntry()) 
+            .isEquals();
+    }
+    
+    public int hashCode() { 
+        return new HashCodeBuilder()
+            .append(getName())
+            .append(getEntry())
+            .toHashCode();
     }
 }

Modified: incubator/roller/trunk/src/org/apache/roller/pojos/FolderData.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/pojos/FolderData.java?view=diff&rev=497459&r1=497458&r2=497459
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/pojos/FolderData.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/pojos/FolderData.java Thu Jan 18 07:35:39 2007
@@ -19,11 +19,12 @@
 package org.apache.roller.pojos;
 
 import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Iterator;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
-import java.util.TreeSet;
+import org.apache.commons.lang.builder.EqualsBuilder;
+import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.apache.commons.lang.builder.ToStringBuilder;
 
 import org.apache.roller.RollerException;
 import org.apache.roller.business.BookmarkManager;
@@ -43,7 +44,7 @@
  * @hibernate.class lazy="true" table="folder"
  * @hibernate.cache usage="read-write"
  */
-public class FolderData extends PersistentObject 
+public class FolderData 
         implements Serializable, Comparable {
     
     public static final long serialVersionUID = -6272468884763861944L;
@@ -87,8 +88,7 @@
     }
     
     
-    public void setData(PersistentObject other) {
-        FolderData otherData = (FolderData) other;
+    public void setData(FolderData otherData) {
         
         this.id = otherData.getId();
         this.name = otherData.getName();
@@ -100,46 +100,39 @@
         this.setBookmarks(otherData.getBookmarks());
     }
     
-    
-    public String toString() {
-        
-        StringBuffer str = new StringBuffer("{");
-        str.append("id=").append(id);
-        str.append(",");
-        str.append("path=").append(path);
-        str.append(",");
-        str.append("desc=").append(description);
-        str.append("}");
         
-        return str.toString();
+    //------------------------------------------------------- Good citizenship
+
+    public String toString() {
+        return ToStringBuilder.reflectionToString(this);
     }
     
-    
     public boolean equals(Object other) {
         
         if (other == null) return false;
         
         if (other instanceof FolderData) {
-            
-            // NOTE: currently we are implementing equals only using the path
-            //   of the folder.  technically the business key should be for
-            //   both the weblog & path, but we don't expect to be comparing
-            //   folders from 2 different weblogs so this should be fine
-            FolderData that = (FolderData) other;
-            return this.path.equals(that.getPath());
+            FolderData o = (FolderData) other;
+            return new EqualsBuilder()
+                .append(getPath(), o.getPath()) 
+                .append(getWebsite(), o.getWebsite()) 
+                .isEquals();
         }
         
         return false;
-    }
+    }    
     
     
+    /**
+     * @see java.lang.Comparable#compareTo(java.lang.Object)
+     */
     public int hashCode() {
-        // NOTE: just like equals() it's possibly better if this is the combo
-        //   of both the path hashCode and the weblog hashCode
-        return this.path.hashCode();
+        return new HashCodeBuilder()
+            .append(getPath())
+            .append(getWebsite())
+            .toHashCode();
     }
     
-    
     /**
      * @see java.lang.Comparable#compareTo(java.lang.Object)
      */
@@ -148,7 +141,6 @@
         return getName().compareTo(other.getName());
     }
     
-    
     /**
      * Database surrogate key.
      *
@@ -162,6 +154,8 @@
     }
     
     public void setId(String id) {
+        // Form bean workaround: empty string is never a valid id
+        if (id != null && id.trim().length() == 0) return; 
         this.id = id;
     }
     
@@ -256,7 +250,7 @@
      *
      * @roller.wrapPojoMethod type="pojo-collection" class="org.apache.roller.pojos.FolderData"
      *
-     * @hibernate.set lazy="true" inverse="true" cascade="delete"
+     * @hibernate.set lazy="true" inverse="true" cascade="delete" 
      * @hibernate.collection-key column="parentid"
      * @hibernate.collection-one-to-many class="org.apache.roller.pojos.FolderData"
      */

Modified: incubator/roller/trunk/src/org/apache/roller/pojos/HitCountData.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/pojos/HitCountData.java?view=diff&rev=497459&r1=497458&r2=497459
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/pojos/HitCountData.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/pojos/HitCountData.java Thu Jan 18 07:35:39 2007
@@ -19,6 +19,8 @@
 package org.apache.roller.pojos;
 
 import java.io.Serializable;
+import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.apache.commons.lang.builder.ToStringBuilder;
 
 
 /**
@@ -28,7 +30,7 @@
  * @hibernate.class lazy="true" table="roller_hitcounts"
  * @hibernate.cache usage="read-write"
  */
-public class HitCountData extends PersistentObject implements Serializable {
+public class HitCountData implements Serializable {
     
     private String id = null;
     private WebsiteData weblog = null;
@@ -38,13 +40,21 @@
     public HitCountData() {}
 
     
-    public void setData(PersistentObject otherData) {
-        HitCountData other = (HitCountData) otherData;
+    public void setData(HitCountData other) {
         this.id = other.getId();
         this.weblog = other.getWeblog();
         this.dailyHits = other.getDailyHits();
     }
     
+    
+    //------------------------------------------------------- Good citizenship
+
+    public String toString() {
+        return ToStringBuilder.reflectionToString(this);
+    }
+
+    //------------------------------------------------------------------------
+    
     public boolean equals(Object other) {
         
         if(this == other) return true;
@@ -54,10 +64,11 @@
         final HitCountData that = (HitCountData) other;
         return this.getWeblog().equals(that.getWeblog());
     }
-    
-    public int hashCode() {
-        // our natrual key, or business key, is our weblog
-        return this.getWeblog().hashCode();
+       
+    public int hashCode() { 
+        return new HashCodeBuilder()
+            .append(getWeblog())
+            .toHashCode();
     }
     
     
@@ -70,6 +81,8 @@
     }
 
     public void setId(String id) {
+        // Form bean workaround: empty string is never a valid id
+        if (id != null && id.trim().length() == 0) return; 
         this.id = id;
     }
     

Modified: incubator/roller/trunk/src/org/apache/roller/pojos/ObjectAuditData.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/pojos/ObjectAuditData.java?view=diff&rev=497459&r1=497458&r2=497459
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/pojos/ObjectAuditData.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/pojos/ObjectAuditData.java Thu Jan 18 07:35:39 2007
@@ -17,6 +17,9 @@
 package org.apache.roller.pojos;
 
 import java.util.Date;
+import org.apache.commons.lang.builder.EqualsBuilder;
+import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.apache.commons.lang.builder.ToStringBuilder;
 
 /**
  * Records change that a user has made to an object.
@@ -26,7 +29,7 @@
  *
  * @author Dave Johnson
  */
-public class ObjectAuditData extends PersistentObject
+public class ObjectAuditData
 {
     private String id;          // primary key
     private String userId;      // user that made change
@@ -35,10 +38,6 @@
     private String comment;     // description of change
     private Date changeTime;    // time that change was made
     
-    public void setData(PersistentObject vo)
-    {
-    }
-
     /**
      * @ejb:persistent-field
      * @hibernate.id column="id"
@@ -51,6 +50,8 @@
     /** @ejb:persistent-field */
     public void setId(String id)
     {
+        // Form bean workaround: empty string is never a valid id
+        if (id != null && id.trim().length() == 0) return; 
         this.id = id;
     }
     /**
@@ -117,5 +118,26 @@
     public void setUserId(String userId)
     {
         this.userId = userId;
+    }
+    
+    //------------------------------------------------------- Good citizenship
+
+    public String toString() {
+        return ToStringBuilder.reflectionToString(this);
+    }
+
+    public boolean equals(Object other) {
+        if (other == this) return true;
+        if (other instanceof ObjectAuditData != true) return false;
+        ObjectAuditData o = (ObjectAuditData)other;
+        return new EqualsBuilder()
+            .append(getId(), o.getId()) 
+            .isEquals();
+    }
+    
+    public int hashCode() { 
+        return new HashCodeBuilder()
+            .append(getId())
+            .toHashCode();
     }
 }

Modified: incubator/roller/trunk/src/org/apache/roller/pojos/PermissionsData.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/pojos/PermissionsData.java?view=diff&rev=497459&r1=497458&r2=497459
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/pojos/PermissionsData.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/pojos/PermissionsData.java Thu Jan 18 07:35:39 2007
@@ -16,6 +16,10 @@
 
 package org.apache.roller.pojos; 
 
+import org.apache.commons.lang.builder.EqualsBuilder;
+import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.apache.commons.lang.builder.ToStringBuilder;
+
 /**
  * Represents a user's permissions within a website.
  *
@@ -26,7 +30,7 @@
  *
  * @author Dave Johnson
  */
-public class PermissionsData extends PersistentObject
+public class PermissionsData
 {
     private String      id = null;
     private WebsiteData website = null;
@@ -61,6 +65,8 @@
     /** @ejb:persistent-field */
     public void setId(String id) 
     {
+        // Form bean workaround: empty string is never a valid id
+        if (id != null && id.trim().length() == 0) return; 
         this.id = id;
     }
     /** 
@@ -114,11 +120,28 @@
     {
         this.pending = pending;
     }
-    /**
-     * Set data from other object (no-op).
-     */
-    public void setData(PersistentObject vo)
-    {
-        // no-op
+    
+    //------------------------------------------------------- Good citizenship
+
+    public String toString() {
+        return ToStringBuilder.reflectionToString(this);
     }
+    
+    public boolean equals(Object other) {
+        if (other == this) return true;
+        if (other instanceof PermissionsData != true) return false;
+        PermissionsData o = (PermissionsData)other;
+        return new EqualsBuilder()
+            .append(user, o.user) 
+            .append(website, o.website) 
+            .isEquals();
+    }
+    
+    public int hashCode() { 
+        return new HashCodeBuilder()
+            .append(user)
+            .append(website)
+            .toHashCode();
+    }
+
 }

Modified: incubator/roller/trunk/src/org/apache/roller/pojos/PingCategoryRestrictionData.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/pojos/PingCategoryRestrictionData.java?view=diff&rev=497459&r1=497458&r2=497459
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/pojos/PingCategoryRestrictionData.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/pojos/PingCategoryRestrictionData.java Thu Jan 18 07:35:39 2007
@@ -19,6 +19,9 @@
 package org.apache.roller.pojos;
 
 import java.io.Serializable;
+import org.apache.commons.lang.builder.EqualsBuilder;
+import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.apache.commons.lang.builder.ToStringBuilder;
 
 /**
  * Ping Category Restriction.  An instance of this class relates an auto ping configuration {@link AutoPingData} to a
@@ -32,7 +35,7 @@
  * @hibernate.class lazy="true" table="pingcategory"
  * @hibernate.cache usage="read-write"
  */
-public class PingCategoryRestrictionData extends PersistentObject implements Serializable {
+public class PingCategoryRestrictionData implements Serializable {
     private String id;
     private AutoPingData autoPing;
     private WeblogCategoryData weblogCategory;
@@ -59,10 +62,9 @@
     }
 
     /**
-     * Setter needed by RollerImpl.storePersistentObject()
+     * Set bean properties based on other bean.
      */
-    public void setData(PersistentObject vo) {
-        PingCategoryRestrictionData other = (PingCategoryRestrictionData) vo;
+    public void setData(PingCategoryRestrictionData other) {
         id = other.getId();
         autoPing = other.getAutoping();
         weblogCategory = other.getWeblogCategory();
@@ -86,6 +88,8 @@
      * @ejb:persistent-field
      */
     public void setId(String id) {
+        // Form bean workaround: empty string is never a valid id
+        if (id != null && id.trim().length() == 0) return; 
         this.id = id;
     }
 
@@ -131,35 +135,26 @@
         this.weblogCategory = weblogCategory;
     }
 
-    /**
-     * @see Object#equals(Object)
-     */
-    public boolean equals(Object o) {
-        if (this == o) return true;
-        if (!(o instanceof PingCategoryRestrictionData)) return false;
-
-        final PingCategoryRestrictionData pingCategoryRestrictionData = (PingCategoryRestrictionData) o;
-
-        if (id != null ? !id.equals(pingCategoryRestrictionData.getId()) : pingCategoryRestrictionData.getId() != null)
-        {
-            return false;
-        }
-        if (autoPing != null ? !autoPing.equals(pingCategoryRestrictionData.getAutoping()) : pingCategoryRestrictionData.getAutoping() != null)
-        {
-            return false;
-        }
-        if (weblogCategory != null ? !weblogCategory.equals(pingCategoryRestrictionData.getWeblogCategory()) : pingCategoryRestrictionData.getWeblogCategory() != null)
-        {
-            return false;
-        }
+    //------------------------------------------------------- Good citizenship
 
-        return true;
+    public String toString() {
+        return ToStringBuilder.reflectionToString(this);
     }
-
-    /**
-     * @see Object#hashCode()
-     */
-    public int hashCode() {
-        return (id != null ? id.hashCode() : 0);
+    
+    public boolean equals(Object other) {
+        if (other == this) return true;
+        if (other instanceof PingCategoryRestrictionData != true) return false;
+        PingCategoryRestrictionData o = (PingCategoryRestrictionData)other;
+        return new EqualsBuilder()
+            .append(getWeblogCategory(), o.getWeblogCategory()) 
+            .append(getAutoping(), o.getAutoping()) 
+            .isEquals();
+    }
+    
+    public int hashCode() { 
+        return new HashCodeBuilder()
+            .append(getWeblogCategory())
+            .append(getAutoping())
+            .toHashCode();
     }
 }

Modified: incubator/roller/trunk/src/org/apache/roller/pojos/PingQueueEntryData.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/pojos/PingQueueEntryData.java?view=diff&rev=497459&r1=497458&r2=497459
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/pojos/PingQueueEntryData.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/pojos/PingQueueEntryData.java Thu Jan 18 07:35:39 2007
@@ -20,6 +20,9 @@
 
 import java.io.Serializable;
 import java.sql.Timestamp;
+import org.apache.commons.lang.builder.EqualsBuilder;
+import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.apache.commons.lang.builder.ToStringBuilder;
 
 /**
  * Ping queue entry.  Each instance of this class represents an entry on the ping queue. The entry indicates when it was
@@ -31,7 +34,7 @@
  * @hibernate.class lazy="true" table="pingqueueentry"
  * @hibernate.cache usage="read-write"
  */
-public class PingQueueEntryData extends PersistentObject implements Serializable {
+public class PingQueueEntryData implements Serializable {
     private String id = null;
     private Timestamp entryTime = null;
     private PingTargetData pingTarget = null;
@@ -64,11 +67,9 @@
     }
 
     /**
-     * @see PersistentObject#setData(PersistentObject)
+     * Set bean properties based on other bean.
      */
-    public void setData(PersistentObject vo) {
-        PingQueueEntryData other = (PingQueueEntryData) vo;
-
+    public void setData(PingQueueEntryData other) {
         id = other.getId();
         entryTime = other.getEntryTime();
         pingTarget = other.getPingTarget();
@@ -94,6 +95,8 @@
      * @ejb:persistent-field
      */
     public void setId(String id) {
+        // Form bean workaround: empty string is never a valid id
+        if (id != null && id.trim().length() == 0) return; 
         this.id = id;
     }
 
@@ -190,47 +193,26 @@
         return ++attempts;
     }
 
-    /**
-     * @see Object#equals(Object o)
-     */
-    public boolean equals(Object o) {
-        if (this == o) return true;
-        if (!(o instanceof PingQueueEntryData)) return false;
-
-        final PingQueueEntryData pingQueueEntryData = (PingQueueEntryData) o;
+    //------------------------------------------------------- Good citizenship
 
-        if (attempts != pingQueueEntryData.getAttempts()) return false;
-        if (entryTime != null ? !entryTime.equals(pingQueueEntryData.getEntryTime()) : pingQueueEntryData.getEntryTime() != null)
-        {
-            return false;
-        }
-        if (id != null ? !id.equals(pingQueueEntryData.getId()) : pingQueueEntryData.getId() != null) return false;
-        if (pingTarget != null ? !pingTarget.equals(pingQueueEntryData.getPingTarget()) : pingQueueEntryData.getPingTarget() != null)
-        {
-            return false;
-        }
-        if (getWebsite() != null ? !getWebsite().equals(pingQueueEntryData.getWebsite()) : pingQueueEntryData.getWebsite() != null)
-        {
-            return false;
-        }
-
-        return true;
-    }
-
-    /**
-     * @see Object#hashCode()
-     */
-    public int hashCode() {
-        return (id != null ? id.hashCode() : 0);
-    }
-
-    /**
-     * Generate a string form of the object appropriate for logging or debugging.
-     *
-     * @return a string form of the object appropriate for logging or debugging.
-     * @see Object#toString()
-     */
     public String toString() {
-        return "PingQueueEntryData{" + "id='" + id + "'" + ", entryTime=" + entryTime + ", pingTarget=" + pingTarget + ", attempts=" + attempts + "}";
+        return ToStringBuilder.reflectionToString(this);
+    }
+    
+    public boolean equals(Object other) {
+        if (other == this) return true;
+        if (other instanceof PingQueueEntryData != true) return false;
+        PingQueueEntryData o = (PingQueueEntryData)other;
+        return new EqualsBuilder()
+            .append(getEntryTime(), o.getEntryTime()) 
+            .append(getWebsite(), o.getWebsite()) 
+            .isEquals();
+    }
+    
+    public int hashCode() { 
+        return new HashCodeBuilder()
+            .append(getEntryTime())
+            .append(getWebsite())
+            .toHashCode();
     }
 }

Modified: incubator/roller/trunk/src/org/apache/roller/pojos/PingTargetData.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/pojos/PingTargetData.java?view=diff&rev=497459&r1=497458&r2=497459
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/pojos/PingTargetData.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/pojos/PingTargetData.java Thu Jan 18 07:35:39 2007
@@ -20,6 +20,9 @@
 
 import java.io.Serializable;
 import java.sql.Timestamp;
+import org.apache.commons.lang.builder.EqualsBuilder;
+import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.apache.commons.lang.builder.ToStringBuilder;
 
 
 /**
@@ -33,7 +36,7 @@
  * @hibernate.class lazy="true" table="pingtarget"
  * @hibernate.cache usage="read-write"
  */
-public class PingTargetData extends PersistentObject implements Serializable {
+public class PingTargetData implements Serializable {
 
     public static final long serialVersionUID = -6354583200913127874L;
 
@@ -77,10 +80,9 @@
 
 
     /**
-     * Setter needed by RollerImpl.storePersistentObject()
+     * Set bean properties based on other bean.
      */
-    public void setData(PersistentObject vo) {
-        PingTargetData other = (PingTargetData) vo;
+    public void setData(PingTargetData other) {
 
         id = other.getId();
         name = other.getName();
@@ -112,6 +114,8 @@
      * @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; 
         this.id = id;
     }
 
@@ -262,49 +266,25 @@
     }
 
 
-    /**
-     * @see java.lang.Object#hashCode()
-     */
-    public int hashCode() {
-        return id.hashCode();
-    }
-
-
-    /**
-     * @see java.lang.Object#equals(Object o)
-     */
-    public boolean equals(Object o) {
-        if (this == o) return true;
-        if (!(o instanceof PingTargetData)) return false;
-
-        final PingTargetData pingTargetData = (PingTargetData) o;
+    //------------------------------------------------------- Good citizenship
 
-        if (conditionCode != pingTargetData.getConditionCode()) return false;
-        if (id != null ? !id.equals(pingTargetData.getId()) : pingTargetData.getId() != null) return false;
-        if (lastSuccess != null ? !lastSuccess.equals(pingTargetData.getLastSuccess()) : pingTargetData.getLastSuccess() != null)
-        {
-            return false;
-        }
-        if (name != null ? !name.equals(pingTargetData.getName()) : pingTargetData.getName() != null) return false;
-        if (pingUrl != null ? !pingUrl.equals(pingTargetData.getPingUrl()) : pingTargetData.getPingUrl() != null) {
-            return false;
-        }
-        if (getWebsite() != null ? !getWebsite().equals(pingTargetData.getWebsite()) : pingTargetData.getWebsite() != null) {
-            return false;
-        }
-
-        return true;
+    public String toString() {
+        return ToStringBuilder.reflectionToString(this);
     }
 
-
-    /**
-     * Generate a string form of the object appropriate for logging or debugging.
-     *
-     * @return a string form of the object appropriate for logging or debugging.
-     * @see java.lang.Object#toString()
-     */
-    public String toString() {
-        return "PingTargetData{" + "id='" + id + "'" + ", name='" + name + "'" + ", pingUrl='" + pingUrl + "'" + ", conditionCode=" + conditionCode + ", lastSuccess=" + lastSuccess + "}";
+    public boolean equals(Object other) {
+        if (other == this) return true;
+        if (other instanceof PingTargetData != true) return false;
+        PingTargetData o = (PingTargetData)other;
+        return new EqualsBuilder()
+            .append(getId(), o.getId()) 
+            .isEquals();
+    }
+    
+    public int hashCode() { 
+        return new HashCodeBuilder()
+            .append(id)
+            .toHashCode();
     }
 
 }

Modified: incubator/roller/trunk/src/org/apache/roller/pojos/RefererData.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/pojos/RefererData.java?view=diff&rev=497459&r1=497458&r2=497459
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/pojos/RefererData.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/pojos/RefererData.java Thu Jan 18 07:35:39 2007
@@ -21,6 +21,9 @@
 package org.apache.roller.pojos;
 
 import org.apache.commons.lang.StringEscapeUtils;
+import org.apache.commons.lang.builder.EqualsBuilder;
+import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.apache.commons.lang.builder.ToStringBuilder;
 
 
 /**
@@ -32,7 +35,7 @@
  * @hibernate.class lazy="true" table="referer"
  * @hibernate.cache usage="read-write"
  */
-public class RefererData extends PersistentObject
+public class RefererData
     implements java.io.Serializable
 {
     static final long serialVersionUID = -1817992900602131316L;
@@ -100,6 +103,8 @@
 
     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; 
         this.id = id;
     }
 
@@ -383,213 +388,25 @@
         return getDisplayUrl(50, false);
     }
 
-    //-------------------------------------------------------------------------
-    public String toString()
-    {
-        StringBuffer str = new StringBuffer("{");
-
-        str.append("id=" + id + " " + "website=" + website + " " + 
-                   "dateString=" + 
-                   dateString + " " + "refererUrl=" + refererUrl + " " + 
-                   "refererPermalink=" + refererPermalink + " " + 
-                   "requestUrl=" + requestUrl + " " + "title=" + title + " " + 
-                   "excerpt=" + excerpt + " " + "visible=" + visible + " " + 
-                   "duplicate=" + duplicate + " " + "dayHits=" + dayHits + 
-                   " " + "totalHits=" + totalHits);
-        str.append('}');
-
-        return (str.toString());
-    }
-
-    public boolean equals(Object pOther)
-    {
-        if (pOther instanceof RefererData)
-        {
-            RefererData lTest = (RefererData) pOther;
-            boolean lEquals = true;
-
-            if (this.id == null)
-            {
-                lEquals = lEquals && (lTest.getId() == null);
-            }
-            else
-            {
-                lEquals = lEquals && this.id.equals(lTest.getId());
-            }
-
-            if (this.website == null)
-            {
-                lEquals = lEquals && (lTest.getWebsite() == null);
-            }
-            else
-            {
-                lEquals = lEquals && this.website.equals(lTest.getWebsite());
-            }
-
-            if (this.weblogEntry == null)
-            {
-                lEquals = lEquals && (lTest.getWeblogEntry() == null);
-            }
-            else
-            {
-                lEquals = lEquals && 
-                          this.weblogEntry.equals(lTest.getWeblogEntry());
-            }
-
-            if (this.dateString == null)
-            {
-                lEquals = lEquals && (lTest.getDateString() == null);
-            }
-            else
-            {
-                lEquals = lEquals && 
-                          this.dateString.equals(lTest.getDateString());
-            }
-
-            if (this.refererUrl == null)
-            {
-                lEquals = lEquals && (lTest.getRefererUrl() == null);
-            }
-            else
-            {
-                lEquals = lEquals && 
-                          this.refererUrl.equals(lTest.getRefererUrl());
-            }
-
-            if (this.refererPermalink == null)
-            {
-                lEquals = lEquals && (lTest.getRefererPermalink() == null);
-            }
-            else
-            {
-                lEquals = lEquals && 
-                          this.refererPermalink.equals(lTest.getRefererPermalink());
-            }
-
-            if (this.requestUrl == null)
-            {
-                lEquals = lEquals && (lTest.getRequestUrl() == null);
-            }
-            else
-            {
-                lEquals = lEquals && 
-                          this.requestUrl.equals(lTest.getRequestUrl());
-            }
-
-            if (this.title == null)
-            {
-                lEquals = lEquals && (lTest.getTitle() == null);
-            }
-            else
-            {
-                lEquals = lEquals && this.title.equals(lTest.getTitle());
-            }
-
-            if (this.excerpt == null)
-            {
-                lEquals = lEquals && (lTest.getExcerpt() == null);
-            }
-            else
-            {
-                lEquals = lEquals && this.excerpt.equals(lTest.getExcerpt());
-            }
-
-            if (this.visible == null)
-            {
-                lEquals = lEquals && (lTest.getVisible() == null);
-            }
-            else
-            {
-                lEquals = lEquals && this.visible.equals(lTest.getVisible());
-            }
-
-            if (this.duplicate == null)
-            {
-                lEquals = lEquals && (lTest.getDuplicate() == null);
-            }
-            else
-            {
-                lEquals = lEquals && this.duplicate.equals(lTest.getDuplicate());
-            }
-
-            if (this.dayHits == null)
-            {
-                lEquals = lEquals && (lTest.getDayHits() == null);
-            }
-            else
-            {
-                lEquals = lEquals && this.dayHits.equals(lTest.getDayHits());
-            }
-
-            if (this.totalHits == null)
-            {
-                lEquals = lEquals && (lTest.getTotalHits() == null);
-            }
-            else
-            {
-                lEquals = lEquals && this.totalHits.equals(lTest.getTotalHits());
-            }
-
-            return lEquals;
-        }
-        else
-        {
-            return false;
-        }
-    }
-
-    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.weblogEntry != null) ? this.weblogEntry.hashCode() : 0);
-        result = (37 * result) + 
-                 ((this.dateString != null) ? this.dateString.hashCode() : 0);
-        result = (37 * result) + 
-                 ((this.refererUrl != null) ? this.refererUrl.hashCode() : 0);
-        result = (37 * result) + 
-                 ((this.refererPermalink != null)
-                  ? this.refererPermalink.hashCode() : 0);
-        result = (37 * result) + 
-                 ((this.requestUrl != null) ? this.requestUrl.hashCode() : 0);
-        result = (37 * result) + 
-                 ((this.title != null) ? this.title.hashCode() : 0);
-        result = (37 * result) + 
-                 ((this.excerpt != null) ? this.excerpt.hashCode() : 0);
-        result = (37 * result) + 
-                 ((this.visible != null) ? this.visible.hashCode() : 0);
-        result = (37 * result) + 
-                 ((this.duplicate != null) ? this.duplicate.hashCode() : 0);
-        result = (37 * result) + 
-                 ((this.dayHits != null) ? this.dayHits.hashCode() : 0);
-        result = (37 * result) + 
-                 ((this.totalHits != null) ? this.totalHits.hashCode() : 0);
-
-        return result;
-    }
 
     /**
-     * Setter is needed in RollerImpl.storePersistentObject()
+     * Set bean properties based on other bean.
      */
-    public void setData(org.apache.roller.pojos.PersistentObject otherData)
+    public void setData(RefererData otherData)
     {
-        this.id = ((RefererData) otherData).getId();
-        this.website = ((RefererData) otherData).getWebsite();
-        this.weblogEntry = ((RefererData) otherData).getWeblogEntry();
-        this.dateString = ((RefererData) otherData).getDateString();
-        this.refererUrl = ((RefererData) otherData).getRefererUrl();
-        this.refererPermalink = ((RefererData) otherData).getRefererPermalink();
-        this.requestUrl = ((RefererData) otherData).getRequestUrl();
-        this.title = ((RefererData) otherData).getTitle();
-        this.excerpt = ((RefererData) otherData).getExcerpt();
-        this.visible = ((RefererData) otherData).getVisible();
-        this.duplicate = ((RefererData) otherData).getDuplicate();
-        this.dayHits = ((RefererData) otherData).getDayHits();
-        this.totalHits = ((RefererData) otherData).getTotalHits();
+        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();
     }
 
     /**
@@ -606,6 +423,29 @@
      */
     public void setDisplayUrl(String string)
     {
+    }
+    
+    //------------------------------------------------------- Good citizenship
+
+    public String toString() {
+        return ToStringBuilder.reflectionToString(this);
+    }
+
+    public boolean equals(Object other) {
+        if (other == this) return true;
+        if (other instanceof RefererData != true) return false;
+        RefererData o = (RefererData)other;
+        return new EqualsBuilder()
+            .append(getRefererUrl(), o.getRefererUrl()) 
+            .append(getWeblogEntry(), o.getWeblogEntry()) 
+            .isEquals();
+    }
+    
+    public int hashCode() { 
+        return new HashCodeBuilder()
+            .append(getRefererUrl())
+            .append(getWeblogEntry())
+            .toHashCode();
     }
 
 }

Modified: incubator/roller/trunk/src/org/apache/roller/pojos/RoleData.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/pojos/RoleData.java?view=diff&rev=497459&r1=497458&r2=497459
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/pojos/RoleData.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/pojos/RoleData.java Thu Jan 18 07:35:39 2007
@@ -18,6 +18,10 @@
 
 package org.apache.roller.pojos;
 
+import org.apache.commons.lang.builder.EqualsBuilder;
+import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.apache.commons.lang.builder.ToStringBuilder;
+
 
 /**
  * Role bean.
@@ -29,7 +33,6 @@
  * @hibernate.cache usage="read-write"
  */
 public class RoleData
-   extends org.apache.roller.pojos.PersistentObject
    implements java.io.Serializable
 {
    static final long serialVersionUID = -4254083071697970972L;
@@ -69,6 +72,8 @@
    /** @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; 
       this.id = id;
    }
 
@@ -114,76 +119,36 @@
       this.role = role;
    }
 
-   public String toString()
-   {
-      StringBuffer str = new StringBuffer("{");
-
-      str.append("id=" + id + " " + "userName=" + userName + " " + "user=" + user + " " + "role=" + role);
-      str.append('}');
-
-      return(str.toString());
-   }
-
-   public boolean equals( Object pOther )
-   {
-      if( pOther instanceof RoleData )
-      {
-         RoleData lTest = (RoleData) pOther;
-         boolean lEquals = true;
-
-         if( this.userName == null )
-         {
-            lEquals = lEquals && ( lTest.getUserName() == null );
-         }
-         else
-         {
-            lEquals = lEquals && this.userName.equals( lTest.getUserName() );
-         }
-         if( this.user == null )
-         {
-            lEquals = lEquals && ( lTest.getUser() == null );
-         }
-         else
-         {
-            lEquals = lEquals && this.user.equals( lTest.getUser() );
-         }
-         if( this.role == null )
-         {
-            lEquals = lEquals && ( lTest.getRole() == null );
-         }
-         else
-         {
-            lEquals = lEquals && this.role.equals( lTest.getRole() );
-         }
-
-         return lEquals;
-      }
-      else
-      {
-         return false;
-      }
-   }
-
-   public int hashCode()
-   {
-      int result = 17;
-      result = 37*result + ((this.id != null) ? this.id.hashCode() : 0);
-      result = 37*result + ((this.userName != null) ? this.userName.hashCode() : 0);
-      result = 37*result + ((this.user != null) ? this.user.hashCode() : 0);
-      result = 37*result + ((this.role != null) ? this.role.hashCode() : 0);
-      return result;
-      }
 
-   /**
-	* Setter is needed in RollerImpl.storePersistentObject()
-    */
-   public void setData( org.apache.roller.pojos.PersistentObject otherData )
-   {
+    //------------------------------------------------------- Good citizenship
 
-      this.id = ((RoleData)otherData).getId();
-      this.userName = ((RoleData)otherData).getUserName();
-      this.user = ((RoleData)otherData).getUser();
-      this.role = ((RoleData)otherData).getRole();
+    public String toString() {
+        return ToStringBuilder.reflectionToString(this);
+    }
+
+    public boolean equals(Object other) {
+        if (other == this) return true;
+        if (other instanceof RoleData != true) return false;
+        RoleData o = (RoleData)other;
+        return new EqualsBuilder()
+            .append(getRole(), o.getRole())
+            .append(getUserName(), o.getUserName())
+            .isEquals();
+    }
+    
+    public int hashCode() {
+        return new HashCodeBuilder().append(getUserName()).append(getRole()).toHashCode();
+    }
+
+    /**
+     * Set bean properties based on other bean.
+     */
+   public void setData( RoleData otherData )
+   {
+      this.id = otherData.getId();
+      this.userName = otherData.getUserName();
+      this.user =     otherData.getUser();
+      this.role =     otherData.getRole();
    }
 
 }

Modified: incubator/roller/trunk/src/org/apache/roller/pojos/RollerConfigData.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/pojos/RollerConfigData.java?view=diff&rev=497459&r1=497458&r2=497459
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/pojos/RollerConfigData.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/pojos/RollerConfigData.java Thu Jan 18 07:35:39 2007
@@ -25,10 +25,9 @@
 import java.util.List;
 
 import org.apache.commons.lang.StringUtils;
-import org.apache.roller.RollerException;
-import org.apache.roller.business.Roller;
-import org.apache.roller.business.RollerFactory;
-import org.apache.roller.util.PojoUtil;
+import org.apache.commons.lang.builder.EqualsBuilder;
+import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.apache.commons.lang.builder.ToStringBuilder;
 
 /**
  * Configuration object for Roller.  Reads and writes roller-config.xml.
@@ -42,7 +41,6 @@
  * @hibernate.class lazy="true" table="rollerconfig"
  */
 public class RollerConfigData
-    extends org.apache.roller.pojos.PersistentObject
     implements java.io.Serializable
 {
     static final long serialVersionUID = -6354583200913127875L;
@@ -212,6 +210,8 @@
 
     /** @ejb:persistent-field */
     public void setId(String id) {
+        // Form bean workaround: empty string is never a valid id
+        if (id != null && id.trim().length() == 0) return; 
         this.id = id;
     }
 
@@ -722,86 +722,29 @@
         this.mRefererSpamWords = child.getRefererSpamWords();
     }
 
-    /** nice output for debugging */
-    public String toString()
-    {
-        StringBuffer buf = new StringBuffer();
-        buf.append("RollerConfig \n");
-        Class clazz = getClass();
-        Field[] fields = clazz.getDeclaredFields();
-
-        try {
-            AccessibleObject.setAccessible(fields, true);
-            for (int i = 0; i < fields.length; i++) {
-                buf.append(
-                    "\t["
-                        + fields[i].getName()
-                        + "="
-                        + fields[i].get(this)
-                        + "], \n");
-            }
-        } catch (Exception e) {
-            // ignored!
-        }
-
-        return buf.toString();
-    }
+	public void setData(RollerConfigData vo) {
+        updateValues(vo);
+	}
 
+    //------------------------------------------------------- Good citizenship
 
-	public void setData(PersistentObject vo) {
-		if (vo instanceof RollerConfigData) {
-      		this.id = ((RollerConfigData)vo).id;
-			updateValues((RollerConfigData)vo);
-        }
-	}
+    public String toString() {
+        return ToStringBuilder.reflectionToString(this);
+    }
 
-    public boolean equals(Object pOther)
-    {
-        if (pOther instanceof RollerConfigData)
-        {
-            RollerConfigData lTest = (RollerConfigData) pOther;
-            boolean lEquals = true;
-
-            lEquals = PojoUtil.equals(lEquals, this.id, lTest.id);
-			lEquals = PojoUtil.equals(lEquals, this.mAbsoluteURL, lTest.getAbsoluteURL());
-			lEquals = PojoUtil.equals(lEquals, this.mRssUseCache, lTest.getRssUseCache());
-			lEquals = PojoUtil.equals(lEquals, this.mRssCacheTime, lTest.getRssCacheTime());
-			lEquals = PojoUtil.equals(lEquals, this.mNewUserAllowed, lTest.getNewUserAllowed());
-			lEquals = PojoUtil.equals(lEquals, this.mAdminUsers, lTest.getAdminUsers());
-			lEquals = PojoUtil.equals(lEquals, this.mUserThemes, lTest.getUserThemes());
-			lEquals = PojoUtil.equals(lEquals, this.mEditorPages, lTest.getEditorPages());
-			lEquals = PojoUtil.equals(lEquals, this.mEnableAggregator, lTest.getEnableAggregator());
-			lEquals = PojoUtil.equals(lEquals, this.mUploadEnabled, lTest.getUploadEnabled());
-			lEquals = PojoUtil.equals(lEquals, this.mUploadMaxDirMB, lTest.getUploadMaxDirMB());
-			lEquals = PojoUtil.equals(lEquals, this.mUploadMaxFileMB, lTest.getUploadMaxFileMB());
-			lEquals = PojoUtil.equals(lEquals, this.mUploadAllow, lTest.getUploadAllow());
-			lEquals = PojoUtil.equals(lEquals, this.mUploadForbid, lTest.getUploadForbid());
-			lEquals = PojoUtil.equals(lEquals, this.mUploadDir, lTest.getUploadDir());
-			lEquals = PojoUtil.equals(lEquals, this.uploadPath, lTest.getUploadPath());
-			lEquals = PojoUtil.equals(lEquals, this.mMemDebug, lTest.getMemDebug());
-			lEquals = PojoUtil.equals(lEquals, this.mAutoformatComments, lTest.getAutoformatComments());
-			lEquals = PojoUtil.equals(lEquals, this.mEscapeCommentHtml, lTest.getEscapeCommentHtml());
-			lEquals = PojoUtil.equals(lEquals, this.mEmailComments, lTest.getEmailComments());
-			lEquals = PojoUtil.equals(lEquals, this.mEnableLinkback, lTest.getEnableLinkback());
-			lEquals = PojoUtil.equals(lEquals, this.mSiteName, lTest.getSiteName());
-			lEquals = PojoUtil.equals(lEquals, this.mSiteDescription, lTest.getSiteDescription());
-			lEquals = PojoUtil.equals(lEquals, this.mEmailAddress, lTest.getEmailAddress());
-			lEquals = PojoUtil.equals(lEquals, this.mIndexDir, lTest.getIndexDir());
-            lEquals = PojoUtil.equals(lEquals, this.mEncryptPasswords, lTest.getEncryptPasswords());
-            lEquals = PojoUtil.equals(lEquals, this.mAlgorithm, lTest.getAlgorithm());
-            lEquals = PojoUtil.equals(lEquals, this.mRefererSpamWords, lTest.getRefererSpamWords());
-
-		 	return lEquals;
-	  	}
-	  	else
-	  	{
-		 	return false;
-      	}
-	}
+    public boolean equals(Object other) {
+        if (other == this) return true;
+        if (other instanceof RollerConfigData != true) return false;
+        RollerConfigData o = (RollerConfigData)other;
+        return new EqualsBuilder()
+            .append(getId(), o.getId())  
+            .isEquals();
+    }
     
-    public int hashCode()
-    {
-        return super.hashCode();
+    public int hashCode() { 
+        return new HashCodeBuilder()
+            .append(getId())
+            .toHashCode();
     }
 
 }

Modified: incubator/roller/trunk/src/org/apache/roller/pojos/RollerPropertyData.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/pojos/RollerPropertyData.java?view=diff&rev=497459&r1=497458&r2=497459
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/pojos/RollerPropertyData.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/pojos/RollerPropertyData.java Thu Jan 18 07:35:39 2007
@@ -23,6 +23,10 @@
 
 package org.apache.roller.pojos;
 
+import org.apache.commons.lang.builder.EqualsBuilder;
+import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.apache.commons.lang.builder.ToStringBuilder;
+
 
 /**
  * This POJO represents a single property of the roller system.
@@ -34,7 +38,6 @@
  * @hibernate.cache usage="read-write"
  */
 public class RollerPropertyData 
-    extends org.apache.roller.pojos.PersistentObject
     implements java.io.Serializable
 {
     
@@ -61,7 +64,7 @@
     }
     
     
-    public void setData(PersistentObject object)
+    public void setData(RollerPropertyData object)
     {
         if (object instanceof RollerPropertyData)
         {
@@ -71,12 +74,7 @@
         }
     }
     
-    
-    public String toString()
-    {
-        return (this.name + "=" + this.value);
-    }
-    
+        
 
     /**
      * Getter for property name.
@@ -124,14 +122,24 @@
         this.value = value;
     }
     
-    
-    public String getId() {
-        // this is only here because it is required by PersistentObject
-        return null;
+    //------------------------------------------------------- Good citizenship
+
+    public String toString() {
+        return (this.name + "=" + this.value);
+    }
+
+    public boolean equals(Object other) {
+        if (other == this) return true;
+        if (other instanceof RollerPropertyData != true) return false;
+        RollerPropertyData o = (RollerPropertyData)other;
+        return new EqualsBuilder()
+            .append(getName(), o.getName())  
+            .isEquals();
     }
     
-    
-    public void setId(String id) {
-        // do nothing ... only here because the PersistentObject class requires it
+    public int hashCode() { 
+        return new HashCodeBuilder()
+            .append(getName())
+            .toHashCode();
     }
 }

Modified: incubator/roller/trunk/src/org/apache/roller/pojos/StatCount.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/pojos/StatCount.java?view=diff&rev=497459&r1=497458&r2=497459
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/pojos/StatCount.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/pojos/StatCount.java Thu Jan 18 07:35:39 2007
@@ -17,6 +17,10 @@
 */
 package org.apache.roller.pojos;
 
+import org.apache.commons.lang.builder.EqualsBuilder;
+import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.apache.commons.lang.builder.ToStringBuilder;
+
 /**
  * Represents a statistical count.
  */
@@ -94,5 +98,28 @@
 
     public void setWeblogHandle(String weblogHandle) {
         this.weblogHandle = weblogHandle;
+    }
+    
+    //------------------------------------------------------- Good citizenship
+
+    public String toString() {
+        return ToStringBuilder.reflectionToString(this);
+    }
+
+    public boolean equals(Object other) {
+        if (other == this) return true;
+        if (other instanceof StatCount != true) return false;
+        StatCount o = (StatCount)other;
+        return new EqualsBuilder()
+            .append(getSubjectId(), o.getSubjectId()) 
+            .append(getTypeKey(), o.getTypeKey()) 
+            .isEquals();
+    }
+    
+    public int hashCode() { 
+        return new HashCodeBuilder()
+            .append(getSubjectId())
+            .append(getTypeKey())
+            .toHashCode();
     }
 }

Modified: incubator/roller/trunk/src/org/apache/roller/pojos/StaticTemplate.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/pojos/StaticTemplate.java?view=diff&rev=497459&r1=497458&r2=497459
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/pojos/StaticTemplate.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/pojos/StaticTemplate.java Thu Jan 18 07:35:39 2007
@@ -63,6 +63,8 @@
     }
 
     public void setId(String id) {
+        // Form bean workaround: empty string is never a valid id
+        if (id != null && id.trim().length() == 0) return; 
         this.id = id;
     }
 

Modified: incubator/roller/trunk/src/org/apache/roller/pojos/TaskLockData.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/pojos/TaskLockData.java?view=diff&rev=497459&r1=497458&r2=497459
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/pojos/TaskLockData.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/pojos/TaskLockData.java Thu Jan 18 07:35:39 2007
@@ -21,6 +21,7 @@
 import java.io.Serializable;
 import java.util.Calendar;
 import java.util.Date;
+import org.apache.commons.lang.builder.ToStringBuilder;
 
 
 /**
@@ -30,7 +31,7 @@
  * @hibernate.class lazy="true" table="roller_tasklock"
  * @hibernate.cache usage="read-write"
  */
-public class TaskLockData extends PersistentObject implements Serializable {
+public class TaskLockData implements Serializable {
     
     private String id = null;
     private String name = null;
@@ -83,8 +84,7 @@
     }
     
     
-    public void setData(PersistentObject otherData) {
-        TaskLockData other = (TaskLockData) otherData;
+    public void setData(TaskLockData other) {
         this.id = other.getId();
         this.name = other.getName();
         this.locked = other.isLocked();
@@ -92,7 +92,13 @@
         this.timeLeased = other.getTimeLeased();
         this.lastRun = other.getLastRun();
     }
-    
+
+    //------------------------------------------------------- Good citizenship
+
+    public String toString() {
+        return ToStringBuilder.reflectionToString(this);
+    }
+
     public boolean equals(Object other) {
         
         if(this == other) return true;
@@ -100,12 +106,12 @@
         
         // our natural key, or business key, is our name
         final TaskLockData that = (TaskLockData) other;
-        return this.name.equals(that.getName());
+        return this.getName().equals(that.getName());
     }
     
     public int hashCode() {
         // our natrual key, or business key, is our name
-        return this.name.hashCode();
+        return this.getName().hashCode();
     }
     
     /**
@@ -117,6 +123,8 @@
     }
 
     public void setId(String id) {
+        // Form bean workaround: empty string is never a valid id
+        if (id != null && id.trim().length() == 0) return; 
         this.id = id;
     }
 

Modified: incubator/roller/trunk/src/org/apache/roller/pojos/Theme.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/pojos/Theme.java?view=diff&rev=497459&r1=497458&r2=497459
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/pojos/Theme.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/pojos/Theme.java Thu Jan 18 07:35:39 2007
@@ -164,6 +164,8 @@
     }
 
     public void setId(String id) {
+        // Form bean workaround: empty string is never a valid id
+        if (id != null && id.trim().length() == 0) return; 
         this.id = id;
     }
     

Modified: incubator/roller/trunk/src/org/apache/roller/pojos/ThemeTemplate.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/pojos/ThemeTemplate.java?view=diff&rev=497459&r1=497458&r2=497459
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/pojos/ThemeTemplate.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/pojos/ThemeTemplate.java Thu Jan 18 07:35:39 2007
@@ -75,6 +75,8 @@
     }
 
     public void setId(String id) {
+        // Form bean workaround: empty string is never a valid id
+        if (id != null && id.trim().length() == 0) return; 
         this.id = id;
     }
 



Mime
View raw message