markap14 commented on a change in pull request #3931: NIFI-6872: support 
download flow
URL: https://github.com/apache/nifi/pull/3931#discussion_r357703283
 
 

 ##########
 File path: 
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/StandardNiFiServiceFacade.java
 ##########
 @@ -4395,6 +4396,78 @@ private VersionControlComponentMappingEntity 
createVersionControlComponentMappin
         return entity;
     }
 
+    @Override
+    public VersionedFlowSnapshot getCurrentFlowSnapshotByGroupId(final String 
processGroupId) {
+        final ProcessGroup processGroup = 
processGroupDAO.getProcessGroup(processGroupId);
+        final VersionControlInformation versionControlInfo = 
processGroup.getVersionControlInformation();
+
+        // Create a complete (include descendant flows) VersionedProcessGroup 
snapshot of the flow as it is
+        // currently without any registry related fields populated, even if 
the flow is currently versioned.
+        final NiFiRegistryFlowMapper mapper = 
makeNiFiRegistryFlowMapper(controllerFacade.getExtensionManager());
+        final InstantiatedVersionedProcessGroup nonVersionedProcessGroup =
+                mapper.mapNonVersionedProcessGroup(processGroup, 
controllerFacade.getControllerServiceProvider());
+
+        // Create a complete (include descendant flows) map of parameter 
contexts
+        final Collection<VersionedParameterContext> parameterContexts =
+                mapper.mapParameterContexts(processGroup, true);
+        final Map<String, VersionedParameterContext> parameterContextMap = 
parameterContexts.stream()
 
 Review comment:
   See comment above, about the creation of 
`Collection<VersionedParameterContext>` with regards to changing to a 
`Set<VersionedParameterContext>`. As this is currently written, if we have 
Group A with Parameter Context A, and a child group, Group B, also with 
Parameter Context A, this will result in the 
`Collection<VersionedParameterContext>` containing two 
`VersionedParameterContext` objects with the same name. This line of code will 
now throw an `IllegalStateException` because it will result in the Map that is 
being formed having duplicate keys.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to