continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmcconn...@apache.org
Subject svn commit: r478935 - in /maven/continuum/trunk: continuum-api/src/main/java/org/apache/maven/continuum/store/ continuum-core/src/main/java/org/apache/maven/continuum/ continuum-store/src/main/java/org/apache/maven/continuum/store/
Date Fri, 24 Nov 2006 18:04:17 GMT
Author: jmcconnell
Date: Fri Nov 24 10:04:17 2006
New Revision: 478935

URL: http://svn.apache.org/viewvc?view=rev&rev=478935
Log:
when I reverted the change for the build ordering I nuked the bit about how the project groups
were able to populate in the build by schedule, so I changed the way I used to to it so we
can retain the across group project ordering and its now consolidated in a small method in
the store that aggregates the two method calls to produce a correct list of projects actived
by the schedule

Modified:
    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/store/ContinuumStore.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/store/ContinuumStore.java?view=diff&rev=478935&r1=478934&r2=478935
==============================================================================
--- 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
Fri Nov 24 10:04:17 2006
@@ -157,6 +157,9 @@
     Map getProjectGroupIdsAndBuildDefinitionsIdsBySchedule( int scheduleId )
         throws ContinuumStoreException;
 
+    public Map getAggregatedProjectIdsAndBuildDefinitionIdsBySchedule( int scheduleId )
+        throws ContinuumStoreException;
+
     void updateProject( Project project )
         throws ContinuumStoreException;
 

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?view=diff&rev=478935&r1=478934&r2=478935
==============================================================================
--- 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
Fri Nov 24 10:04:17 2006
@@ -704,10 +704,11 @@
 
         try
         {
-            projectsMap = store.getProjectIdsAndBuildDefinitionsIdsBySchedule( schedule.getId()
);
+            projectsMap = store.getAggregatedProjectIdsAndBuildDefinitionIdsBySchedule( schedule.getId()
);
 
-            if ( projectsMap == null )
+            if ( projectsMap == null || projectsMap.size() == 0 )
             {
+                getLogger().debug( "no builds attached to schedule" );
                 // We don't have projects attached to this schedule
                 return;
             }
@@ -728,7 +729,6 @@
         for ( Iterator projectIterator = projectsList.iterator(); projectIterator.hasNext();
)
         {
             Project project = (Project) projectIterator.next();
-
             List buildDefIds = (List) projectsMap.get( new Integer( project.getId() ) );
 
             if ( buildDefIds != null && !buildDefIds.isEmpty() )

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?view=diff&rev=478935&r1=478934&r2=478935
==============================================================================
--- 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
Fri Nov 24 10:04:17 2006
@@ -201,6 +201,47 @@
         }
     }
 
+    /**
+     * get the combined list of projectId and build definitions, including the ones
+     * inherited by their project group
+     *
+     * @param scheduleId
+     * @return
+     * @throws ContinuumStoreException
+     */
+    public Map getAggregatedProjectIdsAndBuildDefinitionIdsBySchedule( int scheduleId )
+        throws ContinuumStoreException
+    {
+        Map projectSource = getProjectIdsAndBuildDefinitionsIdsBySchedule( scheduleId );
+        Map projectGroupSource = getProjectGroupIdsAndBuildDefinitionsIdsBySchedule( scheduleId
);
+
+        Map aggregate = new HashMap();
+
+        // start out by checking if we have projects with this scheduleId
+        if ( projectSource != null )
+        {
+            aggregate.putAll( projectSource );
+        }
+
+        // iterate through the project groups and make sure we are not walking over projects
that
+        // might define their own build definitions
+        for ( Iterator i = projectGroupSource.keySet().iterator(); i.hasNext(); )
+        {
+            Integer projectGroupId = (Integer) i.next();
+            List projectsInGroup = getProjectsInGroup( projectGroupId.intValue() );
+
+            for ( Iterator j = projectsInGroup.iterator(); j.hasNext(); )
+            {   
+                Integer projectId = new Integer( ( (Project) j.next() ).getId() );
+                if ( !aggregate.keySet().contains( projectId ) )
+                {
+                    aggregate.put( projectId, projectGroupSource.get( projectGroupId ) );
+                }
+            }
+        }
+        return aggregate;
+    }
+
     public Map getProjectIdsAndBuildDefinitionsIdsBySchedule( int scheduleId )
         throws ContinuumStoreException
     {
@@ -252,6 +293,10 @@
                     buildDefinitions.add( obj[1] );
                 }
 
+                return projects;
+            }
+            if ( !projects.isEmpty() )
+            {
                 return projects;
             }
         }



Mime
View raw message