roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From snoopd...@apache.org
Subject svn commit: r189695 [24/67] - in /incubator/roller/trunk: ./ contrib/ contrib/lib/ contrib/plugins/ contrib/plugins/src/ contrib/plugins/src/org/ contrib/plugins/src/org/roller/ contrib/plugins/src/org/roller/presentation/ contrib/plugins/src/org/roller/presentation/velocity/ contrib/plugins/src/org/roller/presentation/velocity/plugins/ contrib/plugins/src/org/roller/presentation/velocity/plugins/acronyms/ contrib/plugins/src/org/roller/presentation/velocity/plugins/bookmarks/ contrib/plugins/src/org/roller/presentation/velocity/plugins/email/ contrib/plugins/src/org/roller/presentation/velocity/plugins/jspwiki/ contrib/plugins/src/org/roller/presentation/velocity/plugins/radeox/ contrib/plugins/src/org/roller/presentation/velocity/plugins/readmore/ contrib/plugins/src/org/roller/presentation/velocity/plugins/smileys/ contrib/plugins/src/org/roller/presentation/velocity/plugins/textile/ contrib/plugins/src/org/roller/presentation/velocity/plugins/topictag/ custom/ custom/src/ custom/web/ docs/ docs/images/ docs/installguide/ docs/installguide/old/ docs/userguide/ docs/userguide/images/ docs/userguide/old/ metadata/ metadata/database/ metadata/database/hibernate/ metadata/xdoclet/ nbproject/ personal/ personal/eclipse/ personal/testing/ sandbox/ sandbox/planetroller/ sandbox/planetroller/metadata/ sandbox/planetroller/metadata/database/ sandbox/planetroller/src/ sandbox/planetroller/src/org/ sandbox/planetroller/src/org/roller/ sandbox/planetroller/src/org/roller/tools/ sandbox/planetroller/src/org/roller/tools/planet/ sandbox/planetroller/templates/ sandbox/planetroller/test/ sandbox/planetroller/test/org/ sandbox/planetroller/test/org/roller/ sandbox/planetroller/test/org/roller/model/ sandbox/planetroller/test/org/roller/tools/ sandbox/planetroller/test/org/roller/tools/planet/ sandbox/planetroller/testdata/ sandbox/planetroller/testdata/cache/ sandbox/planetroller/testdata/output/ sandbox/standalone/ sandbox/standalone/jspwiki/ sandbox/standalone/jspwiki/default/ sandbox/standalone/jspwiki/default/images/ sandbox/standalone/lib/ sandbox/standalone/src/ sandbox/standalone/src/org/ sandbox/standalone/src/org/roller/ sandbox/standalone/src/org/roller/jspwiki/ sandbox/standalone/src/org/roller/tomcat/ sandbox/standalone/src/org/roller/util/ sandbox/standalone/tests/ sandbox/standalone/tests/org/ sandbox/standalone/tests/org/roller/ sandbox/standalone/tests/org/roller/util/ sandbox/standalone/tomcat/ src/ src/org/ src/org/roller/ src/org/roller/business/ src/org/roller/business/hibernate/ src/org/roller/business/search/ src/org/roller/business/search/operations/ src/org/roller/business/utils/ src/org/roller/config/ src/org/roller/config/runtime/ src/org/roller/model/ src/org/roller/pojos/ src/org/roller/presentation/ src/org/roller/presentation/atomapi/ src/org/roller/presentation/bookmarks/ src/org/roller/presentation/bookmarks/actions/ src/org/roller/presentation/bookmarks/formbeans/ src/org/roller/presentation/bookmarks/tags/ src/org/roller/presentation/filters/ src/org/roller/presentation/forms/ src/org/roller/presentation/newsfeeds/ src/org/roller/presentation/pagecache/ src/org/roller/presentation/pagecache/rollercache/ src/org/roller/presentation/pings/ src/org/roller/presentation/planet/ src/org/roller/presentation/tags/ src/org/roller/presentation/tags/calendar/ src/org/roller/presentation/tags/menu/ src/org/roller/presentation/util/ src/org/roller/presentation/velocity/ src/org/roller/presentation/weblog/ src/org/roller/presentation/weblog/actions/ src/org/roller/presentation/weblog/formbeans/ src/org/roller/presentation/weblog/tags/ src/org/roller/presentation/website/ src/org/roller/presentation/website/actions/ src/org/roller/presentation/website/formbeans/ src/org/roller/presentation/website/tags/ src/org/roller/presentation/xmlrpc/ src/org/roller/util/ src/org/roller/util/rome/ tests/ tests/org/ tests/org/roller/ tests/org/roller/ant/ tests/org/roller/business/ tests/org/roller/presentation/ tests/org/roller/presentation/atomapi/ tests/org/roller/presentation/bookmarks/ tests/org/roller/presentation/filters/ tests/org/roller/presentation/velocity/ tests/org/roller/presentation/velocity/plugins/ tests/org/roller/presentation/velocity/plugins/smileys/ tests/org/roller/presentation/velocity/plugins/textile/ tests/org/roller/presentation/weblog/ tests/org/roller/presentation/xmlrpc/ tests/org/roller/util/ tests/org/roller/util/rome/ tools/ tools/buildtime/ tools/buildtime/ant-1.6.2/ tools/buildtime/findbugs/ tools/buildtime/findbugs/lib/ tools/buildtime/findbugs/plugin/ tools/buildtime/mockrunner-0.3/ tools/buildtime/mockrunner-0.3/lib/ tools/buildtime/mockrunner-0.35/ tools/buildtime/mockrunner-0.35/lib/ tools/buildtime/tomcat-4.1.24/ tools/buildtime/xdoclet-1.2/ tools/buildtime/xdoclet-1.2/lib/ tools/hibernate-2.1/ tools/hibernate-2.1/lib/ tools/lib/ tools/standard-1.0.3/ tools/standard-1.0.3/lib/ tools/standard-1.0.3/tld/ tools/struts-1.2.4/ tools/struts-1.2.4/lib/ web/ web/WEB-INF/ web/WEB-INF/classes/ web/WEB-INF/classes/flavors/ web/WEB-INF/classes/themes/ web/bookmarks/ web/editor/ web/editor/images/ web/images/ web/images/editor/ web/images/midas/ web/images/preview/ web/images/smileys/ web/planet/ web/tags/ web/templates/ web/theme/ web/theme/images/ web/theme/lavender/ web/theme/scripts/ web/theme/scripts/classes/ web/themes/ web/themes/basic/ web/themes/berkley/ web/themes/berkley/images/ web/themes/brushedmetal/ web/themes/brushedmetal/images/ web/themes/cheb/ web/themes/cheb/images/ web/themes/cheb/scripts/ web/themes/clean/ web/themes/currency-i18n/ web/themes/currency-i18n/images/ web/themes/currency/ web/themes/currency/images/ web/themes/grey2/ web/themes/moonshine/ web/themes/movablemanila/ web/themes/movablemanila/images/ web/themes/pacifica/ web/themes/robot/ web/themes/rolling/ web/themes/rolling/images/ web/themes/sotto/ web/themes/sotto/images/ web/themes/sotto/styles/ web/themes/sunsets/ web/themes/sunsets/images/ web/themes/sunsets/scripts/ web/themes/sunsets/styles/ web/themes/werner/ web/themes/x2/ web/themes/x2/images/ web/themes/x2/scripts/ web/themes/x2/styles/ web/weblog/ web/website/
Date Thu, 09 Jun 2005 03:19:20 GMT
Added: incubator/roller/trunk/src/org/roller/pojos/AutoPingData.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/roller/pojos/AutoPingData.java?rev=189695&view=auto
==============================================================================
--- incubator/roller/trunk/src/org/roller/pojos/AutoPingData.java (added)
+++ incubator/roller/trunk/src/org/roller/pojos/AutoPingData.java Wed Jun  8 20:18:46 2005
@@ -0,0 +1,171 @@
+/*
+ * Copyright (c) 2005
+ * Anil R. Gangolli. All rights reserved.
+ *
+ * Distributed with the Roller Weblogger under the terms of the Roller Software License
+ */
+
+package org.roller.pojos;
+
+import java.io.Serializable;
+
+/**
+ * Automatic ping configuration.  An instance of this class relates a website and ping target; it indicates that the specified
+ * ping target should be pinged when the corresponding website is changed.  Pinging can be restricted to changes to
+ * specific categories on the website by instances of the {@link PingCategoryRestrictionData} object.  In the absence of
+ * any category restrictions, the ping target is pinged whenever the corresponding website changes.
+ *
+ * @author Anil Gangolli anil@busybuddha.org
+ * @ejb:bean name="AutoPingData"
+ * @hibernate.class table="autoping"
+ */
+public class AutoPingData extends PersistentObject implements Serializable
+{
+    protected String id;
+    protected PingTargetData pingTarget;
+    protected WebsiteData website;
+
+    static final long serialVersionUID = -9105985454111986435L;
+    
+    /**
+     * Default constructor.  Leaves all fields null.  Required for bean compliance.
+     */
+    public AutoPingData()
+    {
+    }
+
+    /**
+     * Constructor.
+     *
+     * @param id         unique id (primary key) for this instance
+     * @param pingtarget ping target that should be pinged
+     * @param website    website to which this configuration applies
+     */
+    public AutoPingData(String id, PingTargetData pingtarget, WebsiteData website)
+    {
+        this.id = id;
+        this.website = website;
+        this.pingTarget = pingtarget;
+    }
+
+    /**
+     * Setter needed by RollerImpl.storePersistentObject()
+     */
+    public void setData(PersistentObject vo)
+    {
+        AutoPingData other = (AutoPingData)vo;
+        id = other.id;
+        website = other.website;
+        pingTarget = other.pingTarget;
+    }
+
+    /**
+     * Get the unique id (primary key) of this object.
+     *
+     * @return the unique id of this object. -- struts.validator type="required" msgkey="errors.required"
+     * @ejb:persistent-field
+     * @hibernate.id column="id" type="string" generator-class="uuid.hex" unsaved-value="null"
+     */
+    public String getId()
+    {
+        return id;
+    }
+
+    /**
+     * Set the unique id (primary key) of this object
+     *
+     * @param id
+     * @ejb:persistent-field
+     */
+    public void setId(String id)
+    {
+        this.id = id;
+    }
+
+    /**
+     * Get the website.  Get the website whose changes should result in a ping to the ping target specified by this
+     * object.
+     *
+     * @return the website.
+     * @ejb:persistent-field
+     * @hibernate.many-to-one column="websiteid" cascade="none" not-null="false"
+     */
+    public WebsiteData getWebsite()
+    {
+        return website;
+    }
+
+    /**
+     * Set the website.  Set the website whose changes should result in a ping to the ping target specified by this
+     * object.
+     *
+     * @param website the website.
+     * @ejb:persistent-field
+     */
+    public void setWebsite(WebsiteData website)
+    {
+        this.website = website;
+    }
+
+    /**
+     * Get the ping target.  Get the target to be pinged when the corresponding website changes.
+     *
+     * @return the target to be pinged.
+     * @ejb:persistent-field
+     * @hibernate.many-to-one column="pingtargetid" cascade="none" not-null="false"
+     */
+    public PingTargetData getPingTarget()
+    {
+        return pingTarget;
+    }
+
+    /**
+     * Set the ping target.  Set the target to be pinged when the corresponding website changes.
+     *
+     * @param pingtarget the target to be pinged.
+     * @ejb:persistent-field
+     */
+    public void setPingTarget(PingTargetData pingtarget)
+    {
+        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;
+
+        if (id != null ? !id.equals(autoPingData.id) : autoPingData.id != null) return false;
+        if (pingTarget != null ? !pingTarget.equals(autoPingData.pingTarget) : autoPingData.pingTarget != null) return false;
+        if (website != null ? !website.equals(autoPingData.website) : autoPingData.website != 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 java.lang.Object#toString()
+     */
+    public String toString()
+    {
+        return "AutoPingData{" +
+            "id='" + id + "'" +
+            ", pingTarget=" + pingTarget +
+            ", website= " + (website == null ? "null" : "{id='" + website.getId() + "', user='" + website.getUser().getUserName() + "'} ") +
+            "}";
+    }
+}

Added: incubator/roller/trunk/src/org/roller/pojos/BookmarkComparator.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/roller/pojos/BookmarkComparator.java?rev=189695&view=auto
==============================================================================
--- incubator/roller/trunk/src/org/roller/pojos/BookmarkComparator.java (added)
+++ incubator/roller/trunk/src/org/roller/pojos/BookmarkComparator.java Wed Jun  8 20:18:46 2005
@@ -0,0 +1,33 @@
+package org.roller.pojos;
+
+import java.io.Serializable;
+import java.util.Comparator;
+
+public class BookmarkComparator implements Comparator, Serializable
+{
+    static final long serialVersionUID = 4009699640952161148L;
+    
+    public int compare(Object val1, Object val2)
+    throws ClassCastException
+    {
+        BookmarkData bd1 = (BookmarkData)val1;
+        BookmarkData bd2 = (BookmarkData)val2;
+        int priority1 = bd1.getPriority().intValue();
+        int priority2 = bd2.getPriority().intValue();
+
+        if (priority1 > priority2)
+        {
+            return 1;
+        }
+        else if (priority1 < priority2)
+        {
+            return -1;
+        }
+
+        // if priorities are the same, return
+        // results of String.compareTo()
+        return bd1.getName().compareTo(bd2.getName());
+
+    }
+
+}

Added: incubator/roller/trunk/src/org/roller/pojos/BookmarkData.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/roller/pojos/BookmarkData.java?rev=189695&view=auto
==============================================================================
--- incubator/roller/trunk/src/org/roller/pojos/BookmarkData.java (added)
+++ incubator/roller/trunk/src/org/roller/pojos/BookmarkData.java Wed Jun  8 20:18:46 2005
@@ -0,0 +1,428 @@
+package org.roller.pojos;
+
+import org.roller.RollerException;
+import org.roller.model.BookmarkManager;
+import org.roller.model.Roller;
+import org.roller.model.RollerFactory;
+
+import java.io.Serializable;
+
+/**
+ * <p>Represents a single URL in a user's favorite web-bookmarks collection.
+ * Don't construct one of these yourself, instead use the create method in 
+ * the your BookmarkManager implementation.</p>
+ *
+ * @ejb:bean name="BookmarkData"
+ * 
+ * @struts.form include-all="true"
+ *    extends="org.apache.struts.validator.ValidatorForm"
+ * 
+ * @hibernate.class table="bookmark"
+ * hibernate.jcs-cache usage="read-write" 
+ */
+public class BookmarkData extends org.roller.pojos.PersistentObject
+    implements Serializable, Comparable
+{
+    static final long serialVersionUID = 2315131256728236003L;
+    
+    protected FolderData folder;
+
+    protected String id = null;
+    protected String name;
+    protected String description;
+    protected String url;
+    protected Integer weight;
+    protected Integer priority;
+    protected String image;
+    protected String feedUrl;  
+    
+    protected BookmarkManager bookmarkManager = null;
+
+    //----------------------------------------------------------- Constructors
+    
+    /** Default constructor, for use in form beans only. */
+    public BookmarkData()
+    {
+    }
+    
+    public BookmarkData(
+        FolderData parent,
+        String name, 
+        String desc, 
+        String url, 
+        String feedUrl,
+        Integer weight, 
+        Integer priority, 
+        String image)
+    {
+        this.folder = parent;
+        this.name = name;
+        this.description = desc;
+        this.url = url;
+        this.feedUrl = feedUrl;
+        this.weight = weight;
+        this.priority = priority;
+        this.image = image;   
+    }
+
+    /** For use by BookmarkManager implementations only. */
+    public BookmarkData(BookmarkManager bmgr)
+    {
+        bookmarkManager = bmgr;
+    }
+
+    //------------------------------------------------------------- Attributes
+    
+    /** 
+     * @ejb:persistent-field 
+     * 
+     * @hibernate.id column="id" type="string"
+     *     generator-class="uuid.hex" unsaved-value="null"
+     */
+    public String getId()
+    {
+        return this.id;
+    }
+
+    /** @ejb:persistent-field */
+    public void setId(String id)
+    {
+        this.id = id;
+    }
+
+    /** 
+     * Name of bookmark.
+     * 
+     * @struts.validator type="required" msgkey="errors.required"
+     * @struts.validator-args arg0resource="bookmarkForm.name"
+     * 
+     * @ejb:persistent-field 
+     * 
+     * @hibernate.property column="name" non-null="true" unique="false"
+     */
+    public String getName()
+    {
+        return this.name;
+    }
+
+    /** @ejb:persistent-field */
+    public void setName(String name)
+    {
+        this.name = name;
+    }
+
+    /** 
+     * Description of bookmark.
+     * 
+     * @ejb:persistent-field 
+     * 
+     * @hibernate.property column="description" non-null="true" unique="false"
+     */
+    public String getDescription()
+    {
+        return this.description;
+    }
+
+    /** @ejb:persistent-field */
+    public void setDescription(String description)
+    {
+        this.description = description;
+    }
+
+    /** 
+     * URL of bookmark.
+     * 
+     * @ejb:persistent-field 
+     * 
+     * @hibernate.property column="url" non-null="true" unique="false"
+     */
+    public String getUrl()
+    {
+        return this.url;
+    }
+
+    /** @ejb:persistent-field */
+    public void setUrl(String url)
+    {
+        this.url = url;
+    }
+
+    /** 
+     * Weight indicates prominence of link
+     * 
+     * @struts.validator type="required" msgkey="errors.required"
+     * @struts.validator type="integer" msgkey="errors.integer"
+     * @struts.validator-args arg0resource="bookmarkForm.weight"
+     * 
+     * @ejb:persistent-field 
+     * 
+     * @hibernate.property column="weight" non-null="true" unique="false"
+     */
+    public java.lang.Integer getWeight()
+    {
+        return this.weight;
+    }
+
+    /** @ejb:persistent-field */
+    public void setWeight(java.lang.Integer weight)
+    {
+        this.weight = weight;
+    }
+
+    /** 
+     * Priority determines order of display 
+     * 
+     * @struts.validator type="required" msgkey="errors.required"
+     * @struts.validator type="integer" msgkey="errors.integer"
+     * @struts.validator-args arg0resource="bookmarkForm.priority"
+     * 
+     * @ejb:persistent-field 
+     * 
+     * @hibernate.property column="priority" non-null="true" unique="false"
+     */
+    public java.lang.Integer getPriority()
+    {
+        return this.priority;
+    }
+
+    /** @ejb:persistent-field */
+    public void setPriority(java.lang.Integer priority)
+    {
+        this.priority = priority;
+    }
+
+    /** 
+     * @ejb:persistent-field 
+     * 
+     * @hibernate.property column="image" non-null="true" unique="false"
+     */
+    public String getImage()
+    {
+        return this.image;
+    }
+
+    /** @ejb:persistent-field */
+    public void setImage(String image)
+    {
+        this.image = image;
+    }
+
+    /** 
+     * @ejb:persistent-field 
+     * 
+     * @hibernate.property column="feedurl" non-null="true" unique="false"
+     */
+    public String getFeedUrl()
+    {
+        return this.feedUrl;
+    }
+
+    /** @ejb:persistent-field */
+    public void setFeedUrl(String feedUrl)
+    {
+        this.feedUrl = feedUrl;
+    }
+
+    //---------------------------------------------------------- Relationships
+    
+    /** 
+     * @ejb:persistent-field 
+     * @hibernate.many-to-one column="folderid" cascade="none" not-null="true"
+     */
+    public org.roller.pojos.FolderData getFolder()
+    {
+        return this.folder;
+    }
+
+    /** @ejb:persistent-field */
+    public void setFolder(org.roller.pojos.FolderData folder)
+    {
+        this.folder = folder;
+    }
+
+    //------------------------------------------------------- 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.id == null);
+            }
+            else
+            {
+                lEquals = lEquals && this.id.equals(lTest.id);
+            }
+
+            if (this.name == null)
+            {
+                lEquals = lEquals && (lTest.name == null);
+            }
+            else
+            {
+                lEquals = lEquals && this.name.equals(lTest.name);
+            }
+
+            if (this.description == null)
+            {
+                lEquals = lEquals && (lTest.description == null);
+            }
+            else
+            {
+                lEquals = lEquals && 
+                          this.description.equals(lTest.description);
+            }
+
+            if (this.url == null)
+            {
+                lEquals = lEquals && (lTest.url == null);
+            }
+            else
+            {
+                lEquals = lEquals && this.url.equals(lTest.url);
+            }
+
+            if (this.weight == null)
+            {
+                lEquals = lEquals && (lTest.weight == null);
+            }
+            else
+            {
+                lEquals = lEquals && this.weight.equals(lTest.weight);
+            }
+
+            if (this.priority == null)
+            {
+                lEquals = lEquals && (lTest.priority == null);
+            }
+            else
+            {
+                lEquals = lEquals && this.priority.equals(lTest.priority);
+            }
+
+//            if (this.mFolder == null)
+//            {
+//                lEquals = lEquals && (lTest.mFolder == null);
+//            }
+//            else
+//            {
+//                lEquals = lEquals && this.mFolder.equals(lTest.mFolder);
+//            }
+//
+            if (this.image == null)
+            {
+                lEquals = lEquals && (lTest.image == null);
+            }
+            else
+            {
+                lEquals = lEquals && this.image.equals(lTest.image);
+            }
+
+            if (this.feedUrl == null)
+            {
+                lEquals = lEquals && (lTest.feedUrl == null);
+            }
+            else
+            {
+                lEquals = lEquals && this.feedUrl.equals(lTest.feedUrl);
+            }
+
+            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;
+    }
+
+    /**
+     * Setter is needed in RollerImpl.storePersistentObject()
+     */
+    public void setData(org.roller.pojos.PersistentObject otherData)
+    {
+        this.id = ((BookmarkData) otherData).id;
+        this.name = ((BookmarkData) otherData).name;
+        this.description = ((BookmarkData) otherData).description;
+        this.url = ((BookmarkData) otherData).url;
+        this.weight = ((BookmarkData) otherData).weight;
+        this.priority = ((BookmarkData) otherData).priority;
+        this.folder = ((BookmarkData) otherData).folder;
+        this.image = ((BookmarkData) otherData).image;
+        this.feedUrl = ((BookmarkData) otherData).feedUrl;
+    }
+
+    /** 
+     * @see java.lang.Comparable#compareTo(java.lang.Object)
+     */
+    public int compareTo(Object o)
+    {
+        return bookmarkComparator.compare(this, o);
+    }
+    
+    private BookmarkComparator bookmarkComparator = new BookmarkComparator();
+
+    /**
+     * @param impl
+     */
+    public void setBookmarkManager(BookmarkManager bmgr)
+    {
+        bookmarkManager = bmgr;
+    }
+
+    public boolean canSave() throws RollerException
+    {
+        Roller roller = RollerFactory.getRoller();
+        if (roller.getUser().equals(UserData.SYSTEM_USER)) 
+        {
+            return true;
+        }
+        if (roller.getUser().equals(getFolder().getWebsite().getUser()))
+        {
+            return true;
+        }
+        return false;
+    }
+}
\ No newline at end of file

