Skip to content

Commit

Permalink
NIFI-8771: This closes #5205. Ensure that we consider root process gr…
Browse files Browse the repository at this point in the history
…oup level Controller Services when determining whether or not the dataflow is empty

Signed-off-by: Joe Witt <joewitt@apache.org>
  • Loading branch information
markap14 authored and joewitt committed Jul 8, 2021
1 parent 777f902 commit 2025999
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -683,6 +683,7 @@ private static boolean isEmpty(final ProcessGroupDTO dto) {
&& CollectionUtils.isEmpty(contents.getOutputPorts())
&& CollectionUtils.isEmpty(contents.getProcessGroups())
&& CollectionUtils.isEmpty(contents.getRemoteProcessGroups())
&& CollectionUtils.isEmpty(contents.getControllerServices())
&& parameterContextId == null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ public static ProcessGroupDTO getProcessGroup(final String parentId, final Eleme
final Set<LabelDTO> labels = new HashSet<>();
final Set<ProcessGroupDTO> processGroups = new HashSet<>();
final Set<RemoteProcessGroupDTO> remoteProcessGroups = new HashSet<>();
final Set<ControllerServiceDTO> controllerServices = new HashSet<>();

NodeList nodeList = DomUtils.getChildNodesByTagName(element, "processor");
for (int i = 0; i < nodeList.getLength(); i++) {
Expand Down Expand Up @@ -256,6 +257,11 @@ public static ProcessGroupDTO getProcessGroup(final String parentId, final Eleme
connections.add(getConnection((Element) nodeList.item(i)));
}

nodeList = DomUtils.getChildNodesByTagName(element, "controllerService");
for (int i=0; i < nodeList.getLength(); i++) {
controllerServices.add(getControllerService((Element) nodeList.item(i), encryptor, encodingVersion));
}

final FlowSnippetDTO groupContents = new FlowSnippetDTO();
groupContents.setConnections(connections);
groupContents.setFunnels(funnels);
Expand All @@ -265,6 +271,7 @@ public static ProcessGroupDTO getProcessGroup(final String parentId, final Eleme
groupContents.setProcessGroups(processGroups);
groupContents.setProcessors(processors);
groupContents.setRemoteProcessGroups(remoteProcessGroups);
groupContents.setControllerServices(controllerServices);

dto.setContents(groupContents);
return dto;
Expand Down

0 comments on commit 2025999

Please sign in to comment.