Github user mcgilman commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/2051#discussion_r131983295
  
    --- Diff: 
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/StandardNiFiServiceFacade.java
 ---
    @@ -3062,34 +3206,70 @@ public ProcessGroupEntity getProcessGroup(final 
String groupId) {
             return createProcessGroupEntity(processGroup);
         }
     
    -    private ControllerServiceEntity createControllerServiceEntity(final 
ControllerServiceNode serviceNode, final Set<String> serviceIds) {
    +    private ControllerServiceEntity createControllerServiceEntity(final 
ControllerServiceNode serviceNode, final Set<String> serviceIds, final NiFiUser 
user) {
             final ControllerServiceDTO dto = 
dtoFactory.createControllerServiceDto(serviceNode);
     
             final ControllerServiceReference ref = serviceNode.getReferences();
             final ControllerServiceReferencingComponentsEntity 
referencingComponentsEntity = 
createControllerServiceReferencingComponentsEntity(ref, serviceIds);
             
dto.setReferencingComponents(referencingComponentsEntity.getControllerServiceReferencingComponents());
     
             final RevisionDTO revision = 
dtoFactory.createRevisionDTO(revisionManager.getRevision(serviceNode.getIdentifier()));
    -        final PermissionsDTO permissions = 
dtoFactory.createPermissionsDto(serviceNode);
    +        final PermissionsDTO permissions = 
dtoFactory.createPermissionsDto(serviceNode, user);
             final List<BulletinDTO> bulletins = 
dtoFactory.createBulletinDtos(bulletinRepository.findBulletinsForSource(serviceNode.getIdentifier()));
             final List<BulletinEntity> bulletinEntities = 
bulletins.stream().map(bulletin -> entityFactory.createBulletinEntity(bulletin, 
permissions.getCanRead())).collect(Collectors.toList());
             return entityFactory.createControllerServiceEntity(dto, revision, 
permissions, bulletinEntities);
         }
     
         @Override
    -    public Set<ControllerServiceEntity> getControllerServices(final String 
groupId) {
    -        final Set<ControllerServiceNode> serviceNodes = 
controllerServiceDAO.getControllerServices(groupId);
    +    public VariableRegistryEntity getVariableRegistry(final String 
groupId) {
    +        final ProcessGroup processGroup = 
processGroupDAO.getProcessGroup(groupId);
    +        if (processGroup == null) {
    +            throw new ResourceNotFoundException("Could not find group with 
ID " + groupId);
    +        }
    +
    +        return createVariableRegistryEntity(processGroup);
    +    }
    +
    +    private VariableRegistryEntity createVariableRegistryEntity(final 
ProcessGroup processGroup) {
    +        final VariableRegistryDTO registryDto = 
dtoFactory.createVariableRegistryDto(processGroup);
    +        final RevisionDTO revision = 
dtoFactory.createRevisionDTO(revisionManager.getRevision(processGroup.getIdentifier()));
    +        final PermissionsDTO permissions = 
dtoFactory.createPermissionsDto(processGroup);
    +        return entityFactory.createVariableRegistryEntity(registryDto, 
revision, permissions);
    +    }
    +
    +    @Override
    +    public VariableRegistryEntity populateAffectedComponents(final 
VariableRegistryDTO variableRegistryDto) {
    --- End diff --
    
    `NiFiServiceFacadeLock` handles read/write locking based on the method 
name. Assuming this method needs that thread safety, the name of this method 
needs to be accounted for. Either by changing it here or adding another advice 
to intercept this method call.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to