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

    https://github.com/apache/nifi/pull/511#discussion_r67157240
  
    --- Diff: 
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/StandardNiFiWebConfigurationContext.java
 ---
    @@ -452,8 +456,40 @@ private ComponentDetails 
getComponentConfiguration(final ProcessorDTO processor)
                         .state(processor.getState())
                         .annotationData(processorConfig.getAnnotationData())
                         .properties(processorConfig.getProperties())
    +                    .descriptors(getComponentDescriptors(processorConfig))
                         
.validateErrors(processor.getValidationErrors()).build();
             }
    +
    +        private Map<String,ComponentDescriptor> 
getComponentDescriptors(final ProcessorConfigDTO processorConfig){
    +
    +            final Map<String, ComponentDescriptor> descriptors = new 
HashMap<>();
    +
    +            for(String key : processorConfig.getDescriptors().keySet()){
    +
    +                PropertyDescriptorDTO descriptor = 
processorConfig.getDescriptors().get(key);
    +                List<PropertyDescriptorDTO.AllowableValueDTO> 
allowableValuesDTO = descriptor.getAllowableValues();
    +                Map<String,String> allowableValues = new HashMap<>();
    +
    +                if(allowableValuesDTO != null) {
    +                    for (PropertyDescriptorDTO.AllowableValueDTO value : 
allowableValuesDTO) {
    +                        allowableValues.put(value.getValue(), 
value.getDisplayName());
    +                    }
    +                }
    +
    +                ComponentDescriptor componentDescriptor = new 
ComponentDescriptor.Builder()
    +                        .name(descriptor.getName())
    +                        .displayName(descriptor.getDisplayName())
    +                        .defaultValue(descriptor.getDefaultValue())
    +                        .allowableValues(allowableValues)
    +                        .build();
    +
    +
    +                descriptors.put(key,componentDescriptor);
    +            }
    +
    +            return descriptors;
    --- End diff --
    
    Quick question. Is it possible at all that this operation will return an 
empty Map? And if so is it a valid condition or should it result in some 
validation error? May be not, but I figured I'll ask.


---
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