continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r233288 - in /maven/continuum/trunk: continuum-store/src/main/java/org/apache/maven/continuum/store/ continuum-test/src/main/java/org/apache/maven/continuum/ continuum-web/src/main/resources/templates/screens/
Date Thu, 18 Aug 2005 05:40:44 GMT
Author: brett
Date: Wed Aug 17 22:40:33 2005
New Revision: 233288

URL: http://svn.apache.org/viewcvs?rev=233288&view=rev
Log:
small fixes

Modified:
    maven/continuum/trunk/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoContinuumStore.java
    maven/continuum/trunk/continuum-test/src/main/java/org/apache/maven/continuum/AbstractContinuumTest.java
    maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/Summary.vm

Modified: maven/continuum/trunk/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoContinuumStore.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoContinuumStore.java?rev=233288&r1=233287&r2=233288&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
Wed Aug 17 22:40:33 2005
@@ -23,7 +23,6 @@
 import org.apache.maven.continuum.model.project.ProjectNotifier;
 import org.apache.maven.continuum.model.project.Schedule;
 import org.apache.maven.continuum.model.system.Installation;
-import org.apache.maven.continuum.project.ContinuumProjectState;
 import org.codehaus.plexus.jdo.JdoFactory;
 import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
 import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException;
@@ -44,7 +43,6 @@
  * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
  * @author <a href="mailto:brett@apache.org">Brett Porter</a>
  * @version $Id$
- * @todo cleanup old stuff
  */
 public class JdoContinuumStore
     extends AbstractContinuumStore
@@ -135,10 +133,37 @@
     public void updateBuildResult( BuildResult build )
         throws ContinuumStoreException
     {
-        updateObject( build );
+        PersistenceManager pm = pmf.getPersistenceManager();
+
+        Transaction tx = pm.currentTransaction();
+
+        Project project = build.getProject();
+        try
+        {
+            tx.begin();
+
+            if ( !JDOHelper.isDetached( build ) )
+            {
+                throw new ContinuumStoreException( "Not detached: " + build );
+            }
+
+            pm.attachCopy( build, true );
+
+            if ( !JDOHelper.isDetached( project ) )
+            {
+                throw new ContinuumStoreException( "Not detached: " + project );
+            }
 
-        // TODO: merge requests
-        setProjectState( build.getProject() );
+            project.setState( build.getState() );
+
+            pm.attachCopy( project, true );
+
+            tx.commit();
+        }
+        finally
+        {
+            rollback( tx );
+        }
     }
 
     public void addBuildResult( Project project, BuildResult build )
@@ -224,25 +249,6 @@
         return notifier;
     }
 
-    private Project setProjectState( Project project )
-        throws ContinuumStoreException
-    {
-        BuildResult build = getLatestBuildResultForProject( project.getId() );
-
-        if ( build == null )
-        {
-            project.setState( ContinuumProjectState.NEW );
-        }
-        else
-        {
-            project.setState( build.getState() );
-        }
-
-        updateProject( project );
-
-        return project;
-    }
-
     private Object makePersistent( PersistenceManager pm, Object object, boolean detach )
     {
         pm.makePersistent( object );
@@ -328,8 +334,6 @@
             rollback( tx );
         }
     }
-
-    // TODO ^^^^ REMOVE ^^^^
 
     // ----------------------------------------------------------------------
     // Transaction Management

Modified: maven/continuum/trunk/continuum-test/src/main/java/org/apache/maven/continuum/AbstractContinuumTest.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-test/src/main/java/org/apache/maven/continuum/AbstractContinuumTest.java?rev=233288&r1=233287&r2=233288&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-test/src/main/java/org/apache/maven/continuum/AbstractContinuumTest.java
(original)
+++ maven/continuum/trunk/continuum-test/src/main/java/org/apache/maven/continuum/AbstractContinuumTest.java
Wed Aug 17 22:40:33 2005
@@ -74,7 +74,7 @@
         projectGroup.setGroupId( "foo.test" );
 
         projectGroup.setDescription(
-            "This is the default group that all projects will be " + "added to when using
addProject()." );
+            "This is the default group that all projects will be added to when using addProject()."
);
 
         defaultProjectGroup = store.addProjectGroup( projectGroup );
     }

Modified: maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/Summary.vm
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/Summary.vm?rev=233288&r1=233287&r2=233288&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/Summary.vm (original)
+++ maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/Summary.vm Wed
Aug 17 22:40:33 2005
@@ -55,7 +55,7 @@
         <td>Delete</td>
         #end
 
-        #if ( $item.latestBuildId )
+        #if ( $item.latestBuildId > 0 )
         ## TODO: get rid of this call back to $continuum
         #set ( $build = $continuum.getLatestBuildResultForProject($item.id) )
         <td><a href="$link.setPage('ProjectBuild.vm').addPathInfo('view', "ProjectBuild").addPathInfo('id',
$item.id).addPathInfo('buildId', $build.id)">Last Result</a></td>
@@ -63,7 +63,7 @@
         <td>Last Result</td>
         #end
 
-        #if ( $item.latestBuildId )
+        #if ( $item.latestBuildId > 0 )
         <td><a href="$link.setPage('ProjectBuilds.vm').addPathInfo('view', "ProjectBuilds").addPathInfo('id',
$item.id)">All Results</a></td>
         #else
         <td>All Results</td>



Mime
View raw message