You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@roller.apache.org by sn...@apache.org on 2005/06/09 05:19:20 UTC

svn commit: r189695 [25/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/

Added: incubator/roller/trunk/src/org/roller/pojos/PingTargetData.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/roller/pojos/PingTargetData.java?rev=189695&view=auto
==============================================================================
--- incubator/roller/trunk/src/org/roller/pojos/PingTargetData.java (added)
+++ incubator/roller/trunk/src/org/roller/pojos/PingTargetData.java Wed Jun  8 20:18:46 2005
@@ -0,0 +1,319 @@
+/*
+ * Copyright (c) 2005
+ * Anil R. Gangolli. All rights reserved.
+ *
+ * Distributed as part of the Roller Weblogger under the terms of the Roller Software License.
+ */
+
+package org.roller.pojos;
+
+import org.roller.RollerException;
+import org.roller.model.Roller;
+import org.roller.model.RollerFactory;
+import org.roller.model.AutoPingManager;
+import org.roller.model.PingQueueManager;
+
+import java.io.Serializable;
+import java.util.List;
+import java.sql.Timestamp;
+
+/**
+ * Ping target.   Each instance represents a possible target of a weblog update ping that we send.  Ping targets are
+ * either common (defined centrally by an administrator and used by any website), or custom (defined by the user of a
+ * specific website) for update pings issued for that website.
+ *
+ * @author Anil Gangolli anil@busybuddha.org
+ * @ejb:bean name="PingTargetData"
+ * @struts.form include-all="true"
+ * @hibernate.class table="pingtarget"
+ */
+public class PingTargetData extends PersistentObject implements Serializable
+{
+    protected String id;
+    protected String name;
+    protected String pingUrl;
+    protected WebsiteData website;
+    protected int conditionCode;
+    protected Timestamp lastSuccess;
+
+    public static final int CONDITION_OK = 0;           // last use (after possible retrials) was successful
+    public static final int CONDITION_FAILING = 1;      // last use failed after retrials
+    public static final int CONDITION_DISABLED = 2;     // disabled by failure policy after failures - editing resets
+
+    static final long serialVersionUID = -6354583200913127874L;
+
+    /**
+     * Default empty constructor.
+     */
+    public PingTargetData()
+    {
+    }
+
+    /**
+     * Constructor.
+     *
+     * @param id      the id (primary key) of this target
+     * @param name    the descriptive name of this target
+     * @param pingUrl the URL to which to send the ping
+     * @param website the website (on this server) for which this is a custom ping target (may be null)
+     */
+    public PingTargetData(String id, String name, String pingUrl, WebsiteData website)
+    {
+        this.id = id;
+        this.name = name;
+        this.pingUrl = pingUrl;
+        this.website = website;
+        this.conditionCode = CONDITION_OK;
+        this.lastSuccess = null;
+    }
+
+    /**
+     * Setter needed by RollerImpl.storePersistentObject()
+     */
+    public void setData(PersistentObject vo)
+    {
+        PingTargetData other = (PingTargetData) vo;
+        id = other.id;
+        name = other.name;
+        pingUrl = other.pingUrl;
+        website = other.website;
+        conditionCode = other.conditionCode;
+        lastSuccess = other.lastSuccess;
+    }
+
+
+    /**
+     * Get the unique id of this ping target.
+     *
+     * @return the unique id of this ping target.
+     * @struts.validator type="required" msgkey="errors.required"
+     * @ejb:persistent-field
+     * @hibernate.id column="id" type="string" generator-class="uuid.hex" unsaved-value="null"
+     */
+    public java.lang.String getId()
+    {
+        return this.id;
+    }
+
+    /**
+     * Set the unique id of this ping target
+     *
+     * @param id
+     * @ejb:persistent-field
+     */
+    public void setId(java.lang.String id)
+    {
+        this.id = id;
+    }
+
+    /**
+     * get the name of this ping target.  This is a name assigned by the administrator or a user (for custom) targets.
+     * It is deescriptive and is not necessarily unique.
+     *
+     * @return the name of this ping target
+     * @ejb:persistent-field
+     * @hibernate.property column="name" non-null="true"
+     */
+    public java.lang.String getName()
+    {
+        return this.name;
+    }
+
+    /**
+     * Set the name of this ping target.
+     *
+     * @param name the name of this ping target
+     * @ejb:persistent-field
+     */
+    public void setName(java.lang.String name)
+    {
+        this.name = name;
+    }
+
+    /**
+     * Get the URL to ping.
+     *
+     * @return the URL to ping.
+     * @ejb:persistent-field
+     * @hibernate.property column="pingurl" non-null="true"
+     */
+    public String getPingUrl()
+    {
+        return pingUrl;
+    }
+
+    /**
+     * Set the URL to ping.
+     *
+     * @param pingUrl
+     * @ejb:persistent-field
+     */
+    public void setPingUrl(String pingUrl)
+    {
+        this.pingUrl = pingUrl;
+    }
+
+    /**
+     * Get the website (on this server) for which this ping target is a custom target.  This may be null, indicating
+     * that it is a common ping target, not a custom one.
+     *
+     * @return the website for which this ping target is a custom target, or null if this ping target is not a custom
+     *         target.
+     * @ejb:persistent-field
+     * @hibernate.many-to-one column="websiteid" cascade="none" not-null="false"
+     */
+    public WebsiteData getWebsite()
+    {
+        return website;
+    }
+
+    /**
+     * Set the website (on this server) for which this ping target is a custom target.
+     *
+     * @param website the website for which this ping target is a custom target, or null if this ping target is not a
+     *                custom target
+     * @ejb:persistent-field
+     */
+    public void setWebsite(WebsiteData website)
+    {
+        this.website = website;
+    }
+
+    /**
+     * Get the condition code value.  This code, in combination with the last success timestamp, provides a status
+     * indicator on the ping target based on its  usage by the ping queue processor. It can be used to implement a
+     * failure-based disabling policy.
+     *
+     * @return one of the condition codes {@link #CONDITION_OK}, {@link #CONDITION_FAILING}, {@link
+     *         #CONDITION_DISABLED}.
+     * @ejb:persistent-field
+     * @hibernate.property column="condition" not-null="true"
+     */
+    public int getConditionCode()
+    {
+        return conditionCode;
+    }
+
+    /**
+     * Set the condition code value.
+     *
+     * @param conditionCode the condition code value to set
+     * @ejb:persistent-field
+     */
+    public void setConditionCode(int conditionCode)
+    {
+        this.conditionCode = conditionCode;
+    }
+
+    /**
+     * Get the timestamp of the last successful ping (UTC/GMT).
+     *
+     * @return the timestamp of the last successful ping; <code>null</code> if the target has not yet been used.
+     * @ejb:persistent-field
+     * @hibernate.property column="lastsuccess" not-null="false"
+     */
+    public Timestamp getLastSuccess()
+    {
+        return lastSuccess;
+    }
+
+    /**
+     * Set the timestamp of the last successful ping.
+     *
+     * @param lastSuccess the timestamp of the last successful ping.
+     * @ejb:persistent-field
+     */
+    public void setLastSuccess(Timestamp lastSuccess)
+    {
+        this.lastSuccess = lastSuccess;
+    }
+
+    /**
+     * @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;
+
+        if (conditionCode != pingTargetData.conditionCode) return false;
+        if (id != null ? !id.equals(pingTargetData.id) : pingTargetData.id != null) return false;
+        if (lastSuccess != null ? !lastSuccess.equals(pingTargetData.lastSuccess) : pingTargetData.lastSuccess != null) return false;
+        if (name != null ? !name.equals(pingTargetData.name) : pingTargetData.name != null) return false;
+        if (pingUrl != null ? !pingUrl.equals(pingTargetData.pingUrl) : pingTargetData.pingUrl != null) return false;
+        if (website != null ? !website.equals(pingTargetData.website) : pingTargetData.website != null) return false;
+
+        return true;
+    }
+
+    /**
+     * Determine if the current user has rights to save the current instance.
+     *
+     * @return true if the user has rights to save the current instance, false otherwise.
+     * @throws RollerException
+     */
+    public boolean canSave() throws RollerException
+    {
+        Roller roller = RollerFactory.getRoller();
+        UserData user = roller.getUser();
+        // This is more verbose but easier to debug than returning the value of the boolean expression
+        if (user.equals(UserData.SYSTEM_USER))
+        {
+            return true;
+        }
+        if (website == null && user.hasRole("admin"))
+        {
+            return true;
+        }
+        if (website != null && website.getUser().equals(user))
+        {
+            return true;
+        }
+        return false;
+    }
+
+    /**
+     * Remove the object.
+     *
+     * @throws RollerException
+     * @see org.roller.pojos.PersistentObject#remove()
+     */
+    public void remove() throws RollerException
+    {
+        // First remove ping queue entries and auto ping configurations that use this target.
+        PingQueueManager pingQueueMgr = RollerFactory.getRoller().getPingQueueManager();
+        pingQueueMgr.removeQueueEntriesByPingTarget(this);
+        AutoPingManager autoPingMgr = RollerFactory.getRoller().getAutopingManager();
+        List autopings = autoPingMgr.getAutoPingsByTarget(this);
+        autoPingMgr.removeAutoPings(autopings);
+        super.remove();
+    }
+
+    /**
+     * 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 + "'" +
+            ", website= " + (website == null ? "null" : "{id='" + website.getId() + "', user='" + website.getUser().getUserName() + "'} ") +
+            ", conditionCode=" + conditionCode +
+            ", lastSuccess=" + lastSuccess +
+            "}";
+    }
+}

Added: incubator/roller/trunk/src/org/roller/pojos/PlanetConfigData.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/roller/pojos/PlanetConfigData.java?rev=189695&view=auto
==============================================================================
--- incubator/roller/trunk/src/org/roller/pojos/PlanetConfigData.java (added)
+++ incubator/roller/trunk/src/org/roller/pojos/PlanetConfigData.java Wed Jun  8 20:18:46 2005
@@ -0,0 +1,247 @@
+/*
+ * Copyright 2005 Sun Microsystems, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.roller.pojos;
+
+import java.io.Serializable;
+
+import org.roller.pojos.PersistentObject;
+
+/**
+ * @struts.form include-all="true"
+ * @hibernate.class table="rag_config"
+ * @author Dave Johnson
+ */
+public class PlanetConfigData extends PersistentObject implements Serializable
+{
+    /** Database ID */
+    protected String id;
+    
+    /** Deftault group of planet */
+    protected PlanetGroupData defaultGroup;
+    
+    /** Base URL of planet */
+    protected String siteUrl;
+    
+    /** Proxy port or null if none */
+    protected String proxyHost; 
+    
+    /** proxy port, ignored if proxyHost is null */
+    protected int proxyPort;
+    
+    /** Name of template to be used for main page */
+    protected String mainPage;
+    
+    /** Name of template to be used for groups that don't provide a template */
+    protected String groupPage;
+    
+    /** Name of administrator responsible for site */
+    protected String adminName = null;
+    
+    /** Email of administrator responsible for site */
+    protected String adminEmail = null;
+    
+    /** Title of site */
+    protected String title = null;
+    
+    /** Description of site */
+    protected String description = null;
+    
+    /** Where to place the generated files */
+    protected String outputDir = null;
+    
+    /** Where to find the Velocity templates on disk */
+    protected String templateDir = null;
+    
+    /** Location for caching newsfeed data */
+    protected String cacheDir = null;
+    
+    
+    //----------------------------------------------------------- persistent fields
+    /** 
+     * @hibernate.id column="id" type="string" 
+     *     generator-class="uuid.hex" unsaved-value="null"
+     */
+    public String getId()
+    {
+        return id;
+    }
+    public void setId(String id)
+    {
+        this.id = id;
+    }
+
+    /** 
+     * @hibernate.many-to-one column="default_group_id" cascade="all" not-null="false"
+     */
+    public PlanetGroupData getDefaultGroup()
+    {
+        return defaultGroup;
+    }
+    public void setDefaultGroup(PlanetGroupData group)
+    {
+        this.defaultGroup = group;
+    }
+
+    /** 
+     * @hibernate.property column="group_page" non-null="false" unique="false"
+     */
+    public String getGroupPage()
+    {
+        return groupPage;
+    }    
+    public void setGroupPage(String groupPage)
+    {
+        this.groupPage = groupPage;
+    }
+    
+    /** 
+     * @hibernate.property column="main_page" non-null="false" unique="false"
+     */
+    public String getMainPage()
+    {
+        return mainPage;
+    }
+    public void setMainPage(String mainPage)
+    {
+        this.mainPage = mainPage;
+    }
+    
+    /** 
+     * @hibernate.property column="proxy_host" non-null="false" unique="false"
+     */
+    public String getProxyHost()
+    {
+        return proxyHost;
+    }
+    public void setProxyHost(String proxyHost)
+    {
+        this.proxyHost = proxyHost;
+    }
+    
+    /** 
+     * @hibernate.property column="proxy_port" non-null="false" unique="false"
+     */
+    public int getProxyPort()
+    {
+        return proxyPort;
+    }
+    public void setProxyPort(int proxyPort)
+    {
+        this.proxyPort = proxyPort;
+    }
+
+    /** 
+     * @hibernate.property column="site_url" non-null="false" unique="false"
+     */
+    public String getSiteUrl()
+    {
+        return siteUrl;
+    }
+    public void setSiteUrl(String siteUrl)
+    {
+        this.siteUrl = siteUrl;
+    }
+    
+    /** 
+     * @hibernate.property column="admin_email" non-null="true" unique="false"
+     */
+    public String getAdminEmail()
+    {
+        return adminEmail;
+    }
+    public void setAdminEmail(String adminEmail)
+    {
+        this.adminEmail = adminEmail;
+    }
+    
+    /** 
+     * @hibernate.property column="admin_name" non-null="false" unique="false"
+     */
+    public String getAdminName()
+    {
+        return adminName;
+    }
+    public void setAdminName(String adminName)
+    {
+        this.adminName = adminName;
+    }
+
+    /** 
+     * @hibernate.property column="output_dir" non-null="false" unique="false"
+     */
+    public String getOutputDir()
+    {
+        return outputDir;
+    }
+    public void setOutputDir(String outputDir)
+    {
+        this.outputDir = outputDir;
+    }
+    
+    /** 
+     * @hibernate.property column="template_dir" non-null="false" unique="false"
+     */
+    public String getTemplateDir()
+    {
+        return templateDir;
+    }
+    public void setTemplateDir(String templateDir)
+    {
+        this.templateDir = templateDir;
+    }
+
+    /** 
+     * @hibernate.property column="description" non-null="false" unique="false"
+     */
+    public String getDescription()
+    {
+        return description;
+    }
+    public void setDescription(String description)
+    {
+        this.description = description;
+    }
+
+    /** 
+     * @hibernate.property column="title" non-null="true" unique="false"
+     */
+    public String getTitle()
+    {
+        return title;
+    }
+    public void setTitle(String title)
+    {
+        this.title = title;
+    }
+
+    /** 
+     * @hibernate.property column="cache_dir" non-null="false" unique="false"
+     */
+    public String getCacheDir()
+    {
+        return cacheDir;
+    }
+    public void setCacheDir(String cacheDir)
+    {
+        this.cacheDir = cacheDir;
+    }
+
+    //-------------------------------------------------------------- implementation
+    public void setData(PersistentObject vo)
+    {
+        // TODO Auto-generated method stub
+    }
+}
\ No newline at end of file

Added: incubator/roller/trunk/src/org/roller/pojos/PlanetEntryData.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/roller/pojos/PlanetEntryData.java?rev=189695&view=auto
==============================================================================
--- incubator/roller/trunk/src/org/roller/pojos/PlanetEntryData.java (added)
+++ incubator/roller/trunk/src/org/roller/pojos/PlanetEntryData.java Wed Jun  8 20:18:46 2005
@@ -0,0 +1,341 @@
+/*
+ * Copyright 2005 Sun Microsystems, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.roller.pojos;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.Iterator;
+import java.util.List;
+
+import org.roller.util.Utilities;
+import org.roller.util.rome.ContentModule;
+
+import com.sun.syndication.feed.module.DCModule;
+import com.sun.syndication.feed.synd.SyndCategory;
+import com.sun.syndication.feed.synd.SyndContent;
+import com.sun.syndication.feed.synd.SyndEntry;
+import com.sun.syndication.feed.synd.SyndFeed;
+
+/**
+ * A syndication feed entry intended for use in an in-memory or database cache to 
+ * speed the creation of aggregations in Planet Roller implementations. 
+ * 
+ * @hibernate.class table="rag_entry"
+ * @author Dave Johnson
+ */
+public class PlanetEntryData extends PersistentObject 
+                             implements Serializable, Comparable
+{
+    protected String id;
+    protected String handle;
+    protected String title;
+    protected String guid;
+    protected String permalink;
+    protected String author;
+    protected String content = "";
+    protected Date   published;
+    protected Date   updated;
+    
+    private String categoriesString;
+    protected PlanetSubscriptionData subscription = null;
+    
+    /**
+     * Construct empty entry.
+     */
+    public PlanetEntryData() 
+    {
+    }
+
+    /**
+     * Create entry from Rome entry.
+     */
+    public PlanetEntryData(
+            SyndFeed romeFeed, SyndEntry romeEntry, PlanetSubscriptionData sub) 
+    {
+        setSubscription(sub);
+        initFromRomeEntry(romeFeed, romeEntry);
+    }
+    
+    /** 
+     * Init entry from Rome entry 
+     */
+    private void initFromRomeEntry(SyndFeed romeFeed, SyndEntry romeEntry)
+    {
+        setAuthor(romeEntry.getAuthor());
+        setTitle(romeEntry.getTitle());
+        setPermalink(romeEntry.getLink());
+        
+        // Play some games to get the date       
+        DCModule entrydc = (DCModule)romeEntry.getModule(DCModule.URI);
+        DCModule feeddc = (DCModule)romeFeed.getModule(DCModule.URI);
+        if (romeEntry.getPublishedDate() != null)
+        {        
+            setPublished(romeEntry.getPublishedDate()); // use <pubDate>
+        }
+        else if (entrydc != null)
+        {
+            setPublished(entrydc.getDate()); // use <dc:date>
+        }       
+        // Commented out: preserve knowledge that entry has no date
+        //if (getPublished() == null) // Still no published date?
+        //{
+            //if (romeFeed.getPublishedDate() != null)
+            //{
+                //setPublished(romeFeed.getPublishedDate()); // try feed's <pubDate>
+            //}
+            //else if (feeddc != null)
+            //{
+                //setPublished(feeddc.getDate()); // try feed's <dc:date>
+            //}
+        //}
+        
+        // get content and unescape if it is 'text/plain' 
+        if (romeEntry.getContents().size() > 0)
+        {
+            SyndContent content= (SyndContent)romeEntry.getContents().get(0);
+            if (content != null && content.getType().equals("text/plain"))
+            {
+                setContent(Utilities.unescapeHTML(content.getValue()));
+            }
+            else if (content != null)
+            {
+                setContent(content.getValue());
+            }
+        }
+        
+        // no content, then try <content:encoded>        
+        if (getContent() == null || getContent().trim().length() == 0)
+        {
+            ContentModule cm = (ContentModule)romeEntry.getModule(ContentModule.URI);
+            if (cm != null) 
+            {
+                setContent(Utilities.unescapeHTML(cm.getEncoded()));
+            }
+        }
+        
+        // copy categories
+        if (romeEntry.getCategories().size() > 0)
+        {
+            List list = new ArrayList();
+            Iterator cats = romeEntry.getCategories().iterator();
+            while (cats.hasNext())
+            {
+                SyndCategory cat = (SyndCategory)cats.next();
+                list.add(cat.getName());
+            }
+            setCategories(list);
+        }
+    }
+    
+    //----------------------------------------------------------- persistent fields
+
+    /** 
+     * @hibernate.id column="id" type="string" 
+     *     generator-class="uuid.hex" unsaved-value="null"
+     */
+    public String getId()
+    {
+        return id;
+    }
+    public void setId(String id)
+    {
+        this.id = id;
+    }
+    /** 
+     * @hibernate.property column="categories" non-null="false" unique="false"
+     */
+    public String getCategoriesString()
+    {
+        return categoriesString;
+    }
+    public void setCategoriesString(String categoriesString)
+    {
+        this.categoriesString = categoriesString;
+    }
+    /** 
+     * @hibernate.many-to-one column="subscription_id" cascade="save-update" not-null="true"
+     */
+    public PlanetSubscriptionData getSubscription()
+    {
+        return subscription;
+    }
+    public void setSubscription(PlanetSubscriptionData subscription)
+    {
+        this.subscription = subscription;
+    }
+    /** 
+     * @hibernate.property column="author" non-null="false" unique="false"
+     */
+    public String getAuthor()
+    {
+        return author;
+    }
+    public void setAuthor(String author)
+    {
+        this.author = author;
+    }
+    /** 
+     * @hibernate.property column="content" non-null="false" unique="false"
+     */
+    public String getContent()
+    {
+        return content;
+    }
+    public void setContent(String content)
+    {
+        this.content = content;
+    }
+    /** 
+     * @hibernate.property column="guid" non-null="false" unique="true"
+     */
+    public String getGuid()
+    {
+        return guid;
+    }
+    public void setGuid(String guid)
+    {
+        this.guid = guid;
+    }
+    /** 
+     * @hibernate.property column="handle" non-null="false" unique="false"
+     */
+    public String getHandle()
+    {
+        return handle;
+    }
+    public void setHandle(String handle)
+    {
+        this.handle = handle;
+    }
+    /** 
+     * @hibernate.property column="published" non-null="true" unique="false"
+     */
+    public Date getPublished()
+    {
+        return published;
+    }
+    public void setPublished(Date published)
+    {
+        this.published = published;
+    }
+    /** 
+     * @hibernate.property column="permalink" non-null="true" unique="false"
+     */
+    public String getPermalink()
+    {
+        return permalink;
+    }
+    public void setPermalink(String permalink)
+    {
+        this.permalink = permalink;
+    }
+    /** 
+     * @hibernate.property column="title" non-null="false" unique="false"
+     */
+    public String getTitle()
+    {
+        return title;
+    }
+    public void setTitle(String title)
+    {
+        this.title = title;
+    }
+    /** 
+     * @hibernate.property column="updated" non-null="false" unique="false"
+     */
+    public Date getUpdated()
+    {
+        return updated;
+    }
+    public void setUpdated(Date updated)
+    {
+        this.updated = updated;
+    }
+
+    //----------------------------------------------------------------- convenience
+
+    /**
+     * Returns true if any of entry's categories contain a specific string 
+     * (case-insensitive comparison).
+     */
+    public boolean inCategory(String category) 
+    {
+        Iterator cats = getCategories().iterator();
+        while (cats.hasNext())
+        {
+            String catName = ((String)cats.next()).toLowerCase();
+            if (catName.indexOf(category.toLowerCase()) != -1)
+            {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    //------------------------------------------------------------- implemenatation
+    public List getCategories()
+    {
+        List list = new ArrayList();
+        if (categoriesString != null)
+        {
+            String[] catArray = Utilities.stringToStringArray(categoriesString,",");
+            for (int i=0; i<catArray.length; i++)
+            {
+                list.add(catArray[i]);
+            }
+        }
+        return list;
+    }
+    public void setCategories(List categories)
+    {
+        StringBuffer sb = new StringBuffer();
+        Iterator cats = categories.iterator();
+        while (cats.hasNext())
+        {
+            String cat = (String)cats.next();
+            sb.append(cat);
+            if (cats.hasNext()) sb.append(",");
+        }
+        categoriesString = sb.toString();
+    }
+    
+    /** 
+     * Return category names as a string, separated by delimeters.
+     */
+    public String getCategoriesAsString(String delim)
+    {
+        StringBuffer sb = new StringBuffer();
+        Iterator cats = getCategories().iterator();
+        while (cats.hasNext())
+        {
+            String catName = ((String)cats.next()).toLowerCase();
+            sb.append(catName);
+            if (cats.hasNext()) sb.append(delim);
+        }
+        return sb.toString();
+    }
+    
+    public int compareTo(Object o)
+    {
+        PlanetEntryData other = (PlanetEntryData)o;
+        return getPermalink().compareTo(other.getPermalink());
+    }
+    public void setData(PersistentObject vo)
+    {
+    }
+}
+

Added: incubator/roller/trunk/src/org/roller/pojos/PlanetGroupData.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/roller/pojos/PlanetGroupData.java?rev=189695&view=auto
==============================================================================
--- incubator/roller/trunk/src/org/roller/pojos/PlanetGroupData.java (added)
+++ incubator/roller/trunk/src/org/roller/pojos/PlanetGroupData.java Wed Jun  8 20:18:46 2005
@@ -0,0 +1,248 @@
+/*
+ * Copyright 2005 Sun Microsystems, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.roller.pojos;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+import java.util.StringTokenizer;
+import java.util.TreeSet;
+
+
+/**
+ * @struts.form include-all="true"
+ * @ejb:bean name="PlanetGroupData"
+ * @hibernate.class table="rag_group"
+ */
+public class PlanetGroupData extends PersistentObject implements Serializable
+{
+    transient private String[] catArray = null;
+
+    /** Database ID */
+    protected String id;
+    
+    /** Unique handle by which group may be fetched */
+    protected String handle;
+    
+    /** Title of this group */
+    protected String title;
+    
+    /** Description of this group */
+    protected String description;
+    
+    /** Restrict group by this list of comma separated category names */
+    protected String categoryRestriction;
+    
+    /** Max number of entries to show in HTML representation of this group */
+    protected int maxPageEntries = 45;
+    
+    /** Max number of entries to show in feed representation of this group */
+    protected int maxFeedEntries = 45;
+    
+    /** Subscriptions in this group */
+    protected List subscriptionAssocs = new ArrayList();
+
+    //------------------------------------------------------- persistent fields
+
+    /** 
+     * @ejb:persistent-field 
+     * @hibernate.id column="id" type="string" 
+     *     generator-class="uuid.hex" unsaved-value="null"
+     */
+    public String getId()
+    {
+        return id;
+    }
+    public void setId(String id)
+    {
+        this.id = id;
+    }
+    /** 
+     * @hibernate.bag lazy="false" inverse="true" cascade="delete" 
+     * @hibernate.collection-key column="group_id"
+     * @hibernate.collection-one-to-many 
+     *    class="org.roller.pojos.PlanetGroupSubscriptionAssoc"
+     */
+    public List getGroupSubscriptionAssocs()
+    {
+        return subscriptionAssocs;
+    }
+    public void setGroupSubscriptionAssocs(List subscriptionAssocs)
+    {
+        this.subscriptionAssocs = subscriptionAssocs;
+    }
+    /** 
+     * @hibernate.property column="cat_restriction" non-null="false" unique="false"
+     */
+    public String getCategoryRestriction()
+    {
+        return categoryRestriction;
+    }
+    public void setCategoryRestriction(String categoryRestriction)
+    {
+        this.categoryRestriction = categoryRestriction;
+        catArray = null;
+    }
+    /** 
+     * @hibernate.property column="description" non-null="false" unique="false"
+     */
+    public String getDescription()
+    {
+        return description;
+    }
+    public void setDescription(String description)
+    {
+        this.description = description;
+    }
+    /** 
+     * @hibernate.property column="handle" non-null="false" unique="false"
+     */
+    public String getHandle()
+    {
+        return handle;
+    }
+    public void setHandle(String handle)
+    {
+        this.handle = handle;
+    }
+    /** 
+     * @hibernate.property column="max_feed_entries" non-null="false" unique="false"
+     */
+    public int getMaxFeedEntries()
+    {
+        return maxFeedEntries;
+    }
+    public void setMaxFeedEntries(int maxFeedEntries)
+    {
+        this.maxFeedEntries = maxFeedEntries;
+    }
+    /** 
+     * @hibernate.property column="max_page_entries" non-null="false" unique="false"
+     */
+    public int getMaxPageEntries()
+    {
+        return maxPageEntries;
+    }
+    public void setMaxPageEntries(int maxPageEntries)
+    {
+        this.maxPageEntries = maxPageEntries;
+    }
+    /** 
+     * @hibernate.property column="title" non-null="false" unique="false"
+     */
+    public String getTitle()
+    {
+        return title;
+    }
+    public void setTitle(String title)
+    {
+        this.title = title;
+    }
+
+    //--------------------------------------------------------------- app logic
+
+    /**
+     * Returns true if entry is qualified for inclusion in this group.
+     */
+    public boolean qualified(PlanetEntryData entry)
+    {
+        String[] cats = getCategoryRestructionAsArray();
+        if (cats == null || cats.length == 0) return true;
+        for (int i=0; i<cats.length; i++) 
+        {
+            if (entry.inCategory(cats[i])) return true;
+        }
+        return  false;
+    }
+    
+    //------------------------------------------------------------- convenience
+
+    private String[] getCategoryRestructionAsArray()
+    {
+        if (catArray == null && categoryRestriction != null)
+        {
+            StringTokenizer toker = new StringTokenizer(categoryRestriction,",");
+            catArray = new String[toker.countTokens()];
+            int i = 0;
+    
+            while (toker.hasMoreTokens())
+            {
+                catArray[i++] = toker.nextToken();
+            }
+        }
+        return catArray;
+    }
+    /** no-op to please XDoclet generated form */
+    private void setCategoryRestructionAsArray(String[] ignored)
+    {
+    }
+    
+    //---------------------------------------------------------- implementation
+
+    public void removeSubscription(PlanetSubscriptionData sub)
+    {
+        Set set = new TreeSet();
+        Iterator assocs = getGroupSubscriptionAssocs().iterator();
+        PlanetGroupSubscriptionAssoc target = null;
+        while (assocs.hasNext())
+        {
+            PlanetGroupSubscriptionAssoc assoc = 
+                    (PlanetGroupSubscriptionAssoc)assocs.next();
+            if (assoc.getSubscription().getFeedUrl().equals(sub.getFeedUrl()))
+            {
+                target = assoc;
+                break;
+            }
+        }
+        subscriptionAssocs.remove(target);
+    }
+    public void addSubscription(PlanetSubscriptionData sub)
+    {
+        PlanetGroupSubscriptionAssoc assoc = 
+                new PlanetGroupSubscriptionAssoc();
+        assoc.setGroup(this);
+        assoc.setSubscription(sub);
+        subscriptionAssocs.add(assoc);
+    }
+    public void addSubscriptions(Collection subsList)
+    {
+        Iterator subs = subsList.iterator();
+        while (subs.hasNext())
+        {
+            PlanetSubscriptionData sub = (PlanetSubscriptionData)subs.next();
+            addSubscription(sub);
+        }
+    }
+    public Set getSubscriptions() 
+    {
+        Set set = new TreeSet();
+        Iterator assocs = getGroupSubscriptionAssocs().iterator();
+        while (assocs.hasNext())
+        {
+            PlanetGroupSubscriptionAssoc assoc = 
+                    (PlanetGroupSubscriptionAssoc)assocs.next();
+            set.add(assoc.getSubscription());
+        }
+        return set;
+    }
+    public void setData(PersistentObject vo)
+    {
+        // TODO Auto-generated method stub    
+    }
+}

Added: incubator/roller/trunk/src/org/roller/pojos/PlanetGroupSubscriptionAssoc.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/roller/pojos/PlanetGroupSubscriptionAssoc.java?rev=189695&view=auto
==============================================================================
--- incubator/roller/trunk/src/org/roller/pojos/PlanetGroupSubscriptionAssoc.java (added)
+++ incubator/roller/trunk/src/org/roller/pojos/PlanetGroupSubscriptionAssoc.java Wed Jun  8 20:18:46 2005
@@ -0,0 +1,78 @@
+/*
+ * Copyright 2005 Sun Microsystems, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.roller.pojos;
+
+import java.io.Serializable;
+
+import org.roller.pojos.PersistentObject;
+
+/**
+ * @hibernate.class table="rag_group_subscription"
+ * @author Dave Johnson
+ */
+public class PlanetGroupSubscriptionAssoc extends PersistentObject 
+        implements Serializable
+{
+    /** Database ID */
+    protected String id;
+    
+    protected PlanetGroupData group;
+    protected PlanetSubscriptionData subscription;
+
+    //----------------------------------------------------------- persistent fields
+    /** 
+     * @hibernate.id column="id" type="string" 
+     *     generator-class="uuid.hex" unsaved-value="null"
+     */
+    public String getId()
+    {
+        return id;
+    }
+
+    public void setId(String id)
+    {
+        this.id = id;
+    }
+
+    /** 
+     * @hibernate.many-to-one column="group_id" cascade="none" not-null="false"
+     */
+    public PlanetGroupData getGroup()
+    {
+        return group;
+    }
+    public void setGroup(PlanetGroupData group)
+    {
+        this.group = group;
+    }
+    
+    /** 
+     * @hibernate.many-to-one column="subscription_id" cascade="none" not-null="false"
+     */
+    public PlanetSubscriptionData getSubscription()
+    {
+        return subscription;
+    }    
+    public void setSubscription(PlanetSubscriptionData subscription)
+    {
+        this.subscription = subscription;
+    }
+
+    //-------------------------------------------------------------- implementation
+    public void setData(PersistentObject vo)
+    {
+    }
+}
\ No newline at end of file

Added: incubator/roller/trunk/src/org/roller/pojos/PlanetSubscriptionData.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/roller/pojos/PlanetSubscriptionData.java?rev=189695&view=auto
==============================================================================
--- incubator/roller/trunk/src/org/roller/pojos/PlanetSubscriptionData.java (added)
+++ incubator/roller/trunk/src/org/roller/pojos/PlanetSubscriptionData.java Wed Jun  8 20:18:46 2005
@@ -0,0 +1,214 @@
+/*
+ * Copyright 2005 Sun Microsystems, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.roller.pojos;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Date;
+import java.util.List;
+
+
+
+/**
+ * @struts.form include-all="true"
+ * @ejb:bean name="PlanetSubscriptionData"
+ * @hibernate.class table="rag_subscription"
+ */
+public class PlanetSubscriptionData extends PersistentObject 
+    implements Serializable, Comparable
+{
+    /** Database ID */
+    protected String id;
+    
+    /** Title of the blog or website */
+    protected String title;
+    
+    /** Name of blog or website author */
+    protected String author; 
+    
+    /** URL of the newsfeed */
+    protected String feedUrl;
+    
+    /** URL of the blog or website */
+    protected String siteUrl;
+    
+    /** Last update time of site */
+    protected Date lastUpdated;
+    
+    /** Most recent entries from site (a set of EntityData objects) */
+    protected List entries = new ArrayList(); 
+    
+    /** Inbound links according to Technorati */
+    protected int inboundlinks = 0;
+
+    /** Inbound blogs according to Technorati */
+    protected int inboundblogs = 0;
+    
+    protected List groupAssocs = new ArrayList();
+    
+    //----------------------------------------------------------- persistent fields
+
+    /** 
+     * @hibernate.bag lazy="true" inverse="true" cascade="delete" 
+     * @hibernate.collection-key column="subscription_id"
+     * @hibernate.collection-one-to-many 
+     *    class="org.roller.pojos.PlanetGroupSubscriptionAssoc"
+     */
+    public List getGroupSubscriptionAssocs()
+    {
+        return groupAssocs;
+    }
+    public void setGroupSubscriptionAssocs(List groupAssocs)
+    {
+        this.groupAssocs = groupAssocs;
+    }
+
+    /** 
+     * @hibernate.id column="id" type="string" 
+     *     generator-class="uuid.hex" unsaved-value="null"
+     */
+    public String getId()
+    {
+        return id;
+    }
+    public void setId(String id)
+    {
+        this.id = id;
+    }
+    /** 
+     * @hibernate.bag lazy="true" inverse="true" cascade="all" 
+     * @hibernate.collection-key column="subscription_id"
+     * @hibernate.collection-one-to-many 
+     *    class="org.roller.pojos.PlanetEntryData"
+     */
+    public List getEntries()
+    {
+        return entries;
+    }
+    public void setEntries(List entries)
+    {
+        this.entries = entries;
+    }
+    /** 
+     * @hibernate.property column="feed_url" non-null="true" unique="false"
+     */
+    public String getFeedUrl()
+    {
+        return feedUrl;
+    }
+    public void setFeedUrl(String feedUrl)
+    {
+        this.feedUrl = feedUrl;
+    }
+    /** 
+     * @hibernate.property column="last_updated" non-null="false" unique="false"
+     */
+    public Date getLastUpdated()
+    {
+        return lastUpdated;
+    }
+    public void setLastUpdated(Date lastUpdated)
+    {
+        this.lastUpdated = lastUpdated;
+    }
+    /** 
+     * @hibernate.property column="site_url" non-null="false" unique="false"
+     */
+    public String getSiteUrl()
+    {
+        return siteUrl;
+    }
+    public void setSiteUrl(String siteUrl)
+    {
+        this.siteUrl = siteUrl;
+    }
+    /** 
+     * @hibernate.property column="title" non-null="false" unique="false"
+     */
+    public String getTitle()
+    {
+        return title;
+    }
+    public void setTitle(String title)
+    {
+        this.title = title;
+    }
+    /** 
+     * @hibernate.property column="author" non-null="false" unique="false"
+     */
+    public String getAuthor()
+    {
+        return author;
+    }
+    public void setAuthor(String author)
+    {
+        this.author = author;
+    }
+    /** 
+     * @hibernate.property column="inbound_links" non-null="false" unique="false"
+     */
+    public int getInboundlinks()
+    {
+        return inboundlinks;
+    }
+    public void setInboundlinks(int inboundlinks)
+    {
+        this.inboundlinks = inboundlinks;
+    }
+    /** 
+     * @hibernate.property column="inbound_blogs" non-null="false" unique="false"
+     */
+    public int getInboundblogs()
+    {
+        return inboundblogs;
+    }
+    public void setInboundblogs(int inboundblogs)
+    {
+        this.inboundblogs = inboundblogs;
+    }
+
+    //-------------------------------------------------------------- implementation
+   
+    /**
+     */
+    public void setData(PersistentObject vo)
+    {
+        // TODO Auto-generated method stub        
+    }
+    /**
+     */
+    public int compareTo(Object o)
+    {
+        PlanetSubscriptionData other = (PlanetSubscriptionData)o;
+        return getFeedUrl().compareTo(other.getFeedUrl());
+    }
+
+    public void addEntry(PlanetEntryData entry)
+    {
+        entries.add(entry);
+    }
+    
+    public void addEntries(Collection newEntries)
+    {
+        entries.addAll(newEntries);
+    }
+    
+    public void purgeEntries()
+    {
+        entries.clear();
+    }
+}

Added: incubator/roller/trunk/src/org/roller/pojos/RefererComparator.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/roller/pojos/RefererComparator.java?rev=189695&view=auto
==============================================================================
--- incubator/roller/trunk/src/org/roller/pojos/RefererComparator.java (added)
+++ incubator/roller/trunk/src/org/roller/pojos/RefererComparator.java Wed Jun  8 20:18:46 2005
@@ -0,0 +1,33 @@
+package org.roller.pojos;
+
+
+import java.io.Serializable;
+import java.util.Comparator;
+
+/** Compares referers based on day hits and then alphabetical order */
+public class RefererComparator implements Comparator, Serializable
+{
+    static final long serialVersionUID = -1658901752434218888L;
+    
+    public int compare(Object val1, Object val2)
+    throws ClassCastException
+    {
+        RefererData r1 = (RefererData)val1;
+        RefererData r2 = (RefererData)val2;
+        int hits1 = r1.getDayHits().intValue();
+        int hits2 = r2.getDayHits().intValue();
+
+        if (hits1 > hits2)
+        {
+            return -1;
+        }
+        else if (hits1 < hits2)
+        {
+            return 1;
+        }
+
+        // if hits are the same, return
+        // results of String.compareTo()
+        return r1.getRefererUrl().compareTo(r2.getRefererUrl());
+    }
+}

Added: incubator/roller/trunk/src/org/roller/pojos/RefererData.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/roller/pojos/RefererData.java?rev=189695&view=auto
==============================================================================
--- incubator/roller/trunk/src/org/roller/pojos/RefererData.java (added)
+++ incubator/roller/trunk/src/org/roller/pojos/RefererData.java Wed Jun  8 20:18:46 2005
@@ -0,0 +1,569 @@
+/*
+ * Generated file - Do not edit!
+ */
+package org.roller.pojos;
+
+import org.roller.util.Utilities;
+
+
+/**
+ * Referer bean.
+ * @author David M Johnson
+ *
+ * @ejb:bean name="RefererData"
+ * @struts.form include-all="true"
+ * @hibernate.class table="referer" 
+ * hibernate.jcs-cache usage="read-write"
+ */
+public class RefererData extends org.roller.pojos.PersistentObject
+    implements java.io.Serializable
+{
+    static final long serialVersionUID = -1817992900602131316L;
+    protected java.lang.String id = null;
+    protected org.roller.pojos.WebsiteData website = null;
+    protected org.roller.pojos.WeblogEntryData weblogEntry = null;
+    protected java.lang.String dateString = null;
+    protected java.lang.String refererUrl = null;
+    protected java.lang.String refererPermalink = null;
+    protected java.lang.String requestUrl = null;
+    protected java.lang.String title = null;
+    protected java.lang.String excerpt = null;
+    protected java.lang.Boolean visible = null;
+    protected java.lang.Boolean duplicate = null;
+    protected java.lang.Integer dayHits = null;
+    protected java.lang.Integer totalHits = null;
+
+    public RefererData()
+    {
+    }
+
+    public RefererData(java.lang.String id, 
+                       org.roller.pojos.WebsiteData website, 
+                       org.roller.pojos.WeblogEntryData weblogEntry, 
+                       java.lang.String dateString, java.lang.String refererUrl, 
+                       java.lang.String refererPermalink, 
+                       java.lang.String requestUrl, java.lang.String title, 
+                       java.lang.String excerpt, java.lang.Boolean visible, 
+                       java.lang.Boolean duplicate, java.lang.Integer dayHits, 
+                       java.lang.Integer totalHits)
+    {
+        this.id = id;
+        this.website = website;
+        this.weblogEntry = weblogEntry;
+        this.dateString = dateString;
+        this.refererUrl = refererUrl;
+        this.refererPermalink = refererPermalink;
+        this.requestUrl = requestUrl;
+        this.title = title;
+        this.excerpt = excerpt;
+        this.visible = visible;
+        this.duplicate = duplicate;
+        this.dayHits = dayHits;
+        this.totalHits = totalHits;
+    }
+
+    public RefererData(RefererData otherData)
+    {
+        this.id = otherData.id;
+        this.website = otherData.website;
+        this.weblogEntry = otherData.weblogEntry;
+        this.dateString = otherData.dateString;
+        this.refererUrl = otherData.refererUrl;
+        this.refererPermalink = otherData.refererPermalink;
+        this.requestUrl = otherData.requestUrl;
+        this.title = otherData.title;
+        this.excerpt = otherData.excerpt;
+        this.visible = otherData.visible;
+        this.duplicate = otherData.duplicate;
+        this.dayHits = otherData.dayHits;
+        this.totalHits = otherData.totalHits;
+    }
+
+    //------------------------------------------------------- Simple properties
+
+    /** 
+     * Unique ID and primary key of this Referer.
+     * @hibernate.id column="id" type="string"
+     *  generator-class="uuid.hex" unsaved-value="null"
+     */
+    public java.lang.String getId()
+    {
+        return this.id;
+    }
+
+    public void setId(java.lang.String id)
+    {
+        this.id = id;
+    }
+
+    /** 
+     * ID of website that this referer refers to.
+     * @hibernate.many-to-one column="websiteid" cascade="none" not-null="true"
+     */
+    public org.roller.pojos.WebsiteData getWebsite()
+    {
+        return this.website;
+    }
+
+    public void setWebsite(org.roller.pojos.WebsiteData website)
+    {
+        this.website = website;
+    }
+
+    /**
+     * @hibernate.many-to-one column="entryid" cascade="none"
+     */
+    public org.roller.pojos.WeblogEntryData getWeblogEntry()
+    {
+        return weblogEntry;
+    }
+
+    /**
+     * @param data
+     */
+    public void setWeblogEntry(org.roller.pojos.WeblogEntryData data)
+    {
+        weblogEntry = data;
+    }
+
+    /** 
+     * Date string in YYYYMMDD format.
+     * @hibernate.property column="datestr" non-null="true" unique="false"
+     */
+    public java.lang.String getDateString()
+    {
+        return this.dateString;
+    }
+
+    public void setDateString(java.lang.String dateString)
+    {
+        this.dateString = dateString;
+    }
+
+    /** 
+     * URL of the refering page.
+     * @hibernate.property column="refurl" non-null="true" unique="false"
+     */
+    public java.lang.String getRefererUrl()
+    {
+        return this.refererUrl;
+    }
+
+    public void setRefererUrl(java.lang.String refererUrl)
+    {
+        this.refererUrl = refererUrl;
+    }
+
+    /** 
+     * Requested URL, the URL linked to by the refering page.
+     * @hibernate.property column="refpermalink" non-null="true" unique="false"
+     */
+    public java.lang.String getRefererPermalink()
+    {
+        return this.refererPermalink;
+    }
+
+    public void setRefererPermalink(java.lang.String refererPermalink)
+    {
+        this.refererPermalink = refererPermalink;
+    }
+
+    /** 
+     * Requested URL, the URL linked to by the refering page.
+     * @hibernate.property column="requrl" non-null="true" unique="false"
+     */
+    public java.lang.String getRequestUrl()
+    {
+        return this.requestUrl;
+    }
+
+    public void setRequestUrl(java.lang.String requestUrl)
+    {
+        this.requestUrl = requestUrl;
+    }
+
+    /** 
+     * The text on the refering page that surrounds the refering link.  
+     * @hibernate.property column="title" non-null="true" unique="false"
+     */
+    public java.lang.String getTitle()
+    {
+        return this.title;
+    }
+
+    public void setTitle(java.lang.String title)
+    {
+        this.title = title;
+    }
+
+    /** 
+     * The text on the refering page that surrounds the refering link.  
+     * @hibernate.property column="excerpt" non-null="true" unique="false"
+     */
+    public java.lang.String getExcerpt()
+    {
+        return this.excerpt;
+    }
+
+    public void setExcerpt(java.lang.String excerpt)
+    {
+        this.excerpt = excerpt;
+    }
+
+    /** 
+     * Should this referer be displayed?
+     * @hibernate.property column="visible" non-null="true" unique="false"
+     */
+    public java.lang.Boolean getVisible()
+    {
+        return this.visible;
+    }
+
+    public void setVisible(java.lang.Boolean visible)
+    {
+        this.visible = visible;
+    }
+
+    /** 
+     * Is this referer a duplicate?
+     * @hibernate.property column="duplicate" non-null="true" unique="false"
+     */
+    public java.lang.Boolean getDuplicate()
+    {
+        return this.duplicate;
+    }
+
+    public void setDuplicate(java.lang.Boolean duplicate)
+    {
+        this.duplicate = duplicate;
+    }
+
+    /** 
+     * Hits received today from this referer.
+     * @hibernate.property column="dayhits" non-null="true" unique="false"
+     */
+    public java.lang.Integer getDayHits()
+    {
+        return this.dayHits;
+    }
+
+    public void setDayHits(java.lang.Integer dayHits)
+    {
+        this.dayHits = dayHits;
+    }
+
+    /** 
+     * Total hits received from this referer.
+     * @hibernate.property column="totalhits" non-null="true" unique="false"
+     */
+    public java.lang.Integer getTotalHits()
+    {
+        return this.totalHits;
+    }
+
+    public void setTotalHits(java.lang.Integer totalHits)
+    {
+        this.totalHits = totalHits;
+    }
+
+    //-------------------------------------------------------------------------
+    public String getDisplayUrl(int maxWidth, boolean includeHits)
+    {
+        StringBuffer sb = new StringBuffer();
+
+        String url = Utilities.escapeHTML(getUrl());
+        String displayUrl = url.trim();
+        String restOfUrl = null;
+
+        if (displayUrl.startsWith("http://"))
+        {
+            displayUrl = displayUrl.substring(7);
+        }
+
+        if (displayUrl.length() > maxWidth)
+        {
+            restOfUrl = "..." + 
+                        displayUrl.substring(maxWidth, displayUrl.length());
+            displayUrl = displayUrl.substring(0, maxWidth) + "...";
+        }
+
+        if (url.startsWith("http://"))
+        {
+            sb.append("<a href=\"");
+            sb.append(url);
+        }
+
+        // add a title with the rest of the url if it exists
+        if (restOfUrl != null)
+        {
+            sb.append("\" title=\"");
+            sb.append(restOfUrl);
+        }
+
+        if (sb.length() > 0)
+        {
+            sb.append("\">");
+        }
+
+        sb.append(displayUrl);
+
+        if (includeHits)
+        {
+            sb.append(" (");
+            sb.append(getDayHits());
+            sb.append(")");
+        }
+
+        if (url.startsWith("http://"))
+        {
+            sb.append("</a>");
+        }
+
+        return sb.toString();
+    }
+
+    //-------------------------------------------------------------------------
+    public String getUrl()
+    {
+        if (getRefererPermalink() != null)
+        {
+            return getRefererPermalink();
+        }
+        else
+        {
+            return getRefererUrl();
+        }
+    }
+
+    //-------------------------------------------------------------------------
+    public String getDisplayUrl()
+    {
+        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.id == null);
+            }
+            else
+            {
+                lEquals = lEquals && this.id.equals(lTest.id);
+            }
+
+            if (this.website == null)
+            {
+                lEquals = lEquals && (lTest.website == null);
+            }
+            else
+            {
+                lEquals = lEquals && this.website.equals(lTest.website);
+            }
+
+            if (this.weblogEntry == null)
+            {
+                lEquals = lEquals && (lTest.weblogEntry == null);
+            }
+            else
+            {
+                lEquals = lEquals && 
+                          this.weblogEntry.equals(lTest.weblogEntry);
+            }
+
+            if (this.dateString == null)
+            {
+                lEquals = lEquals && (lTest.dateString == null);
+            }
+            else
+            {
+                lEquals = lEquals && 
+                          this.dateString.equals(lTest.dateString);
+            }
+
+            if (this.refererUrl == null)
+            {
+                lEquals = lEquals && (lTest.refererUrl == null);
+            }
+            else
+            {
+                lEquals = lEquals && 
+                          this.refererUrl.equals(lTest.refererUrl);
+            }
+
+            if (this.refererPermalink == null)
+            {
+                lEquals = lEquals && (lTest.refererPermalink == null);
+            }
+            else
+            {
+                lEquals = lEquals && 
+                          this.refererPermalink.equals(lTest.refererPermalink);
+            }
+
+            if (this.requestUrl == null)
+            {
+                lEquals = lEquals && (lTest.requestUrl == null);
+            }
+            else
+            {
+                lEquals = lEquals && 
+                          this.requestUrl.equals(lTest.requestUrl);
+            }
+
+            if (this.title == null)
+            {
+                lEquals = lEquals && (lTest.title == null);
+            }
+            else
+            {
+                lEquals = lEquals && this.title.equals(lTest.title);
+            }
+
+            if (this.excerpt == null)
+            {
+                lEquals = lEquals && (lTest.excerpt == null);
+            }
+            else
+            {
+                lEquals = lEquals && this.excerpt.equals(lTest.excerpt);
+            }
+
+            if (this.visible == null)
+            {
+                lEquals = lEquals && (lTest.visible == null);
+            }
+            else
+            {
+                lEquals = lEquals && this.visible.equals(lTest.visible);
+            }
+
+            if (this.duplicate == null)
+            {
+                lEquals = lEquals && (lTest.duplicate == null);
+            }
+            else
+            {
+                lEquals = lEquals && this.duplicate.equals(lTest.duplicate);
+            }
+
+            if (this.dayHits == null)
+            {
+                lEquals = lEquals && (lTest.dayHits == null);
+            }
+            else
+            {
+                lEquals = lEquals && this.dayHits.equals(lTest.dayHits);
+            }
+
+            if (this.totalHits == null)
+            {
+                lEquals = lEquals && (lTest.totalHits == null);
+            }
+            else
+            {
+                lEquals = lEquals && this.totalHits.equals(lTest.totalHits);
+            }
+
+            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()
+     */
+    public void setData(org.roller.pojos.PersistentObject otherData)
+    {
+        this.id = ((RefererData) otherData).id;
+        this.website = ((RefererData) otherData).website;
+        this.weblogEntry = ((RefererData) otherData).weblogEntry;
+        this.dateString = ((RefererData) otherData).dateString;
+        this.refererUrl = ((RefererData) otherData).refererUrl;
+        this.refererPermalink = ((RefererData) otherData).refererPermalink;
+        this.requestUrl = ((RefererData) otherData).requestUrl;
+        this.title = ((RefererData) otherData).title;
+        this.excerpt = ((RefererData) otherData).excerpt;
+        this.visible = ((RefererData) otherData).visible;
+        this.duplicate = ((RefererData) otherData).duplicate;
+        this.dayHits = ((RefererData) otherData).dayHits;
+        this.totalHits = ((RefererData) otherData).totalHits;
+    }
+
+    /**
+     * A no-op.
+     * TODO: fix formbean generation so this is not needed. 
+     * @param string
+     */
+    public void setUrl(String string)
+    {
+    }
+
+    /**
+     * A no-op
+     */
+    public void setDisplayUrl(String string)
+    {
+    }
+
+}
\ No newline at end of file

Added: incubator/roller/trunk/src/org/roller/pojos/RoleData.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/roller/pojos/RoleData.java?rev=189695&view=auto
==============================================================================
--- incubator/roller/trunk/src/org/roller/pojos/RoleData.java (added)
+++ incubator/roller/trunk/src/org/roller/pojos/RoleData.java Wed Jun  8 20:18:46 2005
@@ -0,0 +1,187 @@
+
+package org.roller.pojos;
+
+
+/**
+ * Role bean.
+ * @author David M Johnson
+ *
+ * @ejb:bean name="RoleData"
+ * @struts.form include-all="true"
+ * @hibernate.class table="userrole"  
+ * hibernate.jcs-cache usage="read-write"
+ */
+public class RoleData
+   extends org.roller.pojos.PersistentObject
+   implements java.io.Serializable
+{
+   static final long serialVersionUID = -4254083071697970972L;
+
+   protected java.lang.String id;
+   protected java.lang.String userName;
+   protected UserData user;
+   protected java.lang.String role;
+
+   public RoleData()
+   {
+   }
+
+   public RoleData(String id, UserData user, String role)
+   {
+      this.id = id;
+      this.userName = user.getUserName();
+      this.user = user;
+      this.role = role;
+   }
+
+   public RoleData( RoleData otherData )
+   {
+      this.id = otherData.id;
+      this.userName = otherData.userName;
+      this.user = otherData.user;
+      this.role = otherData.role;
+
+   }
+
+   /** 
+    * @ejb:pk-field
+    * @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.property column="username" non-null="true" unique="false"
+    */
+   public java.lang.String getUserName()
+   {
+      return this.userName;
+   }
+   /** @ejb:persistent-field */ 
+   public void setUserName( java.lang.String userName )
+   {
+      this.userName = userName;
+   }
+
+   /** 
+    * @hibernate.many-to-one column="userid" cascade="none" not-null="true"
+    * @ejb:persistent-field 
+    */
+   public UserData getUser()
+   {
+      return this.user;
+   }
+   /** @ejb:persistent-field */ 
+   public void setUser( UserData user )
+   {
+      this.user = user;
+   }
+
+   /** 
+    * @ejb:persistent-field 
+    * @hibernate.property column="rolename" non-null="true" unique="false"
+    */
+   public java.lang.String getRole()
+   {
+      return this.role;
+   }
+   /** @ejb:persistent-field */ 
+   public void setRole( java.lang.String role )
+   {
+      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.id == null )
+         {
+            lEquals = lEquals && ( lTest.id == null );
+         }
+         else
+         {
+            lEquals = lEquals && this.id.equals( lTest.id );
+         }
+         if( this.userName == null )
+         {
+            lEquals = lEquals && ( lTest.userName == null );
+         }
+         else
+         {
+            lEquals = lEquals && this.userName.equals( lTest.userName );
+         }
+         if( this.user == null )
+         {
+            lEquals = lEquals && ( lTest.user == null );
+         }
+         else
+         {
+            lEquals = lEquals && this.user.equals( lTest.user );
+         }
+         if( this.role == null )
+         {
+            lEquals = lEquals && ( lTest.role == null );
+         }
+         else
+         {
+            lEquals = lEquals && this.role.equals( lTest.role );
+         }
+
+         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.roller.pojos.PersistentObject otherData )
+   {
+
+      this.id = ((RoleData)otherData).id;
+
+      this.userName = ((RoleData)otherData).userName;
+
+      this.user = ((RoleData)otherData).user;
+
+      this.role = ((RoleData)otherData).role;
+   }
+
+}