markap14 commented on code in PR #7191:
URL: https://github.com/apache/nifi/pull/7191#discussion_r1223537982
##########
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core-api/src/main/java/org/apache/nifi/controller/AbstractComponentNode.java:
##########
@@ -776,6 +779,23 @@ protected Collection<ValidationResult>
computeValidationErrors(final ValidationC
final Collection<ValidationResult>
referencedServiceValidationResults =
validateReferencedControllerServices(validationContext);
validationResults.addAll(referencedServiceValidationResults);
+ analyze();
+
+
Optional.ofNullable(getValidationContextFactory().getRuleViolationsManager())
+ .map(ruleViolationsManager ->
ruleViolationsManager.getRuleViolationsForSubject(getIdentifier()))
+ .map(Collection::stream)
+ .ifPresent(ruleViolationStream -> ruleViolationStream
+ .filter(ruleViolation ->
ruleViolation.getEnforcementPolicy() == EnforcementPolicy.ENFORCE)
+ .filter(RuleViolation::isEnabled)
+ .forEach(ruleViolation -> validationResults.add(
+ new ValidationResult.Builder()
+ .subject(getComponent().getClass().getSimpleName())
+ .valid(false)
+ .explanation(ruleViolation.getViolationMessage())
+ .build()
+ )
+ ));
Review Comment:
I think it does make sense to go ahead and perform the rule analysis here.
Since that analysis may be enforced by invalidating the component, we need to
ensure that the analysis is performed as part of the validation. If they are
performed out of sync, it can lead to problems where a component is valid,
started, and then the rule enforcement indicates a problem.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]