You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by ma...@apache.org on 2023/01/03 17:10:16 UTC

[nifi] branch main updated: NIFI-10608 Process Group copies include non-processor referenced controller services

This is an automated email from the ASF dual-hosted git repository.

mattyb149 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi.git


The following commit(s) were added to refs/heads/main by this push:
     new d229f3fd11 NIFI-10608 Process Group copies include non-processor referenced controller services
d229f3fd11 is described below

commit d229f3fd115be9801c1eaae8d0fab6e13f7f6893
Author: Nissim Shiman <ns...@yahoo.com>
AuthorDate: Fri Oct 28 18:47:44 2022 +0000

    NIFI-10608 Process Group copies include non-processor referenced
    controller services
    
    Signed-off-by: Matthew Burgess <ma...@apache.org>
    
    This closes #6685
---
 .../src/main/java/org/apache/nifi/web/util/SnippetUtils.java   | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/util/SnippetUtils.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/util/SnippetUtils.java
index 9e8237a390..d4ebcc06c4 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/util/SnippetUtils.java
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/util/SnippetUtils.java
@@ -354,6 +354,16 @@ public final class SnippetUtils {
                 });
         }
 
+        // include services referenced by processor group but not by any processors
+        for (ControllerServiceNode csNode : group.getControllerServices(false)) {
+            if (csNode != null) {
+                ControllerServiceDTO serviceDto = dtoFactory.createControllerServiceDto(csNode);
+                if (allServicesReferenced.add(serviceDto)) {
+                    contents.getControllerServices().add(serviceDto);
+                }
+            }
+        }
+
         // Map child process group ID to the child process group for easy lookup
         final Map<String, ProcessGroupDTO> childGroupMap = contents.getProcessGroups().stream()
             .collect(Collectors.toMap(ComponentDTO::getId, childGroupDto -> childGroupDto));