continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eveni...@apache.org
Subject svn commit: r595235 - in /maven/continuum/trunk: continuum-api/src/main/java/org/apache/maven/continuum/ continuum-api/src/main/java/org/apache/maven/continuum/store/ continuum-core/src/main/java/org/apache/maven/continuum/ continuum-store/src/main/jav...
Date Thu, 15 Nov 2007 08:25:49 GMT
Author: evenisse
Date: Thu Nov 15 00:25:45 2007
New Revision: 595235

URL: http://svn.apache.org/viewvc?rev=595235&view=rev
Log:
Remove not needed fetch group to get the build results list
Add some new build result methods to use later nation on the build result list page


Modified:
    maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java
    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/Continuum.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java?rev=595235&r1=595234&r2=595235&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java
(original)
+++ maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java
Thu Nov 15 00:25:45 2007
@@ -169,13 +169,13 @@
 
     boolean removeProjectsFromCheckoutQueue( int[] projectId )
         throws ContinuumException;
-    
+
     /**
      * @param hashCodes CheckOutTask hashCodes
      * @throws ContinuumException
      */
     void removeTasksFromCheckoutQueueWithHashCodes( int[] hashCodes )
-        throws ContinuumException;    
+        throws ContinuumException;
 
     // ----------------------------------------------------------------------
     // Building
@@ -239,6 +239,8 @@
 
     String getBuildOutput( int projectId, int buildId )
         throws ContinuumException;
+
+    long getNbBuildResultsForProject( int projectId );
 
     Collection<BuildResult> getBuildResultsForProject( int projectId )
         throws ContinuumException;

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=595235&r1=595234&r2=595235&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
Thu Nov 15 00:25:45 2007
@@ -303,7 +303,11 @@
 
     List<BuildResult> getBuildResultsInSuccessForProject( int projectId, long fromDate
);
 
+    long getNbBuildResultsForProject( int projectId );
+
     List<BuildResult> getBuildResultsForProject( int projectId );
+
+    List<BuildResult> getBuildResultsForProject( int projectId, long startIndex, long
endIndex );
 
     List<BuildResult> getBuildResultsForProject( int projectId, long fromDate );
 

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=595235&r1=595234&r2=595235&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
Thu Nov 15 00:25:45 2007
@@ -2785,6 +2785,11 @@
         stopped = true;
     }
 
+    public long getNbBuildResultsForProject( int projectId )
+    {
+        return store.getNbBuildResultsForProject( projectId );
+    }
+
     public Collection<BuildResult> getBuildResultsForProject( int projectId )
         throws ContinuumException
     {

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=595235&r1=595234&r2=595235&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
Thu Nov 15 00:25:45 2007
@@ -1574,13 +1574,44 @@
         }
     }
 
-    public List<BuildResult> getBuildResultsForProject( int projectId )
+    public long getNbBuildResultsForProject( int projectId )
     {
         PersistenceManager pm = getPersistenceManager();
 
         Transaction tx = pm.currentTransaction();
 
-        pm.getFetchPlan().addGroup( BUILD_RESULT_WITH_DETAILS_FETCH_GROUP );
+        try
+        {
+            tx.begin();
+
+            Query query = pm.newQuery( BuildResult.class, "project.id == projectId" );
+
+            query.declareParameters( "int projectId" );
+
+            query.setResult( "count(this)" );
+
+            long result = (Long) query.execute( new Integer( projectId ) );
+
+            tx.commit();
+
+            return result;
+        }
+        finally
+        {
+            rollback( tx );
+        }
+    }
+
+    public List<BuildResult> getBuildResultsForProject( int projectId )
+    {
+        return getBuildResultsForProject( projectId, -1, -1 );
+    }
+
+    public List<BuildResult> getBuildResultsForProject( int projectId, long startIndex,
long endIndex )
+    {
+        PersistenceManager pm = getPersistenceManager();
+
+        Transaction tx = pm.currentTransaction();
 
         try
         {
@@ -1595,6 +1626,11 @@
             query.setFilter( "this.project.id == projectId" );
 
             query.setOrdering( "this.startTime descending" );
+
+            if ( startIndex >= 0 )
+            {
+                query.setRange( startIndex, endIndex );
+            }
 
             List result = (List) query.execute( new Integer( projectId ) );
 



Mime
View raw message