briansolo1985 commented on code in PR #7998: URL: https://github.com/apache/nifi/pull/7998#discussion_r1386715480
########## minifi/minifi-commons/minifi-commons-framework/src/main/java/org/apache/nifi/minifi/commons/service/FlowEnrichService.java: ########## @@ -103,10 +107,12 @@ public byte[] enrichFlow(byte[] flowCandidate) { rootGroup.setInstanceIdentifier(randomUUID().toString()); } + rootGroup.getControllerServices().forEach(cs -> cs.setScheduledState(ENABLED)); Review Comment: Very minor, but in my opinion lamdbas are more expresseive if meaningiful parameter names are used, in this case I would use controllerService, but leave it you. ########## minifi/minifi-commons/minifi-commons-framework/src/main/java/org/apache/nifi/minifi/commons/service/FlowEnrichService.java: ########## @@ -118,7 +124,7 @@ public byte[] enrichFlow(byte[] flowCandidate) { createProvenanceReportingTask(commonSslControllerService.map(VersionedComponent::getInstanceIdentifier).orElse(EMPTY)) .ifPresent(provenanceReportingTask -> { - List<VersionedReportingTask> currentReportingTasks = ofNullable(versionedDataflow.getReportingTasks()).orElseGet(ArrayList::new); + List<VersionedReportingTask> currentReportingTasks = new ArrayList<>(versionedDataflow.getReportingTasks()); Review Comment: And this one also could be simplified ``` createProvenanceReportingTask(commonSslControllerService.map(VersionedComponent::getInstanceIdentifier).orElse(EMPTY)) .ifPresent(versionedDataflow.getReportingTasks()::add); ``` ########## minifi/minifi-commons/minifi-commons-framework/src/main/java/org/apache/nifi/minifi/commons/service/FlowEnrichService.java: ########## @@ -103,10 +107,12 @@ public byte[] enrichFlow(byte[] flowCandidate) { rootGroup.setInstanceIdentifier(randomUUID().toString()); } + rootGroup.getControllerServices().forEach(cs -> cs.setScheduledState(ENABLED)); + Optional<VersionedControllerService> commonSslControllerService = createCommonSslControllerService(); commonSslControllerService .ifPresent(sslControllerService -> { - List<VersionedControllerService> currentControllerServices = ofNullable(versionedDataflow.getControllerServices()).orElseGet(ArrayList::new); + List<VersionedControllerService> currentControllerServices = new ArrayList<>(versionedDataflow.getControllerServices()); Review Comment: Since the initialization was moved outside now it is guaranteed that we will get a non-null list object here. Is it necessary to recreate the list object for some reasons? If not we could simplify the ifPresent block by reducing it to ``` commonSslControllerService.ifPresent(versionedDataflow.getControllerServices()::add); ``` ########## minifi/minifi-commons/minifi-commons-framework/src/main/java/org/apache/nifi/minifi/commons/service/FlowEnrichService.java: ########## @@ -26,6 +26,7 @@ import static java.util.UUID.randomUUID; import static java.util.stream.Collectors.toMap; import static org.apache.commons.lang3.StringUtils.EMPTY; +import static org.apache.nifi.flow.ScheduledState.ENABLED; Review Comment: Could we use the static import in line 159 as well? -- 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: issues-unsubscr...@nifi.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org