Added: incubator/roller/trunk/src/org/roller/pojos/CommentData.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/roller/pojos/CommentData.java?rev=189695&view=auto
==============================================================================
--- incubator/roller/trunk/src/org/roller/pojos/CommentData.java (added)
+++ incubator/roller/trunk/src/org/roller/pojos/CommentData.java Wed Jun  8 20:18:46 2005
@@ -0,0 +1,294 @@
+package org.roller.pojos;
+
+import org.roller.util.PojoUtil;
+
+/**
+ * Weblogentry Comment bean.
+ * @author Lance Lavandowska
+ *
+ * @ejb:bean name="CommentData"
+ * @struts.form include-all="true"
+ * 
+ * @hibernate.class table="comment"  
+ * hibernate.jcs-cache usage="read-write"
+ */
+public class CommentData extends org.roller.pojos.PersistentObject
+    implements java.io.Serializable
+{
+    static final long serialVersionUID = -6668122596726478462L;
+    protected java.lang.String id;
+    protected java.lang.String name;
+    protected java.lang.String email;
+    protected java.lang.String url;
+    protected java.lang.String content;
+    protected java.sql.Timestamp postTime;
+    protected WeblogEntryData mWeblogEntry;
+    protected Boolean spam;
+    protected Boolean notify;
+	protected String remoteHost;
+
+    public CommentData()
+    {
+        spam = Boolean.FALSE;
+    }
+
+    public CommentData(java.lang.String id, WeblogEntryData entry, 
+                       java.lang.String name, java.lang.String email, 
+                       java.lang.String url, java.lang.String content, 
+                       java.sql.Timestamp postTime, 
+                       Boolean spam, Boolean notify)
+    {
+        this.id = id;
+        this.name = name;
+        this.email = email;
+        this.url = url;
+        this.content = content;
+        this.postTime = postTime;
+        this.spam = spam;
+        this.notify = notify;
+
+        mWeblogEntry = entry;
+    }
+
+    public CommentData(CommentData otherData)
+    {
+        this.id = otherData.id;
+        this.name = otherData.name;
+        this.email = otherData.email;
+        this.url = otherData.url;
+        this.content = otherData.content;
+        this.postTime = otherData.postTime;
+        this.spam = otherData.spam;
+        this.notify = otherData.notify;
+        
+        mWeblogEntry = otherData.mWeblogEntry;
+    }
+
+    /** 
+     * @ejb:persistent-field 
+     * @hibernate.id column="id" type="string"
+     *  generator-class="uuid.hex" unsaved-value="null"
+     */
+    public java.lang.String getId()
+    {
+        return this.id;
+    }
+
+    /** @ejb:persistent-field */
+    public void setId(java.lang.String id)
+    {
+        this.id = id;
+    }
+
+    /** 
+     * @ejb:persistent-field 
+     * @hibernate.many-to-one column="entryid" cascade="none" not-null="true"
+     */
+    public WeblogEntryData getWeblogEntry()
+    {
+        return mWeblogEntry;
+    }
+
+    /** @ejb:persistent-field */
+    public void setWeblogEntry(WeblogEntryData entry)
+    {
+        mWeblogEntry = entry;
+    }
+
+    /** 
+     * @ejb:persistent-field 
+     * @hibernate.property column="name" non-null="true" unique="false"
+     */
+    public java.lang.String getName()
+    {
+        return this.name;
+    }
+
+    /** @ejb:persistent-field */
+    public void setName(java.lang.String name)
+    {
+        this.name = name;
+    }
+
+    /** 
+     * Email
+     * @ejb:persistent-field 
+     * @hibernate.property column="email" non-null="true" unique="false"
+     */
+    public java.lang.String getEmail()
+    {
+        return this.email;
+    }
+
+    /** @ejb:persistent-field */
+    public void setEmail(java.lang.String email)
+    {
+        this.email = email;
+    }
+
+    /** 
+     * @ejb:persistent-field 
+     * @hibernate.property column="url" non-null="true" unique="false"
+     */
+    public java.lang.String getUrl()
+    {
+        return this.url;
+    }
+
+    /** @ejb:persistent-field */
+    public void setUrl(java.lang.String url)
+    {
+        this.url = url;
+    }
+
+    /** 
+     * @ejb:persistent-field 
+     * @hibernate.property column="content" non-null="true" unique="false"
+     */
+    public java.lang.String getContent()
+    {
+        return this.content;
+    }
+
+    /** @ejb:persistent-field */
+    public void setContent(java.lang.String content)
+    {
+        this.content = content;
+    }
+
+    /** 
+     * @ejb:persistent-field 
+     * @hibernate.property column="posttime" non-null="true" unique="false"
+     */
+    public java.sql.Timestamp getPostTime()
+    {
+        return this.postTime;
+    }
+
+    /** @ejb:persistent-field */
+    public void setPostTime(java.sql.Timestamp postTime)
+    {
+        this.postTime = postTime;
+    }
+
+    /**
+     * @ejb:persistent-field
+     * @hibernate.property column="spam" non-null="false" unique="false"
+     */
+    public Boolean getSpam()
+    {
+        return this.spam;
+    }
+
+    /** @ejb:persistent-field */
+    public void setSpam(Boolean spam)
+    {
+        this.spam = spam;
+    }
+
+    /**
+     * @ejb:persistent-field
+     * @hibernate.property column="notify" non-null="false" unique="false"
+     */
+    public Boolean getNotify()
+    {
+        return this.notify;
+    }
+
+    /** @ejb:persistent-field */
+    public void setNotify(Boolean notify)
+    {
+        this.notify = notify;
+    }
+
+	/**
+     * @ejb:persistent-field 
+	 */
+	public void setRemoteHost(String remoteHost) {
+		this.remoteHost = remoteHost;
+    }
+	
+	/**
+     * @ejb:persistent-field 
+     * @hibernate.property column="remotehost" non-null="true" unique="false"
+	 */
+	public String getRemoteHost() {
+		return this.remoteHost;
+	}
+
+	public String toString()
+    {
+        StringBuffer str = new StringBuffer("{");
+
+        str.append("id=" + id + " " + 
+                   "name=" + name + " " + 
+                   "email=" + email + " " + 
+                   "url=" + url + " " + 
+                   "content=" + content + " " + 
+                   "postTime=" + postTime + " " + 
+                   "spam=" + spam +
+                   "notify=" + notify);
+        str.append('}');
+
+        return (str.toString());
+    }
+
+    public boolean equals(Object pOther)
+    {
+        if (pOther instanceof CommentData)
+        {
+            CommentData lTest = (CommentData) pOther;
+            boolean lEquals = true;
+
+            lEquals = PojoUtil.equals(lEquals, this.id, lTest.id);
+            lEquals = PojoUtil.equals(lEquals, this.mWeblogEntry, lTest.mWeblogEntry);
+            lEquals = PojoUtil.equals(lEquals, this.name, lTest.name);
+            lEquals = PojoUtil.equals(lEquals, this.email, lTest.email);
+            lEquals = PojoUtil.equals(lEquals, this.url, lTest.url);
+            lEquals = PojoUtil.equals(lEquals, this.content, lTest.content);
+            lEquals = PojoUtil.equals(lEquals, this.postTime, lTest.postTime);
+            lEquals = PojoUtil.equals(lEquals, this.spam, lTest.spam);
+            lEquals = PojoUtil.equals(lEquals, this.notify, lTest.notify);
+
+            return lEquals;
+        }
+        else
+        {
+            return false;
+        }
+    }
+
+    public int hashCode()
+    {
+        int result = 17;
+        result = PojoUtil.addHashCode(result, this.id);
+        result = PojoUtil.addHashCode(result, this.mWeblogEntry);
+        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.spam);
+        result = PojoUtil.addHashCode(result, this.notify);
+
+        return result;
+    }
+
+    /**
+     * Setter is needed in RollerImpl.storePersistentObject()
+     */
+    public void setData(org.roller.pojos.PersistentObject otherData)
+    {
+        CommentData otherComment = (CommentData) otherData;
+        this.id = otherComment.id;
+        this.mWeblogEntry = otherComment.mWeblogEntry;
+        this.name = otherComment.name;
+        this.email = otherComment.email;
+        this.url = otherComment.url;
+        this.content = otherComment.content;
+        this.postTime = otherComment.postTime;
+        this.spam = otherComment.spam;
+        this.notify = otherComment.notify;
+    }
+
+}
\ No newline at end of file

