continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eveni...@apache.org
Subject svn commit: r581824 - /maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/
Date Thu, 04 Oct 2007 09:51:22 GMT
Author: evenisse
Date: Thu Oct  4 02:51:21 2007
New Revision: 581824

URL: http://svn.apache.org/viewvc?rev=581824&view=rev
Log:
Reread some objects from the db before to update them so fields updated from the UI during
the action will keep their new values

Modified:
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/AddBuildDefinitionToProjectAction.java
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/AddBuildDefinitionToProjectGroupAction.java
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CheckoutProjectContinuumAction.java
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/ExecuteBuilderContinuumAction.java
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/UpdateWorkingDirectoryFromScmContinuumAction.java

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/AddBuildDefinitionToProjectAction.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/AddBuildDefinitionToProjectAction.java?rev=581824&r1=581823&r2=581824&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/AddBuildDefinitionToProjectAction.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/AddBuildDefinitionToProjectAction.java
Thu Oct  4 02:51:21 2007
@@ -15,13 +15,13 @@
  * the License.
  */
 
-import java.util.Iterator;
-import java.util.Map;
-
 import org.apache.maven.continuum.model.project.BuildDefinition;
 import org.apache.maven.continuum.model.project.BuildDefinitionTemplate;
 import org.apache.maven.continuum.model.project.Project;
 
+import java.util.Iterator;
+import java.util.Map;
+
 /**
  * AddBuildDefinitionToProjectAction:
  *
@@ -39,13 +39,13 @@
     {
         int projectId = getProjectId( map );
         Project project = store.getProjectWithAllDetails( projectId );
-        
+
         BuildDefinitionTemplate buildDefinitionTemplate = getBuildDefinitionTemplate( map
);
 
-        if (buildDefinitionTemplate != null)
+        if ( buildDefinitionTemplate != null )
         {
-            for ( Iterator<BuildDefinition> iterator = buildDefinitionTemplate.getBuildDefinitions().iterator();
iterator
-                .hasNext(); )
+            for ( Iterator<BuildDefinition> iterator = buildDefinitionTemplate.getBuildDefinitions().iterator();
+                  iterator.hasNext(); )
             {
                 BuildDefinition buildDefinition = iterator.next();
                 resolveDefaultBuildDefinitionsForProject( buildDefinition, project );
@@ -53,12 +53,13 @@
                 project.addBuildDefinition( buildDefinition );
 
                 store.updateProject( project );
-                if (buildDefinition.isDefaultForProject())
+                if ( buildDefinition.isDefaultForProject() )
                 {
                     map.put( AbstractContinuumAction.KEY_BUILD_DEFINITION, buildDefinition
);
                 }
             }
-        } else
+        }
+        else
         {
             BuildDefinition buildDefinition = getBuildDefinition( map );
             resolveDefaultBuildDefinitionsForProject( buildDefinition, project );
@@ -68,6 +69,6 @@
             store.updateProject( project );
             map.put( AbstractContinuumAction.KEY_BUILD_DEFINITION, buildDefinition );
         }
-        
+
     }
 }

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/AddBuildDefinitionToProjectGroupAction.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/AddBuildDefinitionToProjectGroupAction.java?rev=581824&r1=581823&r2=581824&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/AddBuildDefinitionToProjectGroupAction.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/AddBuildDefinitionToProjectGroupAction.java
Thu Oct  4 02:51:21 2007
@@ -46,8 +46,8 @@
         BuildDefinitionTemplate buildDefinitionTemplate = getBuildDefinitionTemplate( map
);
         if ( buildDefinitionTemplate != null )
         {
-            for ( Iterator<BuildDefinition> iterator = buildDefinitionTemplate.getBuildDefinitions().iterator();
iterator
-                .hasNext(); )
+            for ( Iterator<BuildDefinition> iterator = buildDefinitionTemplate.getBuildDefinitions().iterator();
+                  iterator.hasNext(); )
             {
                 BuildDefinition buildDefinition = iterator.next();
                 resolveDefaultBuildDefinitionsForProjectGroup( buildDefinition, projectGroup
);

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CheckoutProjectContinuumAction.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CheckoutProjectContinuumAction.java?rev=581824&r1=581823&r2=581824&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CheckoutProjectContinuumAction.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CheckoutProjectContinuumAction.java
Thu Oct  4 02:51:21 2007
@@ -67,12 +67,15 @@
     public void execute( Map context )
         throws Exception
     {
-        Project project = getProject( context );
-
-        int oldState = project.getState();
+        Project project = store.getProject( getProject( context ).getId() );
 
         BuildDefinition buildDefinition = getBuildDefinition( context );
 
+        if ( buildDefinition != null )
+        {
+            buildDefinition = store.getBuildDefinition( buildDefinition.getId() );
+        }
+
         project.setState( ContinuumProjectState.CHECKING_OUT );
 
         store.updateProject( project );
@@ -135,6 +138,8 @@
                 project.setRelativePath( relativePath );
 
             }
+
+            project = store.getProject( project.getId() );
 
             project.setState( ContinuumProjectState.CHECKEDOUT );
 

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/ExecuteBuilderContinuumAction.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/ExecuteBuilderContinuumAction.java?rev=581824&r1=581823&r2=581824&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/ExecuteBuilderContinuumAction.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/ExecuteBuilderContinuumAction.java
Thu Oct  4 02:51:21 2007
@@ -74,7 +74,7 @@
         // Get parameters from the context
         // ----------------------------------------------------------------------
 
-        Project project = getProject( context );
+        Project project = store.getProject( getProject( context ).getId() );
 
         BuildDefinition buildDefinition = getBuildDefinition( context );
 
@@ -155,6 +155,8 @@
         {
             buildResult.setEndTime( new Date().getTime() );
 
+            project = store.getProject( project.getId() );
+
             if ( buildResult.getState() == ContinuumProjectState.OK )
             {
                 project.setBuildNumber( project.getBuildNumber() + 1 );
@@ -162,7 +164,7 @@
 
             project.setLatestBuildId( buildResult.getId() );
 
-            buildResult.setBuildDefinition( buildDefinition);
+            buildResult.setBuildDefinition( buildDefinition );
 
             buildResult.setBuildNumber( project.getBuildNumber() );
 
@@ -196,8 +198,6 @@
             store.updateBuildResult( buildResult );
 
             buildResult = store.getBuildResult( buildResult.getId() );
-
-            store.storeBuildDefinition( buildDefinition );
 
             store.updateProject( project );
 

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/UpdateWorkingDirectoryFromScmContinuumAction.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/UpdateWorkingDirectoryFromScmContinuumAction.java?rev=581824&r1=581823&r2=581824&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/UpdateWorkingDirectoryFromScmContinuumAction.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/UpdateWorkingDirectoryFromScmContinuumAction.java
Thu Oct  4 02:51:21 2007
@@ -56,7 +56,7 @@
     public void execute( Map context )
         throws Exception
     {
-        Project project = getProject( context );
+        Project project = store.getProject( getProject( context ).getId() );
 
         BuildDefinition buildDefinition = getBuildDefinition( context );
 
@@ -78,6 +78,8 @@
         }
         finally
         {
+            project = store.getProject( project.getId() );
+
             project.setState( state );
 
             store.updateProject( project );



Mime
View raw message