continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From batkin...@apache.org
Subject svn commit: r1670956 - in /continuum/trunk/continuum-webapp/src/main: java/org/apache/maven/continuum/web/action/ resources/localization/ webapp/WEB-INF/jsp/
Date Thu, 02 Apr 2015 19:39:27 GMT
Author: batkinson
Date: Thu Apr  2 19:39:27 2015
New Revision: 1670956

URL: http://svn.apache.org/r1670956
Log:
Fixed form re-population when adding maven projects.

Modified:
    continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddMavenTwoProjectAction.java
    continuum/trunk/continuum-webapp/src/main/resources/localization/Continuum.properties
    continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/addMavenOneProject.jsp
    continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/addMavenTwoProject.jsp

Modified: continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddMavenTwoProjectAction.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddMavenTwoProjectAction.java?rev=1670956&r1=1670955&r2=1670956&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddMavenTwoProjectAction.java
(original)
+++ continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddMavenTwoProjectAction.java
Thu Apr  2 19:39:27 2015
@@ -33,7 +33,9 @@ import org.codehaus.plexus.util.xml.pull
 import java.io.File;
 import java.io.FileNotFoundException;
 import java.io.IOException;
+import java.util.LinkedHashMap;
 import java.util.List;
+import java.util.Map;
 
 /**
  * Add a Maven 2 project to Continuum.
@@ -45,6 +47,63 @@ import java.util.List;
 public class AddMavenTwoProjectAction
     extends AddMavenProjectAction
 {
+
+    @Override
+    public void prepare()
+        throws Exception
+    {
+        super.prepare();
+        setImportType( ImportType.SEPARATE_SCM );
+    }
+
+    public enum ImportType
+    {
+        SEPARATE_SCM( "add.m2.project.importType.projectPerModuleSeparateScm", true, false
),
+        SINGLE_SCM( "add.m2.project.importType.projectPerModuleSingleScm", true, true ),
+        SINGLE_MULTI_MODULE( "add.m2.project.importType.singleMultiModule", false, false
);
+
+        private String textKey;
+
+        private boolean recursiveImport;
+
+        private boolean singleDirCheckout;
+
+        ImportType( String textKey, boolean recursiveImport, boolean singleCheckout )
+        {
+            this.textKey = textKey;
+            this.recursiveImport = recursiveImport;
+            this.singleDirCheckout = singleCheckout;
+        }
+
+        public String getTextKey()
+        {
+            return textKey;
+        }
+
+        public boolean isSingleCheckout()
+        {
+            return singleDirCheckout;
+        }
+
+        public boolean isRecursiveImport()
+        {
+            return recursiveImport;
+        }
+    }
+
+    /**
+     * Generates locale-sensitive import options.
+     */
+    public Map<ImportType, String> getImportOptions()
+    {
+        Map<ImportType, String> options = new LinkedHashMap<ImportType, String>();
+        for ( ImportType type : ImportType.values() )
+        {
+            options.put( type, getText( type.getTextKey() ) );
+        }
+        return options;
+    }
+
     // TODO: remove this part once uploading of an m2 project with modules is supported (
CONTINUUM-1098 )
     public static final String ERROR_UPLOADING_M2_PROJECT_WITH_MODULES = "add.m2.project.upload.modules.error";
 
@@ -52,7 +111,7 @@ public class AddMavenTwoProjectAction
 
     public static final String FILE_SCHEME = "file:/";
 
-    private String checkoutOption;
+    private ImportType importType;
 
     protected ContinuumProjectBuildingResult doExecute( String pomUrl, int selectedProjectGroup,
boolean checkProtocol,
                                                         boolean scmUseCache )
