simonbence commented on a change in pull request #5462:
URL: https://github.com/apache/nifi/pull/5462#discussion_r732888675



##########
File path: 
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/StandardNiFiServiceFacade.java
##########
@@ -4381,7 +4381,7 @@ public ProcessGroupFlowEntity getProcessGroupFlow(final 
String groupId) {
         // doesn't include that anyway. So we can avoid including the 
information in the status that is returned.
         final ProcessGroupStatus groupStatus = 
controllerFacade.getProcessGroupStatus(groupId, 1);
         final PermissionsDTO permissions = 
dtoFactory.createPermissionsDto(processGroup);
-        return 
entityFactory.createProcessGroupFlowEntity(dtoFactory.createProcessGroupFlowDto(processGroup,
 groupStatus, revisionManager, this::getProcessGroupBulletins), permissions);
+        return 
entityFactory.createProcessGroupFlowEntity(dtoFactory.createProcessGroupFlowDto(processGroup,
 groupStatus, revisionManager, this::getProcessGroupBulletins, uiOnly), 
permissions);

Review comment:
       I think, `uiOnly` should not be propogated from the upper layers 
(controllers, etc.) but at some point it might be "solved" into a set of 
excluded (or included) ProcessorConfigDTO attributes. By this the lower levels 
do not need to know about the intent of the client and would be more flexible 
(not sure how much flexibility we will need with this)

##########
File path: 
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/events/VolatileBulletinRepository.java
##########
@@ -126,27 +148,45 @@ public boolean select(final Bulletin bulletin) {
                 return true;
             }
         };
+    }
 
-        final Set<Bulletin> selected = new TreeSet<>();
-        int max = bulletinQuery.getLimit() == null ? Integer.MAX_VALUE : 
bulletinQuery.getLimit();
+    @Override
+    public List<Bulletin> findBulletinsForSource(final String sourceId, final 
String groupId) {

Review comment:
       The two `findBulletinsForSource` share an amount of valuable logis, so I 
would suggest to extract it someting like this:
   
   ```
    private List<Bulletin> findBulletinsForSource(final String sourceId, final 
BulletinQuery bulletinQuery, final Collection<ConcurrentMap<String, 
RingBuffer<Bulletin>>> componentsMaps) {
           final Filter<Bulletin> filter = createFilter(bulletinQuery);
           final Set<Bulletin> selected = new TreeSet<>();
           int max = bulletinQuery.getLimit() == null ? Integer.MAX_VALUE : 
bulletinQuery.getLimit();
   
           for (final ConcurrentMap<String, RingBuffer<Bulletin>> componentMap 
: componentsMaps) {
               if (componentMap == null) {
                   continue;
               }
                            
               final RingBuffer<Bulletin> ringBuffer = 
componentMap.get(sourceId);
               
               if (ringBuffer == null) {
                   continue;
               }
   
               final List<Bulletin> bulletinsForComponent = 
ringBuffer.getSelectedElements(filter, max);
               return bulletinsForComponent;
           }
           
           return Collections.emptyList();
       }
   
       @Override
       public List<Bulletin> findBulletinsForSource(final String sourceId) {
           final BulletinQuery bulletinQuery = new 
BulletinQuery.Builder().sourceIdMatches(Pattern.quote(sourceId)).limit(COMPONENT_BUFFER_SIZE).build();
           return findBulletinsForSource(sourceId, bulletinQuery, 
bulletinStoreMap.values());
       }
   
       @Override
       public List<Bulletin> findBulletinsForSource(final String sourceId, 
final String groupId) {
           final BulletinQuery bulletinQuery = new 
BulletinQuery.Builder().sourceIdMatches(Pattern.quote(sourceId)).groupIdMatches(Pattern.quote(groupId)).limit(COMPONENT_BUFFER_SIZE).build();
           return findBulletinsForSource(sourceId, bulletinQuery, 
Collections.singleton(bulletinStoreMap.get(groupId)));
       }
   ```




-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to