Added: incubator/roller/trunk/src/org/roller/pojos/EntryAttributeData.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/roller/pojos/EntryAttributeData.java?rev=189695&view=auto
==============================================================================
--- incubator/roller/trunk/src/org/roller/pojos/EntryAttributeData.java (added)
+++ incubator/roller/trunk/src/org/roller/pojos/EntryAttributeData.java Wed Jun  8 20:18:46 2005
@@ -0,0 +1,110 @@
+package org.roller.pojos;
+/**
+ * @author David M Johnson
+ * @ejb:bean name="EntryAttribute"
+ * @hibernate.class table="entryattribute" 
+ */
+public class EntryAttributeData extends PersistentObject implements java.lang.Comparable
+{
+    protected String id;
+    protected WeblogEntryData entry;
+    protected String name;
+    protected String value;
+    
+    public EntryAttributeData()
+    {
+    }
+
+    public EntryAttributeData(
+        String id,
+        WeblogEntryData entry,
+        String name,
+        String value)
+    {
+        this.id = id;
+        this.entry = entry;
+        this.name = name;
+        this.value = value;
+    }
+
+    public EntryAttributeData(EntryAttributeData otherData)
+    {
+        this.id = otherData.id;
+        this.entry = otherData.entry;
+        this.name = otherData.name;
+        this.value = otherData.value;
+    }
+
+    /**
+     * @ejb:persistent-field 
+     * @hibernate.id column="id" type="string" 
+     *    generator-class="uuid.hex" unsaved-value="null"
+     */
+    public java.lang.String getId()
+    {
+        return this.id;
+    }
+    /** @ejb:persistent-field */
+    public void setId(java.lang.String id)
+    {
+        this.id = id;
+    }
+
+    /**
+    	* Setter is needed in RollerImpl.storePersistentObject()
+     */
+    public void setData(org.roller.pojos.PersistentObject otherData)
+    {
+        this.id = otherData.getId();
+        this.entry = ((EntryAttributeData) otherData).entry;
+        this.name = ((EntryAttributeData) otherData).name;
+        this.value = ((EntryAttributeData) otherData).value;
+    }
+
+    /** 
+     * @ejb:persistent-field 
+     * @hibernate.many-to-one column="entryid" cascade="none" not-null="true"
+     */
+    public WeblogEntryData getEntry()
+    {
+        return entry;
+    }
+    /** @ejb:persistent-field */ 
+    public void setEntry(WeblogEntryData entry)
+    {
+        this.entry = entry;
+    }
+
+    /** 
+     * @ejb:persistent-field 
+     * @hibernate.property column="name" non-null="true" unique="false"
+     */
+    public String getName()
+    {
+        return name;
+    }
+    /** @ejb:persistent-field */ 
+    public void setName(String name)
+    {
+        this.name = name;
+    }
+    
+    /** 
+     * @ejb:persistent-field 
+     * @hibernate.property column="value" non-null="true" unique="false"
+     */
+    public String getValue()
+    {
+        return value;
+    }
+    /** @ejb:persistent-field */ 
+    public void setValue(String value)
+    {
+        this.value = value;
+    }
+
+    public int compareTo(Object o) {
+        EntryAttributeData att = (EntryAttributeData)o;
+        return getName().compareTo(att.getName());
+    }
+}

