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 2006/05/02 00:23:34 UTC

svn commit: r398712 [9/32] - in /incubator/roller/trunk/src/org/apache: ./ roller/ roller/business/ roller/business/hibernate/ roller/business/referrers/ roller/business/runnable/ roller/business/search/ roller/business/search/operations/ roller/busine...

Added: incubator/roller/trunk/src/org/apache/roller/pojos/PingQueueEntryData.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/apache/roller/pojos/PingQueueEntryData.java?rev=398712&view=auto
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/pojos/PingQueueEntryData.java (added)
+++ incubator/roller/trunk/src/org/apache/roller/pojos/PingQueueEntryData.java Mon May  1 15:23:02 2006
@@ -0,0 +1,250 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  The ASF licenses this file to You
+ * under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.  For additional information regarding
+ * copyright in this work, please see the NOTICE file in the top level
+ * directory of this distribution.
+ */
+
+package org.apache.roller.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 <a href="mailto:anil@busybuddha.org">Anil Gangolli</a>
+ * @ejb:bean name="PingQueueEntryData"
+ * @hibernate.class lazy="false" table="pingqueueentry"
+ * @hibernate.cache usage="read-write"
+ */
+public class PingQueueEntryData extends PersistentObject implements Serializable
+{
+    private String id = null;
+    private Timestamp entryTime = null;
+    private PingTargetData pingTarget = null;
+    private WebsiteData website = null;
+    private int attempts = 0;
+
+    public 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.getId();
+        entryTime = other.getEntryTime();
+        pingTarget = other.getPingTarget();
+        website = other.getWebsite();
+        attempts = other.getAttempts();
+    }
+
+    /**
+     * Get the unique id (primary key) of this object.
+     *
+     * @return the unique id of this object.
+     * @ejb:persistent-field
+     * @hibernate.id column="id" 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.getAttempts()) return false;
+        if (entryTime != null ? !entryTime.equals(pingQueueEntryData.getEntryTime()) : pingQueueEntryData.getEntryTime() != null) return false;
+        if (id != null ? !id.equals(pingQueueEntryData.getId()) : pingQueueEntryData.getId() != null) return false;
+        if (pingTarget != null ? !pingTarget.equals(pingQueueEntryData.getPingTarget()) : pingQueueEntryData.getPingTarget() != null) return false;
+        if (website != null ? !website.equals(pingQueueEntryData.getWebsite()) : pingQueueEntryData.getWebsite() != null) return false;
+
+        return true;
+    }
+
+    /**
+     * @see Object#hashCode()
+     */
+    public int hashCode()
+    {
+        return (id != null ? id.hashCode() : 0);
+    }
+
+    /**
+     * Generate a string form of the object appropriate for logging or debugging.
+     * @return a string form of the object appropriate for logging or debugging.
+     * @see java.lang.Object#toString()
+     */
+    public String toString()
+    {
+        return "PingQueueEntryData{" +
+            "id='" + id + "'" +
+            ", entryTime=" + entryTime +
+            ", pingTarget=" + pingTarget +
+            ", website= " + (website == null ? "null" : "{id='" + website.getId() + "'} ") +
+            ", attempts=" + attempts +
+            "}";
+    }
+}

