This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch df2 in repository https://gitbox.apache.org/repos/asf/camel.git
commit 27a1e020202a8562dad8d6fd516d21e6bae65bf3 Author: Claus Ibsen <[email protected]> AuthorDate: Mon Aug 18 15:14:35 2025 +0200 CAMEL-22354: dataformats - Align all data formats getter setters to model --- .../org/apache/camel/catalog/dataformats/csv.json | 57 +++++---- .../org/apache/camel/catalog/models/csv.json | 57 +++++---- .../apache/camel/catalog/schemas/camel-spring.xsd | 34 ++---- .../apache/camel/catalog/schemas/camel-xml-io.xsd | 34 ++---- .../dataformat/csv/CsvDataFormatConfigurer.java | 4 + .../org/apache/camel/dataformat/csv/csv.json | 57 +++++---- .../apache/camel/dataformat/csv/CsvDataFormat.java | 73 ++++-------- .../camel/dataformat/csv/CsvDataFormatTest.java | 132 ++++++++++++--------- .../csv/CsvMarshalHeaderFromCsvFormatTest.java | 4 +- ...alAutogenColumnsSpringQuoteModeTest-context.xml | 13 +- .../CsvMarshalAutogenColumnsSpringTest-context.xml | 13 +- .../csv/CsvUnmarshalMapLineSpringTest-context.xml | 12 +- .../org/apache/camel/model/dataformat/csv.json | 57 +++++---- .../camel/model/dataformat/CsvDataFormat.java | 70 ++++------- .../reifier/dataformat/CsvDataFormatReifier.java | 15 +-- .../java/org/apache/camel/xml/in/ModelParser.java | 9 +- .../java/org/apache/camel/xml/out/ModelWriter.java | 5 +- .../org/apache/camel/yaml/out/ModelWriter.java | 5 +- .../ROOT/pages/camel-4x-upgrade-guide-4_15.adoc | 23 ++++ .../dsl/yaml/deserializers/ModelDeserializers.java | 16 +-- .../generated/resources/schema/camelYamlDsl.json | 20 +--- 21 files changed, 310 insertions(+), 400 deletions(-) diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/dataformats/csv.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/dataformats/csv.json index 549975887b6..cd07a678c28 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/dataformats/csv.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/dataformats/csv.json @@ -17,34 +17,33 @@ }, "properties": { "id": { "index": 0, "kind": "attribute", "displayName": "Id", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The id of this node" }, - "formatRef": { "index": 1, "kind": "attribute", "displayName": "Format Ref", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The reference format to use, it will be updated with the other format options, the default value is CSVFormat.DEFAULT" }, - "formatName": { "index": 2, "kind": "attribute", "displayName": "Format Name", "group": "advanced", "label": "advanced", "required": false, "type": "enum", "javaType": "java.lang.String", "enum": [ "DEFAULT", "EXCEL", "INFORMIX_UNLOAD", "INFORMIX_UNLOAD_CSV", "MYSQL", "RFC4180" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "DEFAULT", "description": "The name of the format to use, the default value is CSVFormat.DEFAULT" }, - "commentMarkerDisabled": { "index": 3, "kind": "attribute", "displayName": "Comment Marker Disabled", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Disables the comment marker of the reference format." }, - "commentMarker": { "index": 4, "kind": "attribute", "displayName": "Comment Marker", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the comment marker of the reference format." }, - "delimiter": { "index": 5, "kind": "attribute", "displayName": "Delimiter", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the delimiter to use. The default value is , (comma)" }, - "escapeDisabled": { "index": 6, "kind": "attribute", "displayName": "Escape Disabled", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Use for disabling using escape character" }, - "escape": { "index": 7, "kind": "attribute", "displayName": "Escape", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the escape character to use" }, - "headerDisabled": { "index": 8, "kind": "attribute", "displayName": "Header Disabled", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Use for disabling headers" }, - "header": { "index": 9, "kind": "element", "displayName": "Header", "group": "common", "required": false, "type": "array", "javaType": "java.util.List<java.lang.String>", "deprecated": false, "autowired": false, "secret": false, "description": "To configure the CSV headers" }, - "allowMissingColumnNames": { "index": 10, "kind": "attribute", "displayName": "Allow Missing Column Names", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether to allow missing column names." }, - "ignoreEmptyLines": { "index": 11, "kind": "attribute", "displayName": "Ignore Empty Lines", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether to ignore empty lines." }, - "ignoreSurroundingSpaces": { "index": 12, "kind": "attribute", "displayName": "Ignore Surrounding Spaces", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether to ignore surrounding spaces" }, - "nullStringDisabled": { "index": 13, "kind": "attribute", "displayName": "Null String Disabled", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Used to disable null strings" }, - "nullString": { "index": 14, "kind": "attribute", "displayName": "Null String", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the null string" }, - "quoteDisabled": { "index": 15, "kind": "attribute", "displayName": "Quote Disabled", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Used to disable quotes" }, - "quote": { "index": 16, "kind": "attribute", "displayName": "Quote", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the quote to use which by default is double-quote character" }, - "recordSeparatorDisabled": { "index": 17, "kind": "attribute", "displayName": "Record Separator Disabled", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Used for disabling record separator" }, - "recordSeparator": { "index": 18, "kind": "attribute", "displayName": "Record Separator", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the record separator (aka new line) which by default is new line characters (CRLF)" }, - "skipHeaderRecord": { "index": 19, "kind": "attribute", "displayName": "Skip Header Record", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether to skip the header record in the output" }, - "quoteMode": { "index": 20, "kind": "attribute", "displayName": "Quote Mode", "group": "common", "required": false, "type": "enum", "javaType": "java.lang.String", "enum": [ "ALL", "ALL_NON_NULL", "MINIMAL", "NON_NUMERIC", "NONE" ], "deprecated": false, "autowired": false, "secret": false, "description": "Sets the quote mode" }, - "ignoreHeaderCase": { "index": 21, "kind": "attribute", "displayName": "Ignore Header Case", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Sets whether or not to ignore case when accessing header names." }, - "trim": { "index": 22, "kind": "attribute", "displayName": "Trim", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Sets whether or not to trim leading and trailing blanks." }, - "trailingDelimiter": { "index": 23, "kind": "attribute", "displayName": "Trailing Delimiter", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Sets whether or not to add a trailing delimiter." }, - "marshallerFactoryRef": { "index": 24, "kind": "attribute", "displayName": "Marshaller Factory Ref", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the implementation of the CsvMarshallerFactory interface which is able to customize marshalling\/unmarshalling behavior by extending CsvMarshaller or creating it from scratch." }, - "lazyLoad": { "index": 25, "kind": "attribute", "displayName": "Lazy Load", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the unmarshalling should produce an iterator that reads the lines on the fly or if all the lines must be read at one." }, - "useMaps": { "index": 26, "kind": "attribute", "displayName": "Use Maps", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the unmarshalling should produce maps (HashMap)for the lines values instead of lists. It requires to have header (either defined or collected)." }, - "useOrderedMaps": { "index": 27, "kind": "attribute", "displayName": "Use Ordered Maps", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the unmarshalling should produce ordered maps (LinkedHashMap) for the lines values instead of lists. It requires to have header (either defined or collected)." }, - "recordConverterRef": { "index": 28, "kind": "attribute", "displayName": "Record Converter Ref", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Refers to a custom CsvRecordConverter to lookup from the registry to use." }, - "captureHeaderRecord": { "index": 29, "kind": "attribute", "displayName": "Capture Header Record", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the unmarshalling should capture the header record and store it in the message header" } + "format": { "index": 1, "kind": "attribute", "displayName": "Format", "group": "common", "required": false, "type": "enum", "javaType": "java.lang.String", "enum": [ "DEFAULT", "EXCEL", "INFORMIX_UNLOAD", "INFORMIX_UNLOAD_CSV", "MONGODB_CSV", "MONGODB_TSV", "MYSQL", "ORACLE", "POSTGRESQL_CSV", "POSTGRESQL_TEXT", "RFC4180" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "DEFAULT", "description": "The format to use." }, + "commentMarkerDisabled": { "index": 2, "kind": "attribute", "displayName": "Comment Marker Disabled", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Disables the comment marker of the reference format." }, + "commentMarker": { "index": 3, "kind": "attribute", "displayName": "Comment Marker", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the comment marker of the reference format." }, + "delimiter": { "index": 4, "kind": "attribute", "displayName": "Delimiter", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the delimiter to use. The default value is , (comma)" }, + "escapeDisabled": { "index": 5, "kind": "attribute", "displayName": "Escape Disabled", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Use for disabling using escape character" }, + "escape": { "index": 6, "kind": "attribute", "displayName": "Escape", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the escape character to use" }, + "headerDisabled": { "index": 7, "kind": "attribute", "displayName": "Header Disabled", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Use for disabling headers" }, + "header": { "index": 8, "kind": "attribute", "displayName": "Header", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "To configure the CSV headers. Multiple headers can be separated by comma." }, + "allowMissingColumnNames": { "index": 9, "kind": "attribute", "displayName": "Allow Missing Column Names", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether to allow missing column names." }, + "ignoreEmptyLines": { "index": 10, "kind": "attribute", "displayName": "Ignore Empty Lines", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether to ignore empty lines." }, + "ignoreSurroundingSpaces": { "index": 11, "kind": "attribute", "displayName": "Ignore Surrounding Spaces", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether to ignore surrounding spaces" }, + "nullStringDisabled": { "index": 12, "kind": "attribute", "displayName": "Null String Disabled", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Used to disable null strings" }, + "nullString": { "index": 13, "kind": "attribute", "displayName": "Null String", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the null string" }, + "quoteDisabled": { "index": 14, "kind": "attribute", "displayName": "Quote Disabled", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Used to disable quotes" }, + "quote": { "index": 15, "kind": "attribute", "displayName": "Quote", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the quote to use which by default is double-quote character" }, + "recordSeparatorDisabled": { "index": 16, "kind": "attribute", "displayName": "Record Separator Disabled", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Used for disabling record separator" }, + "recordSeparator": { "index": 17, "kind": "attribute", "displayName": "Record Separator", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the record separator (aka new line) which by default is new line characters (CRLF)" }, + "skipHeaderRecord": { "index": 18, "kind": "attribute", "displayName": "Skip Header Record", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether to skip the header record in the output" }, + "quoteMode": { "index": 19, "kind": "attribute", "displayName": "Quote Mode", "group": "common", "required": false, "type": "enum", "javaType": "java.lang.String", "enum": [ "ALL", "ALL_NON_NULL", "MINIMAL", "NON_NUMERIC", "NONE" ], "deprecated": false, "autowired": false, "secret": false, "description": "Sets the quote mode" }, + "ignoreHeaderCase": { "index": 20, "kind": "attribute", "displayName": "Ignore Header Case", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Sets whether or not to ignore case when accessing header names." }, + "trim": { "index": 21, "kind": "attribute", "displayName": "Trim", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Sets whether or not to trim leading and trailing blanks." }, + "trailingDelimiter": { "index": 22, "kind": "attribute", "displayName": "Trailing Delimiter", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Sets whether or not to add a trailing delimiter." }, + "marshallerFactoryRef": { "index": 23, "kind": "attribute", "displayName": "Marshaller Factory Ref", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the implementation of the CsvMarshallerFactory interface which is able to customize marshalling\/unmarshalling behavior by extending CsvMarshaller or creating it from scratch." }, + "lazyLoad": { "index": 24, "kind": "attribute", "displayName": "Lazy Load", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the unmarshalling should produce an iterator that reads the lines on the fly or if all the lines must be read at one." }, + "useMaps": { "index": 25, "kind": "attribute", "displayName": "Use Maps", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the unmarshalling should produce maps (HashMap)for the lines values instead of lists. It requires to have header (either defined or collected)." }, + "useOrderedMaps": { "index": 26, "kind": "attribute", "displayName": "Use Ordered Maps", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the unmarshalling should produce ordered maps (LinkedHashMap) for the lines values instead of lists. It requires to have header (either defined or collected)." }, + "recordConverterRef": { "index": 27, "kind": "attribute", "displayName": "Record Converter Ref", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Refers to a custom CsvRecordConverter to lookup from the registry to use." }, + "captureHeaderRecord": { "index": 28, "kind": "attribute", "displayName": "Capture Header Record", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the unmarshalling should capture the header record and store it in the message header" } } } diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/csv.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/csv.json index 1ff5f222144..ff6de69944d 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/csv.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/csv.json @@ -14,34 +14,33 @@ }, "properties": { "id": { "index": 0, "kind": "attribute", "displayName": "Id", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The id of this node" }, - "formatRef": { "index": 1, "kind": "attribute", "displayName": "Format Ref", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The reference format to use, it will be updated with the other format options, the default value is CSVFormat.DEFAULT" }, - "formatName": { "index": 2, "kind": "attribute", "displayName": "Format Name", "group": "advanced", "label": "advanced", "required": false, "type": "enum", "javaType": "java.lang.String", "enum": [ "DEFAULT", "EXCEL", "INFORMIX_UNLOAD", "INFORMIX_UNLOAD_CSV", "MYSQL", "RFC4180" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "DEFAULT", "description": "The name of the format to use, the default value is CSVFormat.DEFAULT" }, - "commentMarkerDisabled": { "index": 3, "kind": "attribute", "displayName": "Comment Marker Disabled", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Disables the comment marker of the reference format." }, - "commentMarker": { "index": 4, "kind": "attribute", "displayName": "Comment Marker", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the comment marker of the reference format." }, - "delimiter": { "index": 5, "kind": "attribute", "displayName": "Delimiter", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the delimiter to use. The default value is , (comma)" }, - "escapeDisabled": { "index": 6, "kind": "attribute", "displayName": "Escape Disabled", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Use for disabling using escape character" }, - "escape": { "index": 7, "kind": "attribute", "displayName": "Escape", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the escape character to use" }, - "headerDisabled": { "index": 8, "kind": "attribute", "displayName": "Header Disabled", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Use for disabling headers" }, - "header": { "index": 9, "kind": "element", "displayName": "Header", "group": "common", "required": false, "type": "array", "javaType": "java.util.List<java.lang.String>", "deprecated": false, "autowired": false, "secret": false, "description": "To configure the CSV headers" }, - "allowMissingColumnNames": { "index": 10, "kind": "attribute", "displayName": "Allow Missing Column Names", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether to allow missing column names." }, - "ignoreEmptyLines": { "index": 11, "kind": "attribute", "displayName": "Ignore Empty Lines", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether to ignore empty lines." }, - "ignoreSurroundingSpaces": { "index": 12, "kind": "attribute", "displayName": "Ignore Surrounding Spaces", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether to ignore surrounding spaces" }, - "nullStringDisabled": { "index": 13, "kind": "attribute", "displayName": "Null String Disabled", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Used to disable null strings" }, - "nullString": { "index": 14, "kind": "attribute", "displayName": "Null String", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the null string" }, - "quoteDisabled": { "index": 15, "kind": "attribute", "displayName": "Quote Disabled", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Used to disable quotes" }, - "quote": { "index": 16, "kind": "attribute", "displayName": "Quote", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the quote to use which by default is double-quote character" }, - "recordSeparatorDisabled": { "index": 17, "kind": "attribute", "displayName": "Record Separator Disabled", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Used for disabling record separator" }, - "recordSeparator": { "index": 18, "kind": "attribute", "displayName": "Record Separator", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the record separator (aka new line) which by default is new line characters (CRLF)" }, - "skipHeaderRecord": { "index": 19, "kind": "attribute", "displayName": "Skip Header Record", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether to skip the header record in the output" }, - "quoteMode": { "index": 20, "kind": "attribute", "displayName": "Quote Mode", "group": "common", "required": false, "type": "enum", "javaType": "java.lang.String", "enum": [ "ALL", "ALL_NON_NULL", "MINIMAL", "NON_NUMERIC", "NONE" ], "deprecated": false, "autowired": false, "secret": false, "description": "Sets the quote mode" }, - "ignoreHeaderCase": { "index": 21, "kind": "attribute", "displayName": "Ignore Header Case", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Sets whether or not to ignore case when accessing header names." }, - "trim": { "index": 22, "kind": "attribute", "displayName": "Trim", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Sets whether or not to trim leading and trailing blanks." }, - "trailingDelimiter": { "index": 23, "kind": "attribute", "displayName": "Trailing Delimiter", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Sets whether or not to add a trailing delimiter." }, - "marshallerFactoryRef": { "index": 24, "kind": "attribute", "displayName": "Marshaller Factory Ref", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the implementation of the CsvMarshallerFactory interface which is able to customize marshalling\/unmarshalling behavior by extending CsvMarshaller or creating it from scratch." }, - "lazyLoad": { "index": 25, "kind": "attribute", "displayName": "Lazy Load", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the unmarshalling should produce an iterator that reads the lines on the fly or if all the lines must be read at one." }, - "useMaps": { "index": 26, "kind": "attribute", "displayName": "Use Maps", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the unmarshalling should produce maps (HashMap)for the lines values instead of lists. It requires to have header (either defined or collected)." }, - "useOrderedMaps": { "index": 27, "kind": "attribute", "displayName": "Use Ordered Maps", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the unmarshalling should produce ordered maps (LinkedHashMap) for the lines values instead of lists. It requires to have header (either defined or collected)." }, - "recordConverterRef": { "index": 28, "kind": "attribute", "displayName": "Record Converter Ref", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Refers to a custom CsvRecordConverter to lookup from the registry to use." }, - "captureHeaderRecord": { "index": 29, "kind": "attribute", "displayName": "Capture Header Record", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the unmarshalling should capture the header record and store it in the message header" } + "format": { "index": 1, "kind": "attribute", "displayName": "Format", "group": "common", "required": false, "type": "enum", "javaType": "java.lang.String", "enum": [ "DEFAULT", "EXCEL", "INFORMIX_UNLOAD", "INFORMIX_UNLOAD_CSV", "MONGODB_CSV", "MONGODB_TSV", "MYSQL", "ORACLE", "POSTGRESQL_CSV", "POSTGRESQL_TEXT", "RFC4180" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "DEFAULT", "description": "The format to use." }, + "commentMarkerDisabled": { "index": 2, "kind": "attribute", "displayName": "Comment Marker Disabled", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Disables the comment marker of the reference format." }, + "commentMarker": { "index": 3, "kind": "attribute", "displayName": "Comment Marker", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the comment marker of the reference format." }, + "delimiter": { "index": 4, "kind": "attribute", "displayName": "Delimiter", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the delimiter to use. The default value is , (comma)" }, + "escapeDisabled": { "index": 5, "kind": "attribute", "displayName": "Escape Disabled", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Use for disabling using escape character" }, + "escape": { "index": 6, "kind": "attribute", "displayName": "Escape", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the escape character to use" }, + "headerDisabled": { "index": 7, "kind": "attribute", "displayName": "Header Disabled", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Use for disabling headers" }, + "header": { "index": 8, "kind": "attribute", "displayName": "Header", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "To configure the CSV headers. Multiple headers can be separated by comma." }, + "allowMissingColumnNames": { "index": 9, "kind": "attribute", "displayName": "Allow Missing Column Names", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether to allow missing column names." }, + "ignoreEmptyLines": { "index": 10, "kind": "attribute", "displayName": "Ignore Empty Lines", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether to ignore empty lines." }, + "ignoreSurroundingSpaces": { "index": 11, "kind": "attribute", "displayName": "Ignore Surrounding Spaces", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether to ignore surrounding spaces" }, + "nullStringDisabled": { "index": 12, "kind": "attribute", "displayName": "Null String Disabled", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Used to disable null strings" }, + "nullString": { "index": 13, "kind": "attribute", "displayName": "Null String", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the null string" }, + "quoteDisabled": { "index": 14, "kind": "attribute", "displayName": "Quote Disabled", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Used to disable quotes" }, + "quote": { "index": 15, "kind": "attribute", "displayName": "Quote", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the quote to use which by default is double-quote character" }, + "recordSeparatorDisabled": { "index": 16, "kind": "attribute", "displayName": "Record Separator Disabled", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Used for disabling record separator" }, + "recordSeparator": { "index": 17, "kind": "attribute", "displayName": "Record Separator", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the record separator (aka new line) which by default is new line characters (CRLF)" }, + "skipHeaderRecord": { "index": 18, "kind": "attribute", "displayName": "Skip Header Record", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether to skip the header record in the output" }, + "quoteMode": { "index": 19, "kind": "attribute", "displayName": "Quote Mode", "group": "common", "required": false, "type": "enum", "javaType": "java.lang.String", "enum": [ "ALL", "ALL_NON_NULL", "MINIMAL", "NON_NUMERIC", "NONE" ], "deprecated": false, "autowired": false, "secret": false, "description": "Sets the quote mode" }, + "ignoreHeaderCase": { "index": 20, "kind": "attribute", "displayName": "Ignore Header Case", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Sets whether or not to ignore case when accessing header names." }, + "trim": { "index": 21, "kind": "attribute", "displayName": "Trim", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Sets whether or not to trim leading and trailing blanks." }, + "trailingDelimiter": { "index": 22, "kind": "attribute", "displayName": "Trailing Delimiter", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Sets whether or not to add a trailing delimiter." }, + "marshallerFactoryRef": { "index": 23, "kind": "attribute", "displayName": "Marshaller Factory Ref", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the implementation of the CsvMarshallerFactory interface which is able to customize marshalling\/unmarshalling behavior by extending CsvMarshaller or creating it from scratch." }, + "lazyLoad": { "index": 24, "kind": "attribute", "displayName": "Lazy Load", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the unmarshalling should produce an iterator that reads the lines on the fly or if all the lines must be read at one." }, + "useMaps": { "index": 25, "kind": "attribute", "displayName": "Use Maps", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the unmarshalling should produce maps (HashMap)for the lines values instead of lists. It requires to have header (either defined or collected)." }, + "useOrderedMaps": { "index": 26, "kind": "attribute", "displayName": "Use Ordered Maps", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the unmarshalling should produce ordered maps (LinkedHashMap) for the lines values instead of lists. It requires to have header (either defined or collected)." }, + "recordConverterRef": { "index": 27, "kind": "attribute", "displayName": "Record Converter Ref", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Refers to a custom CsvRecordConverter to lookup from the registry to use." }, + "captureHeaderRecord": { "index": 28, "kind": "attribute", "displayName": "Capture Header Record", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the unmarshalling should capture the header record and store it in the message header" } } } diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camel-spring.xsd b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camel-spring.xsd index 02922dd0fee..15c743edbca 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camel-spring.xsd +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camel-spring.xsd @@ -8259,31 +8259,12 @@ value: false <xs:complexType name="csvDataFormat"> <xs:complexContent> <xs:extension base="tns:dataFormat"> - <xs:sequence> - <xs:element maxOccurs="unbounded" minOccurs="0" name="header" type="xs:string"> - <xs:annotation> - <xs:documentation xml:lang="en"> -<![CDATA[ -To configure the CSV headers. -]]> - </xs:documentation> - </xs:annotation> - </xs:element> - </xs:sequence> - <xs:attribute name="formatRef" type="xs:string"> - <xs:annotation> - <xs:documentation xml:lang="en"> -<![CDATA[ -The reference format to use, it will be updated with the other format options, the default value is CSVFormat.DEFAULT. -]]> - </xs:documentation> - </xs:annotation> - </xs:attribute> - <xs:attribute name="formatName" type="xs:string"> + <xs:sequence/> + <xs:attribute name="format" type="xs:string"> <xs:annotation> <xs:documentation xml:lang="en"> <![CDATA[ -The name of the format to use, the default value is CSVFormat.DEFAULT. Default value: DEFAULT +The format to use. Default value: DEFAULT ]]> </xs:documentation> </xs:annotation> @@ -8338,6 +8319,15 @@ Sets the escape character to use. <xs:documentation xml:lang="en"> <![CDATA[ Use for disabling headers. Default value: false +]]> + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="header" type="xs:string"> + <xs:annotation> + <xs:documentation xml:lang="en"> +<![CDATA[ +To configure the CSV headers. Multiple headers can be separated by comma. ]]> </xs:documentation> </xs:annotation> diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camel-xml-io.xsd b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camel-xml-io.xsd index 4a7408cf8af..d25ed527382 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camel-xml-io.xsd +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camel-xml-io.xsd @@ -6932,31 +6932,12 @@ value: false <xs:complexType name="csvDataFormat"> <xs:complexContent> <xs:extension base="tns:dataFormat"> - <xs:sequence> - <xs:element maxOccurs="unbounded" minOccurs="0" name="header" type="xs:string"> - <xs:annotation> - <xs:documentation xml:lang="en"> -<![CDATA[ -To configure the CSV headers. -]]> - </xs:documentation> - </xs:annotation> - </xs:element> - </xs:sequence> - <xs:attribute name="formatRef" type="xs:string"> - <xs:annotation> - <xs:documentation xml:lang="en"> -<![CDATA[ -The reference format to use, it will be updated with the other format options, the default value is CSVFormat.DEFAULT. -]]> - </xs:documentation> - </xs:annotation> - </xs:attribute> - <xs:attribute name="formatName" type="xs:string"> + <xs:sequence/> + <xs:attribute name="format" type="xs:string"> <xs:annotation> <xs:documentation xml:lang="en"> <![CDATA[ -The name of the format to use, the default value is CSVFormat.DEFAULT. Default value: DEFAULT +The format to use. Default value: DEFAULT ]]> </xs:documentation> </xs:annotation> @@ -7011,6 +6992,15 @@ Sets the escape character to use. <xs:documentation xml:lang="en"> <![CDATA[ Use for disabling headers. Default value: false +]]> + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="header" type="xs:string"> + <xs:annotation> + <xs:documentation xml:lang="en"> +<![CDATA[ +To configure the CSV headers. Multiple headers can be separated by comma. ]]> </xs:documentation> </xs:annotation> diff --git a/components/camel-csv/src/generated/java/org/apache/camel/dataformat/csv/CsvDataFormatConfigurer.java b/components/camel-csv/src/generated/java/org/apache/camel/dataformat/csv/CsvDataFormatConfigurer.java index 4976280976f..0e39ce28b64 100644 --- a/components/camel-csv/src/generated/java/org/apache/camel/dataformat/csv/CsvDataFormatConfigurer.java +++ b/components/camel-csv/src/generated/java/org/apache/camel/dataformat/csv/CsvDataFormatConfigurer.java @@ -29,6 +29,7 @@ public class CsvDataFormatConfigurer extends org.apache.camel.support.component. map.put("Delimiter", java.lang.Character.class); map.put("Escape", java.lang.Character.class); map.put("EscapeDisabled", boolean.class); + map.put("Format", java.lang.String.class); map.put("Header", java.lang.String.class); map.put("HeaderDisabled", boolean.class); map.put("IgnoreEmptyLines", java.lang.Boolean.class); @@ -66,6 +67,7 @@ public class CsvDataFormatConfigurer extends org.apache.camel.support.component. case "escape": target.setEscape(property(camelContext, java.lang.Character.class, value)); return true; case "escapedisabled": case "escapeDisabled": target.setEscapeDisabled(property(camelContext, boolean.class, value)); return true; + case "format": target.setFormat(property(camelContext, java.lang.String.class, value)); return true; case "header": target.setHeader(property(camelContext, java.lang.String.class, value)); return true; case "headerdisabled": case "headerDisabled": target.setHeaderDisabled(property(camelContext, boolean.class, value)); return true; @@ -123,6 +125,7 @@ public class CsvDataFormatConfigurer extends org.apache.camel.support.component. case "escape": return java.lang.Character.class; case "escapedisabled": case "escapeDisabled": return boolean.class; + case "format": return java.lang.String.class; case "header": return java.lang.String.class; case "headerdisabled": case "headerDisabled": return boolean.class; @@ -176,6 +179,7 @@ public class CsvDataFormatConfigurer extends org.apache.camel.support.component. case "escape": return target.getEscape(); case "escapedisabled": case "escapeDisabled": return target.isEscapeDisabled(); + case "format": return target.getFormat(); case "header": return target.getHeader(); case "headerdisabled": case "headerDisabled": return target.isHeaderDisabled(); diff --git a/components/camel-csv/src/generated/resources/META-INF/org/apache/camel/dataformat/csv/csv.json b/components/camel-csv/src/generated/resources/META-INF/org/apache/camel/dataformat/csv/csv.json index 549975887b6..cd07a678c28 100644 --- a/components/camel-csv/src/generated/resources/META-INF/org/apache/camel/dataformat/csv/csv.json +++ b/components/camel-csv/src/generated/resources/META-INF/org/apache/camel/dataformat/csv/csv.json @@ -17,34 +17,33 @@ }, "properties": { "id": { "index": 0, "kind": "attribute", "displayName": "Id", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The id of this node" }, - "formatRef": { "index": 1, "kind": "attribute", "displayName": "Format Ref", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The reference format to use, it will be updated with the other format options, the default value is CSVFormat.DEFAULT" }, - "formatName": { "index": 2, "kind": "attribute", "displayName": "Format Name", "group": "advanced", "label": "advanced", "required": false, "type": "enum", "javaType": "java.lang.String", "enum": [ "DEFAULT", "EXCEL", "INFORMIX_UNLOAD", "INFORMIX_UNLOAD_CSV", "MYSQL", "RFC4180" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "DEFAULT", "description": "The name of the format to use, the default value is CSVFormat.DEFAULT" }, - "commentMarkerDisabled": { "index": 3, "kind": "attribute", "displayName": "Comment Marker Disabled", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Disables the comment marker of the reference format." }, - "commentMarker": { "index": 4, "kind": "attribute", "displayName": "Comment Marker", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the comment marker of the reference format." }, - "delimiter": { "index": 5, "kind": "attribute", "displayName": "Delimiter", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the delimiter to use. The default value is , (comma)" }, - "escapeDisabled": { "index": 6, "kind": "attribute", "displayName": "Escape Disabled", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Use for disabling using escape character" }, - "escape": { "index": 7, "kind": "attribute", "displayName": "Escape", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the escape character to use" }, - "headerDisabled": { "index": 8, "kind": "attribute", "displayName": "Header Disabled", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Use for disabling headers" }, - "header": { "index": 9, "kind": "element", "displayName": "Header", "group": "common", "required": false, "type": "array", "javaType": "java.util.List<java.lang.String>", "deprecated": false, "autowired": false, "secret": false, "description": "To configure the CSV headers" }, - "allowMissingColumnNames": { "index": 10, "kind": "attribute", "displayName": "Allow Missing Column Names", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether to allow missing column names." }, - "ignoreEmptyLines": { "index": 11, "kind": "attribute", "displayName": "Ignore Empty Lines", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether to ignore empty lines." }, - "ignoreSurroundingSpaces": { "index": 12, "kind": "attribute", "displayName": "Ignore Surrounding Spaces", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether to ignore surrounding spaces" }, - "nullStringDisabled": { "index": 13, "kind": "attribute", "displayName": "Null String Disabled", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Used to disable null strings" }, - "nullString": { "index": 14, "kind": "attribute", "displayName": "Null String", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the null string" }, - "quoteDisabled": { "index": 15, "kind": "attribute", "displayName": "Quote Disabled", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Used to disable quotes" }, - "quote": { "index": 16, "kind": "attribute", "displayName": "Quote", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the quote to use which by default is double-quote character" }, - "recordSeparatorDisabled": { "index": 17, "kind": "attribute", "displayName": "Record Separator Disabled", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Used for disabling record separator" }, - "recordSeparator": { "index": 18, "kind": "attribute", "displayName": "Record Separator", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the record separator (aka new line) which by default is new line characters (CRLF)" }, - "skipHeaderRecord": { "index": 19, "kind": "attribute", "displayName": "Skip Header Record", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether to skip the header record in the output" }, - "quoteMode": { "index": 20, "kind": "attribute", "displayName": "Quote Mode", "group": "common", "required": false, "type": "enum", "javaType": "java.lang.String", "enum": [ "ALL", "ALL_NON_NULL", "MINIMAL", "NON_NUMERIC", "NONE" ], "deprecated": false, "autowired": false, "secret": false, "description": "Sets the quote mode" }, - "ignoreHeaderCase": { "index": 21, "kind": "attribute", "displayName": "Ignore Header Case", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Sets whether or not to ignore case when accessing header names." }, - "trim": { "index": 22, "kind": "attribute", "displayName": "Trim", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Sets whether or not to trim leading and trailing blanks." }, - "trailingDelimiter": { "index": 23, "kind": "attribute", "displayName": "Trailing Delimiter", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Sets whether or not to add a trailing delimiter." }, - "marshallerFactoryRef": { "index": 24, "kind": "attribute", "displayName": "Marshaller Factory Ref", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the implementation of the CsvMarshallerFactory interface which is able to customize marshalling\/unmarshalling behavior by extending CsvMarshaller or creating it from scratch." }, - "lazyLoad": { "index": 25, "kind": "attribute", "displayName": "Lazy Load", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the unmarshalling should produce an iterator that reads the lines on the fly or if all the lines must be read at one." }, - "useMaps": { "index": 26, "kind": "attribute", "displayName": "Use Maps", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the unmarshalling should produce maps (HashMap)for the lines values instead of lists. It requires to have header (either defined or collected)." }, - "useOrderedMaps": { "index": 27, "kind": "attribute", "displayName": "Use Ordered Maps", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the unmarshalling should produce ordered maps (LinkedHashMap) for the lines values instead of lists. It requires to have header (either defined or collected)." }, - "recordConverterRef": { "index": 28, "kind": "attribute", "displayName": "Record Converter Ref", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Refers to a custom CsvRecordConverter to lookup from the registry to use." }, - "captureHeaderRecord": { "index": 29, "kind": "attribute", "displayName": "Capture Header Record", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the unmarshalling should capture the header record and store it in the message header" } + "format": { "index": 1, "kind": "attribute", "displayName": "Format", "group": "common", "required": false, "type": "enum", "javaType": "java.lang.String", "enum": [ "DEFAULT", "EXCEL", "INFORMIX_UNLOAD", "INFORMIX_UNLOAD_CSV", "MONGODB_CSV", "MONGODB_TSV", "MYSQL", "ORACLE", "POSTGRESQL_CSV", "POSTGRESQL_TEXT", "RFC4180" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "DEFAULT", "description": "The format to use." }, + "commentMarkerDisabled": { "index": 2, "kind": "attribute", "displayName": "Comment Marker Disabled", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Disables the comment marker of the reference format." }, + "commentMarker": { "index": 3, "kind": "attribute", "displayName": "Comment Marker", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the comment marker of the reference format." }, + "delimiter": { "index": 4, "kind": "attribute", "displayName": "Delimiter", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the delimiter to use. The default value is , (comma)" }, + "escapeDisabled": { "index": 5, "kind": "attribute", "displayName": "Escape Disabled", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Use for disabling using escape character" }, + "escape": { "index": 6, "kind": "attribute", "displayName": "Escape", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the escape character to use" }, + "headerDisabled": { "index": 7, "kind": "attribute", "displayName": "Header Disabled", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Use for disabling headers" }, + "header": { "index": 8, "kind": "attribute", "displayName": "Header", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "To configure the CSV headers. Multiple headers can be separated by comma." }, + "allowMissingColumnNames": { "index": 9, "kind": "attribute", "displayName": "Allow Missing Column Names", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether to allow missing column names." }, + "ignoreEmptyLines": { "index": 10, "kind": "attribute", "displayName": "Ignore Empty Lines", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether to ignore empty lines." }, + "ignoreSurroundingSpaces": { "index": 11, "kind": "attribute", "displayName": "Ignore Surrounding Spaces", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether to ignore surrounding spaces" }, + "nullStringDisabled": { "index": 12, "kind": "attribute", "displayName": "Null String Disabled", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Used to disable null strings" }, + "nullString": { "index": 13, "kind": "attribute", "displayName": "Null String", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the null string" }, + "quoteDisabled": { "index": 14, "kind": "attribute", "displayName": "Quote Disabled", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Used to disable quotes" }, + "quote": { "index": 15, "kind": "attribute", "displayName": "Quote", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the quote to use which by default is double-quote character" }, + "recordSeparatorDisabled": { "index": 16, "kind": "attribute", "displayName": "Record Separator Disabled", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Used for disabling record separator" }, + "recordSeparator": { "index": 17, "kind": "attribute", "displayName": "Record Separator", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the record separator (aka new line) which by default is new line characters (CRLF)" }, + "skipHeaderRecord": { "index": 18, "kind": "attribute", "displayName": "Skip Header Record", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether to skip the header record in the output" }, + "quoteMode": { "index": 19, "kind": "attribute", "displayName": "Quote Mode", "group": "common", "required": false, "type": "enum", "javaType": "java.lang.String", "enum": [ "ALL", "ALL_NON_NULL", "MINIMAL", "NON_NUMERIC", "NONE" ], "deprecated": false, "autowired": false, "secret": false, "description": "Sets the quote mode" }, + "ignoreHeaderCase": { "index": 20, "kind": "attribute", "displayName": "Ignore Header Case", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Sets whether or not to ignore case when accessing header names." }, + "trim": { "index": 21, "kind": "attribute", "displayName": "Trim", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Sets whether or not to trim leading and trailing blanks." }, + "trailingDelimiter": { "index": 22, "kind": "attribute", "displayName": "Trailing Delimiter", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Sets whether or not to add a trailing delimiter." }, + "marshallerFactoryRef": { "index": 23, "kind": "attribute", "displayName": "Marshaller Factory Ref", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the implementation of the CsvMarshallerFactory interface which is able to customize marshalling\/unmarshalling behavior by extending CsvMarshaller or creating it from scratch." }, + "lazyLoad": { "index": 24, "kind": "attribute", "displayName": "Lazy Load", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the unmarshalling should produce an iterator that reads the lines on the fly or if all the lines must be read at one." }, + "useMaps": { "index": 25, "kind": "attribute", "displayName": "Use Maps", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the unmarshalling should produce maps (HashMap)for the lines values instead of lists. It requires to have header (either defined or collected)." }, + "useOrderedMaps": { "index": 26, "kind": "attribute", "displayName": "Use Ordered Maps", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the unmarshalling should produce ordered maps (LinkedHashMap) for the lines values instead of lists. It requires to have header (either defined or collected)." }, + "recordConverterRef": { "index": 27, "kind": "attribute", "displayName": "Record Converter Ref", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Refers to a custom CsvRecordConverter to lookup from the registry to use." }, + "captureHeaderRecord": { "index": 28, "kind": "attribute", "displayName": "Capture Header Record", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the unmarshalling should capture the header record and store it in the message header" } } } diff --git a/components/camel-csv/src/main/java/org/apache/camel/dataformat/csv/CsvDataFormat.java b/components/camel-csv/src/main/java/org/apache/camel/dataformat/csv/CsvDataFormat.java index ad6e00f6640..5cdde017136 100644 --- a/components/camel-csv/src/main/java/org/apache/camel/dataformat/csv/CsvDataFormat.java +++ b/components/camel-csv/src/main/java/org/apache/camel/dataformat/csv/CsvDataFormat.java @@ -38,7 +38,8 @@ import org.apache.commons.csv.QuoteMode; @Dataformat("csv") public class CsvDataFormat extends ServiceSupport implements DataFormat, DataFormatName { // CSV format options - private CSVFormat format = CSVFormat.DEFAULT; + private CSVFormat csvFormat = CSVFormat.DEFAULT; + private String format; private boolean commentMarkerDisabled; private Character commentMarker; private Character delimiter; @@ -77,7 +78,7 @@ public class CsvDataFormat extends ServiceSupport implements DataFormat, DataFor } public CsvDataFormat(CSVFormat format) { - setFormat(format); + csvFormat = format; } @Override @@ -105,6 +106,13 @@ public class CsvDataFormat extends ServiceSupport implements DataFormat, DataFor super.doInit(); marshaller = marshallerFactory.create(getActiveFormat(), this); unmarshaller = CsvUnmarshaller.create(getActiveFormat(), this); + + if (csvFormat == null && format != null) { + csvFormat = CSVFormat.valueOf(format); + } + if (csvFormat == null) { + csvFormat = CSVFormat.DEFAULT; + } } @Override @@ -113,7 +121,7 @@ public class CsvDataFormat extends ServiceSupport implements DataFormat, DataFor } CSVFormat getActiveFormat() { - CSVFormat answer = format; + CSVFormat answer = csvFormat; if (commentMarkerDisabled) { answer = answer.withCommentMarker(null); // null disables the comment marker @@ -196,30 +204,6 @@ public class CsvDataFormat extends ServiceSupport implements DataFormat, DataFor //region Getters/Setters - /** - * Gets the CSV format before applying any changes. It cannot be {@code null}, the default one is - * {@link org.apache.commons.csv.CSVFormat#DEFAULT}. - * - * @return CSV format - */ - public CSVFormat getFormat() { - return format; - } - - /** - * Sets the CSV format before applying any changes. If {@code null}, then - * {@link org.apache.commons.csv.CSVFormat#DEFAULT} is used instead. - * - * @param format CSV format - * @return Current {@code CsvDataFormat}, fluent API - * @see org.apache.commons.csv.CSVFormat - * @see org.apache.commons.csv.CSVFormat#DEFAULT - */ - public CsvDataFormat setFormat(CSVFormat format) { - this.format = (format == null) ? CSVFormat.DEFAULT : format; - return this; - } - /** * Sets the {@link CsvMarshaller} factory. If {@code null}, then {@link CsvMarshallerFactory#DEFAULT} is used * instead. @@ -241,31 +225,16 @@ public class CsvDataFormat extends ServiceSupport implements DataFormat, DataFor return marshallerFactory; } - /** - * Sets the CSV format by name before applying any changes. - * - * @param name CSV format name - * @return Current {@code CsvDataFormat}, fluent API - * @see #setFormat(org.apache.commons.csv.CSVFormat) - * @see org.apache.commons.csv.CSVFormat - */ - public CsvDataFormat setFormatName(String name) { - if (name == null) { - setFormat(null); - } else if ("DEFAULT".equals(name)) { - setFormat(CSVFormat.DEFAULT); - } else if ("RFC4180".equals(name)) { - setFormat(CSVFormat.RFC4180); - } else if ("EXCEL".equals(name)) { - setFormat(CSVFormat.EXCEL); - } else if ("TDF".equals(name)) { - setFormat(CSVFormat.TDF); - } else if ("MYSQL".equals(name)) { - setFormat(CSVFormat.MYSQL); - } else { - throw new IllegalArgumentException("Unsupported format"); - } - return this; + public CSVFormat getCsvFormat() { + return csvFormat; + } + + public String getFormat() { + return format; + } + + public void setFormat(String format) { + this.format = format; } /** diff --git a/components/camel-csv/src/test/java/org/apache/camel/dataformat/csv/CsvDataFormatTest.java b/components/camel-csv/src/test/java/org/apache/camel/dataformat/csv/CsvDataFormatTest.java index 41a9e2eb34c..512845a4076 100644 --- a/components/camel-csv/src/test/java/org/apache/camel/dataformat/csv/CsvDataFormatTest.java +++ b/components/camel-csv/src/test/java/org/apache/camel/dataformat/csv/CsvDataFormatTest.java @@ -37,9 +37,10 @@ public class CsvDataFormatTest { @Test void shouldUseDefaultFormat() { CsvDataFormat dataFormat = new CsvDataFormat(); + dataFormat.start(); // Properly initialized - assertSame(CSVFormat.DEFAULT, dataFormat.getFormat()); + assertSame(CSVFormat.DEFAULT, dataFormat.getCsvFormat()); // Properly used assertEquals(CSVFormat.DEFAULT, dataFormat.getActiveFormat()); @@ -48,9 +49,10 @@ public class CsvDataFormatTest { @Test void shouldUseFormatFromConstructor() { CsvDataFormat dataFormat = new CsvDataFormat(CSVFormat.EXCEL); + dataFormat.start(); // Properly initialized - assertSame(CSVFormat.EXCEL, dataFormat.getFormat()); + assertSame(CSVFormat.EXCEL, dataFormat.getCsvFormat()); // Properly used assertEquals(CSVFormat.EXCEL, dataFormat.getActiveFormat()); @@ -58,35 +60,23 @@ public class CsvDataFormatTest { @Test void shouldUseSpecifiedFormat() { - CsvDataFormat dataFormat = new CsvDataFormat() - .setFormat(CSVFormat.MYSQL); + CsvDataFormat dataFormat = new CsvDataFormat(CSVFormat.MYSQL); + dataFormat.start(); // Properly saved - assertSame(CSVFormat.MYSQL, dataFormat.getFormat()); + assertSame(CSVFormat.MYSQL, dataFormat.getCsvFormat()); // Properly used assertEquals(CSVFormat.MYSQL, dataFormat.getActiveFormat()); } - @Test - void shouldFallbackToDefaultFormat() { - CsvDataFormat dataFormat = new CsvDataFormat(CSVFormat.EXCEL) - .setFormat(null); - - // Properly saved - assertSame(CSVFormat.DEFAULT, dataFormat.getFormat()); - - // Properly used - assertEquals(CSVFormat.DEFAULT, dataFormat.getActiveFormat()); - } - @Test void shouldDefineFormatByName() { - CsvDataFormat dataFormat = new CsvDataFormat() - .setFormatName("EXCEL"); + CsvDataFormat dataFormat = new CsvDataFormat(CSVFormat.EXCEL); + dataFormat.start(); // Properly saved - assertSame(CSVFormat.EXCEL, dataFormat.getFormat()); + assertSame(CSVFormat.EXCEL, dataFormat.getCsvFormat()); // Properly used assertEquals(CSVFormat.EXCEL, dataFormat.getActiveFormat()); @@ -97,9 +87,10 @@ public class CsvDataFormatTest { CsvDataFormat dataFormat = new CsvDataFormat() .setCommentMarkerDisabled(true) .setCommentMarker('c'); + dataFormat.start(); // Properly saved - assertSame(CSVFormat.DEFAULT, dataFormat.getFormat()); + assertSame(CSVFormat.DEFAULT, dataFormat.getCsvFormat()); assertTrue(dataFormat.isCommentMarkerDisabled()); assertEquals(Character.valueOf('c'), dataFormat.getCommentMarker()); @@ -111,9 +102,10 @@ public class CsvDataFormatTest { void shouldOverrideCommentMarker() { CsvDataFormat dataFormat = new CsvDataFormat() .setCommentMarker('c'); + dataFormat.start(); // Properly saved - assertSame(CSVFormat.DEFAULT, dataFormat.getFormat()); + assertSame(CSVFormat.DEFAULT, dataFormat.getCsvFormat()); assertEquals(Character.valueOf('c'), dataFormat.getCommentMarker()); // Properly used @@ -124,9 +116,10 @@ public class CsvDataFormatTest { void shouldOverrideDelimiter() { CsvDataFormat dataFormat = new CsvDataFormat() .setDelimiter('d'); + dataFormat.start(); // Properly saved - assertSame(CSVFormat.DEFAULT, dataFormat.getFormat()); + assertSame(CSVFormat.DEFAULT, dataFormat.getCsvFormat()); assertEquals(Character.valueOf('d'), dataFormat.getDelimiter()); // Properly used @@ -138,9 +131,10 @@ public class CsvDataFormatTest { CsvDataFormat dataFormat = new CsvDataFormat() .setEscapeDisabled(true) .setEscape('e'); + dataFormat.start(); // Properly saved - assertSame(CSVFormat.DEFAULT, dataFormat.getFormat()); + assertSame(CSVFormat.DEFAULT, dataFormat.getCsvFormat()); assertTrue(dataFormat.isEscapeDisabled()); assertEquals(Character.valueOf('e'), dataFormat.getEscape()); @@ -152,9 +146,10 @@ public class CsvDataFormatTest { void shouldOverrideEscape() { CsvDataFormat dataFormat = new CsvDataFormat() .setEscape('e'); + dataFormat.start(); // Properly saved - assertSame(CSVFormat.DEFAULT, dataFormat.getFormat()); + assertSame(CSVFormat.DEFAULT, dataFormat.getCsvFormat()); assertEquals(Character.valueOf('e'), dataFormat.getEscape()); // Properly used @@ -166,9 +161,10 @@ public class CsvDataFormatTest { CsvDataFormat dataFormat = new CsvDataFormat() .setHeaderDisabled(true) .setHeader(new String[] { "a", "b", "c" }); + dataFormat.start(); // Properly saved - assertSame(CSVFormat.DEFAULT, dataFormat.getFormat()); + assertSame(CSVFormat.DEFAULT, dataFormat.getCsvFormat()); assertTrue(dataFormat.isHeaderDisabled()); assertEquals("a,b,c", dataFormat.getHeader()); @@ -180,9 +176,10 @@ public class CsvDataFormatTest { void shouldOverrideHeader() { CsvDataFormat dataFormat = new CsvDataFormat() .setHeader("a,b,c"); + dataFormat.start(); // Properly saved - assertSame(CSVFormat.DEFAULT, dataFormat.getFormat()); + assertSame(CSVFormat.DEFAULT, dataFormat.getCsvFormat()); assertEquals("a,b,c", dataFormat.getHeader()); // Properly used @@ -193,9 +190,10 @@ public class CsvDataFormatTest { void shouldAllowMissingColumnNames() { CsvDataFormat dataFormat = new CsvDataFormat() .setAllowMissingColumnNames(true); + dataFormat.start(); // Properly saved - assertSame(CSVFormat.DEFAULT, dataFormat.getFormat()); + assertSame(CSVFormat.DEFAULT, dataFormat.getCsvFormat()); assertEquals(Boolean.TRUE, dataFormat.getAllowMissingColumnNames()); // Properly used @@ -206,9 +204,10 @@ public class CsvDataFormatTest { void shouldNotAllowMissingColumnNames() { CsvDataFormat dataFormat = new CsvDataFormat() .setAllowMissingColumnNames(false); + dataFormat.start(); // Properly saved - assertSame(CSVFormat.DEFAULT, dataFormat.getFormat()); + assertSame(CSVFormat.DEFAULT, dataFormat.getCsvFormat()); assertEquals(Boolean.FALSE, dataFormat.getAllowMissingColumnNames()); // Properly used @@ -219,9 +218,10 @@ public class CsvDataFormatTest { void shouldIgnoreEmptyLines() { CsvDataFormat dataFormat = new CsvDataFormat() .setIgnoreEmptyLines(true); + dataFormat.start(); // Properly saved - assertSame(CSVFormat.DEFAULT, dataFormat.getFormat()); + assertSame(CSVFormat.DEFAULT, dataFormat.getCsvFormat()); assertEquals(Boolean.TRUE, dataFormat.getIgnoreEmptyLines()); // Properly used @@ -232,9 +232,10 @@ public class CsvDataFormatTest { void shouldNotIgnoreEmptyLines() { CsvDataFormat dataFormat = new CsvDataFormat() .setIgnoreEmptyLines(false); + dataFormat.start(); // Properly saved - assertSame(CSVFormat.DEFAULT, dataFormat.getFormat()); + assertSame(CSVFormat.DEFAULT, dataFormat.getCsvFormat()); assertEquals(Boolean.FALSE, dataFormat.getIgnoreEmptyLines()); // Properly used @@ -245,9 +246,10 @@ public class CsvDataFormatTest { void shouldIgnoreSurroundingSpaces() { CsvDataFormat dataFormat = new CsvDataFormat() .setIgnoreSurroundingSpaces(true); + dataFormat.start(); // Properly saved - assertSame(CSVFormat.DEFAULT, dataFormat.getFormat()); + assertSame(CSVFormat.DEFAULT, dataFormat.getCsvFormat()); assertEquals(Boolean.TRUE, dataFormat.getIgnoreSurroundingSpaces()); // Properly used @@ -258,9 +260,10 @@ public class CsvDataFormatTest { void shouldNotIgnoreSurroundingSpaces() { CsvDataFormat dataFormat = new CsvDataFormat() .setIgnoreSurroundingSpaces(false); + dataFormat.start(); // Properly saved - assertSame(CSVFormat.DEFAULT, dataFormat.getFormat()); + assertSame(CSVFormat.DEFAULT, dataFormat.getCsvFormat()); assertEquals(Boolean.FALSE, dataFormat.getIgnoreSurroundingSpaces()); // Properly used @@ -272,9 +275,10 @@ public class CsvDataFormatTest { CsvDataFormat dataFormat = new CsvDataFormat() .setNullStringDisabled(true) .setNullString("****"); + dataFormat.start(); // Properly saved - assertSame(CSVFormat.DEFAULT, dataFormat.getFormat()); + assertSame(CSVFormat.DEFAULT, dataFormat.getCsvFormat()); assertTrue(dataFormat.isNullStringDisabled()); assertEquals("****", dataFormat.getNullString()); @@ -286,9 +290,10 @@ public class CsvDataFormatTest { void shouldOverrideNullString() { CsvDataFormat dataFormat = new CsvDataFormat() .setNullString("****"); + dataFormat.start(); // Properly saved - assertSame(CSVFormat.DEFAULT, dataFormat.getFormat()); + assertSame(CSVFormat.DEFAULT, dataFormat.getCsvFormat()); assertEquals("****", dataFormat.getNullString()); // Properly used @@ -300,9 +305,10 @@ public class CsvDataFormatTest { CsvDataFormat dataFormat = new CsvDataFormat() .setQuoteDisabled(true) .setQuote('q'); + dataFormat.start(); // Properly saved - assertSame(CSVFormat.DEFAULT, dataFormat.getFormat()); + assertSame(CSVFormat.DEFAULT, dataFormat.getCsvFormat()); assertTrue(dataFormat.isQuoteDisabled()); assertEquals(Character.valueOf('q'), dataFormat.getQuote()); @@ -314,9 +320,10 @@ public class CsvDataFormatTest { void shouldOverrideQuote() { CsvDataFormat dataFormat = new CsvDataFormat() .setQuote('q'); + dataFormat.start(); // Properly saved - assertSame(CSVFormat.DEFAULT, dataFormat.getFormat()); + assertSame(CSVFormat.DEFAULT, dataFormat.getCsvFormat()); assertEquals(Character.valueOf('q'), dataFormat.getQuote()); // Properly used @@ -327,9 +334,10 @@ public class CsvDataFormatTest { void shouldOverrideQuoteMode() { CsvDataFormat dataFormat = new CsvDataFormat() .setQuoteMode(QuoteMode.ALL); + dataFormat.start(); // Properly saved - assertSame(CSVFormat.DEFAULT, dataFormat.getFormat()); + assertSame(CSVFormat.DEFAULT, dataFormat.getCsvFormat()); assertEquals(QuoteMode.ALL, dataFormat.getQuoteMode()); // Properly used @@ -341,9 +349,10 @@ public class CsvDataFormatTest { CsvDataFormat dataFormat = new CsvDataFormat() .setRecordSeparatorDisabled(true) .setRecordSeparator("separator"); + dataFormat.start(); // Properly saved - assertSame(CSVFormat.DEFAULT, dataFormat.getFormat()); + assertSame(CSVFormat.DEFAULT, dataFormat.getCsvFormat()); assertTrue(dataFormat.isRecordSeparatorDisabled()); assertEquals("separator", dataFormat.getRecordSeparator()); @@ -355,9 +364,10 @@ public class CsvDataFormatTest { void shouldOverrideRecordSeparator() { CsvDataFormat dataFormat = new CsvDataFormat() .setRecordSeparator("separator"); + dataFormat.start(); // Properly saved - assertSame(CSVFormat.DEFAULT, dataFormat.getFormat()); + assertSame(CSVFormat.DEFAULT, dataFormat.getCsvFormat()); assertEquals("separator", dataFormat.getRecordSeparator()); // Properly used @@ -368,9 +378,10 @@ public class CsvDataFormatTest { void shouldSkipHeaderRecord() { CsvDataFormat dataFormat = new CsvDataFormat() .setSkipHeaderRecord(true); + dataFormat.start(); // Properly saved - assertSame(CSVFormat.DEFAULT, dataFormat.getFormat()); + assertSame(CSVFormat.DEFAULT, dataFormat.getCsvFormat()); assertEquals(Boolean.TRUE, dataFormat.getSkipHeaderRecord()); // Properly used @@ -381,9 +392,10 @@ public class CsvDataFormatTest { void shouldNotSkipHeaderRecord() { CsvDataFormat dataFormat = new CsvDataFormat() .setSkipHeaderRecord(false); + dataFormat.start(); // Properly saved - assertSame(CSVFormat.DEFAULT, dataFormat.getFormat()); + assertSame(CSVFormat.DEFAULT, dataFormat.getCsvFormat()); assertEquals(Boolean.FALSE, dataFormat.getSkipHeaderRecord()); // Properly used @@ -394,9 +406,10 @@ public class CsvDataFormatTest { void shouldHandleLazyLoad() { CsvDataFormat dataFormat = new CsvDataFormat() .setLazyLoad(true); + dataFormat.start(); // Properly saved - assertSame(CSVFormat.DEFAULT, dataFormat.getFormat()); + assertSame(CSVFormat.DEFAULT, dataFormat.getCsvFormat()); assertTrue(dataFormat.isLazyLoad()); // Properly used (it doesn't modify the format) @@ -407,9 +420,10 @@ public class CsvDataFormatTest { void shouldHandleUseMaps() { CsvDataFormat dataFormat = new CsvDataFormat() .setUseMaps(true); + dataFormat.start(); // Properly saved - assertSame(CSVFormat.DEFAULT, dataFormat.getFormat()); + assertSame(CSVFormat.DEFAULT, dataFormat.getCsvFormat()); assertTrue(dataFormat.isUseMaps()); // Properly used (it doesn't modify the format) @@ -427,9 +441,10 @@ public class CsvDataFormatTest { CsvDataFormat dataFormat = new CsvDataFormat() .setRecordConverter(converter); + dataFormat.start(); // Properly saved - assertSame(CSVFormat.DEFAULT, dataFormat.getFormat()); + assertSame(CSVFormat.DEFAULT, dataFormat.getCsvFormat()); assertSame(converter, dataFormat.getRecordConverter()); // Properly used (it doesn't modify the format) @@ -440,24 +455,27 @@ public class CsvDataFormatTest { void testTrim() { // Set to TRUE CsvDataFormat dataFormat = new CsvDataFormat().setTrim(true); + dataFormat.start(); // Properly saved - assertSame(CSVFormat.DEFAULT, dataFormat.getFormat()); + assertSame(CSVFormat.DEFAULT, dataFormat.getCsvFormat()); assertEquals(Boolean.TRUE, dataFormat.getTrim()); // Properly used assertTrue(dataFormat.getActiveFormat().getTrim()); // NOT set dataFormat = new CsvDataFormat(); + dataFormat.start(); // Properly saved - assertSame(CSVFormat.DEFAULT, dataFormat.getFormat()); + assertSame(CSVFormat.DEFAULT, dataFormat.getCsvFormat()); assertNull(dataFormat.getTrim()); // Properly used assertFalse(dataFormat.getActiveFormat().getTrim()); // Set to false dataFormat = new CsvDataFormat().setTrim(false); + dataFormat.start(); // Properly saved - assertSame(CSVFormat.DEFAULT, dataFormat.getFormat()); + assertSame(CSVFormat.DEFAULT, dataFormat.getCsvFormat()); assertEquals(Boolean.FALSE, dataFormat.getTrim()); // Properly used assertFalse(dataFormat.getActiveFormat().getTrim()); @@ -468,24 +486,27 @@ public class CsvDataFormatTest { void testIgnoreHeaderCase() { // Set to TRUE CsvDataFormat dataFormat = new CsvDataFormat().setIgnoreHeaderCase(true); + dataFormat.start(); // Properly saved - assertSame(CSVFormat.DEFAULT, dataFormat.getFormat()); + assertSame(CSVFormat.DEFAULT, dataFormat.getCsvFormat()); assertEquals(Boolean.TRUE, dataFormat.getIgnoreHeaderCase()); // Properly used assertTrue(dataFormat.getActiveFormat().getIgnoreHeaderCase()); // NOT set dataFormat = new CsvDataFormat(); + dataFormat.start(); // Properly saved - assertSame(CSVFormat.DEFAULT, dataFormat.getFormat()); + assertSame(CSVFormat.DEFAULT, dataFormat.getCsvFormat()); assertNull(dataFormat.getIgnoreHeaderCase()); // Properly used assertFalse(dataFormat.getActiveFormat().getIgnoreHeaderCase()); // Set to false dataFormat = new CsvDataFormat().setIgnoreHeaderCase(false); + dataFormat.start(); // Properly saved - assertSame(CSVFormat.DEFAULT, dataFormat.getFormat()); + assertSame(CSVFormat.DEFAULT, dataFormat.getCsvFormat()); assertEquals(Boolean.FALSE, dataFormat.getIgnoreHeaderCase()); // Properly used assertFalse(dataFormat.getActiveFormat().getIgnoreHeaderCase()); @@ -495,24 +516,27 @@ public class CsvDataFormatTest { void testTrailingDelimiter() { // Set to TRUE CsvDataFormat dataFormat = new CsvDataFormat().setTrailingDelimiter(true); + dataFormat.start(); // Properly saved - assertSame(CSVFormat.DEFAULT, dataFormat.getFormat()); + assertSame(CSVFormat.DEFAULT, dataFormat.getCsvFormat()); assertEquals(Boolean.TRUE, dataFormat.getTrailingDelimiter()); // Properly used assertTrue(dataFormat.getActiveFormat().getTrailingDelimiter()); // NOT set dataFormat = new CsvDataFormat(); + dataFormat.start(); // Properly saved - assertSame(CSVFormat.DEFAULT, dataFormat.getFormat()); + assertSame(CSVFormat.DEFAULT, dataFormat.getCsvFormat()); assertNull(dataFormat.getTrailingDelimiter()); // Properly used assertFalse(dataFormat.getActiveFormat().getTrailingDelimiter()); // Set to false dataFormat = new CsvDataFormat().setTrailingDelimiter(false); + dataFormat.start(); // Properly saved - assertSame(CSVFormat.DEFAULT, dataFormat.getFormat()); + assertSame(CSVFormat.DEFAULT, dataFormat.getCsvFormat()); assertEquals(Boolean.FALSE, dataFormat.getTrailingDelimiter()); // Properly used assertFalse(dataFormat.getActiveFormat().getTrailingDelimiter()); diff --git a/components/camel-csv/src/test/java/org/apache/camel/dataformat/csv/CsvMarshalHeaderFromCsvFormatTest.java b/components/camel-csv/src/test/java/org/apache/camel/dataformat/csv/CsvMarshalHeaderFromCsvFormatTest.java index 12ee7a3c400..7f1e085ade0 100644 --- a/components/camel-csv/src/test/java/org/apache/camel/dataformat/csv/CsvMarshalHeaderFromCsvFormatTest.java +++ b/components/camel-csv/src/test/java/org/apache/camel/dataformat/csv/CsvMarshalHeaderFromCsvFormatTest.java @@ -112,8 +112,6 @@ public class CsvMarshalHeaderFromCsvFormatTest extends CamelTestSupport { .setIgnoreSurroundingSpaces(true) .setHeader("first_name", "last_name") .get(); - CsvDataFormat dataFormat = new CsvDataFormat(); - dataFormat.setFormat(format); - return dataFormat; + return new CsvDataFormat(format); } } diff --git a/components/camel-csv/src/test/resources/org/apache/camel/dataformat/csv/CsvMarshalAutogenColumnsSpringQuoteModeTest-context.xml b/components/camel-csv/src/test/resources/org/apache/camel/dataformat/csv/CsvMarshalAutogenColumnsSpringQuoteModeTest-context.xml index 2936ea9961a..d8604ab8757 100644 --- a/components/camel-csv/src/test/resources/org/apache/camel/dataformat/csv/CsvMarshalAutogenColumnsSpringQuoteModeTest-context.xml +++ b/components/camel-csv/src/test/resources/org/apache/camel/dataformat/csv/CsvMarshalAutogenColumnsSpringQuoteModeTest-context.xml @@ -28,9 +28,7 @@ <route> <from uri="direct:start"/> <marshal> - <csv delimiter="|" skipHeaderRecord="true" quoteMode="ALL"> - <header>item</header> - </csv> + <csv delimiter="|" skipHeaderRecord="true" quoteMode="ALL" header="item"/> </marshal> <convertBodyTo type="java.lang.String"/> <to uri="mock:result"/> @@ -39,10 +37,7 @@ <route> <from uri="direct:start2"/> <marshal> - <csv formatRef="excelFormat" delimiter="|" skipHeaderRecord="true"> - <header>orderId</header> - <header>amount</header> - </csv> + <csv format="EXCEL" delimiter="|" skipHeaderRecord="true" header="orderId,amount"/> </marshal> <convertBodyTo type="java.lang.String"/> <to uri="mock:result2"/> @@ -50,8 +45,4 @@ </camelContext> - <bean id="excelFormat" class="org.springframework.beans.factory.config.FieldRetrievingFactoryBean"> - <property name="staticField" value="org.apache.commons.csv.CSVFormat.EXCEL"/> - </bean> - </beans> \ No newline at end of file diff --git a/components/camel-csv/src/test/resources/org/apache/camel/dataformat/csv/CsvMarshalAutogenColumnsSpringTest-context.xml b/components/camel-csv/src/test/resources/org/apache/camel/dataformat/csv/CsvMarshalAutogenColumnsSpringTest-context.xml index 31c58c4bc64..67f3372d077 100644 --- a/components/camel-csv/src/test/resources/org/apache/camel/dataformat/csv/CsvMarshalAutogenColumnsSpringTest-context.xml +++ b/components/camel-csv/src/test/resources/org/apache/camel/dataformat/csv/CsvMarshalAutogenColumnsSpringTest-context.xml @@ -28,9 +28,7 @@ <route> <from uri="direct:start"/> <marshal> - <csv delimiter="|" skipHeaderRecord="true"> - <header>item</header> - </csv> + <csv delimiter="|" skipHeaderRecord="true" header="item"/> </marshal> <convertBodyTo type="java.lang.String"/> <to uri="mock:result"/> @@ -39,10 +37,7 @@ <route> <from uri="direct:start2"/> <marshal> - <csv formatRef="excelFormat" delimiter="|" skipHeaderRecord="true"> - <header>orderId</header> - <header>amount</header> - </csv> + <csv format="EXCEL" delimiter="|" skipHeaderRecord="true" header="orderId,amount"/> </marshal> <convertBodyTo type="java.lang.String"/> <to uri="mock:result2"/> @@ -50,8 +45,4 @@ </camelContext> - <bean id="excelFormat" class="org.springframework.beans.factory.config.FieldRetrievingFactoryBean"> - <property name="staticField" value="org.apache.commons.csv.CSVFormat.EXCEL"/> - </bean> - </beans> \ No newline at end of file diff --git a/components/camel-csv/src/test/resources/org/apache/camel/dataformat/csv/CsvUnmarshalMapLineSpringTest-context.xml b/components/camel-csv/src/test/resources/org/apache/camel/dataformat/csv/CsvUnmarshalMapLineSpringTest-context.xml index 593d7222ecb..024073119f5 100644 --- a/components/camel-csv/src/test/resources/org/apache/camel/dataformat/csv/CsvUnmarshalMapLineSpringTest-context.xml +++ b/components/camel-csv/src/test/resources/org/apache/camel/dataformat/csv/CsvUnmarshalMapLineSpringTest-context.xml @@ -34,22 +34,14 @@ <route> <from uri="direct:explicitHeader"/> <unmarshal> - <csv delimiter="|" useMaps="true"> - <header>MyOrderId</header> - <header>MyItem</header> - <header>MyAmount</header> - </csv> + <csv delimiter="|" useMaps="true" header="MyOrderId,MyItem,MyAmount"/> </unmarshal> <to uri="mock:result"/> </route> <route> <from uri="direct:replaceHeader"/> <unmarshal> - <csv delimiter="|" useMaps="true" skipHeaderRecord="true"> - <header>MyOrderId</header> - <header>MyItem</header> - <header>MyAmount</header> - </csv> + <csv delimiter="|" useMaps="true" skipHeaderRecord="true" header="MyOrderId,MyItem,MyAmount"/> </unmarshal> <to uri="mock:result"/> </route> diff --git a/core/camel-core-model/src/generated/resources/META-INF/org/apache/camel/model/dataformat/csv.json b/core/camel-core-model/src/generated/resources/META-INF/org/apache/camel/model/dataformat/csv.json index 1ff5f222144..ff6de69944d 100644 --- a/core/camel-core-model/src/generated/resources/META-INF/org/apache/camel/model/dataformat/csv.json +++ b/core/camel-core-model/src/generated/resources/META-INF/org/apache/camel/model/dataformat/csv.json @@ -14,34 +14,33 @@ }, "properties": { "id": { "index": 0, "kind": "attribute", "displayName": "Id", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The id of this node" }, - "formatRef": { "index": 1, "kind": "attribute", "displayName": "Format Ref", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The reference format to use, it will be updated with the other format options, the default value is CSVFormat.DEFAULT" }, - "formatName": { "index": 2, "kind": "attribute", "displayName": "Format Name", "group": "advanced", "label": "advanced", "required": false, "type": "enum", "javaType": "java.lang.String", "enum": [ "DEFAULT", "EXCEL", "INFORMIX_UNLOAD", "INFORMIX_UNLOAD_CSV", "MYSQL", "RFC4180" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "DEFAULT", "description": "The name of the format to use, the default value is CSVFormat.DEFAULT" }, - "commentMarkerDisabled": { "index": 3, "kind": "attribute", "displayName": "Comment Marker Disabled", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Disables the comment marker of the reference format." }, - "commentMarker": { "index": 4, "kind": "attribute", "displayName": "Comment Marker", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the comment marker of the reference format." }, - "delimiter": { "index": 5, "kind": "attribute", "displayName": "Delimiter", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the delimiter to use. The default value is , (comma)" }, - "escapeDisabled": { "index": 6, "kind": "attribute", "displayName": "Escape Disabled", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Use for disabling using escape character" }, - "escape": { "index": 7, "kind": "attribute", "displayName": "Escape", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the escape character to use" }, - "headerDisabled": { "index": 8, "kind": "attribute", "displayName": "Header Disabled", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Use for disabling headers" }, - "header": { "index": 9, "kind": "element", "displayName": "Header", "group": "common", "required": false, "type": "array", "javaType": "java.util.List<java.lang.String>", "deprecated": false, "autowired": false, "secret": false, "description": "To configure the CSV headers" }, - "allowMissingColumnNames": { "index": 10, "kind": "attribute", "displayName": "Allow Missing Column Names", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether to allow missing column names." }, - "ignoreEmptyLines": { "index": 11, "kind": "attribute", "displayName": "Ignore Empty Lines", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether to ignore empty lines." }, - "ignoreSurroundingSpaces": { "index": 12, "kind": "attribute", "displayName": "Ignore Surrounding Spaces", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether to ignore surrounding spaces" }, - "nullStringDisabled": { "index": 13, "kind": "attribute", "displayName": "Null String Disabled", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Used to disable null strings" }, - "nullString": { "index": 14, "kind": "attribute", "displayName": "Null String", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the null string" }, - "quoteDisabled": { "index": 15, "kind": "attribute", "displayName": "Quote Disabled", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Used to disable quotes" }, - "quote": { "index": 16, "kind": "attribute", "displayName": "Quote", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the quote to use which by default is double-quote character" }, - "recordSeparatorDisabled": { "index": 17, "kind": "attribute", "displayName": "Record Separator Disabled", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Used for disabling record separator" }, - "recordSeparator": { "index": 18, "kind": "attribute", "displayName": "Record Separator", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the record separator (aka new line) which by default is new line characters (CRLF)" }, - "skipHeaderRecord": { "index": 19, "kind": "attribute", "displayName": "Skip Header Record", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether to skip the header record in the output" }, - "quoteMode": { "index": 20, "kind": "attribute", "displayName": "Quote Mode", "group": "common", "required": false, "type": "enum", "javaType": "java.lang.String", "enum": [ "ALL", "ALL_NON_NULL", "MINIMAL", "NON_NUMERIC", "NONE" ], "deprecated": false, "autowired": false, "secret": false, "description": "Sets the quote mode" }, - "ignoreHeaderCase": { "index": 21, "kind": "attribute", "displayName": "Ignore Header Case", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Sets whether or not to ignore case when accessing header names." }, - "trim": { "index": 22, "kind": "attribute", "displayName": "Trim", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Sets whether or not to trim leading and trailing blanks." }, - "trailingDelimiter": { "index": 23, "kind": "attribute", "displayName": "Trailing Delimiter", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Sets whether or not to add a trailing delimiter." }, - "marshallerFactoryRef": { "index": 24, "kind": "attribute", "displayName": "Marshaller Factory Ref", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the implementation of the CsvMarshallerFactory interface which is able to customize marshalling\/unmarshalling behavior by extending CsvMarshaller or creating it from scratch." }, - "lazyLoad": { "index": 25, "kind": "attribute", "displayName": "Lazy Load", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the unmarshalling should produce an iterator that reads the lines on the fly or if all the lines must be read at one." }, - "useMaps": { "index": 26, "kind": "attribute", "displayName": "Use Maps", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the unmarshalling should produce maps (HashMap)for the lines values instead of lists. It requires to have header (either defined or collected)." }, - "useOrderedMaps": { "index": 27, "kind": "attribute", "displayName": "Use Ordered Maps", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the unmarshalling should produce ordered maps (LinkedHashMap) for the lines values instead of lists. It requires to have header (either defined or collected)." }, - "recordConverterRef": { "index": 28, "kind": "attribute", "displayName": "Record Converter Ref", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Refers to a custom CsvRecordConverter to lookup from the registry to use." }, - "captureHeaderRecord": { "index": 29, "kind": "attribute", "displayName": "Capture Header Record", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the unmarshalling should capture the header record and store it in the message header" } + "format": { "index": 1, "kind": "attribute", "displayName": "Format", "group": "common", "required": false, "type": "enum", "javaType": "java.lang.String", "enum": [ "DEFAULT", "EXCEL", "INFORMIX_UNLOAD", "INFORMIX_UNLOAD_CSV", "MONGODB_CSV", "MONGODB_TSV", "MYSQL", "ORACLE", "POSTGRESQL_CSV", "POSTGRESQL_TEXT", "RFC4180" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "DEFAULT", "description": "The format to use." }, + "commentMarkerDisabled": { "index": 2, "kind": "attribute", "displayName": "Comment Marker Disabled", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Disables the comment marker of the reference format." }, + "commentMarker": { "index": 3, "kind": "attribute", "displayName": "Comment Marker", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the comment marker of the reference format." }, + "delimiter": { "index": 4, "kind": "attribute", "displayName": "Delimiter", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the delimiter to use. The default value is , (comma)" }, + "escapeDisabled": { "index": 5, "kind": "attribute", "displayName": "Escape Disabled", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Use for disabling using escape character" }, + "escape": { "index": 6, "kind": "attribute", "displayName": "Escape", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the escape character to use" }, + "headerDisabled": { "index": 7, "kind": "attribute", "displayName": "Header Disabled", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Use for disabling headers" }, + "header": { "index": 8, "kind": "attribute", "displayName": "Header", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "To configure the CSV headers. Multiple headers can be separated by comma." }, + "allowMissingColumnNames": { "index": 9, "kind": "attribute", "displayName": "Allow Missing Column Names", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether to allow missing column names." }, + "ignoreEmptyLines": { "index": 10, "kind": "attribute", "displayName": "Ignore Empty Lines", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether to ignore empty lines." }, + "ignoreSurroundingSpaces": { "index": 11, "kind": "attribute", "displayName": "Ignore Surrounding Spaces", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether to ignore surrounding spaces" }, + "nullStringDisabled": { "index": 12, "kind": "attribute", "displayName": "Null String Disabled", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Used to disable null strings" }, + "nullString": { "index": 13, "kind": "attribute", "displayName": "Null String", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the null string" }, + "quoteDisabled": { "index": 14, "kind": "attribute", "displayName": "Quote Disabled", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Used to disable quotes" }, + "quote": { "index": 15, "kind": "attribute", "displayName": "Quote", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the quote to use which by default is double-quote character" }, + "recordSeparatorDisabled": { "index": 16, "kind": "attribute", "displayName": "Record Separator Disabled", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Used for disabling record separator" }, + "recordSeparator": { "index": 17, "kind": "attribute", "displayName": "Record Separator", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the record separator (aka new line) which by default is new line characters (CRLF)" }, + "skipHeaderRecord": { "index": 18, "kind": "attribute", "displayName": "Skip Header Record", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether to skip the header record in the output" }, + "quoteMode": { "index": 19, "kind": "attribute", "displayName": "Quote Mode", "group": "common", "required": false, "type": "enum", "javaType": "java.lang.String", "enum": [ "ALL", "ALL_NON_NULL", "MINIMAL", "NON_NUMERIC", "NONE" ], "deprecated": false, "autowired": false, "secret": false, "description": "Sets the quote mode" }, + "ignoreHeaderCase": { "index": 20, "kind": "attribute", "displayName": "Ignore Header Case", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Sets whether or not to ignore case when accessing header names." }, + "trim": { "index": 21, "kind": "attribute", "displayName": "Trim", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Sets whether or not to trim leading and trailing blanks." }, + "trailingDelimiter": { "index": 22, "kind": "attribute", "displayName": "Trailing Delimiter", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Sets whether or not to add a trailing delimiter." }, + "marshallerFactoryRef": { "index": 23, "kind": "attribute", "displayName": "Marshaller Factory Ref", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Sets the implementation of the CsvMarshallerFactory interface which is able to customize marshalling\/unmarshalling behavior by extending CsvMarshaller or creating it from scratch." }, + "lazyLoad": { "index": 24, "kind": "attribute", "displayName": "Lazy Load", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the unmarshalling should produce an iterator that reads the lines on the fly or if all the lines must be read at one." }, + "useMaps": { "index": 25, "kind": "attribute", "displayName": "Use Maps", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the unmarshalling should produce maps (HashMap)for the lines values instead of lists. It requires to have header (either defined or collected)." }, + "useOrderedMaps": { "index": 26, "kind": "attribute", "displayName": "Use Ordered Maps", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the unmarshalling should produce ordered maps (LinkedHashMap) for the lines values instead of lists. It requires to have header (either defined or collected)." }, + "recordConverterRef": { "index": 27, "kind": "attribute", "displayName": "Record Converter Ref", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Refers to a custom CsvRecordConverter to lookup from the registry to use." }, + "captureHeaderRecord": { "index": 28, "kind": "attribute", "displayName": "Capture Header Record", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the unmarshalling should capture the header record and store it in the message header" } } } diff --git a/core/camel-core-model/src/main/java/org/apache/camel/model/dataformat/CsvDataFormat.java b/core/camel-core-model/src/main/java/org/apache/camel/model/dataformat/CsvDataFormat.java index 8754ed8e41c..8b3c7baf911 100644 --- a/core/camel-core-model/src/main/java/org/apache/camel/model/dataformat/CsvDataFormat.java +++ b/core/camel-core-model/src/main/java/org/apache/camel/model/dataformat/CsvDataFormat.java @@ -39,12 +39,8 @@ public class CsvDataFormat extends DataFormatDefinition { // Format options @XmlAttribute - @Metadata(label = "advanced") - private String formatRef; - @XmlAttribute - @Metadata(label = "advanced", enums = "DEFAULT,EXCEL,INFORMIX_UNLOAD,INFORMIX_UNLOAD_CSV,MYSQL,RFC4180", - defaultValue = "DEFAULT") - private String formatName; + @Metadata(enums = "DEFAULT,EXCEL,INFORMIX_UNLOAD,INFORMIX_UNLOAD_CSV,MONGODB_CSV,MONGODB_TSV,MYSQL,ORACLE,POSTGRESQL_CSV,POSTGRESQL_TEXT,RFC4180", defaultValue = "DEFAULT") + private String format; @XmlAttribute @Metadata(label = "advanced", javaType = "java.lang.Boolean") private String commentMarkerDisabled; @@ -62,8 +58,8 @@ public class CsvDataFormat extends DataFormatDefinition { @XmlAttribute @Metadata(javaType = "java.lang.Boolean") private String headerDisabled; - @XmlElement - private List<String> header; + @XmlAttribute + private String header; @XmlAttribute @Metadata(javaType = "java.lang.Boolean") private String allowMissingColumnNames; @@ -130,8 +126,7 @@ public class CsvDataFormat extends DataFormatDefinition { protected CsvDataFormat(CsvDataFormat source) { super(source); - this.formatRef = source.formatRef; - this.formatName = source.formatName; + this.format = source.format; this.commentMarkerDisabled = source.commentMarkerDisabled; this.commentMarker = source.commentMarker; this.delimiter = source.delimiter; @@ -173,8 +168,7 @@ public class CsvDataFormat extends DataFormatDefinition { private CsvDataFormat(Builder builder) { this(); - this.formatRef = builder.formatRef; - this.formatName = builder.formatName; + this.format = builder.format; this.commentMarkerDisabled = builder.commentMarkerDisabled; this.commentMarker = builder.commentMarker; this.delimiter = builder.delimiter; @@ -228,27 +222,15 @@ public class CsvDataFormat extends DataFormatDefinition { return marshallerFactoryRef; } - public String getFormatRef() { - return formatRef; - } - - /** - * The reference format to use, it will be updated with the other format options, the default value is - * CSVFormat.DEFAULT - */ - public void setFormatRef(String formatRef) { - this.formatRef = formatRef; - } - - public String getFormatName() { - return formatName; + public String getFormat() { + return format; } /** - * The name of the format to use, the default value is CSVFormat.DEFAULT + * The format to use. */ - public void setFormatName(String formatName) { - this.formatName = formatName; + public void setFormat(String format) { + this.format = format; } public String getCommentMarkerDisabled() { @@ -319,14 +301,14 @@ public class CsvDataFormat extends DataFormatDefinition { this.headerDisabled = headerDisabled; } - public List<String> getHeader() { + public String getHeader() { return header; } /** - * To configure the CSV headers + * To configure the CSV headers. Multiple headers can be separated by comma. */ - public void setHeader(List<String> header) { + public void setHeader(String header) { this.header = header; } @@ -547,15 +529,14 @@ public class CsvDataFormat extends DataFormatDefinition { */ @XmlTransient public static class Builder implements DataFormatBuilder<CsvDataFormat> { - private String formatRef; - private String formatName; + private String format; private String commentMarkerDisabled; private String commentMarker; private String delimiter; private String escapeDisabled; private String escape; private String headerDisabled; - private List<String> header; + private String header; private String allowMissingColumnNames; private String ignoreEmptyLines; private String ignoreSurroundingSpaces; @@ -589,19 +570,10 @@ public class CsvDataFormat extends DataFormatDefinition { } /** - * The reference format to use, it will be updated with the other format options, the default value is - * CSVFormat.DEFAULT - */ - public Builder formatRef(String formatRef) { - this.formatRef = formatRef; - return this; - } - - /** - * The name of the format to use, the default value is CSVFormat.DEFAULT + * The format to use. */ - public Builder formatName(String formatName) { - this.formatName = formatName; + public Builder format(String format) { + this.format = format; return this; } @@ -674,9 +646,9 @@ public class CsvDataFormat extends DataFormatDefinition { } /** - * To configure the CSV headers + * To configure the CSV headers. Multiple headers can be separated by comma. */ - public Builder header(List<String> header) { + public Builder header(String header) { this.header = header; return this; } diff --git a/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/dataformat/CsvDataFormatReifier.java b/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/dataformat/CsvDataFormatReifier.java index bb79546710a..21fa8852482 100644 --- a/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/dataformat/CsvDataFormatReifier.java +++ b/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/dataformat/CsvDataFormatReifier.java @@ -31,25 +31,14 @@ public class CsvDataFormatReifier extends DataFormatReifier<CsvDataFormat> { @Override protected void prepareDataFormatConfig(Map<String, Object> properties) { - properties.put("format", asRef(definition.getFormatRef())); - properties.put("formatName", definition.getFormatName()); + properties.put("format", definition.getFormat()); properties.put("commentMarkerDisabled", definition.getCommentMarkerDisabled()); properties.put("commentMarker", definition.getCommentMarker()); properties.put("delimiter", definition.getDelimiter()); properties.put("escapeDisabled", definition.getEscapeDisabled()); properties.put("escape", definition.getEscape()); properties.put("headerDisabled", definition.getHeaderDisabled()); - // in the model header is a List<String> however it should ideally have - // just been a comma separated String so its configurable in uris - // so we join the List into a String in the reifier so the configurer can - // use the value as-is - if (definition.getHeader() != null && !definition.getHeader().isEmpty()) { - StringJoiner sj = new StringJoiner(","); - for (String s : definition.getHeader()) { - sj.add(s); - } - properties.put("header", sj.toString()); - } + properties.put("header", definition.getHeader()); properties.put("allowMissingColumnNames", definition.getAllowMissingColumnNames()); properties.put("ignoreEmptyLines", definition.getIgnoreEmptyLines()); properties.put("ignoreSurroundingSpaces", definition.getIgnoreSurroundingSpaces()); diff --git a/core/camel-xml-io/src/generated/java/org/apache/camel/xml/in/ModelParser.java b/core/camel-xml-io/src/generated/java/org/apache/camel/xml/in/ModelParser.java index 34e236a746c..40106fe2816 100644 --- a/core/camel-xml-io/src/generated/java/org/apache/camel/xml/in/ModelParser.java +++ b/core/camel-xml-io/src/generated/java/org/apache/camel/xml/in/ModelParser.java @@ -1821,8 +1821,8 @@ public class ModelParser extends BaseParser { case "delimiter": def.setDelimiter(val); yield true; case "escape": def.setEscape(val); yield true; case "escapeDisabled": def.setEscapeDisabled(val); yield true; - case "formatName": def.setFormatName(val); yield true; - case "formatRef": def.setFormatRef(val); yield true; + case "format": def.setFormat(val); yield true; + case "header": def.setHeader(val); yield true; case "headerDisabled": def.setHeaderDisabled(val); yield true; case "ignoreEmptyLines": def.setIgnoreEmptyLines(val); yield true; case "ignoreHeaderCase": def.setIgnoreHeaderCase(val); yield true; @@ -1843,10 +1843,7 @@ public class ModelParser extends BaseParser { case "useMaps": def.setUseMaps(val); yield true; case "useOrderedMaps": def.setUseOrderedMaps(val); yield true; default: yield identifiedTypeAttributeHandler().accept(def, key, val); - }, (def, key) -> switch (key) { - case "header": doAdd(doParseText(), def.getHeader(), def::setHeader); yield true; - default: yield false; - }, noValueHandler()); + }, noElementHandler(), noValueHandler()); } protected CustomDataFormat doParseCustomDataFormat() throws IOException, XmlPullParserException { return doParse(new CustomDataFormat(), (def, key, val) -> switch (key) { diff --git a/core/camel-xml-io/src/generated/java/org/apache/camel/xml/out/ModelWriter.java b/core/camel-xml-io/src/generated/java/org/apache/camel/xml/out/ModelWriter.java index e382c074e94..db14a623965 100644 --- a/core/camel-xml-io/src/generated/java/org/apache/camel/xml/out/ModelWriter.java +++ b/core/camel-xml-io/src/generated/java/org/apache/camel/xml/out/ModelWriter.java @@ -2505,18 +2505,17 @@ public class ModelWriter extends BaseWriter { doWriteAttribute("escape", def.getEscape(), null); doWriteAttribute("nullStringDisabled", def.getNullStringDisabled(), null); doWriteAttribute("commentMarker", def.getCommentMarker(), null); - doWriteAttribute("formatRef", def.getFormatRef(), null); doWriteAttribute("quoteMode", def.getQuoteMode(), null); - doWriteAttribute("formatName", def.getFormatName(), "DEFAULT"); + doWriteAttribute("format", def.getFormat(), "DEFAULT"); doWriteAttribute("ignoreSurroundingSpaces", def.getIgnoreSurroundingSpaces(), null); doWriteAttribute("quoteDisabled", def.getQuoteDisabled(), null); doWriteAttribute("useOrderedMaps", def.getUseOrderedMaps(), null); doWriteAttribute("ignoreHeaderCase", def.getIgnoreHeaderCase(), null); + doWriteAttribute("header", def.getHeader(), null); doWriteAttribute("recordSeparatorDisabled", def.getRecordSeparatorDisabled(), null); doWriteAttribute("captureHeaderRecord", def.getCaptureHeaderRecord(), null); doWriteAttribute("marshallerFactoryRef", def.getMarshallerFactoryRef(), null); doWriteAttribute("recordSeparator", def.getRecordSeparator(), null); - doWriteList(null, "header", def.getHeader(), this::doWriteString); endElement(name); } protected void doWriteCustomDataFormat(String name, CustomDataFormat def) throws IOException { diff --git a/core/camel-yaml-io/src/generated/java/org/apache/camel/yaml/out/ModelWriter.java b/core/camel-yaml-io/src/generated/java/org/apache/camel/yaml/out/ModelWriter.java index ca55f674c34..489e4d94c36 100644 --- a/core/camel-yaml-io/src/generated/java/org/apache/camel/yaml/out/ModelWriter.java +++ b/core/camel-yaml-io/src/generated/java/org/apache/camel/yaml/out/ModelWriter.java @@ -2505,18 +2505,17 @@ public class ModelWriter extends BaseWriter { doWriteAttribute("escape", def.getEscape(), null); doWriteAttribute("nullStringDisabled", def.getNullStringDisabled(), null); doWriteAttribute("commentMarker", def.getCommentMarker(), null); - doWriteAttribute("formatRef", def.getFormatRef(), null); doWriteAttribute("quoteMode", def.getQuoteMode(), null); - doWriteAttribute("formatName", def.getFormatName(), "DEFAULT"); + doWriteAttribute("format", def.getFormat(), "DEFAULT"); doWriteAttribute("ignoreSurroundingSpaces", def.getIgnoreSurroundingSpaces(), null); doWriteAttribute("quoteDisabled", def.getQuoteDisabled(), null); doWriteAttribute("useOrderedMaps", def.getUseOrderedMaps(), null); doWriteAttribute("ignoreHeaderCase", def.getIgnoreHeaderCase(), null); + doWriteAttribute("header", def.getHeader(), null); doWriteAttribute("recordSeparatorDisabled", def.getRecordSeparatorDisabled(), null); doWriteAttribute("captureHeaderRecord", def.getCaptureHeaderRecord(), null); doWriteAttribute("marshallerFactoryRef", def.getMarshallerFactoryRef(), null); doWriteAttribute("recordSeparator", def.getRecordSeparator(), null); - doWriteList(null, "header", def.getHeader(), this::doWriteString); endElement(name); } protected void doWriteCustomDataFormat(String name, CustomDataFormat def) throws IOException { diff --git a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_15.adoc b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_15.adoc index 179da410975..7778dc2a650 100644 --- a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_15.adoc +++ b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_15.adoc @@ -16,5 +16,28 @@ to their implementation using reflection-free configurers. A few data formats ha |crypto|algorithmParameterRef|algorithmParameterSpec |crypto|keyRef|key |crypto|initVectorRef|initVector +|csv|formatRef|format +|csv|formatName|format |=== +And in XML DSL the csv dataformat have changed `header` from a `List<String>` to be a single `String` +where the header values are seperated by comma. This is more tooling friendly and also how other components +and dataformats are configured. + +For example: + +[source,xml] +---- +<csv format="EXCEL" delimiter="|" skipHeaderRecord="true"> + <header>orderId</header> + <header>amount</header> +</csv> +---- + +Should be changed to: + +[source,xml] +---- +<csv format="EXCEL" delimiter="|" skipHeaderRecord="true" header="orderId,amount"/> +---- + diff --git a/dsl/camel-yaml-dsl/camel-yaml-dsl-deserializers/src/generated/java/org/apache/camel/dsl/yaml/deserializers/ModelDeserializers.java b/dsl/camel-yaml-dsl/camel-yaml-dsl-deserializers/src/generated/java/org/apache/camel/dsl/yaml/deserializers/ModelDeserializers.java index 6ef75de1d55..089b2f6b888 100644 --- a/dsl/camel-yaml-dsl/camel-yaml-dsl-deserializers/src/generated/java/org/apache/camel/dsl/yaml/deserializers/ModelDeserializers.java +++ b/dsl/camel-yaml-dsl/camel-yaml-dsl-deserializers/src/generated/java/org/apache/camel/dsl/yaml/deserializers/ModelDeserializers.java @@ -2974,9 +2974,8 @@ public final class ModelDeserializers extends YamlDeserializerSupport { @YamlProperty(name = "delimiter", type = "string", description = "Sets the delimiter to use. The default value is , (comma)", displayName = "Delimiter"), @YamlProperty(name = "escape", type = "string", description = "Sets the escape character to use", displayName = "Escape"), @YamlProperty(name = "escapeDisabled", type = "boolean", description = "Use for disabling using escape character", displayName = "Escape Disabled"), - @YamlProperty(name = "formatName", type = "enum:DEFAULT,EXCEL,INFORMIX_UNLOAD,INFORMIX_UNLOAD_CSV,MYSQL,RFC4180", defaultValue = "DEFAULT", description = "The name of the format to use, the default value is CSVFormat.DEFAULT", displayName = "Format Name"), - @YamlProperty(name = "formatRef", type = "string", description = "The reference format to use, it will be updated with the other format options, the default value is CSVFormat.DEFAULT", displayName = "Format Ref"), - @YamlProperty(name = "header", type = "array:string", description = "To configure the CSV headers", displayName = "Header"), + @YamlProperty(name = "format", type = "enum:DEFAULT,EXCEL,INFORMIX_UNLOAD,INFORMIX_UNLOAD_CSV,MONGODB_CSV,MONGODB_TSV,MYSQL,ORACLE,POSTGRESQL_CSV,POSTGRESQL_TEXT,RFC4180", defaultValue = "DEFAULT", description = "The format to use.", displayName = "Format"), + @YamlProperty(name = "header", type = "string", description = "To configure the CSV headers. Multiple headers can be separated by comma.", displayName = "Header"), @YamlProperty(name = "headerDisabled", type = "boolean", description = "Use for disabling headers", displayName = "Header Disabled"), @YamlProperty(name = "id", type = "string", description = "The id of this node", displayName = "Id"), @YamlProperty(name = "ignoreEmptyLines", type = "boolean", description = "Whether to ignore empty lines.", displayName = "Ignore Empty Lines"), @@ -3054,18 +3053,13 @@ public final class ModelDeserializers extends YamlDeserializerSupport { target.setEscapeDisabled(val); break; } - case "formatName": { - String val = asText(node); - target.setFormatName(val); - break; - } - case "formatRef": { + case "format": { String val = asText(node); - target.setFormatRef(val); + target.setFormat(val); break; } case "header": { - java.util.List<String> val = asStringList(node); + String val = asText(node); target.setHeader(val); break; } diff --git a/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camelYamlDsl.json b/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camelYamlDsl.json index 9430c39fa1f..983383db819 100644 --- a/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camelYamlDsl.json +++ b/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camelYamlDsl.json @@ -10470,25 +10470,17 @@ "title" : "Escape Disabled", "description" : "Use for disabling using escape character" }, - "formatName" : { + "format" : { "type" : "string", - "title" : "Format Name", - "description" : "The name of the format to use, the default value is CSVFormat.DEFAULT", + "title" : "Format", + "description" : "The format to use.", "default" : "DEFAULT", - "enum" : [ "DEFAULT", "EXCEL", "INFORMIX_UNLOAD", "INFORMIX_UNLOAD_CSV", "MYSQL", "RFC4180" ] - }, - "formatRef" : { - "type" : "string", - "title" : "Format Ref", - "description" : "The reference format to use, it will be updated with the other format options, the default value is CSVFormat.DEFAULT" + "enum" : [ "DEFAULT", "EXCEL", "INFORMIX_UNLOAD", "INFORMIX_UNLOAD_CSV", "MONGODB_CSV", "MONGODB_TSV", "MYSQL", "ORACLE", "POSTGRESQL_CSV", "POSTGRESQL_TEXT", "RFC4180" ] }, "header" : { - "type" : "array", + "type" : "string", "title" : "Header", - "description" : "To configure the CSV headers", - "items" : { - "type" : "string" - } + "description" : "To configure the CSV headers. Multiple headers can be separated by comma." }, "headerDisabled" : { "type" : "boolean",