Added: incubator/roller/trunk/src/org/roller/pojos/FolderAssoc.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/roller/pojos/FolderAssoc.java?rev=189695&view=auto
==============================================================================
--- incubator/roller/trunk/src/org/roller/pojos/FolderAssoc.java (added)
+++ incubator/roller/trunk/src/org/roller/pojos/FolderAssoc.java Wed Jun  8 20:18:46 2005
@@ -0,0 +1,138 @@
+package org.roller.pojos;
+
+
+/**
+ * @author David M Johnson
+ *
+ * @ejb:bean name="FolderAssoc"
+ * @hibernate.class table="folderassoc" 
+ *     hibernate.jcs-cache usage="read-write"
+ */
+public class FolderAssoc extends PersistentObject
+    implements Assoc
+{
+    static final long serialVersionUID = 882325251670705915L;
+    public static final String PARENT = "PARENT";
+    public static final String GRANDPARENT = "GRANDPARENT";
+
+    protected String id;
+    protected FolderData folder;
+    protected FolderData ancestor;
+    protected java.lang.String relation;
+    
+    public FolderAssoc()
+    {
+    }
+
+    public FolderAssoc(
+        String id,
+        FolderData folder,
+        FolderData ancestor,
+        String relation)
+    {
+        this.id = id;
+        this.folder = folder;
+        this.ancestor = ancestor;
+        this.relation = relation;
+    }
+
+    public FolderAssoc(FolderAssoc otherData)
+    {
+        this.id = otherData.id;
+        this.folder = otherData.folder;
+        this.ancestor = otherData.ancestor;
+        this.relation = otherData.relation;
+    }
+
+    /**
+     * @ejb:persistent-field 
+     * @hibernate.id column="id" type="string"
+     *  generator-class="uuid.hex" unsaved-value="null"
+     */
+    public java.lang.String getId()
+    {
+        return this.id;
+    }
+    /** @ejb:persistent-field */
+    public void setId(java.lang.String id)
+    {
+        this.id = id;
+    }
+
+    /**
+    	* Setter is needed in RollerImpl.storePersistentObject()
+     */
+    public void setData(org.roller.pojos.PersistentObject otherData)
+    {
+        this.id = otherData.getId();
+        this.folder = ((FolderAssoc)otherData).getFolder();
+        this.ancestor = ((FolderAssoc)otherData).getAncestorFolder();
+        this.relation = ((FolderAssoc)otherData).getRelation();
+    }
+
+    /** 
+     * @ejb:persistent-field 
+     * @hibernate.many-to-one column="ancestorid" cascade="none"
+     */
+    public FolderData getAncestorFolder()
+    {
+        return ancestor;
+    }
+    
+    /** @ejb:persistent-field */ 
+    public void setAncestorFolder(FolderData data)
+    {
+        ancestor = data;
+    }
+
+    /** 
+     * @ejb:persistent-field 
+     * @hibernate.many-to-one column="folderid" cascade="none" not-null="true"
+     */
+    public FolderData getFolder()
+    {
+        return folder;
+    }
+
+    /** @ejb:persistent-field */ 
+    public void setFolder(FolderData data)
+    {
+        folder = data;
+    }
+
+    /** 
+     * @ejb:persistent-field 
+     * @hibernate.property column="relation" non-null="true" unique="false"
+     */
+    public java.lang.String getRelation()
+    {
+        return relation;
+    }
+
+    /** @ejb:persistent-field */ 
+    public void setRelation(java.lang.String string)
+    {
+        relation = string;
+    }
+
+    public HierarchicalPersistentObject getObject()
+    {
+        return getFolder();
+    }
+
+    public void setObject(HierarchicalPersistentObject hpo)
+    {
+        setFolder((FolderData)hpo);
+    }
+
+    public HierarchicalPersistentObject getAncestor()
+    {
+        return getAncestorFolder();
+    }
+
+    public void setAncestor(HierarchicalPersistentObject hpo)
+    {
+        setAncestorFolder((FolderData)hpo);
+    }
+
+}