@@ -60,27 +119,12 @@ public class AddMavenTwoProjectAction
     {
         ContinuumProjectBuildingResult result = null;
 
-        boolean nonRecursiveProject;
-        boolean checkoutInSingleDirectory;
-
-        if ( "checkoutInSingleDirectory".equals( checkoutOption ) )
-        {
-            checkoutInSingleDirectory = true;
-            nonRecursiveProject = false;
-        }
-        else if ( "nonRecursiveProject".equals( checkoutOption ) )
-        {
-            checkoutInSingleDirectory = false;
-            nonRecursiveProject = true;
-        }
-        else
-        {
-            checkoutInSingleDirectory = false;
-            nonRecursiveProject = false;
-        }
+        ImportType importType = getImportType();
+        boolean recursiveImport = importType.isRecursiveImport();
+        boolean checkoutInSingleDirectory = importType.isSingleCheckout();
 
         // TODO: remove this part once uploading of an m2 project with modules is supported
( CONTINUUM-1098 )
-        boolean preventModulesInFileUpload = !checkProtocol && !nonRecursiveProject;
+        boolean preventModulesInFileUpload = !checkProtocol && recursiveImport;
         if ( preventModulesInFileUpload )
         {
             List modules = fileToModel( urlToFile( pomUrl ) ).getModules();
@@ -94,7 +138,7 @@ public class AddMavenTwoProjectAction
         if ( result == null )
         {
             result = getContinuum().addMavenTwoProject( pomUrl, selectedProjectGroup, checkProtocol,
scmUseCache,
-                                                        !nonRecursiveProject, this.getBuildDefinitionTemplateId(),
+                                                        recursiveImport, this.getBuildDefinitionTemplateId(),
                                                         checkoutInSingleDirectory );
         }
 
@@ -181,13 +225,13 @@ public class AddMavenTwoProjectAction
         setPomUrl( pomUrl );
     }
 
-    public String getCheckoutOption()
+    public ImportType getImportType()
     {
-        return checkoutOption;
+        return importType;
     }
 
-    public void setCheckoutOption( String checkoutOption )
+    public void setImportType( ImportType importType )
     {
-        this.checkoutOption = checkoutOption;
+        this.importType = importType;
     }
 }

Modified: continuum/trunk/continuum-webapp/src/main/resources/localization/Continuum.properties
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/main/resources/localization/Continuum.properties?rev=1670956&r1=1670955&r2=1670956&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/resources/localization/Continuum.properties
(original)
+++ continuum/trunk/continuum-webapp/src/main/resources/localization/Continuum.properties
Thu Apr  2 19:39:27 2015
@@ -348,13 +348,17 @@ add.m2.project.m2PomFile.label = Upload
 add.m2.project.m2PomFile.message = Enter the local filename of the Maven POM to upload.
 add.m2.project.m2PomFile.error = You must enter a valid URL
 add.m2.project.projectGroup = Project Group
+
 # TODO: remove this part once uploading of an m2 project with modules is supported ( CONTINUUM-1098
)
-add.m2.project.upload.modules.error = File upload of multi-module POM requires a recursive
build
-add.m2.project.nonRecursiveProject = For multi-module project, load only root as recursive
build
+add.m2.project.upload.modules.error = File upload of multi-module POM requires single multi-module
project import type.
+
 add.m2.project.buildDefinitionTemplate = Build Definition Template
 add.m2.project.defaultBuildDefinition = Default
-add.m2.project.checkoutInSingleDirectory = Checkout multi-module project in single directory
-add.m2.project.checkoutInSeparateDirectories = Checkout multi-module project in separate
directories 
+
+add.m2.project.importType = Import Type
+add.m2.project.importType.singleMultiModule = Single multi-module
+add.m2.project.importType.projectPerModuleSingleScm = Project per module, single checkout
+add.m2.project.importType.projectPerModuleSeparateScm = Project per module, separate checkouts
 
 # ----------------------------------------------------------------------
 # Page: AddProject (ant or shell)

