NIFI-8763 Hide some properties in CSVReader when built-in CSV Format is selected

Signed-off-by: Pierre Villard <pierre.villard.fr@gmail.com>

This closes #5263.
This commit is contained in:
Timea Barna 2021-07-29 09:48:25 +02:00 committed by Pierre Villard
parent fb96590586
commit 0497129aa6
No known key found for this signature in database
GPG Key ID: F92A93B30C07C6D5
2 changed files with 14 additions and 1 deletions

View File

@ -59,6 +59,7 @@ public class CSVUtils {
"but the expression gets evaluated to an invalid Value Separator at runtime, then it will be skipped and the default Value Separator will be used.")
.addValidator(CSVValidators.UNESCAPED_SINGLE_CHAR_VALIDATOR)
.expressionLanguageSupported(ExpressionLanguageScope.FLOWFILE_ATTRIBUTES)
.dependsOn(CSV_FORMAT, CUSTOM)
.defaultValue(",")
.required(true)
.build();
@ -68,6 +69,7 @@ public class CSVUtils {
"but the expression gets evaluated to an invalid Quote Character at runtime, then it will be skipped and the default Quote Character will be used.")
.addValidator(new CSVValidators.SingleCharacterValidator())
.expressionLanguageSupported(ExpressionLanguageScope.FLOWFILE_ATTRIBUTES)
.dependsOn(CSV_FORMAT, CUSTOM)
.defaultValue("\"")
.required(true)
.build();
@ -101,6 +103,7 @@ public class CSVUtils {
.description("The character that is used to denote the start of a comment. Any line that begins with this comment will be ignored.")
.addValidator(new CSVValidators.SingleCharacterValidator())
.expressionLanguageSupported(ExpressionLanguageScope.FLOWFILE_ATTRIBUTES)
.dependsOn(CSV_FORMAT, CUSTOM)
.required(false)
.build();
public static final PropertyDescriptor ESCAPE_CHAR = new PropertyDescriptor.Builder()
@ -109,6 +112,7 @@ public class CSVUtils {
"but the expression gets evaluated to an invalid Escape Character at runtime, then it will be skipped and the default Escape Character will be used.")
.addValidator(new CSVValidators.SingleCharacterValidator())
.expressionLanguageSupported(ExpressionLanguageScope.FLOWFILE_ATTRIBUTES)
.dependsOn(CSV_FORMAT, CUSTOM)
.defaultValue("\\")
.required(true)
.build();
@ -117,6 +121,7 @@ public class CSVUtils {
.description("Specifies a String that, if present as a value in the CSV, should be considered a null field instead of using the literal value.")
.addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
.expressionLanguageSupported(ExpressionLanguageScope.NONE)
.dependsOn(CSV_FORMAT, CUSTOM)
.required(false)
.build();
public static final PropertyDescriptor TRIM_FIELDS = new PropertyDescriptor.Builder()
@ -125,6 +130,7 @@ public class CSVUtils {
.expressionLanguageSupported(ExpressionLanguageScope.NONE)
.allowableValues("true", "false")
.defaultValue("true")
.dependsOn(CSV_FORMAT, CUSTOM)
.required(true)
.build();
public static final PropertyDescriptor CHARSET = new PropertyDescriptor.Builder()
@ -147,6 +153,7 @@ public class CSVUtils {
"duplicate CSV column")
.expressionLanguageSupported(ExpressionLanguageScope.NONE)
.allowableValues("true", "false")
.dependsOn(CSV_FORMAT, CUSTOM)
.defaultValue("true")
.required(false)
.build();
@ -165,6 +172,7 @@ public class CSVUtils {
.expressionLanguageSupported(ExpressionLanguageScope.NONE)
.allowableValues(QUOTE_ALL, QUOTE_MINIMAL, QUOTE_NON_NUMERIC, QUOTE_NONE)
.defaultValue(QUOTE_MINIMAL.getValue())
.dependsOn(CSV_FORMAT, CUSTOM)
.required(true)
.build();
public static final PropertyDescriptor TRAILING_DELIMITER = new PropertyDescriptor.Builder()
@ -173,6 +181,7 @@ public class CSVUtils {
.expressionLanguageSupported(ExpressionLanguageScope.NONE)
.allowableValues("true", "false")
.defaultValue("false")
.dependsOn(CSV_FORMAT, CUSTOM)
.required(true)
.build();
public static final PropertyDescriptor RECORD_SEPARATOR = new PropertyDescriptor.Builder()
@ -181,6 +190,7 @@ public class CSVUtils {
.addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
.expressionLanguageSupported(ExpressionLanguageScope.NONE)
.defaultValue("\\n")
.dependsOn(CSV_FORMAT, CUSTOM)
.required(true)
.build();
public static final PropertyDescriptor INCLUDE_HEADER_LINE = new PropertyDescriptor.Builder()

View File

@ -23,7 +23,10 @@
<body>
<p>
The CSVReader allows for interpreting input data as delimited Records. By default, a comma is used as the field separator,
but this is configurable. It is common, for instance, to use a tab in order to read tab-separated values, or TSV.
but this is configurable. It is common, for instance, to use a tab in order to read tab-separated values, or TSV.<br>
There are pre-defined CSV formats in the reader like EXCEL. Further information regarding their settings can be found here:
<a href="https://commons.apache.org/proper/commons-csv/apidocs/org/apache/commons/csv/CSVFormat.html">
https://commons.apache.org/proper/commons-csv/apidocs/org/apache/commons/csv/CSVFormat.html</a><br>
The reader allows for customization of the CSV Format, such as which character should be used
to separate CSV fields, which character should be used for quoting and when to quote fields, which character should denote
a comment, etc. The names of the fields may be specified either by having a "header line" as the first line in the CSV