Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'hudson-core/src/main/java')
-rw-r--r--hudson-core/src/main/java/hudson/util/CascadingUtil.java73
-rw-r--r--hudson-core/src/main/java/org/eclipse/hudson/api/model/project/property/TriggerProjectProperty.java5
2 files changed, 40 insertions, 38 deletions
diff --git a/hudson-core/src/main/java/hudson/util/CascadingUtil.java b/hudson-core/src/main/java/hudson/util/CascadingUtil.java
index f0c29477..467988d1 100644
--- a/hudson-core/src/main/java/hudson/util/CascadingUtil.java
+++ b/hudson-core/src/main/java/hudson/util/CascadingUtil.java
@@ -401,39 +401,40 @@ public class CascadingUtil {
}
/**
- * Sets trigger for job and all its children if necessary.
- *
- * @param job parentJob
- * @param descriptor trigger descriptor
- * @param key trigger property key
- * @param req stapler request
- * @param json submited json
- * @throws hudson.model.Descriptor.FormException if incorrect parameters
- */
- @SuppressWarnings("unchecked")
- public static void setChildrenTrigger(Job job, TriggerDescriptor descriptor, String key, StaplerRequest req,
- JSONObject json) throws Descriptor.FormException {
- TriggerProjectProperty<Trigger<?>> property = CascadingUtil.getTriggerProjectProperty(job, key);
- if (property.getValue() != null) {
- property.getValue().stop();
- }
- Trigger trigger = null;
- if (json.has(key)) {
- trigger = descriptor.newInstance(req, json.getJSONObject(key));
- trigger.start(job, true);
- }
- property.setValue(trigger);
- Set<String> cascadingChildrenNames = job.getCascadingChildrenNames();
- for (String childName : cascadingChildrenNames) {
- Job childJob = (Job)Hudson.getInstance().getItem(childName);
- if (StringUtils.equals(job.getName(), childJob.getCascadingProjectName())) {
- TriggerProjectProperty childProperty = CascadingUtil.getTriggerProjectProperty(childJob, key);
- if (!childProperty.isOverridden()) {
- setChildrenTrigger(childJob, descriptor, key, req, json);
- } else if (!childProperty.allowOverrideValue(trigger, childProperty.getValue())) {
- childProperty.setOverridden(false);
- }
- }
- }
- }
- }
+ * Sets trigger for job and all its children if necessary.
+ *
+ * @param job parentJob
+ * @param descriptor trigger descriptor
+ * @param key trigger property key
+ * @param req stapler request
+ * @param json submited json
+ * @throws hudson.model.Descriptor.FormException
+ * if incorrect parameters
+ */
+ @SuppressWarnings("unchecked")
+ public static void setChildrenTrigger(Job job, TriggerDescriptor descriptor, String key, StaplerRequest req,
+ JSONObject json) throws Descriptor.FormException {
+ TriggerProjectProperty property = CascadingUtil.getTriggerProjectProperty(job, key);
+ if (property.getValue() != null) {
+ property.getValue().stop();
+ }
+ Trigger trigger = null;
+ if (json.has(key)) {
+ trigger = descriptor.newInstance(req, json.getJSONObject(key));
+ trigger.start(job, true);
+ }
+ property.setValue(trigger);
+ Set<String> cascadingChildrenNames = job.getCascadingChildrenNames();
+ for (String childName : cascadingChildrenNames) {
+ Job childJob = (Job) Hudson.getInstance().getItem(childName);
+ if (StringUtils.equals(job.getName(), childJob.getCascadingProjectName())) {
+ TriggerProjectProperty childProperty = CascadingUtil.getTriggerProjectProperty(childJob, key);
+ if (!childProperty.isOverridden()) {
+ setChildrenTrigger(childJob, descriptor, key, req, json);
+ } else if (!childProperty.allowOverrideValue(trigger, childProperty.getValue())) {
+ childProperty.setOverridden(false);
+ }
+ }
+ }
+ }
+}
diff --git a/hudson-core/src/main/java/org/eclipse/hudson/api/model/project/property/TriggerProjectProperty.java b/hudson-core/src/main/java/org/eclipse/hudson/api/model/project/property/TriggerProjectProperty.java
index 8fab5309..84e4eb50 100644
--- a/hudson-core/src/main/java/org/eclipse/hudson/api/model/project/property/TriggerProjectProperty.java
+++ b/hudson-core/src/main/java/org/eclipse/hudson/api/model/project/property/TriggerProjectProperty.java
@@ -15,13 +15,14 @@
package org.eclipse.hudson.api.model.project.property;
+import hudson.triggers.Trigger;
import org.eclipse.hudson.api.model.IJob;
/**
* Property for triggers in case of we should use child project trigger
* instead of parent project if they are equals.
*/
-public class TriggerProjectProperty<T> extends ExternalProjectProperty<T> {
+public class TriggerProjectProperty extends BaseProjectProperty<Trigger> {
public TriggerProjectProperty(IJob job) {
super(job);
}
@@ -30,7 +31,7 @@ public class TriggerProjectProperty<T> extends ExternalProjectProperty<T> {
* {@inheritDoc}
*/
@Override
- protected void clearOriginalValue(T originalValue) {
+ protected void clearOriginalValue(Trigger originalValue) {
setOriginalValue(originalValue, false);
}
}

Back to the top