roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agillil...@apache.org
Subject svn commit: r517886 - in /incubator/roller/trunk/apps/planet/src/java/org/apache/roller/planet/pojos: PlanetData.java PlanetGroupData.java
Date Tue, 13 Mar 2007 21:39:55 GMT
Author: agilliland
Date: Tue Mar 13 14:39:54 2007
New Revision: 517886

URL: http://svn.apache.org/viewvc?view=rev&rev=517886
Log:
make sure objects in collections have some sort of ordering.


Modified:
    incubator/roller/trunk/apps/planet/src/java/org/apache/roller/planet/pojos/PlanetData.java
    incubator/roller/trunk/apps/planet/src/java/org/apache/roller/planet/pojos/PlanetGroupData.java

Modified: incubator/roller/trunk/apps/planet/src/java/org/apache/roller/planet/pojos/PlanetData.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/apps/planet/src/java/org/apache/roller/planet/pojos/PlanetData.java?view=diff&rev=517886&r1=517885&r2=517886
==============================================================================
--- incubator/roller/trunk/apps/planet/src/java/org/apache/roller/planet/pojos/PlanetData.java
(original)
+++ incubator/roller/trunk/apps/planet/src/java/org/apache/roller/planet/pojos/PlanetData.java
Tue Mar 13 14:39:54 2007
@@ -18,8 +18,8 @@
 
 package org.apache.roller.planet.pojos;
 
-import java.util.HashSet;
 import java.util.Set;
+import java.util.TreeSet;
 
 
 /**
@@ -27,13 +27,13 @@
  * 
  * @hibernate.class lazy="true" table="rag_planet"
  */
-public class PlanetData {
+public class PlanetData implements Comparable {
     
     private String id = null;
     private String handle = null;
     private String title = null;
     private String description = null;
-    private Set groups = new HashSet();
+    private Set groups = new TreeSet();
     
     
     public PlanetData() {
@@ -46,7 +46,16 @@
         this.description = desc;
     }
     
-
+    
+    /**
+     * For comparing planets and sorting, ordered by Title.
+     */
+    public int compareTo(Object o) {
+        PlanetData other = (PlanetData) o;
+        return getTitle().compareTo(other.getTitle());
+    }
+    
+    
     /**
      * @hibernate.id column="id" generator-class="uuid.hex" unsaved-value="null"
      */
@@ -57,7 +66,8 @@
     public void setId(String id) {
         this.id = id;
     }
-
+    
+    
     /**
      * @hibernate.property column="handle" non-null="true" unique="true"
      */
@@ -69,6 +79,7 @@
         this.handle = handle;
     }
     
+    
     /**
      * @hibernate.property column="title" non-null="true" unique="false"
      */
@@ -79,7 +90,8 @@
     public void setTitle(String title) {
         this.title = title;
     }
-
+    
+    
     /**
      * @hibernate.property column="description" non-null="false" unique="false"
      */
@@ -91,8 +103,9 @@
         this.description = description;
     }
     
+    
     /** 
-     * @hibernate.set lazy="true" invert="true" cascade="all"
+     * @hibernate.set lazy="true" invert="true" cascade="all" sort="natural"
      * @hibernate.collection-key column="planet_id"
      * @hibernate.collection-one-to-many class="org.apache.roller.planet.pojos.PlanetGroupData"
      */

Modified: incubator/roller/trunk/apps/planet/src/java/org/apache/roller/planet/pojos/PlanetGroupData.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/apps/planet/src/java/org/apache/roller/planet/pojos/PlanetGroupData.java?view=diff&rev=517886&r1=517885&r2=517886
==============================================================================
--- incubator/roller/trunk/apps/planet/src/java/org/apache/roller/planet/pojos/PlanetGroupData.java
(original)
+++ incubator/roller/trunk/apps/planet/src/java/org/apache/roller/planet/pojos/PlanetGroupData.java
Tue Mar 13 14:39:54 2007
@@ -17,9 +17,9 @@
 package org.apache.roller.planet.pojos;
 
 import java.io.Serializable;
-import java.util.HashSet;
 import java.util.Set;
 import java.util.StringTokenizer;
+import java.util.TreeSet;
 
 
 /**
@@ -27,7 +27,7 @@
  *
  * @hibernate.class lazy="true" table="rag_group"
  */
-public class PlanetGroupData implements Serializable {
+public class PlanetGroupData implements Serializable, Comparable {
     
     transient private String[] catArray = null;
     
@@ -44,7 +44,7 @@
     
     // associations
     private PlanetData planet = null;
-    private Set subscriptions = new HashSet();
+    private Set subscriptions = new TreeSet();
     
     
     public PlanetGroupData() {}
@@ -58,6 +58,15 @@
     
     
     /**
+     * For comparing groups and sorting, ordered by Title.
+     */
+    public int compareTo(Object o) {
+        PlanetGroupData other = (PlanetGroupData) o;
+        return getTitle().compareTo(other.getTitle());
+    }
+    
+    
+    /**
      * @hibernate.id column="id" generator-class="uuid.hex" unsaved-value="null"
      */
     public String getId() {
@@ -70,7 +79,7 @@
     
     
     /**
-     * @hibernate.set table="rag_group_subscription" lazy="true" invert="true" cascade="none"
+     * @hibernate.set table="rag_group_subscription" lazy="true" invert="true" cascade="none"
sort="natural"
      * @hibernate.collection-key column="group_id"
      * @hibernate.collection-many-to-many column="subscription_id" class="org.apache.roller.planet.pojos.PlanetSubscriptionData"
      */



Mime
View raw message