Added: incubator/roller/trunk/src/org/roller/pojos/FolderData.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/roller/pojos/FolderData.java?rev=189695&view=auto
==============================================================================
--- incubator/roller/trunk/src/org/roller/pojos/FolderData.java (added)
+++ incubator/roller/trunk/src/org/roller/pojos/FolderData.java Wed Jun  8 20:18:46 2005
@@ -0,0 +1,503 @@
+package org.roller.pojos;
+
+import java.io.Serializable;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+import java.util.TreeSet;
+
+import org.roller.RollerException;
+import org.roller.business.PersistenceStrategy;
+import org.roller.model.BookmarkManager;
+import org.roller.model.Roller;
+import org.roller.model.RollerFactory;
+
+/**
+ * <p>Folder that holds Bookmarks and other Folders. A Roller Website has a 
+ * set of Folders (there is no one root folder) and each Folder may contain 
+ * Folders or Bookmarks. Don't construct one of these yourself, instead use
+ * the create method in your BookmarkManager implementation.</p>
+ *
+ * @struts.form include-all="true"
+ *    extends="org.apache.struts.validator.ValidatorForm"
+ * @ejb:bean name="FolderData"
+ * 
+ * @hibernate.class table="folder"
+ * hibernate.jcs-cache usage="read-write"
+ */
+public class FolderData extends HierarchicalPersistentObject
+    implements Serializable, Comparable
+{
+    static final long serialVersionUID = -6272468884763861944L;
+    
+    protected Set bookmarks = new TreeSet();
+    protected List folders = null;
+    protected WebsiteData website;
+    
+    protected String id;
+    protected String name;
+    protected String description;
+    protected String path;
+    
+    //----------------------------------------------------------- Constructors
+    
+    /** For use by BookmarkManager implementations only. */
+    public FolderData()
+    {
+    }
+    
+    public FolderData(
+        FolderData parent,
+        String name, 
+        String desc, 
+        WebsiteData website)
+    {
+        mNewParent = parent;
+        this.name = name;
+        this.description = desc;
+        this.website = website;
+    }
+
+    public void setData(org.roller.pojos.PersistentObject otherData)
+    {
+        mNewParent = ((FolderData) otherData).mNewParent;
+        this.bookmarks = ((FolderData) otherData).bookmarks;
+        this.id = ((FolderData) otherData).id;
+        this.name = ((FolderData) otherData).name;
+        this.description = ((FolderData) otherData).description;
+        this.website = ((FolderData) otherData).website;
+    }
+
+    public void save() throws RollerException
+    {   
+        if (RollerFactory.getRoller().getBookmarkManager().isDuplicateFolderName(this))
+        {
+            throw new RollerException("Duplicate folder name");
+        }
+        super.save(); 
+    }
+    
+    /** 
+     * @see org.roller.pojos.HierarchicalPersistentObject#getAssocClass()
+     */
+    public Class getAssocClass()
+    {
+        return FolderAssoc.class;
+    }
+
+    /** 
+     * @see org.roller.pojos.HierarchicalPersistentObject#getObjectPropertyName()
+     */
+    public String getObjectPropertyName()
+    {
+        return "folder";
+    }
+
+    /** 
+     * @see org.roller.pojos.HierarchicalPersistentObject#getAncestorPropertyName()
+     */
+    public String getAncestorPropertyName()
+    {
+        return "ancestorFolder";
+    }
+
+    public boolean isInUse()
+    {
+        try
+        {
+            return RollerFactory.getRoller().getBookmarkManager().isFolderInUse(this); 
+        }
+        catch (RollerException e)
+        {
+            throw new RuntimeException(e);
+        }
+    }
+    
+    public boolean descendentOf(FolderData ancestor) 
+        throws RollerException
+    {
+        return RollerFactory.getRoller().getBookmarkManager().isDescendentOf(this, ancestor);
+    }
+
+    //------------------------------------------------------------- Attributes
+    
+    /** 
+     * @ejb:persistent-field 
+     * 
+     * @hibernate.id column="id" type="string"
+     *     generator-class="uuid.hex" unsaved-value="null"
+     */
+    public String getId()
+    {
+        return this.id;
+    }
+
+    /** @ejb:persistent-field */
+    public void setId(String id)
+    {
+        this.id = id;
+    }
+
+    /** 
+     * @struts.validator type="required" msgkey="errors.required"
+     * @struts.validator type="mask" msgkey="errors.noslashes"
+     * @struts.validator-var name="mask" value="${noslashes}"
+     * @struts.validator-args arg0resource="folderForm.name"
+     * 
+     * @ejb:persistent-field 
+     * 
+     * @hibernate.property column="name" non-null="true" unique="false"
+     */
+    public String getName()
+    {
+        return this.name;
+    }
+
+    /** @ejb:persistent-field */
+    public void setName(String name)
+    {
+        this.name = name;
+    }
+
+    /** 
+     * Description
+     * 
+     * @ejb:persistent-field 
+     * 
+     * @hibernate.property column="description" non-null="true" unique="false"
+     */
+    public String getDescription()
+    {
+        return this.description;
+    }
+
+    /** @ejb:persistent-field */
+    public void setDescription(String description)
+    {
+        this.description = description;
+    }
+
+    //---------------------------------------------------------- Relationships
+    
+    /** Get path to this bookmark folder. */
+    public String getPath() throws RollerException
+    {
+        if (mNewParent != null) 
+        {
+            throw new RollerException(
+                "Folder has a new parent and must be saved before getPath() will work");
+        }
+        
+        if (null == path)
+        {
+            path = RollerFactory.getRoller().getBookmarkManager().getPath(this);
+        }
+        return path;
+    }
+        
+    /** 
+     * @ejb:persistent-field 
+     * 
+     * @hibernate.many-to-one column="websiteid" cascade="none" not-null="true"
+     */
+    public WebsiteData getWebsite()
+    {
+        return website;
+    }
+
+    /** @ejb:persistent-field */
+    public void setWebsite( WebsiteData website )
+    {
+        this.website = website;
+    }
+
+    /** Return parent category, or null if category is root of hierarchy. */
+    public FolderData getParent() throws RollerException
+    {
+        if (mNewParent != null)
+        {
+            // Category has new parent, so return that
+            return (FolderData)mNewParent;
+        }
+        else if (getParentAssoc() != null)
+        {
+            // Return parent found in database
+            return ((FolderAssoc)getParentAssoc()).getAncestorFolder();
+        }
+        else 
+        {
+            return null;
+        }
+    }
+
+    /** Set parent category, database will be updated when object is saved. */
+    public void setParent(HierarchicalPersistentObject parent)
+    {
+        mNewParent = parent;
+    }
+
+    /** Query to get child categories of this category. */
+    public List getFolders() throws RollerException
+    {
+        if (folders == null)
+        {
+            folders = new LinkedList();
+            List childAssocs = getChildAssocs();
+            Iterator childIter = childAssocs.iterator();
+            while (childIter.hasNext())
+            {
+                FolderAssoc assoc =
+                    (FolderAssoc) childIter.next();
+                folders.add(assoc.getFolder());
+            }
+        }
+        return folders;
+    }
+
+    //------------------------------------------------------ Bookmark children
+    
+    /** 
+      * @ejb:persistent-field
+     * 
+     * @hibernate.set lazy="true" order-by="name" inverse="true" cascade="delete" 
+     * @hibernate.collection-key column="folderid" 
+     * @hibernate.collection-one-to-many class="org.roller.pojos.BookmarkData"
+     */
+    public Set getBookmarks()    
+    {
+        return this.bookmarks;
+    }
+
+    /** @ejb:persistent-field */
+    public void setBookmarks(Set bookmarks)
+    {
+        this.bookmarks = bookmarks;
+    }
+    
+    /** Store bookmark and add to folder */
+    public void addBookmark(BookmarkData bookmark) throws RollerException
+    {
+        bookmark.setFolder(this);
+        bookmarks.add(bookmark);  
+        bookmark.save();      
+    }
+
+    /** Remove boomkark from folder */
+    public void removeBookmark(BookmarkData bookmark)
+    {
+        bookmarks.remove(bookmark);
+        bookmark.setFolder(null);
+    }
+
+    /**
+     * @param subfolders
+     */
+    public List retrieveBookmarks(boolean subfolders) throws RollerException
+    {
+        BookmarkManager bmgr = RollerFactory.getRoller().getBookmarkManager();
+        return bmgr.retrieveBookmarks(this, subfolders);
+    }
+
+    /** 
+     * Move all bookmarks that exist in this folder and all
+     * subfolders of this folder to a single new folder.
+     */ 
+    public void moveContents(FolderData dest) throws RollerException
+    {
+        Iterator entries = retrieveBookmarks(true).iterator();
+        while (entries.hasNext())
+        {
+            BookmarkData bookmark = (BookmarkData) entries.next();
+            bookmark.setFolder(dest);
+            bookmark.save();
+        }
+    }
+
+    //------------------------------------------------------------------------
+
+    /** 
+     * @see org.roller.pojos.HierarchicalPersistentObject#createAssoc(
+     *    org.roller.pojos.HierarchicalPersistentObject, 
+     *    org.roller.pojos.HierarchicalPersistentObject, java.lang.String)
+     */
+    public Assoc createAssoc(
+        HierarchicalPersistentObject object, 
+        HierarchicalPersistentObject associatedObject, 
+        String relation) throws RollerException
+    {
+        BookmarkManager bmgr = RollerFactory.getRoller().getBookmarkManager();
+        return bmgr.createFolderAssoc(
+            (FolderData)object, 
+            (FolderData)associatedObject, 
+            relation);
+    }
+
+    //------------------------------------------------------- Good citizenship
+
+    public String toString()
+    {
+        StringBuffer str = new StringBuffer("{");
+        str.append(
+              "bookmarks=" + bookmarks + " " 
+            + "id=" + id + " " 
+            + "name=" + name + " " 
+            + "description=" + description);
+        str.append('}');
+        return (str.toString());
+    }
+
+    public boolean equals(Object pOther)
+    {
+        if (pOther instanceof FolderData)
+        {
+            FolderData lTest = (FolderData) pOther;
+            boolean lEquals = true;
+
+//            if (this.bookmarks == null)
+//            {
+//                lEquals = lEquals && (lTest.bookmarks == null);
+//            }
+//            else
+//            {
+//                lEquals = lEquals && this.bookmarks.equals(lTest.bookmarks);
+//            }
+
+            if (this.id == null)
+            {
+                lEquals = lEquals && (lTest.id == null);
+            }
+            else
+            {
+                lEquals = lEquals && this.id.equals(lTest.id);
+            }
+
+            if (this.name == null)
+            {
+                lEquals = lEquals && (lTest.name == null);
+            }
+            else
+            {
+                lEquals = lEquals && this.name.equals(lTest.name);
+            }
+
+            if (this.description == null)
+            {
+                lEquals = lEquals && (lTest.description == null);
+            }
+            else
+            {
+                lEquals = lEquals && 
+                          this.description.equals(lTest.description);
+            }
+
+            if (this.website == null)
+            {
+                lEquals = lEquals && (lTest.website == null);
+            }
+            else
+            {
+                lEquals = lEquals && this.website.equals(lTest.website);
+            }
+
+            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.website != null) ? this.website.hashCode() : 0);
+
+        return result;
+    }
+
+    /** 
+     * @see java.lang.Comparable#compareTo(java.lang.Object)
+     */
+    public int compareTo(Object o)
+    {
+        FolderData other = (FolderData)o;
+        return getName().compareTo(other.getName());
+    }
+
+    /** TODO: fix Struts form generation template so this is not needed. */
+    public void setAssocClassName(String dummy) {};
+    /** TODO: fix Struts form generation template so this is not needed. */
+    public void setObjectPropertyName(String dummy) {};
+    /** 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) {}
+    /** TODO: fix formbean generation so this is not needed. */
+    public void setInUse(boolean flag) {}
+
+    /** 
+     * @see org.roller.pojos.HierarchicalPersistentObject#getParentAssoc()
+     */
+    protected Assoc getParentAssoc() throws RollerException
+    {
+        return RollerFactory.getRoller().getBookmarkManager().getFolderParentAssoc(this);
+    }
+
+    /** 
+     * @see org.roller.pojos.HierarchicalPersistentObject#getChildAssocs()
+     */
+    protected List getChildAssocs() throws RollerException
+    {
+        return RollerFactory.getRoller().getBookmarkManager().getFolderChildAssocs(this);
+    }
+
+    /** 
+     * @see org.roller.pojos.HierarchicalPersistentObject#getAllDescendentAssocs()
+     */
+    public List getAllDescendentAssocs() throws RollerException
+    {
+        return RollerFactory.getRoller().getBookmarkManager().getAllFolderDecscendentAssocs(this);
+    }
+
+    /** 
+     * @see org.roller.pojos.HierarchicalPersistentObject#getAncestorAssocs()
+     */
+    public List getAncestorAssocs() throws RollerException
+    {
+        return RollerFactory.getRoller().getBookmarkManager().getFolderAncestorAssocs(this);
+    }
+    
+    protected void removeDescendent(
+            PersistenceStrategy pstrategy, PersistentObject po)  throws RollerException
+    {
+        /*FolderData folder = (FolderData)po;
+        Iterator bookmarks = folder.getBookmarks().iterator();
+        while (bookmarks.hasNext()) {
+            bookmarks.remove();
+        }*/
+        pstrategy.remove(po);
+    }
+
+    public boolean canSave() throws RollerException
+    {
+        Roller roller = RollerFactory.getRoller();
+        if (roller.getUser().equals(UserData.SYSTEM_USER)) 
+        {
+            return true;
+        }
+        if (roller.getUser().equals(getWebsite().getUser()))
+        {
+            return true;
+        }
+        return false;
+    }
+}

