From 8403cc77b2b60d2379b99fa1c27bdee1863bd5d9 Mon Sep 17 00:00:00 2001 From: kohsuke Date: Fri, 30 Nov 2007 07:07:53 +0000 Subject: [PATCH] updated to use structured form submission. git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@6132 71c3de6d-444a-0410-be80-ed276b4c234a --- .../main/java/hudson/tasks/ArtifactArchiver.java | 15 ++++++++------- .../hudson/tasks/ArtifactArchiver/config.jelly | 6 +++--- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/core/src/main/java/hudson/tasks/ArtifactArchiver.java b/core/src/main/java/hudson/tasks/ArtifactArchiver.java index d13a8114b2..9e542a7cef 100644 --- a/core/src/main/java/hudson/tasks/ArtifactArchiver.java +++ b/core/src/main/java/hudson/tasks/ArtifactArchiver.java @@ -11,11 +11,14 @@ import hudson.model.Result; import hudson.util.FormFieldValidator; import org.kohsuke.stapler.StaplerRequest; import org.kohsuke.stapler.StaplerResponse; +import org.kohsuke.stapler.DataBoundConstructor; import javax.servlet.ServletException; import java.io.File; import java.io.IOException; +import net.sf.json.JSONObject; + /** * Copies the artifacts into an archive directory. * @@ -38,9 +41,10 @@ public class ArtifactArchiver extends Publisher { */ private final boolean latestOnly; + @DataBoundConstructor public ArtifactArchiver(String artifacts, String excludes, boolean latestOnly) { - this.artifacts = artifacts; - this.excludes = excludes; + this.artifacts = artifacts.trim(); + this.excludes = Util.fixEmptyAndTrim(excludes); this.latestOnly = latestOnly; } @@ -125,11 +129,8 @@ public class ArtifactArchiver extends Publisher { new FormFieldValidator.WorkspaceFileMask(req,rsp).process(); } - public Publisher newInstance(StaplerRequest req) { - return new ArtifactArchiver( - req.getParameter("artifacts").trim(), - Util.fixEmpty(req.getParameter("artifacts_excludes").trim()), - req.getParameter("artifacts_latest_only")!=null); + public ArtifactArchiver newInstance(StaplerRequest req, JSONObject formData) throws FormException { + return req.bindJSON(ArtifactArchiver.class,formData); } } } diff --git a/core/src/main/resources/hudson/tasks/ArtifactArchiver/config.jelly b/core/src/main/resources/hudson/tasks/ArtifactArchiver/config.jelly index a0f70caeff..6402964a6d 100644 --- a/core/src/main/resources/hudson/tasks/ArtifactArchiver/config.jelly +++ b/core/src/main/resources/hudson/tasks/ArtifactArchiver/config.jelly @@ -1,14 +1,14 @@ - - + - +