tpalfy commented on a change in pull request #3979: NIFI-7009: Atlas reporting 
task retrieves only the active flow compon…
URL: https://github.com/apache/nifi/pull/3979#discussion_r366927947
 
 

 ##########
 File path: 
nifi-nar-bundles/nifi-atlas-bundle/nifi-atlas-reporting-task/src/main/java/org/apache/nifi/atlas/NiFiAtlasClient.java
 ##########
 @@ -201,12 +202,12 @@ public NiFiFlow fetchNiFiFlow(String rootProcessGroupId, 
String clusterName) thr
         nifiFlow.setUrl(toStr(attributes.get(ATTR_URL)));
         nifiFlow.setDescription(toStr(attributes.get(ATTR_DESCRIPTION)));
 
-        
nifiFlow.getQueues().putAll(toQualifiedNameIds(toAtlasObjectIds(nifiFlowEntity.getAttribute(ATTR_QUEUES))));
-        
nifiFlow.getRootInputPortEntities().putAll(toQualifiedNameIds(toAtlasObjectIds(nifiFlowEntity.getAttribute(ATTR_INPUT_PORTS))));
-        
nifiFlow.getRootOutputPortEntities().putAll(toQualifiedNameIds(toAtlasObjectIds(nifiFlowEntity.getAttribute(ATTR_OUTPUT_PORTS))));
+        nifiFlow.getQueues().putAll(fetchFlowComponents(TYPE_NIFI_QUEUE, 
nifiFlowReferredEntities));
+        
nifiFlow.getRootInputPortEntities().putAll(fetchFlowComponents(TYPE_NIFI_INPUT_PORT,
 nifiFlowReferredEntities));
+        
nifiFlow.getRootOutputPortEntities().putAll(fetchFlowComponents(TYPE_NIFI_OUTPUT_PORT,
 nifiFlowReferredEntities));
 
         final Map<String, NiFiFlowPath> flowPaths = nifiFlow.getFlowPaths();
-        final Map<AtlasObjectId, AtlasEntity> flowPathEntities = 
toQualifiedNameIds(toAtlasObjectIds(attributes.get(ATTR_FLOW_PATHS)));
+        final Map<AtlasObjectId, AtlasEntity> flowPathEntities = 
fetchFlowComponents(TYPE_NIFI_FLOW_PATH, nifiFlowReferredEntities);
 
         for (AtlasEntity flowPathEntity : flowPathEntities.values()) {
 
 Review comment:
   Feels strange to leave the handling of the flowpaths as it is. We retrieve 
only the `ACTIVE` ones, but we discard their `referredEntities`. So when it 
comes to their inputs/ouputs, we fall back to the old logic and retrieve them 
all and filter out the `DELETED` ones afterwards.
   
   Even more, to me it seems if we actually didn't set `minExtInfo` to `true` 
but left it on `false`, we could get away with a single REST call, because in 
that case each of the `referredEntities` would contain `relationshipAttributes` 
that also have a `guid` and `entityStatus` (`ACTIVE` or `DELETED`) attribute.

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to