continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eveni...@apache.org
Subject svn commit: r554753 - in /maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-server: pom.xml src/main/java/org/apache/maven/continuum/xmlrpc/server/ContinuumServiceImpl.java
Date Mon, 09 Jul 2007 20:11:23 GMT
Author: evenisse
Date: Mon Jul  9 13:11:22 2007
New Revision: 554753

URL: http://svn.apache.org/viewvc?view=rev&rev=554753
Log:
Fix updateProjectGroup method and some typo

Modified:
    maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-server/pom.xml
    maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-server/src/main/java/org/apache/maven/continuum/xmlrpc/server/ContinuumServiceImpl.java

Modified: maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-server/pom.xml
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-server/pom.xml?view=diff&rev=554753&r1=554752&r2=554753
==============================================================================
--- maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-server/pom.xml (original)
+++ maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-server/pom.xml Mon Jul  9 13:11:22
2007
@@ -38,6 +38,10 @@
     </dependency>
     <dependency>
       <groupId>org.codehaus.plexus.redback</groupId>
+      <artifactId>redback-rbac-role-manager</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.codehaus.plexus.redback</groupId>
       <artifactId>redback-system</artifactId>
     </dependency>
     <dependency>

Modified: maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-server/src/main/java/org/apache/maven/continuum/xmlrpc/server/ContinuumServiceImpl.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-server/src/main/java/org/apache/maven/continuum/xmlrpc/server/ContinuumServiceImpl.java?view=diff&rev=554753&r1=554752&r2=554753
==============================================================================
--- maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-server/src/main/java/org/apache/maven/continuum/xmlrpc/server/ContinuumServiceImpl.java
(original)
+++ maven/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-server/src/main/java/org/apache/maven/continuum/xmlrpc/server/ContinuumServiceImpl.java
Mon Jul  9 13:11:22 2007
@@ -42,6 +42,9 @@
 import org.apache.maven.continuum.xmlrpc.test.TestCaseFailure;
 import org.apache.maven.continuum.xmlrpc.test.TestResult;
 import org.codehaus.plexus.redback.authorization.AuthorizationException;
+import org.codehaus.plexus.redback.role.RoleManager;
+import org.codehaus.plexus.redback.role.RoleManagerException;
+import org.codehaus.plexus.util.StringUtils;
 
 import java.util.ArrayList;
 import java.util.Collection;
@@ -63,6 +66,11 @@
      */
     private Continuum continuum;
 
+    /**
+     * @plexus.requirement role-hint="default"
+     */
+    private RoleManager roleManager;
+
     public boolean ping()
         throws ContinuumException
     {
@@ -138,11 +146,11 @@
 
         p.setName( project.getName() );
         p.setVersion( project.getVersion() );
-        p.setScmUrl( p.getScmUrl() );
+        p.setScmUrl( project.getScmUrl() );
         p.setScmUseCache( project.isScmUseCache() );
         p.setScmUsername( project.getScmUsername() );
         p.setScmPassword( project.getScmPassword() );
-        p.setScmTag( p.getScmTag() );
+        p.setScmTag( project.getScmTag() );
 
         continuum.updateProject( p );
 
@@ -248,9 +256,46 @@
     public ProjectGroupSummary updateProjectGroup( ProjectGroupSummary projectGroup )
         throws ContinuumException
     {
+        if ( projectGroup == null )
+        {
+            return null;
+        }
+
         checkModifyProjectGroupAuthorization( getProjectGroupName( projectGroup.getId() )
);
 
-        continuum.updateProjectGroup( populateProjectGroupSummary( projectGroup ) );
+        if ( StringUtils.isEmpty( projectGroup.getName() ) )
+        {
+            throw new ContinuumException( "project group name is required" );
+        }
+        else if ( StringUtils.isEmpty( projectGroup.getName().trim() ) )
+        {
+            throw new ContinuumException( "project group name can't be spaces" );
+        }
+
+        org.apache.maven.continuum.model.project.ProjectGroup pg =
+            continuum.getProjectGroupWithProjects( projectGroup.getId() );
+
+        // need to administer roles since they are based off of this
+        // todo convert everything like to work off of string keys
+        if ( !projectGroup.getName().equals( pg.getName() ) )
+        {
+            try
+            {
+                roleManager.updateRole( "project-administrator", pg.getName(), projectGroup.getName()
);
+                roleManager.updateRole( "project-developer", pg.getName(), projectGroup.getName()
);
+                roleManager.updateRole( "project-user", pg.getName(), projectGroup.getName()
);
+
+                pg.setName( projectGroup.getName() );
+            }
+            catch ( RoleManagerException e )
+            {
+                throw new ContinuumException( "unable to rename the project group", e );
+            }
+        }
+
+        pg.setDescription( projectGroup.getDescription() );
+
+        continuum.updateProjectGroup( pg );
         return getProjectGroupSummary( projectGroup.getId() );
     }
 



Mime
View raw message