continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c...@apache.org
Subject svn commit: r766333 - /continuum/branches/continuum-1.3.x/continuum-data-management/data-management-jdo/src/main/java/org/apache/maven/continuum/management/JdoDataManagementTool.java
Date Sat, 18 Apr 2009 14:50:14 GMT
Author: ctan
Date: Sat Apr 18 14:50:13 2009
New Revision: 766333

URL: http://svn.apache.org/viewvc?rev=766333&view=rev
Log:
[CONTINUUM-2171] fixed build definition duplicate key exception during import

Modified:
    continuum/branches/continuum-1.3.x/continuum-data-management/data-management-jdo/src/main/java/org/apache/maven/continuum/management/JdoDataManagementTool.java

Modified: continuum/branches/continuum-1.3.x/continuum-data-management/data-management-jdo/src/main/java/org/apache/maven/continuum/management/JdoDataManagementTool.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-1.3.x/continuum-data-management/data-management-jdo/src/main/java/org/apache/maven/continuum/management/JdoDataManagementTool.java?rev=766333&r1=766332&r2=766333&view=diff
==============================================================================
--- continuum/branches/continuum-1.3.x/continuum-data-management/data-management-jdo/src/main/java/org/apache/maven/continuum/management/JdoDataManagementTool.java
(original)
+++ continuum/branches/continuum-1.3.x/continuum-data-management/data-management-jdo/src/main/java/org/apache/maven/continuum/management/JdoDataManagementTool.java
Sat Apr 18 14:50:13 2009
@@ -344,13 +344,15 @@
             ProjectGroup projectGroup = (ProjectGroup) i.next();
 
             // first, we must map up any schedules, etc.
-            processBuildDefinitions( projectGroup.getBuildDefinitions(), schedules, profiles
);
+            projectGroup.setBuildDefinitions( processBuildDefinitions( projectGroup.getBuildDefinitions(),

+                                                                       schedules, profiles,
buildDefinitions ) );
 
             for ( Iterator j = projectGroup.getProjects().iterator(); j.hasNext(); )
             {
                 Project project = (Project) j.next();
 
-                processBuildDefinitions( project.getBuildDefinitions(), schedules, profiles
);
+                project.setBuildDefinitions( processBuildDefinitions( project.getBuildDefinitions(),

+                                                                      schedules, profiles,
buildDefinitions ) );
             }
 
             if ( projectGroup.getLocalRepository() != null )
@@ -484,27 +486,40 @@
         return groupProjects;
     }
 
-    private static void processBuildDefinitions( List buildDefinitions, Map<Integer, Schedule>
schedules,
-                                                 Map<Integer, Profile> profiles )
+    private List<BuildDefinition> processBuildDefinitions( List<BuildDefinition>
buildDefinitions, 
+                                                           Map<Integer, Schedule> schedules,
+                                                           Map<Integer, Profile> profiles,

+                                                           Map<Integer, BuildDefinition>
buildDefs )
     {
-        for ( Iterator i = buildDefinitions.iterator(); i.hasNext(); )
-        {
-            BuildDefinition def = (BuildDefinition) i.next();
+        List<BuildDefinition> buildDefsList = new ArrayList<BuildDefinition>();
 
-            if ( def.getSchedule() != null )
+        for ( BuildDefinition def : buildDefinitions )
+        {
+            if ( buildDefs.get( Integer.valueOf( def.getId() ) ) != null )
             {
-                def.setSchedule( schedules.get( Integer.valueOf( def.getSchedule().getId()
) ) );
+                buildDefsList.add( buildDefs.get( Integer.valueOf( def.getId() ) ) );
             }
-
-            if ( def.getProfile() != null )
+            else
             {
-                def.setProfile( profiles.get( Integer.valueOf( def.getProfile().getId() )
) );
+                if ( def.getSchedule() != null )
+                {
+                    def.setSchedule( schedules.get( Integer.valueOf( def.getSchedule().getId()
) ) );
+                }
+    
+                if ( def.getProfile() != null )
+                {
+                    def.setProfile( profiles.get( Integer.valueOf( def.getProfile().getId()
) ) );
+                }
+
+                buildDefsList.add( def );
             }
         }
+
+        return buildDefsList;
     }
 
     private List<BuildDefinition> processBuildDefinitions( List<BuildDefinition>
buildDefinitions, 
-                                                 Map<Integer, BuildDefinition> buildDefs
)
+                                                           Map<Integer, BuildDefinition>
buildDefs )
     {
         List<BuildDefinition> buildDefsList = new ArrayList<BuildDefinition>();
         



Mime
View raw message