mirror of https://github.com/apache/nifi.git
NIFI-7635: StandardConfigurationContext.getProperty() gets the property descriptor and its default value from the component itself
This closes #4408. Signed-off-by: Mark Payne <markap14@hotmail.com>
This commit is contained in:
parent
b1e77019ac
commit
4f11e36260
|
@ -74,15 +74,11 @@ public class StandardConfigurationContext implements ConfigurationContext {
|
||||||
@Override
|
@Override
|
||||||
public PropertyValue getProperty(final PropertyDescriptor property) {
|
public PropertyValue getProperty(final PropertyDescriptor property) {
|
||||||
final String configuredValue = component.getEffectivePropertyValue(property);
|
final String configuredValue = component.getEffectivePropertyValue(property);
|
||||||
final String resolvedValue = (configuredValue == null) ? property.getDefaultValue() : configuredValue;
|
|
||||||
|
|
||||||
if (resolvedValue == null) {
|
// We need to get the 'canonical representation' of the property descriptor from the component itself,
|
||||||
// We need to get the 'canonical representation' of the property descriptor from the component itself,
|
// since the supplied PropertyDescriptor may not have the proper default value.
|
||||||
// since the supplied PropertyDescriptor may have been built using only the name, and without the proper
|
final PropertyDescriptor resolvedDescriptor = component.getPropertyDescriptor(property.getName());
|
||||||
// default value.
|
final String resolvedValue = (configuredValue == null) ? resolvedDescriptor.getDefaultValue() : configuredValue;
|
||||||
final PropertyDescriptor resolvedDescriptor = component.getPropertyDescriptor(property.getName());
|
|
||||||
return new StandardPropertyValue(resolvedDescriptor.getDefaultValue(), serviceLookup, component.getParameterLookup(), preparedQueries.get(property), variableRegistry);
|
|
||||||
}
|
|
||||||
|
|
||||||
return new StandardPropertyValue(resolvedValue, serviceLookup, component.getParameterLookup(), preparedQueries.get(property), variableRegistry);
|
return new StandardPropertyValue(resolvedValue, serviceLookup, component.getParameterLookup(), preparedQueries.get(property), variableRegistry);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue