You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@forrest.apache.org by br...@apache.org on 2004/04/07 22:24:49 UTC

svn commit: rev 9916 - in xml/forrest/trunk/scratchpad/forrestbot2/webapp/src/java/org/apache/forrest/forrestbot/webapp: dto util

Author: brondsem
Date: Wed Apr  7 13:24:48 2004
New Revision: 9916

Modified:
   xml/forrest/trunk/scratchpad/forrestbot2/webapp/src/java/org/apache/forrest/forrestbot/webapp/dto/ProjectDTO.java
   xml/forrest/trunk/scratchpad/forrestbot2/webapp/src/java/org/apache/forrest/forrestbot/webapp/util/Project.java
Log:
sort projects

Modified: xml/forrest/trunk/scratchpad/forrestbot2/webapp/src/java/org/apache/forrest/forrestbot/webapp/dto/ProjectDTO.java
==============================================================================
--- xml/forrest/trunk/scratchpad/forrestbot2/webapp/src/java/org/apache/forrest/forrestbot/webapp/dto/ProjectDTO.java	(original)
+++ xml/forrest/trunk/scratchpad/forrestbot2/webapp/src/java/org/apache/forrest/forrestbot/webapp/dto/ProjectDTO.java	Wed Apr  7 13:24:48 2004
@@ -20,7 +20,7 @@
 
 import java.util.Date;
 
-public class ProjectDTO {
+public class ProjectDTO implements Comparable {
 	String name;
 	int status;
 	Date lastBuilt;
@@ -140,6 +140,16 @@
 	 */
 	public void setDeployable(boolean b) {
 		deployable = b;
+	}
+
+	/* (non-Javadoc)
+	 * @see java.lang.Comparable#compareTo(java.lang.Object)
+	 */
+	public int compareTo(Object arg0) {
+		// TODO Auto-generated method stub
+		if (arg0 instanceof ProjectDTO)
+			return getName().compareTo(((ProjectDTO)arg0).getName());
+		return 0;
 	}
 
 }

Modified: xml/forrest/trunk/scratchpad/forrestbot2/webapp/src/java/org/apache/forrest/forrestbot/webapp/util/Project.java
==============================================================================
--- xml/forrest/trunk/scratchpad/forrestbot2/webapp/src/java/org/apache/forrest/forrestbot/webapp/util/Project.java	(original)
+++ xml/forrest/trunk/scratchpad/forrestbot2/webapp/src/java/org/apache/forrest/forrestbot/webapp/util/Project.java	Wed Apr  7 13:24:48 2004
@@ -24,6 +24,7 @@
 import java.io.RandomAccessFile;
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.Date;
 import java.util.Iterator;
 
@@ -158,7 +159,7 @@
 	public static Collection getAllProjects() {
 
 		/* based on config files */
-		Collection sites = new ArrayList();
+		ArrayList sites = new ArrayList();
 		File f = new File(Config.getProperty("config-dir"));
 		File[] possibleSites = f.listFiles();
 		for (int i = 0; i < possibleSites.length; i++) {
@@ -172,6 +173,7 @@
 				}
 			}
 		}
+		Collections.sort(sites);
 		return sites;
 	}