Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorakozak2011-11-22 11:49:54 -0500
committerWinston Prakash2011-12-01 20:47:03 -0500
commitf0f5cb0973d44bd017ad00778b66dae915d3bda5 (patch)
treeed6ca3e03b0ee2d0ebec1b4f04b5578952d9600d /hudson-core/src/main/java/org/eclipse
parent831da551c48a79f1f7f1e1195f414c4a3af0c282 (diff)
downloadorg.eclipse.hudson.core-f0f5cb0973d44bd017ad00778b66dae915d3bda5.tar.gz
org.eclipse.hudson.core-f0f5cb0973d44bd017ad00778b66dae915d3bda5.tar.xz
org.eclipse.hudson.core-f0f5cb0973d44bd017ad00778b66dae915d3bda5.zip
Refresh Configuration page after changing cascading parent. Update project properties overridden flag based on chosen cascading parent. Use ProjectProperty.isOverridden instead of ProjectProperty.isPropertyOverridden
Signed-off-by: Winston Prakash <winston.prakash@gmail.com>
Diffstat (limited to 'hudson-core/src/main/java/org/eclipse')
-rw-r--r--hudson-core/src/main/java/org/eclipse/hudson/api/model/IProjectProperty.java9
-rw-r--r--hudson-core/src/main/java/org/eclipse/hudson/api/model/project/property/BaseProjectProperty.java25
2 files changed, 21 insertions, 13 deletions
diff --git a/hudson-core/src/main/java/org/eclipse/hudson/api/model/IProjectProperty.java b/hudson-core/src/main/java/org/eclipse/hudson/api/model/IProjectProperty.java
index 48fae06c..b9e06a4a 100644
--- a/hudson-core/src/main/java/org/eclipse/hudson/api/model/IProjectProperty.java
+++ b/hudson-core/src/main/java/org/eclipse/hudson/api/model/IProjectProperty.java
@@ -64,7 +64,7 @@ public interface IProjectProperty<T> extends Serializable {
/**
* @return true if value inherited from cascading project, false - otherwise,
*/
- boolean isPropertyOverridden();
+ boolean isOverridden();
/**
* Returns property value. If originalValue is not null or value was overridden for this
@@ -85,4 +85,11 @@ public interface IProjectProperty<T> extends Serializable {
* Resets value for given job. Default implementation sets Null value and resets propertyOverridden flag to false.
*/
void resetValue();
+
+ /**
+ * Sets the overridden flag.
+ *
+ * @param overridden true - mark property as overridden, false - otherwise.
+ */
+ void setOverridden(boolean overridden);
}
diff --git a/hudson-core/src/main/java/org/eclipse/hudson/api/model/project/property/BaseProjectProperty.java b/hudson-core/src/main/java/org/eclipse/hudson/api/model/project/property/BaseProjectProperty.java
index 4cd693c4..1ee8a9f3 100644
--- a/hudson-core/src/main/java/org/eclipse/hudson/api/model/project/property/BaseProjectProperty.java
+++ b/hudson-core/src/main/java/org/eclipse/hudson/api/model/project/property/BaseProjectProperty.java
@@ -69,11 +69,9 @@ public class BaseProjectProperty<T> implements IProjectProperty<T> {
}
/**
- * Sets the overridden flag.
- *
- * @param overridden true - mark property as overridden, false - otherwise.
+ * {@inheritDoc}
*/
- final void setPropertyOverridden(boolean overridden) {
+ public final void setOverridden(boolean overridden) {
propertyOverridden = overridden;
}
@@ -92,7 +90,7 @@ public class BaseProjectProperty<T> implements IProjectProperty<T> {
/**
* {@inheritDoc}
*/
- public boolean isPropertyOverridden() {
+ public boolean isOverridden() {
return propertyOverridden;
}
@@ -107,7 +105,7 @@ public class BaseProjectProperty<T> implements IProjectProperty<T> {
* {@inheritDoc}
*/
public T getValue() {
- if (isPropertyOverridden() || null != originalValue) {
+ if (isOverridden() || null != originalValue) {
return getOriginalValue();
}
return getCascadingValue();
@@ -124,12 +122,15 @@ public class BaseProjectProperty<T> implements IProjectProperty<T> {
value = prepareValue(value);
if (!getJob().hasCascadingProject()) {
originalValue = value;
- } else if (allowOverrideValue(
- (T) getJob().getCascadingProject().getProperty(propertyKey, this.getClass()).getValue(), value)) {
- originalValue = value;
- setPropertyOverridden(true);
} else {
- resetValue();
+ T cascadingValue = (T) getJob().getCascadingProject().getProperty(propertyKey, this.getClass()).getValue();
+ T candidateValue = null == value ? getDefaultValue() : value;
+ if (allowOverrideValue(cascadingValue, candidateValue)) {
+ originalValue = value;
+ setOverridden(true);
+ } else {
+ resetValue();
+ }
}
}
@@ -138,7 +139,7 @@ public class BaseProjectProperty<T> implements IProjectProperty<T> {
*/
public void resetValue() {
this.originalValue = null;
- setPropertyOverridden(false);
+ setOverridden(false);
}
/**

Back to the top