From 3b9313f5130e2bc31e606e689515446fdf8882e0 Mon Sep 17 00:00:00 2001 From: Brantone Date: Wed, 13 May 2015 01:13:33 -0700 Subject: [PATCH 1/2] Issue #43 : new checkbox for syncing 'Ownership' --- .../eztemplates/TemplateImplementationProperty.java | 11 +++++++++-- .../jenkins/eztemplates/utils/TemplateUtils.java | 9 ++++++++- .../TemplateImplementationProperty/config.jelly | 5 ++++- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/joelj/jenkins/eztemplates/TemplateImplementationProperty.java b/src/main/java/com/joelj/jenkins/eztemplates/TemplateImplementationProperty.java index cc7bf50..8dca5f8 100644 --- a/src/main/java/com/joelj/jenkins/eztemplates/TemplateImplementationProperty.java +++ b/src/main/java/com/joelj/jenkins/eztemplates/TemplateImplementationProperty.java @@ -26,9 +26,10 @@ public class TemplateImplementationProperty extends JobProperty newInstance(StaplerRequest request, JSONObject formData) t boolean syncDisabled = useTemplate.getBoolean("syncDisabled"); boolean syncSecurity = useTemplate.getBoolean("syncSecurity"); boolean syncScm = useTemplate.getBoolean("syncScm"); + boolean syncOwnership = useTemplate.getBoolean("syncOwnership"); - return new TemplateImplementationProperty(templateJobName, syncMatrixAxis, syncDescription, syncBuildTriggers, syncDisabled, syncSecurity, syncScm); + return new TemplateImplementationProperty(templateJobName, syncMatrixAxis, syncDescription, syncBuildTriggers, syncDisabled, syncSecurity, syncScm, syncOwnership); } return null; diff --git a/src/main/java/com/joelj/jenkins/eztemplates/utils/TemplateUtils.java b/src/main/java/com/joelj/jenkins/eztemplates/utils/TemplateUtils.java index 602cb53..d1ef69e 100644 --- a/src/main/java/com/joelj/jenkins/eztemplates/utils/TemplateUtils.java +++ b/src/main/java/com/joelj/jenkins/eztemplates/utils/TemplateUtils.java @@ -68,7 +68,8 @@ public static void handleTemplateCopied(AbstractProject copy, AbstractProject or false, false, false, - true + true, + false ); copy.addProperty(implProperty); } @@ -99,6 +100,7 @@ public static void handleTemplateImplementationSaved(AbstractProject implementat String description = implementationProject.getDescription(); AuthorizationMatrixProperty oldAuthMatrixProperty = (AuthorizationMatrixProperty) implementationProject.getProperty(AuthorizationMatrixProperty.class); SCM oldScm = (SCM) implementationProject.getScm(); + JobProperty oldOwnership = implementationProject.getProperty("com.synopsys.arc.jenkins.plugins.ownership.jobs.JobOwnerJobProperty"); AxisList oldAxisList = null; if (implementationProject instanceof MatrixProject && !property.getSyncMatrixAxis()) { @@ -139,6 +141,11 @@ public static void handleTemplateImplementationSaved(AbstractProject implementat implementationProject.setScm(oldScm); } + if (!property.getSyncOwnership() && oldOwnership != null) { + implementationProject.removeProperty(oldOwnership.getClass()); + implementationProject.addProperty(oldOwnership); + } + ProjectUtils.silentSave(implementationProject); } diff --git a/src/main/resources/com/joelj/jenkins/eztemplates/TemplateImplementationProperty/config.jelly b/src/main/resources/com/joelj/jenkins/eztemplates/TemplateImplementationProperty/config.jelly index 4c2bf65..24a134f 100644 --- a/src/main/resources/com/joelj/jenkins/eztemplates/TemplateImplementationProperty/config.jelly +++ b/src/main/resources/com/joelj/jenkins/eztemplates/TemplateImplementationProperty/config.jelly @@ -33,6 +33,9 @@ + + + - \ No newline at end of file + From 66c1dc682a176289652f9d69958e2c98340310aa Mon Sep 17 00:00:00 2001 From: Brantone Date: Wed, 17 Jun 2015 23:47:48 -0700 Subject: [PATCH 2/2] Standardize the checkbox defaults with others --- .../com/joelj/jenkins/eztemplates/utils/TemplateUtils.java | 2 +- .../eztemplates/TemplateImplementationProperty/config.jelly | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/joelj/jenkins/eztemplates/utils/TemplateUtils.java b/src/main/java/com/joelj/jenkins/eztemplates/utils/TemplateUtils.java index d1ef69e..54598fa 100644 --- a/src/main/java/com/joelj/jenkins/eztemplates/utils/TemplateUtils.java +++ b/src/main/java/com/joelj/jenkins/eztemplates/utils/TemplateUtils.java @@ -68,7 +68,7 @@ public static void handleTemplateCopied(AbstractProject copy, AbstractProject or false, false, false, - true, + false, false ); copy.addProperty(implProperty); diff --git a/src/main/resources/com/joelj/jenkins/eztemplates/TemplateImplementationProperty/config.jelly b/src/main/resources/com/joelj/jenkins/eztemplates/TemplateImplementationProperty/config.jelly index 24a134f..7b051ee 100644 --- a/src/main/resources/com/joelj/jenkins/eztemplates/TemplateImplementationProperty/config.jelly +++ b/src/main/resources/com/joelj/jenkins/eztemplates/TemplateImplementationProperty/config.jelly @@ -31,10 +31,10 @@ - + - +