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 0497129 NIFI-8763 Hide some properties in CSVReader when built-in CSV
Format is selected
0497129 is described below
commit 0497129aa674889b378d8d32a061d050d1bc0ac0
Author: Timea Barna <[email protected]>
AuthorDate: Thu Jul 29 09:48:25 2021 +0200
NIFI-8763 Hide some properties in CSVReader when built-in CSV Format is
selected
Signed-off-by: Pierre Villard <[email protected]>
This closes #5263.
---
.../src/main/java/org/apache/nifi/csv/CSVUtils.java | 10 ++++++++++
.../docs/org.apache.nifi.csv.CSVReader/additionalDetails.html | 5 ++++-
2 files changed, 14 insertions(+), 1 deletion(-)
diff --git
a/nifi-nar-bundles/nifi-extension-utils/nifi-record-utils/nifi-standard-record-utils/src/main/java/org/apache/nifi/csv/CSVUtils.java
b/nifi-nar-bundles/nifi-extension-utils/nifi-record-utils/nifi-standard-record-utils/src/main/java/org/apache/nifi/csv/CSVUtils.java
index 82a2c25..cbddfdb 100644
---
a/nifi-nar-bundles/nifi-extension-utils/nifi-record-utils/nifi-standard-record-utils/src/main/java/org/apache/nifi/csv/CSVUtils.java
+++
b/nifi-nar-bundles/nifi-extension-utils/nifi-record-utils/nifi-standard-record-utils/src/main/java/org/apache/nifi/csv/CSVUtils.java
@@ -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()
diff --git
a/nifi-nar-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/main/resources/docs/org.apache.nifi.csv.CSVReader/additionalDetails.html
b/nifi-nar-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/main/resources/docs/org.apache.nifi.csv.CSVReader/additionalDetails.html
index 2a60e1c..fd14a50 100644
---
a/nifi-nar-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/main/resources/docs/org.apache.nifi.csv.CSVReader/additionalDetails.html
+++
b/nifi-nar-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/main/resources/docs/org.apache.nifi.csv.CSVReader/additionalDetails.html
@@ -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