in src/main/java/org/apache/nifi/components/ValidationContext.java [143:188]
private boolean isDependencySatisfied(final PropertyDescriptor propertyDescriptor, final Function<String, PropertyDescriptor> propertyDescriptorLookup, final Set<String> propertiesSeen) {
final Set<PropertyDependency> dependencies = propertyDescriptor.getDependencies();
if (dependencies.isEmpty()) {
return true;
}
final boolean added = propertiesSeen.add(propertyDescriptor.getName());
if (!added) {
return false;
}
try {
for (final PropertyDependency dependency : dependencies) {
final String dependencyName = dependency.getPropertyName();
// Check if the property being depended upon has its dependencies satisfied.
final PropertyDescriptor dependencyDescriptor = propertyDescriptorLookup.apply(dependencyName);
if (dependencyDescriptor == null) {
return false;
}
final PropertyValue propertyValue = getProperty(dependencyDescriptor);
final String dependencyValue = propertyValue == null ? dependencyDescriptor.getDefaultValue() : propertyValue.getValue();
if (dependencyValue == null) {
return false;
}
final boolean transitiveDependencySatisfied = isDependencySatisfied(dependencyDescriptor, propertyDescriptorLookup, propertiesSeen);
if (!transitiveDependencySatisfied) {
return false;
}
// Check if the property being depended upon is set to one of the values that satisfies this dependency.
// If the dependency has no dependent values, then any non-null value satisfies the dependency.
// The value is already known to be non-null due to the check above.
final Set<String> dependentValues = dependency.getDependentValues();
if (dependentValues != null && !dependentValues.contains(dependencyValue)) {
return false;
}
}
return true;
} finally {
propertiesSeen.remove(propertyDescriptor.getName());
}
}