Modified: continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/addMavenOneProject.jsp
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/addMavenOneProject.jsp?rev=1670956&r1=1670955&r2=1670956&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/addMavenOneProject.jsp (original)
+++ continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/addMavenOneProject.jsp Thu
Apr  2 19:39:27 2015
@@ -47,11 +47,11 @@
                                   <tbody>
                                     <tr>
                                       <td><s:text name="add.m1.project.m1PomUrl.username.label"/>:
</td>
-                                      <td><input type="text" name="scmUsername"
size="20" id="addMavenOneProject_scmUsername"/><td>
+                                      <td><s:textfield name="scmUsername" size="20"
id="addMavenOneProject_scmUsername" theme="simple"/><td>
                                     </tr>  
                                     <tr>
                                       <td><s:text name="add.m1.project.m1PomUrl.password.label"/>:
</td>
-                                      <td><input type="password" name="scmPassword"
size="20" id="addMavenOneProject_scmPassword"/><td>
+                                      <td><s:password name="scmPassword" size="20"
id="addMavenOneProject_scmPassword" theme="simple"/><td>
                                     </tr>  
                                   </tbody>
                                     <tr>

Modified: continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/addMavenTwoProject.jsp
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/addMavenTwoProject.jsp?rev=1670956&r1=1670955&r2=1670956&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/addMavenTwoProject.jsp (original)
+++ continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/addMavenTwoProject.jsp Thu
Apr  2 19:39:27 2015
@@ -47,11 +47,11 @@
 		                              <tbody>
 		                                <tr>
 		                                  <td><s:text name="add.m2.project.m2PomUrl.username.label"/>:
</td>
-		                                  <td><input type="text" name="scmUsername" size="20"
id="addMavenTwoProject_scmUsername"/></td>
+		                                  <td><s:textfield name="scmUsername" size="20"
id="addMavenTwoProject_scmUsername" theme="simple"/></td>
 		                                </tr>  
 		                                <tr>
 		                                  <td><s:text name="add.m2.project.m2PomUrl.password.label"/>:
</td>
-		                                  <td><input type="password" name="scmPassword"
size="20" id="addMavenTwoProject_scmPassword"/></td>
+		                                  <td><s:password name="scmPassword" size="20"
id="addMavenTwoProject_scmPassword" theme="simple"/></td>
 		                                </tr>  
 		                              </tbody>
 		                                <tr>
@@ -77,27 +77,9 @@
                               <s:select label="%{getText('add.m2.project.projectGroup')}"
name="selectedProjectGroup"
                                          list="projectGroups" listKey="id" listValue="name"/>
                             </s:else>
-                            <s:label>
-                              <s:param name="after">
-                                <table cellspacing="0" cellpadding="0">
-	                              <tbody>
-	                                <tr>
-	                                  <td><input name="checkoutOption" type="radio"
value="checkoutInSeparateDirectories" checked /></td>
-                                      <td><s:text name="add.m2.project.checkoutInSeparateDirectories"/></td>
-	                                </tr>
-	                                <tr>
-	                                  <td><input name="checkoutOption" type="radio"
value="checkoutInSingleDirectory"/></td>
-                                      <td><s:text name="add.m2.project.checkoutInSingleDirectory"/></td>
-	                                </tr>
-	                                <tr>
-	                                  <td><input name="checkoutOption" type="radio"
value="nonRecursiveProject"/></td>
-                                      <td><s:text name="add.m2.project.nonRecursiveProject"/></td>
-	                                </tr>
-	                              </tbody>
-	                            </table>
-                              </s:param>
-                            </s:label>	 
-                            
+
+                            <s:radio label="%{getText('add.m2.project.importType')}" name="importType"
list="importOptions" />
+
                             <s:select label="%{getText('add.m2.project.buildDefinitionTemplate')}"
name="buildDefinitionTemplateId"
                                        list="buildDefinitionTemplates" listKey="id" listValue="name"
headerKey="-1" 
                                        headerValue="%{getText('add.m2.project.defaultBuildDefinition')}"/>




Mime
View raw message