checkModifyProjectGroupAuthorization( getProjectGroupName( projectGroup.getId() ) );
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() );