Added: incubator/roller/trunk/src/org/apache/roller/pojos/PingTargetData.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/apache/roller/pojos/PingTargetData.java?rev=398712&view=auto
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/pojos/PingTargetData.java (added)
+++ incubator/roller/trunk/src/org/apache/roller/pojos/PingTargetData.java Mon May  1 15:23:02 2006
@@ -0,0 +1,290 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  The ASF licenses this file to You
+ * under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.  For additional information regarding
+ * copyright in this work, please see the NOTICE file in the top level
+ * directory of this distribution.
+ */
+
+package org.apache.roller.pojos;
+
+import org.apache.roller.RollerException;
+import org.apache.roller.model.Roller;
+import org.apache.roller.model.RollerFactory;
+import org.apache.roller.model.AutoPingManager;
+import org.apache.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 <a href="mailto:anil@busybuddha.org">Anil Gangolli</a>
+ * @ejb:bean name="PingTargetData"
+ * @struts.form include-all="true"
+ * @hibernate.class lazy="false" table="pingtarget"
+ * @hibernate.cache usage="read-write"
+ */
+public class PingTargetData extends PersistentObject implements Serializable
+{
+    private String id = null;
+    private String name = null;
+    private String pingUrl = null;
+    private WebsiteData website = null;
+    private int conditionCode = -1;
+    private Timestamp lastSuccess = null;
+
+    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
+
+    public 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.getId();
+        name = other.getName();
+        pingUrl = other.getPingUrl();
+        website = other.getWebsite();
+        conditionCode = other.getConditionCode();
+        lastSuccess = other.getLastSuccess();
+    }
+
+
+    /**
+     * 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" 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="conditioncode" 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.getConditionCode()) return false;
+        if (id != null ? !id.equals(pingTargetData.getId()) : pingTargetData.getId() != null) return false;
+        if (lastSuccess != null ? !lastSuccess.equals(pingTargetData.getLastSuccess()) : pingTargetData.getLastSuccess() != null) return false;
+        if (name != null ? !name.equals(pingTargetData.getName()) : pingTargetData.getName() != null) return false;
+        if (pingUrl != null ? !pingUrl.equals(pingTargetData.getPingUrl()) : pingTargetData.getPingUrl() != null) return false;
+        if (website != null ? !website.equals(pingTargetData.getWebsite()) : pingTargetData.getWebsite() != null) return false;
+
+        return true;
+    }
+
+
+    /**
+     * 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() + "'} ") +
+            ", conditionCode=" + conditionCode +
+            ", lastSuccess=" + lastSuccess +
+            "}";
+    }
+}

Added: incubator/roller/trunk/src/org/apache/roller/pojos/PlanetConfigData.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/apache/roller/pojos/PlanetConfigData.java?rev=398712&view=auto
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/pojos/PlanetConfigData.java (added)
+++ incubator/roller/trunk/src/org/apache/roller/pojos/PlanetConfigData.java Mon May  1 15:23:02 2006
@@ -0,0 +1,250 @@
+/*
+ * 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.apache.roller.pojos;
+
+import java.io.Serializable;
+
+import org.apache.roller.pojos.PersistentObject;
+
+/**
+ * @struts.form include-all="true"
+ * @hibernate.class lazy="false" 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 = "";
+    
+    
+    //----------------------------------------------------------- persistent fields
+    /** 
+     * @hibernate.id column="id" 
+     *     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;
+    }
+
+    /** 
+     * Not longer stored in database, but we keep this field for compatibility 
+     * with standalone version of planet (which persists config in XML).
+     *
+     * @hibernate.property column="cache_dir" non-null="true" unique="false"
+     */
+    public String getCacheDir()
+    {
+        return cacheDir;
+    }
+    public void setCacheDir(String dir)
+    {
+        if (dir != null) cacheDir = dir;
+    }
+
+    //-------------------------------------------------------------- implementation
+    public void setData(PersistentObject vo)
+    {
+        // TODO Auto-generated method stub
+    }
+}
\ No newline at end of file

