aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorakozak2011-11-23 08:45:51 (EST)
committerWinston Prakash2011-12-01 20:47:12 (EST)
commit2e604586156c7a6d8f9551e080b164b88108d4e1 (patch)
treea225fe61435c47b62dce57b2d83e0274282e0bb4
parentbafd1fdd228d42c04491b9959334d3d1bfda7382 (diff)
downloadorg.eclipse.hudson.core-2e604586156c7a6d8f9551e080b164b88108d4e1.zip
org.eclipse.hudson.core-2e604586156c7a6d8f9551e080b164b88108d4e1.tar.gz
org.eclipse.hudson.core-2e604586156c7a6d8f9551e080b164b88108d4e1.tar.bz2
Increase visibility for allowOverrideValue method. Move this method to IProjectProperty interface
Signed-off-by: Winston Prakash <winston.prakash@gmail.com>
-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.java12
-rw-r--r--hudson-core/src/main/java/org/eclipse/hudson/api/model/project/property/DescribableListProjectProperty.java3
-rw-r--r--hudson-core/src/main/java/org/eclipse/hudson/api/model/project/property/StringProjectProperty.java4
4 files changed, 17 insertions, 11 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 b9e06a4..a4f11b8 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
@@ -87,6 +87,15 @@ public interface IProjectProperty<T> extends Serializable {
void resetValue();
/**
+ * Returns true, if cascading value should be overridden by candidate value.
+ *
+ * @param cascadingValue value from cascading project if any.
+ * @param candidateValue candidate value.
+ * @return true if cascading value should be replaced by candidate value.
+ */
+ boolean allowOverrideValue(T cascadingValue, T candidateValue);
+
+ /**
* Sets the overridden flag.
*
* @param overridden true - mark property as overridden, false - otherwise.
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 8d57a20..3c51644 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
@@ -124,7 +124,7 @@ public class BaseProjectProperty<T> implements IProjectProperty<T> {
if (!getJob().hasCascadingProject()) {
setOriginalValue(value, false);
} else {
- T cascadingValue = (T) getJob().getCascadingProject().getProperty(propertyKey, this.getClass()).getValue();
+ T cascadingValue = getCascadingValue();
T candidateValue = null == value ? getDefaultValue() : value;
if (allowOverrideValue(cascadingValue, candidateValue)) {
setOriginalValue(value, true);
@@ -155,13 +155,9 @@ public class BaseProjectProperty<T> implements IProjectProperty<T> {
}
/**
- * Returns true, if cascading value should be overridden by candidate value.
- *
- * @param cascadingValue value from cascading project if any.
- * @param candidateValue candidate value.
- * @return true if cascading value should be replaced by candidate value.
+ * {@inheritDoc}
*/
- protected boolean allowOverrideValue(T cascadingValue, T candidateValue) {
+ public boolean allowOverrideValue(T cascadingValue, T candidateValue) {
return ObjectUtils.notEqual(cascadingValue, candidateValue)
&& !EqualsBuilder.reflectionEquals(cascadingValue, candidateValue);
}
@@ -182,4 +178,4 @@ public class BaseProjectProperty<T> implements IProjectProperty<T> {
public T getOriginalValue() {
return originalValue;
}
-} \ No newline at end of file
+}
diff --git a/hudson-core/src/main/java/org/eclipse/hudson/api/model/project/property/DescribableListProjectProperty.java b/hudson-core/src/main/java/org/eclipse/hudson/api/model/project/property/DescribableListProjectProperty.java
index 34f012d..c2414cc 100644
--- a/hudson-core/src/main/java/org/eclipse/hudson/api/model/project/property/DescribableListProjectProperty.java
+++ b/hudson-core/src/main/java/org/eclipse/hudson/api/model/project/property/DescribableListProjectProperty.java
@@ -36,10 +36,11 @@ public class DescribableListProjectProperty extends BaseProjectProperty<Describa
}
@Override
- protected boolean allowOverrideValue(DescribableList cascadingValue, DescribableList candidateValue) {
+ public boolean allowOverrideValue(DescribableList cascadingValue, DescribableList candidateValue) {
return (null != candidateValue || null != cascadingValue)
&& ((null == cascadingValue || null == candidateValue)
|| !CollectionUtils.isEqualCollection(cascadingValue.toList(), candidateValue.toList()));
}
}
+
diff --git a/hudson-core/src/main/java/org/eclipse/hudson/api/model/project/property/StringProjectProperty.java b/hudson-core/src/main/java/org/eclipse/hudson/api/model/project/property/StringProjectProperty.java
index 299d3f8..9565332 100644
--- a/hudson-core/src/main/java/org/eclipse/hudson/api/model/project/property/StringProjectProperty.java
+++ b/hudson-core/src/main/java/org/eclipse/hudson/api/model/project/property/StringProjectProperty.java
@@ -40,7 +40,7 @@ public class StringProjectProperty extends BaseProjectProperty<String> {
/**
* {@inheritDoc}
*/
- protected boolean allowOverrideValue(String cascadingValue, String candidateValue) {
+ public boolean allowOverrideValue(String cascadingValue, String candidateValue) {
return !StringUtils.equalsIgnoreCase(cascadingValue, candidateValue);
}
-} \ No newline at end of file
+}