continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tryg...@apache.org
Subject svn commit: r208960 - in /maven/continuum/trunk: continuum-core/src/main/java/org/apache/maven/continuum/store/ModelloJPoxContinuumStore.java continuum-model/src/main/resources/continuum.mdo
Date Sun, 03 Jul 2005 17:32:49 GMT
Author: trygvis
Date: Sun Jul  3 10:32:47 2005
New Revision: 208960

URL: http://svn.apache.org/viewcvs?rev=208960&view=rev
Log:
o Adding back project.state.

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

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=208960&r1=208959&r2=208960&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
Sun Jul  3 10:32:47 2005
@@ -28,6 +28,7 @@
 import org.apache.maven.continuum.project.ContinuumBuild;
 import org.apache.maven.continuum.project.ContinuumJPoxStore;
 import org.apache.maven.continuum.project.ContinuumProject;
+import org.apache.maven.continuum.project.ContinuumProjectState;
 import org.apache.maven.continuum.scm.CheckOutScmResult;
 import org.apache.maven.continuum.scm.ScmFile;
 
@@ -79,13 +80,13 @@
             Object id = store.addContinuumProject( project );
 
             project = store.getContinuumProjectByJdoId( id, true );
+
+            return project.getId();
         }
         catch ( Exception e )
         {
             throw new ContinuumStoreException( "Error while adding a project.", e );
         }
-
-        return project.getId();
     }
 
     public void removeProject( String projectId )
@@ -147,7 +148,14 @@
     {
         try
         {
-            return store.getContinuumProjectCollection( true, null, "name ascending" );
+            Collection collection = store.getContinuumProjectCollection( true, null, "name
ascending" );
+
+            for ( Iterator it = collection.iterator(); it.hasNext(); )
+            {
+                setProjectState( (ContinuumProject) it.next() );
+            }
+
+            return collection;
         }
         catch ( Exception e )
         {
@@ -164,17 +172,29 @@
 
             String ordering = "";
 
+            store.begin();
+
             Collection projects = store.getContinuumProjectCollection( true, filter, ordering
);
 
             if ( projects.size() == 0 )
             {
+                store.commit();
+
                 return null;
             }
 
-            return (ContinuumProject) projects.iterator().next();
+            ContinuumProject project = (ContinuumProject) projects.iterator().next();
+
+            setProjectState( project );
+
+            store.commit();
+
+            return project;
         }
         catch ( Exception e )
         {
+            rollback( store );
+
             throw new ContinuumStoreException( "Error while loading project set", e );
         }
     }
@@ -184,6 +204,8 @@
     {
         try
         {
+            store.begin();
+
             String filter = "this.scmUrl == \"" + scmUrl + "\"";
 
             String ordering = "";
@@ -192,13 +214,21 @@
 
             if ( projects.size() == 0 )
             {
+                store.commit();
+
                 return null;
             }
 
-            return (ContinuumProject) projects.iterator().next();
+            ContinuumProject project = setProjectState( (ContinuumProject) projects.iterator().next()
);
+
+            store.commit();
+
+            return project;
         }
         catch ( Exception e )
         {
+            rollback( store );
+
             throw new ContinuumStoreException( "Error while finding projects.", e );
         }
     }
@@ -208,10 +238,20 @@
     {
         try
         {
-            return store.getContinuumProject( projectId, true );
+            store.begin();
+
+            ContinuumProject project = store.getContinuumProject( projectId, true );
+
+            setProjectState( project );
+
+            store.commit();
+
+            return project;
         }
         catch ( Exception e )
         {
+            rollback( store );
+
             throw new ContinuumStoreException( "Error while loading project.", e );
         }
     }
@@ -332,6 +372,8 @@
 
             if ( builds.size() == 0 )
             {
+                store.commit();
+
                 return null;
             }
 
@@ -411,6 +453,23 @@
     public ContinuumJPoxStore getStore()
     {
         return store;
+    }
+
+    private ContinuumProject setProjectState( ContinuumProject project )
+        throws ContinuumStoreException
+    {
+        ContinuumBuild build = getLatestBuildForProject( project.getId() );
+
+        if ( build == null )
+        {
+            project.setState( ContinuumProjectState.NEW );
+        }
+        else
+        {
+            project.setState( build.getState() );
+        }
+
+        return project;
     }
 
     private void rollback( ContinuumJPoxStore store )

Modified: maven/continuum/trunk/continuum-model/src/main/resources/continuum.mdo
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-model/src/main/resources/continuum.mdo?rev=208960&r1=208959&r2=208960&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-model/src/main/resources/continuum.mdo (original)
+++ maven/continuum/trunk/continuum-model/src/main/resources/continuum.mdo Sun Jul  3 10:32:47
2005
@@ -46,20 +46,11 @@
           <version>1.0.0</version>
           <type>String</type>
         </field>
-<!--
-        <field>
+        <field stash.storable="false">
           <name>state</name>
           <version>1.0.0</version>
           <type>int</type>
--->
-          <!--
-          <association>
-            <type>ContinuumProjectState</type>
-          </association>
-          -->
-<!--
         </field>
--->
         <field>
           <name>executorId</name>
           <version>1.0.0</version>



Mime
View raw message