Added: incubator/roller/trunk/src/org/roller/pojos/HierarchicalPersistentObject.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/roller/pojos/HierarchicalPersistentObject.java?rev=189695&view=auto
==============================================================================
--- incubator/roller/trunk/src/org/roller/pojos/HierarchicalPersistentObject.java (added)
+++ incubator/roller/trunk/src/org/roller/pojos/HierarchicalPersistentObject.java Wed Jun  8 20:18:46 2005
@@ -0,0 +1,277 @@
+/*
+ * Created on Jan 13, 2004
+ */
+package org.roller.pojos;
+
+import org.roller.RollerException;
+import org.roller.business.PersistenceStrategy;
+import org.roller.model.RollerFactory;
+
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+
+/**
+ * Abstract base class for hierarchical persistent objects. Provides generic
+ * implementations of save and remove that know how to handle parents, children, 
+ * and descendents.
+ * 
+ * @author David M Johnson
+ */
+public abstract class HierarchicalPersistentObject extends PersistentObject
+{        
+    protected HierarchicalPersistentObject mNewParent = null;   
+    
+    /** Create an association between object and ancestor. */
+    protected abstract Assoc createAssoc(
+        HierarchicalPersistentObject object, 
+        HierarchicalPersistentObject ancestor,
+        String relation ) throws RollerException;
+        
+    /** Name of association class which must implement Assoc. */
+    public abstract Class getAssocClass();
+    
+    /** Name of object propery in association class */
+    public abstract String getObjectPropertyName();
+    
+    /** Name of ancestor propery in association class */
+    public abstract String getAncestorPropertyName();
+    
+    /** Set new parent - invalidates getPath() until object is saved(). */
+    public abstract void setParent(HierarchicalPersistentObject parent);
+    
+    protected abstract Assoc getParentAssoc() throws RollerException;
+
+    protected abstract List getChildAssocs() throws RollerException;
+    
+    public abstract List getAllDescendentAssocs() throws RollerException;
+    
+    public abstract List getAncestorAssocs() throws RollerException;
+    
+    /** Returns true if this object is in use and should not be deleted */
+    public abstract boolean isInUse() throws RollerException;   
+
+    /** Save this  object and ancestoral associations. */
+    public void save() throws RollerException
+    {
+        boolean fresh = (getId() == null || "".equals(getId()));
+        PersistenceStrategy pstrategy =
+            RollerFactory.getRoller().getPersistenceStrategy();
+        pstrategy.store(this);
+        if (fresh)
+        {
+            // Every fresh cat needs a parent assoc     
+            Assoc parentAssoc = createAssoc(
+                this, mNewParent, Assoc.PARENT);
+            parentAssoc.save();
+        }
+        else if (null != mNewParent)
+        {
+            // New parent must be added to parentAssoc
+            Assoc parentAssoc = getParentAssoc();
+            parentAssoc.setAncestor(mNewParent);
+            parentAssoc.save();
+        }
+        
+        // Clear out existing grandparent associations
+        Iterator ancestors = getAncestorAssocs().iterator();
+        while (ancestors.hasNext())
+        {
+            Assoc assoc = (Assoc)ancestors.next();
+            if (assoc.getRelation().equals(Assoc.GRANDPARENT))
+            {
+                assoc.remove();
+            }
+        }
+        
+        // Walk parent assocations, creating new grandparent associations
+        int count = 0;
+        Assoc currentAssoc = getParentAssoc();               
+        while (null != currentAssoc.getAncestor())
+        {
+            if (count > 0) 
+            {
+                Assoc assoc = createAssoc(this, 
+                    currentAssoc.getAncestor(), 
+                    Assoc.GRANDPARENT);
+                assoc.save();
+            }                
+            currentAssoc = currentAssoc.getAncestor().getParentAssoc();
+            count++;
+        }
+        
+        // all descendents must also reset their ancestor links
+//        Query childQuery = 
+//            pstrategy.getQueryFactory().createQuery(getAssocClass());
+//        childQuery.setWhere(
+//            pstrategy.getQueryFactory().createCondition(                
+//                pstrategy.getQueryFactory().createCondition(
+//                    getAncestorPropertyName(), Query.EQ, this),
+//                Query.AND,                        
+//                pstrategy.getQueryFactory().createCondition(
+//                    "relation", Query.EQ, Assoc.PARENT)));
+//        
+        Iterator children = getChildAssocs().iterator();
+        while (children.hasNext())
+        {
+            Assoc assoc = (Assoc) children.next();
+            
+            // resetting parent will cause reset of ancestors links
+            assoc.getObject().setParent(this);
+            
+            // recursively...
+            assoc.getObject().save();    
+        }
+        
+        // Clear new parent now that new parent has been saved
+        mNewParent = null;
+    }
+
+
+    /** Remove self, all decendent children and associations. */
+    public void remove() throws RollerException
+    {
+        PersistenceStrategy pstrategy =
+            RollerFactory.getRoller().getPersistenceStrategy();
+
+        // loop to remove all of my descendents and associations
+        List toRemove = new LinkedList();
+        Iterator catIter = this.getAllDescendentAssocs().iterator();
+        while (catIter.hasNext())
+        {
+            Assoc assoc = (Assoc)catIter.next();
+            HierarchicalPersistentObject hpo = assoc.getObject();
+            
+            // remove my descendent's parent and grandparent associations
+            Iterator ancestors = hpo.getAncestorAssocs().iterator();
+            while (ancestors.hasNext())
+            {
+                Assoc dassoc = (Assoc)ancestors.next();
+                dassoc.remove();
+            }
+            
+            // remove decendent association and descendents
+            assoc.remove();
+            toRemove.add(hpo);
+        }
+        Iterator removeIterator = toRemove.iterator();
+        while (removeIterator.hasNext())
+        {
+            PersistentObject po = (PersistentObject) removeIterator.next();
+            removeDescendent(pstrategy, po);
+        }
+
+        // loop to remove my own parent and grandparent associations
+        Iterator ancestors = getAncestorAssocs().iterator();
+        while (ancestors.hasNext())
+        {
+            Assoc assoc = (Assoc)ancestors.next();
+            assoc.remove();
+        }
+        
+        // remove myself
+        removeDescendent(pstrategy, this);        
+    }
+
+    /**
+     * Override this if you want to handle descendant removal yourself.
+     */
+    protected void removeDescendent(
+       PersistenceStrategy pstrategy, PersistentObject po)  throws RollerException
+    {
+        pstrategy.remove(po);
+    }
+
+    /** Should be needed only be manager objects */
+    public HierarchicalPersistentObject getNewParent()
+    {
+        return mNewParent;
+    }
+    
+//    /** Query database to get parent association. */
+//    protected Assoc getParentAssoc() 
+//        throws RollerException
+//    {
+//        Class clazz = getAssocClass();
+//        String objectColName = getObjectPropertyName();
+//
+//        QueryFactory factory =
+//          RollerFactory.getRoller().getPersistenceStrategy().getQueryFactory();
+//        Query query = factory.createQuery(clazz);
+//        
+//        Condition catCond = 
+//            factory.createCondition(objectColName, Query.EQ, this);
+//        Condition parentCond =
+//            factory.createCondition("relation",Query.EQ,Assoc.PARENT);
+//        query.setWhere(factory.createCondition(catCond, Query.AND, parentCond));
+//        List parents = query.execute();
+//        
+//        if (parents.size() > 1)
+//        {
+//            throw new RollerException("ERROR: more than one parent");
+//        }
+//        else if (parents.size() == 1)
+//        {
+//            return (Assoc) parents.get(0);
+//        }
+//        else
+//        {
+//            return null;
+//        }
+//    }
+//
+//    /** Get child associations, those whose parent is this category. */
+//    protected List getChildAssocs() 
+//        throws RollerException
+//    {
+//        Class clazz = getAssocClass();
+//        String assocColName = getAncestorPropertyName();       
+//
+//        QueryFactory factory =
+//            RollerFactory
+//                .getRoller()
+//                .getPersistenceStrategy()
+//                .getQueryFactory();
+//        Query query = factory.createQuery(clazz);
+//               
+//        Condition catCond = 
+//            factory.createCondition(assocColName, Query.EQ, this);
+//        
+//        Condition parentCond =
+//            factory.createCondition("relation", Query.EQ, Assoc.PARENT);
+//        
+//        query.setWhere(factory.createCondition(catCond, Query.AND, parentCond));
+//        return query.execute();
+//    }
+//
+//    /** 
+//     * Get all descendent associations, those that have this category as an 
+//     * ancestor, public for testing purposes only.
+//     */
+//    public List getAllDescendentAssocs() 
+//        throws RollerException
+//    {
+//        Class clazz = getAssocClass();
+//        String assocColName = getAncestorPropertyName();       
+//        QueryFactory factory =
+//           RollerFactory.getRoller().getPersistenceStrategy().getQueryFactory();
+//        Query query = factory.createQuery(clazz);
+//        query.setWhere(factory.createCondition(assocColName, Query.EQ, this));
+//        return query.execute();
+//    }
+//    
+//    /** 
+//     * Get all ancestor associations, public for testing purposes only. 
+//     */
+//    public List getAncestorAssocs() 
+//        throws RollerException
+//    {
+//        Class clazz = getAssocClass();
+//        String objectColName = getObjectPropertyName();
+//        QueryFactory factory =
+//           RollerFactory.getRoller().getPersistenceStrategy().getQueryFactory();
+//        Query query = factory.createQuery(clazz);
+//        query.setWhere(factory.createCondition(objectColName, Query.EQ, this));
+//        return query.execute();
+//    }     
+}

