continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From epunza...@apache.org
Subject svn commit: r496965 - in /maven/continuum/trunk: continuum-api/src/main/java/org/apache/maven/continuum/ continuum-core/src/main/java/org/apache/maven/continuum/ continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ continuum-webapp/src...
Date Wed, 17 Jan 2007 08:51:56 GMT
Author: epunzalan
Date: Wed Jan 17 00:51:55 2007
New Revision: 496965

URL: http://svn.apache.org/viewvc?view=rev&rev=496965
Log:
[CONTINUUM-1138]

Add option to choose a project group when adding new Ant and Shell projects

Modified:
    maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
    maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddProjectAction.java
    maven/continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/addProject.jsp

Modified: maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java?view=diff&rev=496965&r1=496964&r2=496965
==============================================================================
--- maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java
(original)
+++ maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/Continuum.java
Wed Jan 17 00:51:55 2007
@@ -20,7 +20,6 @@
  */
 
 import org.apache.maven.continuum.configuration.ConfigurationService;
-import org.apache.maven.continuum.execution.ContinuumBuildExecutor;
 import org.apache.maven.continuum.model.project.BuildDefinition;
 import org.apache.maven.continuum.model.project.BuildResult;
 import org.apache.maven.continuum.model.project.Project;
@@ -56,11 +55,11 @@
 
     /**
      * Get all {@link ProjectGroup}s and their {@link Project}s
-     * 
+     *
      * @return {@link Collection} <{@link ProjectGroup}>
      */
     public Collection getAllProjectGroupsWithProjects();
-    
+
     public Collection getAllProjectGroups();
 
     public ProjectGroup getProjectGroupByProjectId( int projectId )
@@ -74,16 +73,16 @@
 
     public void addProjectGroup( ProjectGroup projectGroup )
         throws ContinuumException;
-    
+
     public ProjectGroup getProjectGroupWithProjects( int projectGroupId )
         throws ContinuumException;
 
     public ProjectGroup getProjectGroupByGroupId( String groupId )
         throws ContinuumException;
-    
+
     public ProjectGroup getProjectGroupByGroupIdWithBuildDetails( String groupId )
         throws ContinuumException;
-    
+
     // ----------------------------------------------------------------------
     // Project
     // ----------------------------------------------------------------------
@@ -192,9 +191,9 @@
 
     /**
      * Add a project to the list of building projects (ant, shell,...)
-     * 
+     *
      * @param project the project to add
-     * @param executorId the id of an {@link ContinuumBuildExecutor}, eg. <code>ant</code>
or <code>shell</code> 
+     * @param executorId the id of an {@link org.apache.maven.continuum.execution.ContinuumBuildExecutor},
eg. <code>ant</code> or <code>shell</code>
      * @return id of the project
      * @throws ContinuumException
      */
