diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/html/HtmlDocumentationWriter.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/html/HtmlDocumentationWriter.java index d78f2899de..c086cc2f63 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/html/HtmlDocumentationWriter.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/html/HtmlDocumentationWriter.java @@ -516,7 +516,7 @@ public class HtmlDocumentationWriter implements DocumentationWriter { } xmlStreamWriter.writeEndElement(); - writeSimpleElement(xmlStreamWriter, "td", property.getDefaultValue(), false, "default-value"); + writeSimpleElement(xmlStreamWriter, "td", getDefaultValue(property), false, "default-value"); xmlStreamWriter.writeStartElement("td"); xmlStreamWriter.writeAttribute("id", "allowable-values"); writeValidValues(xmlStreamWriter, property); @@ -674,6 +674,25 @@ public class HtmlDocumentationWriter implements DocumentationWriter { } } + private String getDefaultValue(final PropertyDescriptor propertyDescriptor) { + final String defaultValue; + + final String descriptorDefaultValue = propertyDescriptor.getDefaultValue(); + + final List allowableValues = propertyDescriptor.getAllowableValues(); + if (allowableValues != null) { + defaultValue = allowableValues.stream() + .filter(allowableValue -> allowableValue.getValue().equals(descriptorDefaultValue)) + .findFirst() + .map(AllowableValue::getDisplayName) + .orElse(descriptorDefaultValue); + } else { + defaultValue = descriptorDefaultValue; + } + + return defaultValue; + } + /** * Indicates whether or not the component contains at least one sensitive property. * diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/test/java/org/apache/nifi/documentation/example/FullyDocumentedProcessor.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/test/java/org/apache/nifi/documentation/example/FullyDocumentedProcessor.java index d4fdb1280b..66a17526f6 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/test/java/org/apache/nifi/documentation/example/FullyDocumentedProcessor.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/test/java/org/apache/nifi/documentation/example/FullyDocumentedProcessor.java @@ -89,8 +89,8 @@ public class FullyDocumentedProcessor extends AbstractProcessor { .description("Indicates whether or not to pull files from subdirectories") .required(true) .allowableValues( - new AllowableValue("true", "true", "Should pull from sub directories"), - new AllowableValue("false", "false", "Should not pull from sub directories") + new AllowableValue("true", "Enabled", "Should pull from sub directories"), + new AllowableValue("false", "Disabled", "Should not pull from sub directories") ) .defaultValue("true") .build(); diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/test/java/org/apache/nifi/documentation/html/ProcessorDocumentationWriterTest.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/test/java/org/apache/nifi/documentation/html/ProcessorDocumentationWriterTest.java index 617de73d67..94130ce575 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/test/java/org/apache/nifi/documentation/html/ProcessorDocumentationWriterTest.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/test/java/org/apache/nifi/documentation/html/ProcessorDocumentationWriterTest.java @@ -94,6 +94,10 @@ public class ProcessorDocumentationWriterTest { assertContains(results, "Supports Expression Language: true (will be evaluated using variable registry only)"); assertContains(results, "Supports Expression Language: true (undefined scope)"); + // Check Property Values + assertContains(results, "Enabled"); + assertContains(results, "0 sec"); + // verify dynamic properties assertContains(results, "Routes FlowFiles to relationships based on XPath");