]> source.dussan.org Git - archiva.git/commitdiff
[MRM-694]
authorMaria Odea B. Ching <oching@apache.org>
Fri, 23 May 2008 06:18:36 +0000 (06:18 +0000)
committerMaria Odea B. Ching <oching@apache.org>
Fri, 23 May 2008 06:18:36 +0000 (06:18 +0000)
-add validation check for existing ids for repo groups and remote & managed repos

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@659443 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/AddManagedRepositoryAction.java
archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/AddRemoteRepositoryAction.java
archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/RepositoryGroupsAction.java

index 74a6d5b914430f18fb41ebc26b027d06c3885752..6d5a0bb7b5acb0faa4f09405707c0165bbc5eec5 100644 (file)
@@ -104,7 +104,12 @@ public class AddManagedRepositoryAction
             addFieldError( "repository.id", "Unable to add new repository with id [" + repoId
                 + "], that id already exists as a remote repository." );
         }
-
+        else if( config.getRepositoryGroupsAsMap().containsKey( repoId ) )
+        {
+            addFieldError( "repository.id", "Unable to add new repository with id [" + repoId
+               + "], that id already exists as a repository group." );
+        }
+        
         if ( !validator.validate( repository.getRefreshCronExpression() ) )
         {
             addFieldError( "repository.refreshCronExpression", "Invalid cron expression." );
index bcf51762478521de6b838602ee12a023f5bad45d..80d67582cee605ba756df5cff04b7d73ea14eb62 100644 (file)
@@ -100,6 +100,11 @@ public class AddRemoteRepositoryAction
             addFieldError( "repository.id", "Unable to add new repository with id [" + repoId
                 + "], that id already exists as a remote repository." );
         }
+        else if( config.getRepositoryGroupsAsMap().containsKey( repoId ) )
+        {
+            addFieldError( "repository.id", "Unable to add new repository with id [" + repoId
+               + "], that id already exists as a repository group." );
+        }
     }
     
     public RemoteRepositoryConfiguration getRepository()
index d01cc9b985f8d44b8419b6273346b763999ad88e..9a4f3d134de09ec7143b2a38f4cb4916ceb4c4fc 100644 (file)
@@ -93,7 +93,19 @@ public class RepositoryGroupsAction
         if ( configuration.getRepositoryGroupsAsMap().containsKey( repoGroupId ) )
         {
             addActionError( "Unable to add new repository group with id [" + repoGroupId
-                    + "], that id already exists." );
+                    + "], that id already exists as a repository group." );
+            return ERROR;
+        }
+        else if ( configuration.getManagedRepositoriesAsMap().containsKey( repoGroupId ) )
+        {
+            addActionError( "Unable to add new repository group with id [" + repoGroupId
+                    + "], that id already exists as a managed repository." );
+            return ERROR;
+        }
+        else if ( configuration.getRemoteRepositoriesAsMap().containsKey( repoGroupId ) )
+        {
+            addActionError( "Unable to add new repository group with id [" + repoGroupId
+                    + "], that id already exists as a remote repository." );
             return ERROR;
         }