continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eveni...@apache.org
Subject svn commit: r594212 - in /maven/continuum/trunk: continuum-api/src/main/java/org/apache/maven/continuum/store/ continuum-core/src/main/java/org/apache/maven/continuum/ continuum-store/src/main/java/org/apache/maven/continuum/store/
Date Mon, 12 Nov 2007 17:06:37 GMT
Author: evenisse
Date: Mon Nov 12 09:06:35 2007
New Revision: 594212

URL: http://svn.apache.org/viewvc?rev=594212&view=rev
Log:
[CONTINUUM-1551] Ordering build results by start date

Modified:
    maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/store/ContinuumStore.java
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
    maven/continuum/trunk/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoContinuumStore.java

Modified: maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/store/ContinuumStore.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/store/ContinuumStore.java?rev=594212&r1=594211&r2=594212&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/store/ContinuumStore.java
(original)
+++ maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/store/ContinuumStore.java
Mon Nov 12 09:06:35 2007
@@ -303,6 +303,8 @@
 
     List<BuildResult> getBuildResultsInSuccessForProject( int projectId, long fromDate
);
 
+    List<BuildResult> getBuildResultsForProject( int projectId );
+
     List<BuildResult> getBuildResultsForProject( int projectId, long fromDate );
 
     Map getLatestBuildResultsByProjectGroupId( int projectGroupId );

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java?rev=594212&r1=594211&r2=594212&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
Mon Nov 12 09:06:35 2007
@@ -2788,12 +2788,7 @@
     public Collection<BuildResult> getBuildResultsForProject( int projectId )
         throws ContinuumException
     {
-        ArrayList<BuildResult> buildResults =
-            new ArrayList<BuildResult>( getProjectWithBuilds( projectId ).getBuildResults()
);
-
-        Collections.reverse( buildResults );
-
-        return buildResults;
+        return store.getBuildResultsForProject( projectId );
     }
 
     // ----------------------------------------------------------------------

Modified: maven/continuum/trunk/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoContinuumStore.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoContinuumStore.java?rev=594212&r1=594211&r2=594212&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoContinuumStore.java
(original)
+++ maven/continuum/trunk/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoContinuumStore.java
Mon Nov 12 09:06:35 2007
@@ -1574,6 +1574,42 @@
         }
     }
 
+    public List<BuildResult> getBuildResultsForProject( int projectId )
+    {
+        PersistenceManager pm = getPersistenceManager();
+
+        Transaction tx = pm.currentTransaction();
+
+        pm.getFetchPlan().addGroup( BUILD_RESULT_WITH_DETAILS_FETCH_GROUP );
+
+        try
+        {
+            tx.begin();
+
+            Extent extent = pm.getExtent( BuildResult.class, true );
+
+            Query query = pm.newQuery( extent );
+
+            query.declareParameters( "int projectId" );
+
+            query.setFilter( "this.project.id == projectId" );
+
+            query.setOrdering( "this.startTime descending" );
+
+            List result = (List) query.execute( new Integer( projectId ) );
+
+            result = (List) pm.detachCopyAll( result );
+
+            tx.commit();
+
+            return result;
+        }
+        finally
+        {
+            rollback( tx );
+        }
+    }
+
     public List<BuildResult> getBuildResultsForProject( int projectId, long fromDate
)
     {
         PersistenceManager pm = getPersistenceManager();



Mime
View raw message