You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@continuum.apache.org by jv...@apache.org on 2005/07/07 23:25:54 UTC

svn commit: r209649 - /maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/store/ModelloJPoxContinuumStore.java

Author: jvanzyl
Date: Thu Jul  7 14:25:52 2005
New Revision: 209649

URL: http://svn.apache.org/viewcvs?rev=209649&view=rev
Log:

o using lastBuildId to track last build

Modified:
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/store/ModelloJPoxContinuumStore.java

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/store/ModelloJPoxContinuumStore.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/store/ModelloJPoxContinuumStore.java?rev=209649&r1=209648&r2=209649&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/store/ModelloJPoxContinuumStore.java (original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/store/ModelloJPoxContinuumStore.java Thu Jul  7 14:25:52 2005
@@ -320,10 +320,14 @@
 
             Object id = store.addContinuumBuild( build );
 
+            project.setLastBuildId( build.getId() );
+
             store.commit();
 
             build = store.getContinuumBuildByJdoId( id, true );
 
+            System.out.println( "build.getId() = " + build.getId() );
+
             return build.getId();
         }
         catch ( Exception e )
@@ -361,6 +365,39 @@
     }
 
     public ContinuumBuild getLatestBuildForProject( String projectId )
+        throws ContinuumStoreException
+    {
+        try
+        {
+            store.begin();
+
+            ContinuumProject p = store.getContinuumProject( projectId, false );
+
+            if ( p.getLastBuildId() == null )
+            {
+                store.commit();
+
+                return null;
+            }
+
+            ContinuumBuild b = store.getContinuumBuild( p.getLastBuildId(), false );
+
+            b = (ContinuumBuild) store.getThreadState().getPersistenceManager().detachCopy( b );
+
+            store.commit();
+
+            return b;
+
+        }
+        catch ( Exception e )
+        {
+            rollback( store );
+
+            throw new ContinuumStoreException( "Error while loading last build for project id: '" + projectId + "'.", e );
+        }
+    }
+
+    public ContinuumBuild getLatestBuildForProjectx( String projectId )
         throws ContinuumStoreException
     {
         // TODO: Find a better way to query for the latest build.