You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by pv...@apache.org on 2021/03/02 08:42:03 UTC

[nifi] branch main updated: NIFI-8270: Fixed issue to show property dependent on default value of another

This is an automated email from the ASF dual-hosted git repository.

pvillard pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi.git


The following commit(s) were added to refs/heads/main by this push:
     new 0d473ba  NIFI-8270: Fixed issue to show property dependent on default value of another
0d473ba is described below

commit 0d473bacf66898bc9269784249c31c787c997233
Author: Matthew Burgess <ma...@apache.org>
AuthorDate: Mon Mar 1 14:32:12 2021 -0500

    NIFI-8270: Fixed issue to show property dependent on default value of another
    
    Signed-off-by: Pierre Villard <pi...@gmail.com>
    
    This closes #4860.
---
 .../main/java/org/apache/nifi/web/api/dto/DtoFactory.java    | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/dto/DtoFactory.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/dto/DtoFactory.java
index 5437d44..792e06c 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/dto/DtoFactory.java
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/dto/DtoFactory.java
@@ -1556,8 +1556,8 @@ public final class DtoFactory {
         orderedProperties.putAll(sortedProperties);
 
         // build the descriptor and property dtos
-        dto.setDescriptors(new LinkedHashMap<String, PropertyDescriptorDTO>());
-        dto.setProperties(new LinkedHashMap<String, String>());
+        dto.setDescriptors(new LinkedHashMap<>());
+        dto.setProperties(new LinkedHashMap<>());
         for (final Map.Entry<PropertyDescriptor, String> entry : orderedProperties.entrySet()) {
             final PropertyDescriptor descriptor = entry.getKey();
 
@@ -1568,6 +1568,8 @@ public final class DtoFactory {
             String propertyValue = entry.getValue();
             if (propertyValue != null && descriptor.isSensitive()) {
                 propertyValue = SENSITIVE_VALUE_MASK;
+            } else if (propertyValue == null && descriptor.getDefaultValue() != null) {
+                propertyValue = descriptor.getDefaultValue();
             }
 
             // set the property value
@@ -1636,8 +1638,8 @@ public final class DtoFactory {
         orderedProperties.putAll(sortedProperties);
 
         // build the descriptor and property dtos
-        dto.setDescriptors(new LinkedHashMap<String, PropertyDescriptorDTO>());
-        dto.setProperties(new LinkedHashMap<String, String>());
+        dto.setDescriptors(new LinkedHashMap<>());
+        dto.setProperties(new LinkedHashMap<>());
         for (final Map.Entry<PropertyDescriptor, String> entry : orderedProperties.entrySet()) {
             final PropertyDescriptor descriptor = entry.getKey();
 
@@ -1649,6 +1651,8 @@ public final class DtoFactory {
             String propertyValue = entry.getValue();
             if (propertyValue != null && descriptor.isSensitive()) {
                 propertyValue = SENSITIVE_VALUE_MASK;
+            } else if (propertyValue == null && descriptor.getDefaultValue() != null) {
+                propertyValue = descriptor.getDefaultValue();
             }
 
             // set the property value