Return-Path: X-Original-To: apmail-continuum-commits-archive@www.apache.org Delivered-To: apmail-continuum-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 435C917C5E for ; Thu, 2 Apr 2015 19:39:28 +0000 (UTC) Received: (qmail 58559 invoked by uid 500); 2 Apr 2015 19:39:28 -0000 Delivered-To: apmail-continuum-commits-archive@continuum.apache.org Received: (qmail 58531 invoked by uid 500); 2 Apr 2015 19:39:28 -0000 Mailing-List: contact commits-help@continuum.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@continuum.apache.org Delivered-To: mailing list commits@continuum.apache.org Received: (qmail 58522 invoked by uid 99); 2 Apr 2015 19:39:28 -0000 Received: from eris.apache.org (HELO hades.apache.org) (140.211.11.105) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 02 Apr 2015 19:39:28 +0000 Received: from hades.apache.org (localhost [127.0.0.1]) by hades.apache.org (ASF Mail Server at hades.apache.org) with ESMTP id E9F34AC012B for ; Thu, 2 Apr 2015 19:39:27 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@continuum.apache.org From: batkinson@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20150402193927.E9F34AC012B@hades.apache.org> 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 getImportOptions() + { + Map options = new LinkedHashMap(); + 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 @@ : - + : - + 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 @@ : - + : - + @@ -77,27 +77,9 @@ - - - - - - - - - - - - - - - - - -
-
-
- + + +