Added: incubator/roller/trunk/src/org/apache/roller/pojos/PlanetEntryData.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/apache/roller/pojos/PlanetEntryData.java?rev=398712&view=auto
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/pojos/PlanetEntryData.java (added)
+++ incubator/roller/trunk/src/org/apache/roller/pojos/PlanetEntryData.java Mon May  1 15:23:02 2006
@@ -0,0 +1,403 @@
+/*
+ * 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.apache.roller.pojos;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.roller.config.RollerRuntimeConfig;
+import org.apache.roller.util.rome.ContentModule;
+
+import org.apache.roller.util.Utilities;
+import org.apache.commons.lang.StringUtils;
+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;
+
+// this will be needed for ROME v0.8
+//import com.sun.syndication.feed.synd.SyndPerson;
+
+import java.util.Map;
+import org.apache.roller.RollerException;
+import org.apache.roller.model.PagePluginManager;
+import org.apache.roller.model.Roller;
+import org.apache.roller.model.RollerFactory;
+
+/**
+ * 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 lazy="false" 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);
+    }
+    
+    /**
+     * Create entry from Rome entry.
+     */
+    public PlanetEntryData(
+            WeblogEntryData rollerEntry, 
+            PlanetSubscriptionData sub, 
+            Map pagePlugins) throws RollerException
+    {
+        setSubscription(sub);
+        initFromRollerEntry(rollerEntry, pagePlugins);
+    }
+    
+    /** 
+     * Init entry from Rome entry 
+     */
+    private void initFromRomeEntry(SyndFeed romeFeed, SyndEntry romeEntry)
+    {
+        setAuthor(romeEntry.getAuthor());
+        // this will be needed (instead of the previous line) for ROME v0.8
+        //List authors = romeEntry.getAuthors();
+        //if (authors!=null && authors.size() > 0) {
+            //SyndPerson person = (SyndPerson)authors.get(0);
+            //setAuthor(person.getName());
+        //}
+        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>
+        }       
+        
+        // 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);
+        }
+    }
+    
+    /** 
+     * Init entry from Roller entry 
+     */
+    private void initFromRollerEntry(WeblogEntryData rollerEntry, Map pagePlugins) 
+        throws RollerException
+    {
+        Roller roller = RollerFactory.getRoller();
+        PagePluginManager ppmgr = roller.getPagePluginManager();
+       
+        String content = "";
+        if (!StringUtils.isEmpty(rollerEntry.getText())) {
+            content = rollerEntry.getText();
+        } else {
+            content = rollerEntry.getSummary();
+        }
+        content = ppmgr.applyPagePlugins(rollerEntry, pagePlugins, content, true);
+        
+        setAuthor(    rollerEntry.getCreator().getFullName());
+        setTitle(     rollerEntry.getTitle());
+        setPermalink( rollerEntry.getLink());
+        setPublished( rollerEntry.getPubTime());         
+        setContent(   content);
+        
+        setPermalink(RollerRuntimeConfig.getProperty("site.absoluteurl") 
+            + rollerEntry.getPermaLink());
+        
+        List cats = new ArrayList();
+        cats.add(rollerEntry.getCategory().getPath());
+        setCategories(cats);   
+    }
+    
+    //----------------------------------------------------------- persistent fields
+
+    /** 
+     * @hibernate.id column="id" 
+     *     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="none" 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 boolean equals(Object other) {
+        
+        if(this == other) return true;
+        if(!(other instanceof PlanetEntryData)) return false;
+        
+        final PlanetEntryData that = (PlanetEntryData) other;
+        return this.permalink.equals(that.getPermalink());
+    }
+    
+    public int hashCode() {
+        return this.permalink.hashCode();
+    }
+    
+    public void setData(PersistentObject vo)
+    {
+    }
+}
+

Added: incubator/roller/trunk/src/org/apache/roller/pojos/PlanetGroupData.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/apache/roller/pojos/PlanetGroupData.java?rev=398712&view=auto
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/pojos/PlanetGroupData.java (added)
+++ incubator/roller/trunk/src/org/apache/roller/pojos/PlanetGroupData.java Mon May  1 15:23:02 2006
@@ -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.apache.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 lazy="false" table="rag_group"
+ */
+public class PlanetGroupData extends PersistentObject implements Serializable
+{
+    transient private String[] catArray = null;
+
+    /** Database ID */
+    private String id = null;
+    
+    /** Unique handle by which group may be fetched */
+    private String handle = null;
+    
+    /** Title of this group */
+    private String title = null;
+    
+    /** Description of this group */
+    private String description = null;
+    
+    /** Restrict group by this list of comma separated category names */
+    private String categoryRestriction = null;
+    
+    /** Max number of entries to show in HTML representation of this group */
+    private int maxPageEntries = 45;
+    
+    /** Max number of entries to show in feed representation of this group */
+    private int maxFeedEntries = 45;
+    
+    /** Subscriptions in this group */
+    private List subscriptionAssocs = new ArrayList();
+
+    //------------------------------------------------------- persistent fields
+
+    /** 
+     * @ejb:persistent-field 
+     * @hibernate.id column="id" 
+     *     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.apache.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/apache/roller/pojos/PlanetGroupSubscriptionAssoc.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/apache/roller/pojos/PlanetGroupSubscriptionAssoc.java?rev=398712&view=auto
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/pojos/PlanetGroupSubscriptionAssoc.java (added)
+++ incubator/roller/trunk/src/org/apache/roller/pojos/PlanetGroupSubscriptionAssoc.java Mon May  1 15:23:02 2006
@@ -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.apache.roller.pojos;
+
+import java.io.Serializable;
+
+import org.apache.roller.pojos.PersistentObject;
+
+/**
+ * @hibernate.class lazy="false" table="rag_group_subscription"
+ * @author Dave Johnson
+ */
+public class PlanetGroupSubscriptionAssoc extends PersistentObject 
+        implements Serializable
+{
+    /** Database ID */
+    private String id = null;
+    
+    private PlanetGroupData group = null;
+    private PlanetSubscriptionData subscription = null;
+
+    //----------------------------------------------------------- persistent fields
+    /** 
+     * @hibernate.id column="id" 
+     *     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/apache/roller/pojos/PlanetSubscriptionData.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/apache/roller/pojos/PlanetSubscriptionData.java?rev=398712&view=auto
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/pojos/PlanetSubscriptionData.java (added)
+++ incubator/roller/trunk/src/org/apache/roller/pojos/PlanetSubscriptionData.java Mon May  1 15:23:02 2006
@@ -0,0 +1,224 @@
+/*
+ * 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.apache.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 lazy="false" 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.apache.roller.pojos.PlanetGroupSubscriptionAssoc"
+     */
+    public List getGroupSubscriptionAssocs()
+    {
+        return groupAssocs;
+    }
+    public void setGroupSubscriptionAssocs(List groupAssocs)
+    {
+        this.groupAssocs = groupAssocs;
+    }
+
+    /** 
+     * @hibernate.id column="id" 
+     *     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-delete-orphan" 
+     * @hibernate.collection-key column="subscription_id"
+     * @hibernate.collection-one-to-many class="org.apache.roller.pojos.PlanetEntryData"
+     */
+    public List getEntries()
+    {
+        return entries;
+    }
+    private 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 boolean equals(Object other) {
+        
+        if(this == other) return true;
+        if(!(other instanceof PlanetSubscriptionData)) return false;
+        
+        final PlanetSubscriptionData that = (PlanetSubscriptionData) other;
+        return this.feedUrl.equals(that.getFeedUrl());
+    }
+    
+    public int hashCode() {
+        return this.feedUrl.hashCode();
+    }
+    
+    public void addEntry(PlanetEntryData entry)
+    {
+        this.getEntries().add(entry);
+    }
+    
+    public void addEntries(Collection newEntries)
+    {
+        this.getEntries().addAll(newEntries);
+    }
+    
+    public void purgeEntries()
+    {
+        this.getEntries().clear();
+    }
+}

Added: incubator/roller/trunk/src/org/apache/roller/pojos/RefererComparator.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/apache/roller/pojos/RefererComparator.java?rev=398712&view=auto
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/pojos/RefererComparator.java (added)
+++ incubator/roller/trunk/src/org/apache/roller/pojos/RefererComparator.java Mon May  1 15:23:02 2006
@@ -0,0 +1,50 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+*  contributor license agreements.  The ASF licenses this file to You
+* under the Apache License, Version 2.0 (the "License"); you may not
+* use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.  For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+package org.apache.roller.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/apache/roller/pojos/RefererData.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/apache/roller/pojos/RefererData.java?rev=398712&view=auto
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/pojos/RefererData.java (added)
+++ incubator/roller/trunk/src/org/apache/roller/pojos/RefererData.java Mon May  1 15:23:02 2006
@@ -0,0 +1,611 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+*  contributor license agreements.  The ASF licenses this file to You
+* under the Apache License, Version 2.0 (the "License"); you may not
+* use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.  For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+/*
+ * Generated file - Do not edit!
+ */
+package org.apache.roller.pojos;
+
+import org.apache.roller.util.Utilities;
+
+
+/**
+ * Referer bean.
+ * @author David M Johnson
+ *
+ * @ejb:bean name="RefererData"
+ * @struts.form include-all="true"
+ * @hibernate.class lazy="false" table="referer"
+ * @hibernate.cache usage="read-write"
+ */
+public class RefererData extends PersistentObject
+    implements java.io.Serializable
+{
+    static final long serialVersionUID = -1817992900602131316L;
+    private java.lang.String id = null;
+    private org.apache.roller.pojos.WebsiteData website = null;
+    private org.apache.roller.pojos.WeblogEntryData weblogEntry = null;
+    private java.lang.String dateString = null;
+    private java.lang.String refererUrl = null;
+    private java.lang.String refererPermalink = null;
+    private java.lang.String requestUrl = null;
+    private java.lang.String title = null;
+    private java.lang.String excerpt = null;
+    private java.lang.Boolean visible = null;
+    private java.lang.Boolean duplicate = null;
+    private java.lang.Integer dayHits = null;
+    private java.lang.Integer totalHits = null;
+
+    public RefererData()
+    {
+    }
+
+    public RefererData(java.lang.String id, 
+                       org.apache.roller.pojos.WebsiteData website, 
+                       org.apache.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)
+    {
+        setData(otherData);
+    }
+
+    //------------------------------------------------------- Simple properties
+
+    /** 
+     * Unique ID and primary key of this Referer.
+     *
+     * @roller.wrapPojoMethod type="simple"
+     * @hibernate.id column="id"
+     *  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.
+     *
+     * @roller.wrapPojoMethod type="pojo"
+     * @hibernate.many-to-one column="websiteid" cascade="none" not-null="true"
+     */
+    public org.apache.roller.pojos.WebsiteData getWebsite()
+    {
+        return this.website;
+    }
+
+    public void setWebsite(org.apache.roller.pojos.WebsiteData website)
+    {
+        this.website = website;
+    }
+
+    /**
+     * @roller.wrapPojoMethod type="pojo"
+     * @hibernate.many-to-one column="entryid" cascade="none"
+     */
+    public org.apache.roller.pojos.WeblogEntryData getWeblogEntry()
+    {
+        return weblogEntry;
+    }
+
+    /**
+     * @param data
+     */
+    public void setWeblogEntry(org.apache.roller.pojos.WeblogEntryData data)
+    {
+        weblogEntry = data;
+    }
+
+    /** 
+     * Date string in YYYYMMDD format.
+     *
+     * @roller.wrapPojoMethod type="simple"
+     * @hibernate.property column="datestr" non-null="true" unique="false"
+     */
+    public java.lang.String getDateString()
+    {
+        return this.dateString;
+    }
+
+    public void setDateString(java.lang.String dateString)
+    {
+        this.dateString = dateString;
+    }
+
+    /** 
+     * URL of the refering page.
+     *
+     * @roller.wrapPojoMethod type="simple"
+     * @hibernate.property column="refurl" non-null="true" unique="false"
+     */
+    public java.lang.String getRefererUrl()
+    {
+        return this.refererUrl;
+    }
+
+    public void setRefererUrl(java.lang.String refererUrl)
+    {
+        this.refererUrl = refererUrl;
+    }
+
+    /** 
+     * Requested URL, the URL linked to by the refering page.
+     *
+     * @roller.wrapPojoMethod type="simple"
+     * @hibernate.property column="refpermalink" non-null="true" unique="false"
+     */
+    public java.lang.String getRefererPermalink()
+    {
+        return this.refererPermalink;
+    }
+
+    public void setRefererPermalink(java.lang.String refererPermalink)
+    {
+        this.refererPermalink = refererPermalink;
+    }
+
+    /** 
+     * Requested URL, the URL linked to by the refering page.
+     *
+     * @roller.wrapPojoMethod type="simple"
+     * @hibernate.property column="requrl" non-null="true" unique="false"
+     */
+    public java.lang.String getRequestUrl()
+    {
+        return this.requestUrl;
+    }
+
+    public void setRequestUrl(java.lang.String requestUrl)
+    {
+        this.requestUrl = requestUrl;
+    }
+
+    /** 
+     * The text on the refering page that surrounds the refering link. 
+     *
+     * @roller.wrapPojoMethod type="simple" 
+     * @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.  
+     *
+     * @roller.wrapPojoMethod type="simple"
+     * @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?
+     *
+     * @roller.wrapPojoMethod type="simple"
+     * @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?
+     *
+     * @roller.wrapPojoMethod type="simple"
+     * @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.
+     *
+     * @roller.wrapPojoMethod type="simple"
+     * @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.
+     *
+     * @roller.wrapPojoMethod type="simple"
+     * @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;
+    }
+
+    //-------------------------------------------------------------------------
+    
+    /**
+     * @roller.wrapPojoMethod type="simple"
+     */
+    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();
+    }
+
+    //-------------------------------------------------------------------------
+    
+    /**
+     * @roller.wrapPojoMethod type="simple"
+     */
+    public String getUrl()
+    {
+        if (getRefererPermalink() != null)
+        {
+            return getRefererPermalink();
+        }
+        else
+        {
+            return getRefererUrl();
+        }
+    }
+
+    //-------------------------------------------------------------------------
+    
+    /**
+     * @roller.wrapPojoMethod type="simple"
+     */
+    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.getId() == null);
+            }
+            else
+            {
+                lEquals = lEquals && this.id.equals(lTest.getId());
+            }
+
+            if (this.website == null)
+            {
+                lEquals = lEquals && (lTest.getWebsite() == null);
+            }
+            else
+            {
+                lEquals = lEquals && this.website.equals(lTest.getWebsite());
+            }
+
+            if (this.weblogEntry == null)
+            {
+                lEquals = lEquals && (lTest.getWeblogEntry() == null);
+            }
+            else
+            {
+                lEquals = lEquals && 
+                          this.weblogEntry.equals(lTest.getWeblogEntry());
+            }
+
+            if (this.dateString == null)
+            {
+                lEquals = lEquals && (lTest.getDateString() == null);
+            }
+            else
+            {
+                lEquals = lEquals && 
+                          this.dateString.equals(lTest.getDateString());
+            }
+
+            if (this.refererUrl == null)
+            {
+                lEquals = lEquals && (lTest.getRefererUrl() == null);
+            }
+            else
+            {
+                lEquals = lEquals && 
+                          this.refererUrl.equals(lTest.getRefererUrl());
+            }
+
+            if (this.refererPermalink == null)
+            {
+                lEquals = lEquals && (lTest.getRefererPermalink() == null);
+            }
+            else
+            {
+                lEquals = lEquals && 
+                          this.refererPermalink.equals(lTest.getRefererPermalink());
+            }
+
+            if (this.requestUrl == null)
+            {
+                lEquals = lEquals && (lTest.getRequestUrl() == null);
+            }
+            else
+            {
+                lEquals = lEquals && 
+                          this.requestUrl.equals(lTest.getRequestUrl());
+            }
+
+            if (this.title == null)
+            {
+                lEquals = lEquals && (lTest.getTitle() == null);
+            }
+            else
+            {
+                lEquals = lEquals && this.title.equals(lTest.getTitle());
+            }
+
+            if (this.excerpt == null)
+            {
+                lEquals = lEquals && (lTest.getExcerpt() == null);
+            }
+            else
+            {
+                lEquals = lEquals && this.excerpt.equals(lTest.getExcerpt());
+            }
+
+            if (this.visible == null)
+            {
+                lEquals = lEquals && (lTest.getVisible() == null);
+            }
+            else
+            {
+                lEquals = lEquals && this.visible.equals(lTest.getVisible());
+            }
+
+            if (this.duplicate == null)
+            {
+                lEquals = lEquals && (lTest.getDuplicate() == null);
+            }
+            else
+            {
+                lEquals = lEquals && this.duplicate.equals(lTest.getDuplicate());
+            }
+
+            if (this.dayHits == null)
+            {
+                lEquals = lEquals && (lTest.getDayHits() == null);
+            }
+            else
+            {
+                lEquals = lEquals && this.dayHits.equals(lTest.getDayHits());
+            }
+
+            if (this.totalHits == null)
+            {
+                lEquals = lEquals && (lTest.getTotalHits() == null);
+            }
+            else
+            {
+                lEquals = lEquals && this.totalHits.equals(lTest.getTotalHits());
+            }
+
+            return lEquals;
+        }
+        else
+        {
+            return false;
+        }
+    }
+
+    public int hashCode()
+    {
+        int result = 17;
+        result = (37 * result) + 
+                 ((this.id != null) ? this.id.hashCode() : 0);
+        result = (37 * result) + 
+                 ((this.website != null) ? this.website.hashCode() : 0);
+        result = (37 * result) + 
+                 ((this.weblogEntry != null) ? this.weblogEntry.hashCode() : 0);
+        result = (37 * result) + 
+                 ((this.dateString != null) ? this.dateString.hashCode() : 0);
+        result = (37 * result) + 
+                 ((this.refererUrl != null) ? this.refererUrl.hashCode() : 0);
+        result = (37 * result) + 
+                 ((this.refererPermalink != null)
+                  ? this.refererPermalink.hashCode() : 0);
+        result = (37 * result) + 
+                 ((this.requestUrl != null) ? this.requestUrl.hashCode() : 0);
+        result = (37 * result) + 
+                 ((this.title != null) ? this.title.hashCode() : 0);
+        result = (37 * result) + 
+                 ((this.excerpt != null) ? this.excerpt.hashCode() : 0);
+        result = (37 * result) + 
+                 ((this.visible != null) ? this.visible.hashCode() : 0);
+        result = (37 * result) + 
+                 ((this.duplicate != null) ? this.duplicate.hashCode() : 0);
+        result = (37 * result) + 
+                 ((this.dayHits != null) ? this.dayHits.hashCode() : 0);
+        result = (37 * result) + 
+                 ((this.totalHits != null) ? this.totalHits.hashCode() : 0);
+
+        return result;
+    }
+
+    /**
+     * Setter is needed in RollerImpl.storePersistentObject()
+     */
+    public void setData(org.apache.roller.pojos.PersistentObject otherData)
+    {
+        this.id = ((RefererData) otherData).getId();
+        this.website = ((RefererData) otherData).getWebsite();
+        this.weblogEntry = ((RefererData) otherData).getWeblogEntry();
+        this.dateString = ((RefererData) otherData).getDateString();
+        this.refererUrl = ((RefererData) otherData).getRefererUrl();
+        this.refererPermalink = ((RefererData) otherData).getRefererPermalink();
+        this.requestUrl = ((RefererData) otherData).getRequestUrl();
+        this.title = ((RefererData) otherData).getTitle();
+        this.excerpt = ((RefererData) otherData).getExcerpt();
+        this.visible = ((RefererData) otherData).getVisible();
+        this.duplicate = ((RefererData) otherData).getDuplicate();
+        this.dayHits = ((RefererData) otherData).getDayHits();
+        this.totalHits = ((RefererData) otherData).getTotalHits();
+    }
+
+    /**
+     * 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/apache/roller/pojos/RoleData.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/apache/roller/pojos/RoleData.java?rev=398712&view=auto
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/pojos/RoleData.java (added)
+++ incubator/roller/trunk/src/org/apache/roller/pojos/RoleData.java Mon May  1 15:23:02 2006
@@ -0,0 +1,189 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+*  contributor license agreements.  The ASF licenses this file to You
+* under the Apache License, Version 2.0 (the "License"); you may not
+* use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.  For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+
+package org.apache.roller.pojos;
+
+
+/**
+ * Role bean.
+ * @author David M Johnson
+ *
+ * @ejb:bean name="RoleData"
+ * @struts.form include-all="true"
+ * @hibernate.class lazy="false" table="userrole"
+ * @hibernate.cache usage="read-write"
+ */
+public class RoleData
+   extends org.apache.roller.pojos.PersistentObject
+   implements java.io.Serializable
+{
+   static final long serialVersionUID = -4254083071697970972L;
+
+   private java.lang.String id;
+   private java.lang.String userName;
+   private UserData user;
+   private 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 )
+   {
+       setData(otherData);
+   }
+
+   /** 
+    * @ejb:pk-field
+    * @ejb:persistent-field 
+    * @hibernate.id column="id"
+    *  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.userName == null )
+         {
+            lEquals = lEquals && ( lTest.getUserName() == null );
+         }
+         else
+         {
+            lEquals = lEquals && this.userName.equals( lTest.getUserName() );
+         }
+         if( this.user == null )
+         {
+            lEquals = lEquals && ( lTest.getUser() == null );
+         }
+         else
+         {
+            lEquals = lEquals && this.user.equals( lTest.getUser() );
+         }
+         if( this.role == null )
+         {
+            lEquals = lEquals && ( lTest.getRole() == null );
+         }
+         else
+         {
+            lEquals = lEquals && this.role.equals( lTest.getRole() );
+         }
+
+         return lEquals;
+      }
+      else
+      {
+         return false;
+      }
+   }
+
+   public int hashCode()
+   {
+      int result = 17;
+      result = 37*result + ((this.id != null) ? this.id.hashCode() : 0);
+      result = 37*result + ((this.userName != null) ? this.userName.hashCode() : 0);
+      result = 37*result + ((this.user != null) ? this.user.hashCode() : 0);
+      result = 37*result + ((this.role != null) ? this.role.hashCode() : 0);
+      return result;
+      }
+
+   /**
+	* Setter is needed in RollerImpl.storePersistentObject()
+    */
+   public void setData( org.apache.roller.pojos.PersistentObject otherData )
+   {
+
+      this.id = ((RoleData)otherData).getId();
+      this.userName = ((RoleData)otherData).getUserName();
+      this.user = ((RoleData)otherData).getUser();
+      this.role = ((RoleData)otherData).getRole();
+   }
+
+}