Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ protected void writeProperties(final ConfigurableComponent configurableComponent
}

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);
Expand Down Expand Up @@ -674,6 +674,25 @@ protected void writeProperties(final ConfigurableComponent configurableComponent
}
}

private String getDefaultValue(final PropertyDescriptor propertyDescriptor) {
final String defaultValue;

final String descriptorDefaultValue = propertyDescriptor.getDefaultValue();

final List<AllowableValue> 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.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ public void testFullyDocumentedProcessor() throws IOException {
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");

Expand Down