continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r662295 - /continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectGroupAction.java
Date Sun, 01 Jun 2008 21:45:59 GMT
Author: olamy
Date: Sun Jun  1 14:45:58 2008
New Revision: 662295

URL: http://svn.apache.org/viewvc?rev=662295&view=rev
Log:
[CONTINUUM-1752] Allowed duplication of group name when editing a project group
Submitted by Maria Catherine Tan


Modified:
    continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectGroupAction.java

Modified: continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectGroupAction.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectGroupAction.java?rev=662295&r1=662294&r2=662295&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectGroupAction.java
(original)
+++ continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectGroupAction.java
Sun Jun  1 14:45:58 2008
@@ -325,15 +325,32 @@
             return REQUIRES_AUTHORIZATION;
         }
 
-        if ( name != null && name.equals( "" ) )
+        if ( name != null )
         {
-            addActionError( "projectGroup.error.name.required" );
-            return INPUT;
-        }
-        else if ( name != null && name.trim().equals( "" ) )
-        {
-            addActionError( "projectGroup.error.name.cannot.be.spaces" );
-            return INPUT;
+            if ( name.equals( "" ) )
+            {
+                addActionError( "projectGroup.error.name.required" );
+                return INPUT;
+            }
+            else if ( name.trim().equals( "" ) )
+            {
+                addActionError( "projectGroup.error.name.cannot.be.spaces" );
+                return INPUT;
+            }
+            else
+            {
+                name = name.trim();
+                Iterator iterator = getContinuum().getAllProjectGroups().iterator();
+                while ( iterator.hasNext() )
+                {
+                    ProjectGroup projectGroup = (ProjectGroup) iterator.next();
+                    if ( name.equals( projectGroup.getName() ) && projectGroup.getId()
!= projectGroupId )
+                    {
+                        addActionError( "projectGroup.error.name.already.exists" );
+                        return INPUT;
+                    }
+                }
+            }
         }
 
         projectGroup = getContinuum().getProjectGroupWithProjects( projectGroupId );



Mime
View raw message