Added: incubator/roller/trunk/src/org/roller/pojos/PageData.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/roller/pojos/PageData.java?rev=189695&view=auto
==============================================================================
--- incubator/roller/trunk/src/org/roller/pojos/PageData.java (added)
+++ incubator/roller/trunk/src/org/roller/pojos/PageData.java Wed Jun  8 20:18:46 2005
@@ -0,0 +1,306 @@
+package org.roller.pojos;
+
+import java.util.Date;
+
+import org.roller.RollerException;
+import org.roller.model.Roller;
+import org.roller.model.RollerFactory;
+
+
+/** Page bean.
+ * @author David M Johnson
+ *
+ * @ejb:bean name="PageData"
+ * @struts.form include-all="true"
+ * @hibernate.class table="webpage" 
+ * hibernate.jcs-cache usage="read-write"
+ */
+public class PageData
+   extends org.roller.pojos.PersistentObject
+   implements java.io.Serializable
+{
+   static final long serialVersionUID = -613737191638263428L;
+
+   protected java.lang.String id;
+   protected java.lang.String name;
+   protected java.lang.String description;
+   protected java.lang.String link;
+   protected java.lang.String template;
+   protected java.util.Date updateTime;
+
+   protected WebsiteData mWebsite = null;
+
+   public PageData()
+   {
+   }
+
+   public PageData( 
+       java.lang.String id,
+       WebsiteData website,
+       java.lang.String name,
+       java.lang.String description,
+       java.lang.String link,
+       java.lang.String template,
+       java.util.Date updateTime )
+   {
+      this.id = id;
+      this.mWebsite = website;
+      this.name = name;
+      this.description = description;
+      this.link = link;
+      this.template = template;
+      this.updateTime = (Date)updateTime.clone();
+   }
+
+   public PageData( PageData otherData )
+   {
+      this.id = otherData.id;
+      this.mWebsite = otherData.mWebsite;
+      this.name = otherData.name;
+      this.description = otherData.description;
+      this.link = otherData.link;
+      this.template = otherData.template;
+      this.updateTime = otherData.updateTime;
+
+   }
+
+   /** 
+    * @ejb:persistent-field 
+    * @hibernate.id column="id" type="string"
+    *  generator-class="uuid.hex" unsaved-value="null"
+    */
+   public java.lang.String getId()
+   {
+      return this.id;
+   }
+   /** @ejb:persistent-field */ 
+   public void setId( java.lang.String id )
+   {
+      this.id = id;
+   }
+
+   /** 
+    * @ejb:persistent-field 
+    * @hibernate.many-to-one column="websiteid" cascade="none" not-null="true"
+    */
+   public WebsiteData getWebsite()
+   {
+      return this.mWebsite;
+   }
+   /** @ejb:persistent-field */ 
+   public void setWebsite( WebsiteData website )
+   {
+      this.mWebsite = website;
+   }
+
+   /** 
+    * @ejb:persistent-field 
+    * @hibernate.property column="name" non-null="true" unique="false"
+    */
+   public java.lang.String getName()
+   {
+      return this.name;
+   }
+   /** @ejb:persistent-field */ 
+   public void setName( java.lang.String name )
+   {
+      this.name = name;
+   }
+
+   /** 
+    * Description
+    * @ejb:persistent-field 
+    * @hibernate.property column="description" non-null="true" unique="false"
+    */
+   public java.lang.String getDescription()
+   {
+      return this.description;
+   }
+   /** @ejb:persistent-field */ 
+   public void setDescription( java.lang.String description )
+   {
+      this.description = description;
+   }
+
+   /** 
+    * @ejb:persistent-field 
+    * @hibernate.property column="link" non-null="true" unique="false"
+    */
+   public java.lang.String getLink()
+   {
+      return this.link;
+   }
+   /** @ejb:persistent-field */ 
+   public void setLink( java.lang.String link )
+   {
+      this.link = link;
+   }
+
+   /** 
+    * @ejb:persistent-field 
+    * @hibernate.property column="template" non-null="true" unique="false"
+    */
+   public java.lang.String getTemplate()
+   {
+      return this.template;
+   }
+   /** @ejb:persistent-field */ 
+   public void setTemplate( java.lang.String template )
+   {
+      this.template = template;
+   }
+
+   /** 
+    * @ejb:persistent-field 
+    * @hibernate.property column="updatetime" non-null="true" unique="false"
+    */
+   public java.util.Date getUpdateTime()
+   {
+      return (Date)this.updateTime.clone();
+   }   
+   /** @ejb:persistent-field */ 
+   public void setUpdateTime(final java.util.Date newtime )
+   {
+      if (newtime != null)	
+      {
+      	 updateTime = (Date)newtime.clone();
+      }
+      else 
+      {
+      	 updateTime = null;
+      }
+   }
+
+   public String toString()
+   {
+      StringBuffer str = new StringBuffer("{");
+
+      str.append("id=" + id + " " + "name=" + name + " " + "description=" 
+      + description + " " + "link=" + link + " " + "template=" + template 
+      + " " + "updateTime=" + updateTime);
+      str.append('}');
+
+      return(str.toString());
+   }
+
+   public boolean equals( Object pOther )
+   {
+      if( pOther instanceof PageData )
+      {
+         PageData lTest = (PageData) pOther;
+         boolean lEquals = true;
+
+         if( this.id == null )
+         {
+            lEquals = lEquals && ( lTest.id == null );
+         }
+         else
+         {
+            lEquals = lEquals && this.id.equals( lTest.id );
+         }
+         if( this.mWebsite == null )
+         {
+            lEquals = lEquals && ( lTest.mWebsite == null );
+         }
+         else
+         {
+            lEquals = lEquals && this.mWebsite.equals( lTest.mWebsite );
+         }
+         if( this.name == null )
+         {
+            lEquals = lEquals && ( lTest.name == null );
+         }
+         else
+         {
+            lEquals = lEquals && this.name.equals( lTest.name );
+         }
+         if( this.description == null )
+         {
+            lEquals = lEquals && ( lTest.description == null );
+         }
+         else
+         {
+            lEquals = lEquals && this.description.equals( lTest.description );
+         }
+         if( this.link == null )
+         {
+            lEquals = lEquals && ( lTest.link == null );
+         }
+         else
+         {
+            lEquals = lEquals && this.link.equals( lTest.link );
+         }
+         if( this.template == null )
+         {
+            lEquals = lEquals && ( lTest.template == null );
+         }
+         else
+         {
+            lEquals = lEquals && this.template.equals( lTest.template );
+         }
+         if( this.updateTime == null )
+         {
+            lEquals = lEquals && ( lTest.updateTime == null );
+         }
+         else
+         {
+            lEquals = lEquals && this.updateTime.equals( lTest.updateTime );
+         }
+
+         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.mWebsite != null) ? this.mWebsite.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.link != null) ? this.link.hashCode() : 0);
+      result = 37*result + ((this.template != null) ? this.template.hashCode() : 0);
+      result = 37*result + ((this.updateTime != null) ? this.updateTime.hashCode() : 0);
+      return result;
+      }
+
+   /**
+	* Setter is needed in RollerImpl.storePersistentObject()
+    */
+   public void setData( org.roller.pojos.PersistentObject otherData )
+   {
+
+      this.id = ((PageData)otherData).id;
+
+      this.mWebsite = ((PageData)otherData).mWebsite;
+
+      this.name = ((PageData)otherData).name;
+
+      this.description = ((PageData)otherData).description;
+
+      this.link = ((PageData)otherData).link;
+
+      this.template = ((PageData)otherData).template;
+
+      this.updateTime = ((PageData)otherData).updateTime;
+   }
+
+   public boolean canSave() throws RollerException
+   {
+       Roller roller = RollerFactory.getRoller();
+       if (roller.getUser().equals(UserData.SYSTEM_USER)) 
+       {
+           return true;
+       }
+       if (roller.getUser().equals(getWebsite().getUser()))
+       {
+           return true;
+       }
+       return false;
+   }
+
+}

Added: incubator/roller/trunk/src/org/roller/pojos/PersistentObject.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/roller/pojos/PersistentObject.java?rev=189695&view=auto
==============================================================================
--- incubator/roller/trunk/src/org/roller/pojos/PersistentObject.java (added)
+++ incubator/roller/trunk/src/org/roller/pojos/PersistentObject.java Wed Jun  8 20:18:46 2005
@@ -0,0 +1,67 @@
+
+package org.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;
+import org.apache.commons.lang.builder.ToStringStyle;
+import org.roller.RollerException;
+import org.roller.business.PersistenceStrategy;
+import org.roller.model.RollerFactory;
+
+/** 
+ * Base class for all of Roller's persistent objects.
+ */
+public abstract class PersistentObject implements Serializable
+{
+	private long mTimeStamp = 0L; // this was only for Castor, right? -Lance
+
+	public PersistentObject()
+	{
+	}
+
+	/** Setter needed by RollerImpl.storePersistentObject() */
+	public abstract void setData( PersistentObject vo );
+
+    /** Get ID */
+	public abstract String getId();
+
+    /** Set ID */
+	public abstract void setId( String id );
+
+	//---------------------------------------------------------- TimeStampable
+
+
+    public void save() throws RollerException 
+    {
+        PersistenceStrategy pstrategy =
+            RollerFactory.getRoller().getPersistenceStrategy();
+        pstrategy.store(this);
+    }
+    
+    public void remove() throws RollerException 
+    {
+        PersistenceStrategy pstrategy =
+            RollerFactory.getRoller().getPersistenceStrategy();
+        pstrategy.remove(this);
+    }
+    
+    
+    public String toString() {
+        return ToStringBuilder.reflectionToString(this,
+                ToStringStyle.MULTI_LINE_STYLE);
+    }
+
+    public boolean equals(Object o) {
+        return EqualsBuilder.reflectionEquals(this, o);
+    }
+    
+    /** Can user associated with persistence session save this object? */
+    public boolean canSave() throws RollerException
+    {
+        return true;
+    }
+}
+