@@ -202,8 +201,20 @@
         throws ContinuumException;
 
     /**
-     * Add a Maven 2 project to the list of projects. 
-     * 
+     * Add a project to the list of building projects (ant, shell,...)
+     *
+     * @param project the project to add
+     * @param executorId the id of an {@link org.apache.maven.continuum.execution.ContinuumBuildExecutor},
eg. <code>ant</code> or <code>shell</code>
+     * @param projectGroupId
+     * @return id of the project
+     * @throws ContinuumException
+     */
+    int addProject( Project project, String executorId, int projectGroupId )
+        throws ContinuumException;
+
+    /**
+     * Add a Maven 2 project to the list of projects.
+     *
      * @param metadataUrl url of the pom.xml
      * @return a holder with the projects, project groups and errors occurred during the
project adding
      * @throws ContinuumException
@@ -212,8 +223,8 @@
         throws ContinuumException;
 
     /**
-     * Add a Maven 2 project to the list of projects. 
-     * 
+     * Add a Maven 2 project to the list of projects.
+     *
      * @param metadataUrl url of the pom.xml
      * @param checkProtocol check if the protocol is allowed, use false if the pom is uploaded
      * @return a holder with the projects, project groups and errors occurred during the
project adding
@@ -246,8 +257,8 @@
         throws ContinuumException;
 
     /**
-     * Add a Maven 1 project to the list of projects. 
-     * 
+     * Add a Maven 1 project to the list of projects.
+     *
      * @param metadataUrl url of the project.xml
      * @return a holder with the projects, project groups and errors occurred during the
project adding
      * @throws ContinuumException
@@ -256,8 +267,8 @@
         throws ContinuumException;
 
     /**
-     * Add a Maven 1 project to the list of projects. 
-     * 
+     * Add a Maven 1 project to the list of projects.
+     *
      * @param metadataUrl url of the project.xml
      * @param checkProtocol check if the protocol is allowed, use false if the pom is uploaded
      * @return a holder with the projects, project groups and errors occurred during the
project adding
@@ -380,7 +391,7 @@
         throws ContinuumException;
 
     BuildDefinition addBuildDefinitionToProjectGroup( int projectGroupId, BuildDefinition
buildDefinition )
-        throws ContinuumException;    
+        throws ContinuumException;
 
     List getBuildDefinitionsForProject( int projectId )
         throws ContinuumException;

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java?view=diff&rev=496965&r1=496964&r2=496965
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
Wed Jan 17 00:51:55 2007
@@ -269,7 +269,7 @@
         }
         catch ( ContinuumObjectNotFoundException e )
         {
-            //since we want to add a new project group, we should be getting 
+            //since we want to add a new project group, we should be getting
             //this exception
         }
         catch ( ContinuumStoreException e )
@@ -1117,6 +1117,12 @@
     public int addProject( Project project, String executorId )
         throws ContinuumException
     {
+        return addProject( project, executorId, getDefaultProjectGroup().getId() );
+    }
+
+    public int addProject( Project project, String executorId, int groupId )
+        throws ContinuumException
+    {
         project.setExecutorId( executorId );
 
         if ( executorId.equalsIgnoreCase( "ant" ) )
@@ -1145,16 +1151,18 @@
             }
         }
 
-        return executeAddProjectFromScmActivity( project );
+        return executeAddProjectFromScmActivity( project, groupId );
     }
 
     // ----------------------------------------------------------------------
     // Activities. These should end up as workflows in werkflow
     // ----------------------------------------------------------------------
 
-    private int executeAddProjectFromScmActivity( Project project )
+    private int executeAddProjectFromScmActivity( Project project, int groupId )
         throws ContinuumException
     {
+        ProjectGroup projectGroup = getProjectGroupWithBuildDetails( groupId );
+
         Map context = new HashMap();
 
         // ----------------------------------------------------------------------
@@ -1165,7 +1173,7 @@
 
         context.put( AbstractContinuumAction.KEY_UNVALIDATED_PROJECT, project );
 
-        context.put( AbstractContinuumAction.KEY_UNVALIDATED_PROJECT_GROUP, getDefaultProjectGroup()
);
+        context.put( AbstractContinuumAction.KEY_UNVALIDATED_PROJECT_GROUP, projectGroup
);
 
         executeAction( "validate-project", context );
 

Modified: maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddProjectAction.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddProjectAction.java?view=diff&rev=496965&r1=496964&r2=496965
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddProjectAction.java
(original)
+++ maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddProjectAction.java
Wed Jan 17 00:51:55 2007
@@ -21,13 +21,17 @@
 
 import com.opensymphony.xwork.Validateable;
 import org.apache.maven.continuum.ContinuumException;
+import org.apache.maven.continuum.Continuum;
 import org.apache.maven.continuum.model.project.Project;
+import org.apache.maven.continuum.model.project.ProjectGroup;
 import org.apache.maven.continuum.security.ContinuumRoleConstants;
 import org.codehaus.plexus.security.ui.web.interceptor.SecureAction;
 import org.codehaus.plexus.security.ui.web.interceptor.SecureActionBundle;
 import org.codehaus.plexus.security.ui.web.interceptor.SecureActionException;
 
 import java.util.Iterator;
+import java.util.Collection;
+import java.util.ArrayList;
 
 /**
  * @author Nick Gonzalez
@@ -56,6 +60,10 @@
 
     private String projectType;
 
+    private Collection projectGroups;
+
+    private int selectedProjectGroup;
+
     public void validate()
     {
         boolean projectNameAlreadyExist = false;
@@ -75,7 +83,7 @@
                     break;
                 }
             }
-            if ( projectNameAlreadyExist == true )
+            if ( projectNameAlreadyExist )
             {
                 addActionError( "projectName.already.exist.error" );
             }
@@ -104,13 +112,29 @@
 
         project.setScmTag( projectScmTag );
 
-        getContinuum().addProject( project, projectType );
+        getContinuum().addProject( project, projectType, selectedProjectGroup );
 
         return SUCCESS;
     }
 
     public String input()
+        throws ContinuumException
     {
+        projectGroups = new ArrayList();
+
+        Collection allProjectGroups = getContinuum().getAllProjectGroups();
+
+        for ( Iterator i = allProjectGroups.iterator(); i.hasNext(); )
+        {
+            ProjectGroup pg = (ProjectGroup) i.next();
+
+            //TODO: must implement same functionality using plexus-security
+            projectGroups.add( pg );
+        }
+
+        selectedProjectGroup = getContinuum().getProjectGroupByGroupId(
+            Continuum.DEFAULT_PROJECT_GROUP_GROUP_ID ).getId();
+
         return SUCCESS;
     }
 
@@ -193,5 +217,25 @@
         bundle.addRequiredAuthorization( ContinuumRoleConstants.CONTINUUM_ADD_GROUP_OPERATION
);
 
         return bundle;
+    }
+
+    public Collection getProjectGroups()
+    {
+        return projectGroups;
+    }
+
+    public void setProjectGroups( Collection projectGroups )
+    {
+        this.projectGroups = projectGroups;
+    }
+
+    public int getSelectedProjectGroup()
+    {
+        return selectedProjectGroup;
+    }
+
+    public void setSelectedProjectGroup( int selectedProjectGroup )
+    {
+        this.selectedProjectGroup = selectedProjectGroup;
     }
 }

Modified: maven/continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/addProject.jsp
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/addProject.jsp?view=diff&rev=496965&r1=496964&r2=496965
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/addProject.jsp (original)
+++ maven/continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/addProject.jsp Wed
Jan 17 00:51:55 2007
@@ -32,7 +32,7 @@
         </ww:else>
         </title>
     </head>
-    <body>              
+    <body>
         <div class="app">
             <div id="axial" class="h3">
                 <h3>
@@ -73,6 +73,7 @@
                             <ww:textfield label="%{getText('projectScmTag.label')}" name="projectScmTag">
                                 <ww:param name="desc"><p><ww:text name="projectScmTag.message"/></p></ww:param>
                             </ww:textfield>
+                            <ww:select label="%{getText('projectGroup.name.label')}" name="selectedProjectGroup"
list="projectGroups" listKey="id" listValue="name"/>
                           </tbody>
                         </table>
                         <div class="functnbar3">



Mime
View raw message