diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/dataformats/hl7.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/dataformats/hl7.json index b0c0a0d6a4d08..af79ab998c689 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/dataformats/hl7.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/dataformats/hl7.json @@ -18,6 +18,7 @@ "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" }, "parser": { "index": 1, "kind": "attribute", "displayName": "Parser", "group": "advanced", "label": "advanced", "required": false, "type": "object", "javaType": "ca.uhn.hl7v2.parser.Parser", "deprecated": false, "autowired": false, "secret": false, "description": "To use a custom HL7 parser" }, - "validate": { "index": 2, "kind": "attribute", "displayName": "Validate", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether to validate the HL7 message Is by default true." } + "validate": { "index": 2, "kind": "attribute", "displayName": "Validate", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether to validate the HL7 message Is by default true." }, + "targetFormat": { "index": 3, "kind": "attribute", "displayName": "Target Format", "group": "common", "required": false, "type": "enum", "javaType": "java.lang.String", "enum": [ "XML" ], "deprecated": false, "autowired": false, "secret": false, "description": "The target format for marshal output and unmarshal result type. By default, marshal encodes to HL7 ER7, and unmarshal returns a HAPI Message object. If this is set to XML, marshal encodes to HL7 XML, and unmarshal returns an XML DOM Document." } } } diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/hl7.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/hl7.json index 0276a22521252..01c4467712f8e 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/hl7.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/hl7.json @@ -15,6 +15,7 @@ "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" }, "parser": { "index": 1, "kind": "attribute", "displayName": "Parser", "group": "advanced", "label": "advanced", "required": false, "type": "object", "javaType": "ca.uhn.hl7v2.parser.Parser", "deprecated": false, "autowired": false, "secret": false, "description": "To use a custom HL7 parser" }, - "validate": { "index": 2, "kind": "attribute", "displayName": "Validate", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether to validate the HL7 message Is by default true." } + "validate": { "index": 2, "kind": "attribute", "displayName": "Validate", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether to validate the HL7 message Is by default true." }, + "targetFormat": { "index": 3, "kind": "attribute", "displayName": "Target Format", "group": "common", "required": false, "type": "enum", "javaType": "java.lang.String", "enum": [ "XML" ], "deprecated": false, "autowired": false, "secret": false, "description": "The target format for marshal output and unmarshal result type. By default, marshal encodes to HL7 ER7, and unmarshal returns a HAPI Message object. If this is set to XML, marshal encodes to HL7 XML, and unmarshal returns an XML DOM Document." } } } 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 3195e51d6614c..d8333f69fbd4e 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 @@ -8920,6 +8920,17 @@ To use a custom HL7 parser. + + + + + + + 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 690e7958f3d6f..58730483c54ea 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 @@ -7583,6 +7583,17 @@ To use a custom HL7 parser. + + + + + + + diff --git a/components/camel-hl7/src/generated/java/org/apache/camel/component/hl7/HL7ConverterLoader.java b/components/camel-hl7/src/generated/java/org/apache/camel/component/hl7/HL7ConverterLoader.java index 32f556b2f3622..d0e5152009b8a 100644 --- a/components/camel-hl7/src/generated/java/org/apache/camel/component/hl7/HL7ConverterLoader.java +++ b/components/camel-hl7/src/generated/java/org/apache/camel/component/hl7/HL7ConverterLoader.java @@ -68,6 +68,14 @@ private void registerConverters(TypeConverterRegistry registry) { } return answer; }); + addTypeConverter(registry, ca.uhn.hl7v2.model.Message.class, org.w3c.dom.Document.class, false, + (type, exchange, value) -> { + Object answer = org.apache.camel.component.hl7.HL7Converter.toMessage((org.w3c.dom.Document) value); + if (false && answer == null) { + answer = Void.class; + } + return answer; + }); addTypeConverter(registry, java.lang.String.class, ca.uhn.hl7v2.model.Message.class, false, (type, exchange, value) -> { Object answer = org.apache.camel.component.hl7.HL7Converter.toString((ca.uhn.hl7v2.model.Message) value); diff --git a/components/camel-hl7/src/generated/java/org/apache/camel/component/hl7/HL7DataFormatConfigurer.java b/components/camel-hl7/src/generated/java/org/apache/camel/component/hl7/HL7DataFormatConfigurer.java index 0c674bd0c8dae..dfeba67564fe9 100644 --- a/components/camel-hl7/src/generated/java/org/apache/camel/component/hl7/HL7DataFormatConfigurer.java +++ b/components/camel-hl7/src/generated/java/org/apache/camel/component/hl7/HL7DataFormatConfigurer.java @@ -23,6 +23,7 @@ public class HL7DataFormatConfigurer extends org.apache.camel.support.component. static { Map map = new CaseInsensitiveMap(); map.put("Parser", ca.uhn.hl7v2.parser.Parser.class); + map.put("TargetFormat", java.lang.String.class); map.put("Validate", boolean.class); ALL_OPTIONS = map; } @@ -32,6 +33,8 @@ public boolean configure(CamelContext camelContext, Object obj, String name, Obj HL7DataFormat target = (HL7DataFormat) obj; switch (ignoreCase ? name.toLowerCase() : name) { case "parser": target.setParser(property(camelContext, ca.uhn.hl7v2.parser.Parser.class, value)); return true; + case "targetformat": + case "targetFormat": target.setTargetFormat(property(camelContext, java.lang.String.class, value)); return true; case "validate": target.setValidate(property(camelContext, boolean.class, value)); return true; default: return false; } @@ -46,6 +49,8 @@ public Map getAllOptions(Object target) { public Class getOptionType(String name, boolean ignoreCase) { switch (ignoreCase ? name.toLowerCase() : name) { case "parser": return ca.uhn.hl7v2.parser.Parser.class; + case "targetformat": + case "targetFormat": return java.lang.String.class; case "validate": return boolean.class; default: return null; } @@ -56,6 +61,8 @@ public Object getOptionValue(Object obj, String name, boolean ignoreCase) { HL7DataFormat target = (HL7DataFormat) obj; switch (ignoreCase ? name.toLowerCase() : name) { case "parser": return target.getParser(); + case "targetformat": + case "targetFormat": return target.getTargetFormat(); case "validate": return target.isValidate(); default: return null; } diff --git a/components/camel-hl7/src/generated/resources/META-INF/org/apache/camel/component/hl7/hl7.json b/components/camel-hl7/src/generated/resources/META-INF/org/apache/camel/component/hl7/hl7.json index b0c0a0d6a4d08..af79ab998c689 100644 --- a/components/camel-hl7/src/generated/resources/META-INF/org/apache/camel/component/hl7/hl7.json +++ b/components/camel-hl7/src/generated/resources/META-INF/org/apache/camel/component/hl7/hl7.json @@ -18,6 +18,7 @@ "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" }, "parser": { "index": 1, "kind": "attribute", "displayName": "Parser", "group": "advanced", "label": "advanced", "required": false, "type": "object", "javaType": "ca.uhn.hl7v2.parser.Parser", "deprecated": false, "autowired": false, "secret": false, "description": "To use a custom HL7 parser" }, - "validate": { "index": 2, "kind": "attribute", "displayName": "Validate", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether to validate the HL7 message Is by default true." } + "validate": { "index": 2, "kind": "attribute", "displayName": "Validate", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether to validate the HL7 message Is by default true." }, + "targetFormat": { "index": 3, "kind": "attribute", "displayName": "Target Format", "group": "common", "required": false, "type": "enum", "javaType": "java.lang.String", "enum": [ "XML" ], "deprecated": false, "autowired": false, "secret": false, "description": "The target format for marshal output and unmarshal result type. By default, marshal encodes to HL7 ER7, and unmarshal returns a HAPI Message object. If this is set to XML, marshal encodes to HL7 XML, and unmarshal returns an XML DOM Document." } } } diff --git a/components/camel-hl7/src/main/docs/hl7-dataformat.adoc b/components/camel-hl7/src/main/docs/hl7-dataformat.adoc index 4d35e1fef648b..31f1d6fccbe07 100644 --- a/components/camel-hl7/src/main/docs/hl7-dataformat.adoc +++ b/components/camel-hl7/src/main/docs/hl7-dataformat.adoc @@ -265,6 +265,62 @@ separators anymore by converting `\n` to `\r`. If you + `Expression` for this purpose. +=== Target Format + +By default, the HL7 DataFormat works with HAPI `Message` objects and ER7 (pipe-delimited) encoding. +The `targetFormat` option can be set to `XML` to change the output format: + +* *marshal* encodes the HAPI Message to HL7 XML bytes instead of ER7. +* *unmarshal* returns an `org.w3c.dom.Document` instead of a HAPI `Message`. + +The input format is always auto-detected. Both ER7 and XML inputs are accepted by the parser. +For marshal, the input body can be a HAPI `Message` or an XML `Document` — the registered +TypeConverter handles `Document` to `Message` conversion automatically. + +==== EDI to XML conversion + +[source,java] +---- + HL7DataFormat hl7xml = new HL7DataFormat(); + hl7xml.setTargetFormat("XML"); + + from("direct:hl7in") + .unmarshal(hl7xml) + .to("direct:xmlout"); +---- + +In this example, the HL7 EDI input is unmarshalled directly to an XML `Document`. + +==== XML to Message conversion + +[source,java] +---- + HL7DataFormat hl7xml = new HL7DataFormat(); + hl7xml.setTargetFormat("XML"); + + from("direct:messageIn") + .marshal(hl7xml) + .to("direct:xmlout"); +---- + +Here, a HAPI `Message` is marshalled to HL7 XML bytes. + +==== Round-trip EDI to XML to EDI + +[source,java] +---- + HL7DataFormat hl7xml = new HL7DataFormat(); + hl7xml.setTargetFormat("XML"); + HL7DataFormat hl7 = new HL7DataFormat(); + + from("direct:hl7in") + .unmarshal(hl7xml) + .marshal(hl7) + .to("direct:hl7out"); +---- + +The EDI input is converted to an XML Document, then back to EDI. + === Charset Both `marshal and unmarshal` evaluate the charset diff --git a/components/camel-hl7/src/main/java/org/apache/camel/component/hl7/HL7Converter.java b/components/camel-hl7/src/main/java/org/apache/camel/component/hl7/HL7Converter.java index 80e0683bcdb72..3fc8b6bc80e13 100644 --- a/components/camel-hl7/src/main/java/org/apache/camel/component/hl7/HL7Converter.java +++ b/components/camel-hl7/src/main/java/org/apache/camel/component/hl7/HL7Converter.java @@ -18,6 +18,9 @@ import java.io.IOException; +import org.w3c.dom.Document; +import org.w3c.dom.NodeList; + import ca.uhn.hl7v2.DefaultHapiContext; import ca.uhn.hl7v2.HL7Exception; import ca.uhn.hl7v2.HapiContext; @@ -25,6 +28,7 @@ import ca.uhn.hl7v2.parser.DefaultModelClassFactory; import ca.uhn.hl7v2.parser.ParserConfiguration; import ca.uhn.hl7v2.parser.UnexpectedSegmentBehaviourEnum; +import ca.uhn.hl7v2.parser.XMLParser; import ca.uhn.hl7v2.validation.impl.ValidationContextFactory; import org.apache.camel.Converter; import org.apache.camel.Exchange; @@ -72,4 +76,30 @@ public static Message toMessage(byte[] body, Exchange exchange) throws HL7Except return DEFAULT_CONTEXT.getGenericParser().parse(IOConverter.toString(body, exchange)); } + @Converter + public static Message toMessage(Document doc) throws HL7Exception { + String version = getVersionFromDocument(doc); + return ((XMLParser) DEFAULT_CONTEXT.getXMLParser()).parseDocument(doc, version); + } + + private static final String HL7_V2_XML_NAMESPACE = "urn:hl7-org:v2xml"; + + static String getVersionFromDocument(Document doc) { + NodeList nodes = doc.getElementsByTagNameNS(HL7_V2_XML_NAMESPACE, "VID.1"); + if (nodes.getLength() > 0) { + String version = nodes.item(0).getTextContent(); + if (version != null && !version.trim().isEmpty()) { + return version.trim(); + } + } + nodes = doc.getElementsByTagNameNS(HL7_V2_XML_NAMESPACE, "MSH.12"); + if (nodes.getLength() > 0) { + String version = nodes.item(0).getTextContent(); + if (version != null && !version.trim().isEmpty()) { + return version.trim(); + } + } + return null; + } + } diff --git a/components/camel-hl7/src/main/java/org/apache/camel/component/hl7/HL7DataFormat.java b/components/camel-hl7/src/main/java/org/apache/camel/component/hl7/HL7DataFormat.java index 64f40446838d5..27298829a3e15 100644 --- a/components/camel-hl7/src/main/java/org/apache/camel/component/hl7/HL7DataFormat.java +++ b/components/camel-hl7/src/main/java/org/apache/camel/component/hl7/HL7DataFormat.java @@ -64,8 +64,15 @@ *

* Uses the HAPI (HL7 API) for HL7 parsing. *

- * Uses the default GenericParser from the HAPI API. This DataFormat only supports both the EDI based HL7 - * messages and the XML based messages. + * Uses the default GenericParser from the HAPI API. This DataFormat supports both the ER7 (pipe-delimited) and XML + * based HL7 messages. The input format is auto-detected by the GenericParser. + *

+ * The {@code targetFormat} option controls the output format. When set to {@code XML}: + *

    + *
  • marshal encodes the HAPI Message to HL7 XML bytes instead of ER7. The input body can be either a HAPI Message or + * an XML Document (converted to Message automatically via the registered TypeConverter).
  • + *
  • unmarshal returns an {@link org.w3c.dom.Document} instead of a HAPI Message.
  • + *
*

* The unmarshal operation adds these MSH fields as headers on the Camel message (key, MSH-field): *

    @@ -95,6 +102,7 @@ public class HL7DataFormat extends ServiceSupport implements DataFormat, DataFor private HapiContext hapiContext; private Parser parser; private boolean validate = true; + private String targetFormat; static { HEADER_MAP.put(HL7_SENDING_APPLICATION, "MSH-3"); @@ -120,7 +128,12 @@ public String getDataFormatName() { public void marshal(Exchange exchange, Object body, OutputStream outputStream) throws Exception { Message message = ExchangeHelper.convertToMandatoryType(exchange, Message.class, body); String charsetName = HL7Charset.getCharsetName(message, exchange); - String encoded = parser.encode(message); + String encoded; + if ("XML".equalsIgnoreCase(targetFormat)) { + encoded = hapiContext.getXMLParser().encode(message); + } else { + encoded = parser.encode(message); + } outputStream.write(encoded.getBytes(charsetName)); } @@ -138,6 +151,10 @@ public Object unmarshal(Exchange exchange, InputStream inputStream) throws Excep } exchange.getOut().setHeader(HL7_CONTEXT, hapiContext); exchange.getOut().setHeader(Exchange.CHARSET_NAME, charsetName); + + if ("XML".equalsIgnoreCase(targetFormat)) { + return hapiContext.getXMLParser().encodeDocument(message); + } return message; } @@ -165,6 +182,14 @@ public void setParser(Parser parser) { this.parser = parser; } + public String getTargetFormat() { + return targetFormat; + } + + public void setTargetFormat(String targetFormat) { + this.targetFormat = targetFormat; + } + @Override protected void doStart() throws Exception { if (hapiContext == null) { diff --git a/components/camel-hl7/src/test/java/org/apache/camel/component/hl7/HL7XmlDataFormatTest.java b/components/camel-hl7/src/test/java/org/apache/camel/component/hl7/HL7XmlDataFormatTest.java index 37f7f4e1d22b7..5b639b768a8d5 100644 --- a/components/camel-hl7/src/test/java/org/apache/camel/component/hl7/HL7XmlDataFormatTest.java +++ b/components/camel-hl7/src/test/java/org/apache/camel/component/hl7/HL7XmlDataFormatTest.java @@ -16,6 +16,8 @@ */ package org.apache.camel.component.hl7; +import org.w3c.dom.Document; + import ca.uhn.hl7v2.DefaultHapiContext; import ca.uhn.hl7v2.HapiContext; import ca.uhn.hl7v2.model.Message; @@ -28,8 +30,7 @@ import org.apache.camel.test.junit6.CamelTestSupport; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.*; public class HL7XmlDataFormatTest extends CamelTestSupport { @@ -62,6 +63,67 @@ public void testUnmarshalOkXml() throws Exception { assertEquals("O01", new Terser(received).get("MSH-9-2")); } + @Test + public void testUnmarshalXmlFormat() throws Exception { + MockEndpoint mock = getMockEndpoint("mock:unmarshalXml"); + mock.expectedMessageCount(1); + + String body = createHL7AsString(); + template.sendBody("direct:unmarshalXml", body); + + MockEndpoint.assertIsSatisfied(context); + Object rawBody = mock.getReceivedExchanges().get(0).getIn().getBody(); + assertNotNull(rawBody); + assertInstanceOf(Document.class, rawBody); + Document doc = (Document) rawBody; + assertEquals("ORM_O01", doc.getDocumentElement().getLocalName()); + } + + @Test + public void testMarshalXmlFromDocument() throws Exception { + MockEndpoint mock = getMockEndpoint("mock:marshalFromDoc"); + mock.expectedMessageCount(1); + + String body = createHL7AsString(); + Message msg = hl7.getParser().parse(body); + String xml = hl7.getParser().encode(msg, "XML"); + template.sendBody("direct:marshalFromDoc", xml); + + MockEndpoint.assertIsSatisfied(context); + String edi = mock.getReceivedExchanges().get(0).getIn().getBody(String.class); + assertTrue(edi.contains("MSH|^~\\&|")); + assertTrue(edi.contains("ORM^O01")); + } + + @Test + public void testMarshalXmlOutput() throws Exception { + MockEndpoint mock = getMockEndpoint("mock:marshalXmlOutput"); + mock.expectedMessageCount(1); + + String body = createHL7AsString(); + Message msg = hl7.getParser().parse(body); + template.sendBody("direct:marshalXmlOutput", msg); + + MockEndpoint.assertIsSatisfied(context); + String xml = mock.getReceivedExchanges().get(0).getIn().getBody(String.class); + assertTrue(xml.contains(" { private String parser; private String validate; + private String targetFormat; /** * Whether to validate the HL7 message @@ -123,6 +142,16 @@ public Builder parser(String parser) { return this; } + /** + * The target format for marshal output and unmarshal result type. By default, marshal encodes to HL7 ER7, and + * unmarshal returns a HAPI Message object. If this is set to XML, marshal encodes to HL7 XML, and unmarshal + * returns an XML DOM Document. + */ + public Builder targetFormat(String targetFormat) { + this.targetFormat = targetFormat; + return this; + } + @Override public HL7DataFormat end() { return new HL7DataFormat(this); 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 e213cac7540a2..d4f1127a263fa 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 @@ -1794,6 +1794,7 @@ protected GzipDeflaterDataFormat doParseGzipDeflaterDataFormat() throws IOExcept protected HL7DataFormat doParseHL7DataFormat() throws IOException, XmlPullParserException { return doParse(new HL7DataFormat(), (def, key, val) -> switch (key) { case "parser": def.setParser(val); yield true; + case "targetFormat": def.setTargetFormat(val); yield true; case "validate": def.setValidate(val); yield true; default: yield identifiedTypeAttributeHandler().accept(def, key, val); }, noElementHandler(), noValueHandler()); 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 a51814d0dd56a..5e81fda70cc71 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 @@ -2399,6 +2399,7 @@ protected void doWriteHL7DataFormat(String name, HL7DataFormat def) throws IOExc doWriteIdentifiedTypeAttributes(def); doWriteAttribute("parser", def.getParser(), null); doWriteAttribute("validate", def.getValidate(), "true"); + doWriteAttribute("targetFormat", def.getTargetFormat(), null); endElement(name); } protected void doWriteIcalDataFormat(String name, IcalDataFormat def) throws IOException { diff --git a/core/camel-yaml-io/src/generated/java/org/apache/camel/yaml/out/YamlModelWriter.java b/core/camel-yaml-io/src/generated/java/org/apache/camel/yaml/out/YamlModelWriter.java index b9ddb7fa5e4ca..d48d8ce2b3b5f 100644 --- a/core/camel-yaml-io/src/generated/java/org/apache/camel/yaml/out/YamlModelWriter.java +++ b/core/camel-yaml-io/src/generated/java/org/apache/camel/yaml/out/YamlModelWriter.java @@ -2397,6 +2397,7 @@ protected JsonObject doWriteHL7DataFormat(HL7DataFormat def) { doWriteIdentifiedTypeAttributes(jo, def); doWriteAttribute(jo, "parser", def.getParser(), null); doWriteAttribute(jo, "validate", def.getValidate(), "true"); + doWriteAttribute(jo, "targetFormat", def.getTargetFormat(), null); return jo; } protected JsonObject doWriteIcalDataFormat(IcalDataFormat def) { 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 45bf777d70f5b..71bd1d240aca6 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 @@ -6419,6 +6419,7 @@ protected boolean setProperty(GzipDeflaterDataFormat target, String propertyKey, properties = { @YamlProperty(name = "id", type = "string", description = "The id of this node", displayName = "Id"), @YamlProperty(name = "parser", type = "string", description = "To use a custom HL7 parser", displayName = "Parser"), + @YamlProperty(name = "targetFormat", type = "enum:XML", description = "The target format for marshal output and unmarshal result type. By default, marshal encodes to HL7 ER7, and unmarshal returns a HAPI Message object. If this is set to XML, marshal encodes to HL7 XML, and unmarshal returns an XML DOM Document.", displayName = "Target Format"), @YamlProperty(name = "validate", type = "boolean", defaultValue = "true", description = "Whether to validate the HL7 message Is by default true.", displayName = "Validate") } ) @@ -6447,6 +6448,11 @@ protected boolean setProperty(HL7DataFormat target, String propertyKey, String p target.setParser(val); break; } + case "targetFormat": { + String val = asText(node); + target.setTargetFormat(val); + break; + } case "validate": { String val = asText(node); target.setValidate(val); diff --git a/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camelYamlDsl-canonical.json b/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camelYamlDsl-canonical.json index 8438e7a74b375..19b822bdf87da 100644 --- a/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camelYamlDsl-canonical.json +++ b/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camelYamlDsl-canonical.json @@ -7248,6 +7248,12 @@ "title" : "Parser", "description" : "To use a custom HL7 parser" }, + "targetFormat" : { + "type" : "string", + "title" : "Target Format", + "description" : "The target format for marshal output and unmarshal result type. By default, marshal encodes to HL7 ER7, and unmarshal returns a HAPI Message object. If this is set to XML, marshal encodes to HL7 XML, and unmarshal returns an XML DOM Document.", + "enum" : [ "XML" ] + }, "validate" : { "type" : "boolean", "title" : "Validate", 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 9baa494c457ed..9c2228a0d0701 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 @@ -10784,6 +10784,12 @@ "title" : "Parser", "description" : "To use a custom HL7 parser" }, + "targetFormat" : { + "type" : "string", + "title" : "Target Format", + "description" : "The target format for marshal output and unmarshal result type. By default, marshal encodes to HL7 ER7, and unmarshal returns a HAPI Message object. If this is set to XML, marshal encodes to HL7 XML, and unmarshal returns an XML DOM Document.", + "enum" : [ "XML" ] + }, "validate" : { "type" : "boolean", "title" : "Validate",