Added: incubator/roller/trunk/src/org/roller/pojos/PingCategoryRestrictionData.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/roller/pojos/PingCategoryRestrictionData.java?rev=189695&view=auto
==============================================================================
--- incubator/roller/trunk/src/org/roller/pojos/PingCategoryRestrictionData.java (added)
+++ incubator/roller/trunk/src/org/roller/pojos/PingCategoryRestrictionData.java Wed Jun  8 20:18:46 2005
@@ -0,0 +1,157 @@
+/*
+ * Copyright (c) 2005
+ * Anil R. Gangolli. All rights reserved.
+ *
+ * Distributed with the Roller Weblogger Project under the terms of the Roller Software
+ * License
+ */
+
+package org.roller.pojos;
+
+import java.io.Serializable;
+
+/**
+ * Ping Category Restriction.  An instance of this class relates an auto ping configuration {@link AutoPingData} to a
+ * specific weblog category {@link WeblogCategoryData}.  When one or more instances of this class are present for a
+ * given auto ping configuration, it means that pings should only go out for changes to the categories specified by those
+ * instances.  If no instances of this class are present for a given auto ping configuration, it means that the ping
+ * configuration is not restricted by category, so pings should go out for changes in any category.
+ *
+ * @author Anil Gangolli anil@busybuddha.org
+ * @ejb:bean name="AutoPingData"
+ * @hibernate.class table="pingcategory"
+ */
+public class PingCategoryRestrictionData extends PersistentObject implements Serializable
+{
+    protected String id;
+    protected AutoPingData autoPing;
+    protected WeblogCategoryData weblogCategory;
+
+    static final long serialVersionUID = 2261280579491859418L;
+
+    /**
+     * Default constructor.  Leaves all fields null.  Required for bean compliance.
+     */
+    public PingCategoryRestrictionData()
+    {
+    }
+
+    /**
+     * Constructor
+     *
+     * @param id             unique id of this object
+     * @param autoPing       auto ping configuration being restricted
+     * @param weblogCategory weblog category to which this auto ping configuration is restricted
+     */
+    public PingCategoryRestrictionData(String id, AutoPingData autoPing, WeblogCategoryData weblogCategory)
+    {
+        this.id = id;
+        this.autoPing = autoPing;
+        this.weblogCategory = weblogCategory;
+    }
+
+    /**
+     * Setter needed by RollerImpl.storePersistentObject()
+     */
+    public void setData(PersistentObject vo)
+    {
+        PingCategoryRestrictionData other = (PingCategoryRestrictionData)vo;
+        id = other.id;
+        autoPing = other.autoPing;
+        weblogCategory = other.weblogCategory;
+    }
+
+    /**
+     * Get the unique id (primary key) of this object.
+     *
+     * @return the unique id of this object. -- struts.validator type="required" msgkey="errors.required"
+     * @ejb:persistent-field
+     * @hibernate.id column="id" type="string" generator-class="uuid.hex" unsaved-value="null"
+     */
+    public String getId()
+    {
+        return id;
+    }
+
+    /**
+     * Set the unique id (primary key) of this object
+     *
+     * @param id
+     * @ejb:persistent-field
+     */
+    public void setId(String id)
+    {
+        this.id = id;
+    }
+
+    /**
+     * Get the auto ping configuration to which this category restriction applies.
+     *
+     * @return the auto ping configuration to which this category restriction applies.
+     * @ejb:persistent-field
+     * @hibernate.many-to-one column="autopingid" cascade="none" not-null="true"
+     */
+    public AutoPingData getAutoping()
+    {
+        return autoPing;
+    }
+
+    /**
+     * Set the auto ping configuration to which this category restriction applies.
+     *
+     * @param autoPing the auto ping configuration to which this category restriction applies.
+     * @ejb:persistent-field
+     */
+    public void setAutoping(AutoPingData autoPing)
+    {
+        this.autoPing = autoPing;
+    }
+
+    /**
+     * Get the weblog category.  Get the weblog category to which pings should be restricted.
+     *
+     * @return the weblog category to which pings should be restricted.
+     * @ejb:persistent-field
+     * @hibernate.many-to-one column="weblogcategoryid" cascade="none" not-null="true"
+     */
+    public WeblogCategoryData getWeblogCategory()
+    {
+        return weblogCategory;
+    }
+
+    /**
+     * Set the ping target.  Set the target to be pinged when the corresponding website changes.
+     *
+     * @param weblogCategory the weblog category to which pings should be restricted.
+     * @ejb:persistent-field
+     */
+    public void setWeblogCategory(WeblogCategoryData weblogCategory)
+    {
+        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.id) : pingCategoryRestrictionData.id != null) return false;
+        if (autoPing != null ? !autoPing.equals(pingCategoryRestrictionData.autoPing) : pingCategoryRestrictionData.autoPing != null) return false;
+        if (weblogCategory != null ? !weblogCategory.equals(pingCategoryRestrictionData.weblogCategory) : pingCategoryRestrictionData.weblogCategory != null) return false;
+
+        return true;
+    }
+
+    /**
+     * @see Object#hashCode()
+     */
+    public int hashCode()
+    {
+        return (id != null ? id.hashCode() : 0);
+    }
+}
\ No newline at end of file

Added: incubator/roller/trunk/src/org/roller/pojos/PingQueueEntryData.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/roller/pojos/PingQueueEntryData.java?rev=189695&view=auto
==============================================================================
--- incubator/roller/trunk/src/org/roller/pojos/PingQueueEntryData.java (added)
+++ incubator/roller/trunk/src/org/roller/pojos/PingQueueEntryData.java Wed Jun  8 20:18:46 2005
@@ -0,0 +1,238 @@
+/*
+ * Copyright (c) 2005
+ * Anil R. Gangolli. All rights reserved.
+ *
+ * Distributed with the Roller Weblogger Project under the terms of the Roller Software
+ * License
+ */
+
+package org.roller.pojos;
+
+import java.sql.Timestamp;
+import java.io.Serializable;
+
+/**
+ * Ping queue entry.  Each instance of this class represents an entry on the ping queue. The entry indicates when it was
+ * added to the queue, which configuration to apply for the ping, and the number of ping attempts that have been made
+ * for this entry so far.
+ *
+ * @author Anil Gangolli anil@busybuddha.org
+ * @ejb:bean name="PingQueueEntryData"
+ * @hibernate.class table="pingqueueentry"
+ */
+public class PingQueueEntryData extends PersistentObject implements Serializable
+{
+    String id;
+    Timestamp entryTime;
+    PingTargetData pingTarget;
+    WebsiteData website;
+    int attempts;
+
+    static final long serialVersionUID = -1468021030819538243L;
+
+    /**
+     * Default constructor.  Leaves all fields at Java-specified default values.
+     */
+    public PingQueueEntryData()
+    {
+    }
+
+    /**
+     * Construct with all members
+     *
+     * @param id         unique id of this entry
+     * @param entryTime  timestamp of first entry onto queue
+     * @param pingTarget target site to ping
+     * @param website    website originating the ping
+     * @param attempts   number of prior ping attempts
+     */
+    public PingQueueEntryData(String id, Timestamp entryTime, PingTargetData pingTarget, WebsiteData website, int attempts)
+    {
+        this.id = id;
+        this.entryTime = entryTime;
+        this.pingTarget = pingTarget;
+        this.website = website;
+        this.attempts = attempts;
+    }
+
+    /**
+     * @see PersistentObject#setData(PersistentObject)
+     */
+    public void setData(PersistentObject vo)
+    {
+        PingQueueEntryData other = (PingQueueEntryData) vo;
+        id = other.id;
+        entryTime = other.entryTime;
+        pingTarget = other.pingTarget;
+        website = other.website;
+        attempts = other.attempts;
+    }
+
+    /**
+     * Get the unique id (primary key) of this object.
+     *
+     * @return the unique id of this object.
+     * @ejb:persistent-field
+     * @hibernate.id column="id" type="string" generator-class="uuid.hex" unsaved-value="null"
+     */
+    public String getId()
+    {
+        return id;
+    }
+
+    /**
+     * Set the unique id (primary key) of this object.
+     *
+     * @param id
+     * @ejb:persistent-field
+     */
+    public void setId(String id)
+    {
+        this.id = id;
+    }
+
+    /**
+     * Get the entry time.  Get the time this entry was first added to the queue.
+     *
+     * @return the time the entry was first added to the queue.
+     * @ejb:persistent-field
+     * @hibernate.property column="entrytime" non-null="true"
+     */
+    public Timestamp getEntryTime()
+    {
+        return entryTime;
+    }
+
+    /**
+     * Set the entry time.
+     *
+     * @param entryTime the time the entry was first added to the queue.
+     * @ejb:persistent-field
+     */
+    public void setEntryTime(Timestamp entryTime)
+    {
+        this.entryTime = entryTime;
+    }
+
+    /**
+     * Get the ping target.  Get the target to ping.
+     *
+     * @return the ping target to ping.
+     * @ejb:persistent-field
+     * @hibernate.many-to-one column="pingtargetid" cascade="none" not-null="true"
+     */
+    public PingTargetData getPingTarget()
+    {
+        return pingTarget;
+    }
+
+    /**
+     * Set the ping target.
+     *
+     * @param pingTarget target to ping.
+     * @ejb:persistent-field
+     */
+    public void setPingTarget(PingTargetData pingTarget)
+    {
+        this.pingTarget = pingTarget;
+    }
+
+    /**
+     * Get the website originating the ping.
+     *
+     * @return the website originating the ping.
+     * @ejb:persistent-field
+     * @hibernate.many-to-one column="websiteid" cascade="none" not-null="true"
+     */
+    public WebsiteData getWebsite()
+    {
+        return website;
+    }
+
+    /**
+     * Set the website originating the ping.
+     *
+     * @param website the website originating the ping.
+     * @ejb:persistent-field
+     */
+    public void setWebsite(WebsiteData website)
+    {
+        this.website = website;
+    }
+
+    /**
+     * Get the number of ping attempts that have been made for this queue entry.
+     *
+     * @return the number of ping attempts that have been made for this queue entry.
+     * @ejb:persistent-field
+     * @hibernate.property column="attempts" non-null="true"
+     */
+    public int getAttempts()
+    {
+        return attempts;
+    }
+
+    /**
+     * Set the number of failures that have occurred for this queue entry.
+     *
+     * @param attempts
+     * @ejb:persistent-field
+     */
+    public void setAttempts(int attempts)
+    {
+        this.attempts = attempts;
+    }
+
+    /**
+     * Increment the number of failures for this queue entry.
+     *
+     * @return the new value.
+     */
+    public int incrementAttempts()
+    {
+        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;
+
+        if (attempts != pingQueueEntryData.attempts) return false;
+        if (entryTime != null ? !entryTime.equals(pingQueueEntryData.entryTime) : pingQueueEntryData.entryTime != null) return false;
+        if (id != null ? !id.equals(pingQueueEntryData.id) : pingQueueEntryData.id != null) return false;
+        if (pingTarget != null ? !pingTarget.equals(pingQueueEntryData.pingTarget) : pingQueueEntryData.pingTarget != null) return false;
+        if (website != null ? !website.equals(pingQueueEntryData.website) : pingQueueEntryData.website != 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 java.lang.Object#toString()
+     */
+    public String toString()
+    {
+        return "PingQueueEntryData{" +
+            "id='" + id + "'" +
+            ", entryTime=" + entryTime +
+            ", pingTarget=" + pingTarget +
+            ", website= " + (website == null ? "null" : "{id='" + website.getId() + "', user='" + website.getUser().getUserName() + "'} ") +
+            ", attempts=" + attempts +
+            "}";
+    }
+}



Mime
View raw message