This is an automated email from the ASF dual-hosted git repository. nfilotto pushed a commit to branch CAMEL-17792/doc-message-headers in repository https://gitbox.apache.org/repos/asf/camel.git
commit b022ec0709703746212d88091a271b6cac1ed64c Author: Nicolas Filotto <[email protected]> AuthorDate: Tue Mar 15 11:27:58 2022 +0100 CAMEL-17792: Add doc about the message headers of camel-arangodb --- .../apache/camel/component/arangodb/arangodb.json | 10 +++++++++ .../src/main/docs/arangodb-component.adoc | 26 +++++++++++++--------- .../component/arangodb/ArangoDbConstants.java | 16 +++++++++++++ .../camel/component/arangodb/ArangoDbEndpoint.java | 2 +- 4 files changed, 42 insertions(+), 12 deletions(-) diff --git a/components/camel-arangodb/src/generated/resources/org/apache/camel/component/arangodb/arangodb.json b/components/camel-arangodb/src/generated/resources/org/apache/camel/component/arangodb/arangodb.json index 83ac4e2..2c26b51 100644 --- a/components/camel-arangodb/src/generated/resources/org/apache/camel/component/arangodb/arangodb.json +++ b/components/camel-arangodb/src/generated/resources/org/apache/camel/component/arangodb/arangodb.json @@ -35,6 +35,16 @@ "password": { "kind": "property", "displayName": "Password", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.arangodb.ArangoDbConfiguration", "configurationField": "configuration", "description": "ArangoDB password. If user and password are default, this field is Optional." }, "user": { "kind": "property", "displayName": "User", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.arangodb.ArangoDbConfiguration", "configurationField": "configuration", "description": "ArangoDB user. If user and password are default, this field is Optional." } }, + "headers": { + "CamelArangoDbMultiUpdate": { "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "java.lang.Boolean", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "defaultValue": "false", "description": "Indicates if there are multiple documents to update. If set to `true`, the body of the message must be a `Collection` of documents to update." }, + "CamelArangoDbMultiInsert": { "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "java.lang.Boolean", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "defaultValue": "false", "description": "Indicates if there are multiple documents to insert. If set to `true`, the body of the message must be a `Collection` of documents to insert." }, + "CamelArangoDbMultiDelete": { "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "java.lang.Boolean", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "defaultValue": "false", "description": "Indicates if there are multiple documents to delete. If set to `true`, the body of the message must be a `Collection` of key of documents to delete." }, + "key": { "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The Arango key to use for the operation." }, + "ResultClassType": { "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "java.lang.Class", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "defaultValue": "BaseDocument.class or BaseEdgeDocument.class", "description": "The type of the result of the operation." }, + "CamelArangoDbAqlQuery": { "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The AQL query to execute." }, + "CamelArangoDbAqlParameters": { "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "java.util.Map", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The key\/value pairs defining the variables to bind the query to." }, + "CamelArangoDbAqlOptions": { "kind": "header", "displayName": "", "group": "advanced", "label": "advanced", "required": false, "javaType": "com.arangodb.model.AqlQueryOptions", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The additional options that will be passed to the query API." } + }, "properties": { "database": { "kind": "path", "displayName": "Database", "group": "producer", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "database name" }, "documentCollection": { "kind": "parameter", "displayName": "Document Collection", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.arangodb.ArangoDbConfiguration", "configurationField": "configuration", "description": "Collection name, when using ArangoDb as a Document Database. Set the documentCollection name when [...] diff --git a/components/camel-arangodb/src/main/docs/arangodb-component.adoc b/components/camel-arangodb/src/main/docs/arangodb-component.adoc index 61835c8..e58cdd4 100644 --- a/components/camel-arangodb/src/main/docs/arangodb-component.adoc +++ b/components/camel-arangodb/src/main/docs/arangodb-component.adoc @@ -49,6 +49,10 @@ include::partial$component-endpoint-options.adoc[] // endpoint options: END +// component headers: START +include::partial$component-endpoint-headers.adoc[] +// component headers: END + == Examples === Producer Examples @@ -64,9 +68,9 @@ from("direct:insert") And you can set as body a BaseDocument class -------------------------------------------------------------------------------- - BaseDocument myObject = new BaseDocument(); - myObject.addAttribute("a", "Foo"); - myObject.addAttribute("b", 42); +BaseDocument myObject = new BaseDocument(); +myObject.addAttribute("a", "Foo"); +myObject.addAttribute("b", 42); -------------------------------------------------------------------------------- ==== Query a collection @@ -80,14 +84,14 @@ from("direct:query") And you can invoke an AQL Query in this way -------------------------------------------------------------------------------- - String query = "FOR t IN " + COLLECTION_NAME + " FILTER t.value == @value"; - Map<String, Object> bindVars = new MapBuilder().put("value", "hello") - .get(); - - Exchange result = template.request("direct:query", exchange -> { - exchange.getMessage().setHeader(AQL_QUERY, query); - exchange.getMessage().setHeader(AQL_QUERY_BIND_PARAMETERS, bindVars); - }); +String query = "FOR t IN " + COLLECTION_NAME + " FILTER t.value == @value"; +Map<String, Object> bindVars = new MapBuilder().put("value", "hello") + .get(); + +Exchange result = template.request("direct:query", exchange -> { + exchange.getMessage().setHeader(AQL_QUERY, query); + exchange.getMessage().setHeader(AQL_QUERY_BIND_PARAMETERS, bindVars); +}); -------------------------------------------------------------------------------- diff --git a/components/camel-arangodb/src/main/java/org/apache/camel/component/arangodb/ArangoDbConstants.java b/components/camel-arangodb/src/main/java/org/apache/camel/component/arangodb/ArangoDbConstants.java index 9630fd2..47758a9 100644 --- a/components/camel-arangodb/src/main/java/org/apache/camel/component/arangodb/ArangoDbConstants.java +++ b/components/camel-arangodb/src/main/java/org/apache/camel/component/arangodb/ArangoDbConstants.java @@ -16,14 +16,30 @@ */ package org.apache.camel.component.arangodb; +import org.apache.camel.spi.Metadata; + public final class ArangoDbConstants { + @Metadata(description = "Indicates if there are multiple documents to update. If set to `true`, the body of the message must be a `Collection` of documents to update.", + javaType = "java.lang.Boolean", defaultValue = "false") public static final String MULTI_UPDATE = "CamelArangoDbMultiUpdate"; + @Metadata(description = "Indicates if there are multiple documents to insert. If set to `true`, the body of the message must be a `Collection` of documents to insert.", + javaType = "java.lang.Boolean", defaultValue = "false") public static final String MULTI_INSERT = "CamelArangoDbMultiInsert"; + @Metadata(description = "Indicates if there are multiple documents to delete. If set to `true`, the body of the message must be a `Collection` of key of documents to delete.", + javaType = "java.lang.Boolean", defaultValue = "false") public static final String MULTI_DELETE = "CamelArangoDbMultiDelete"; + @Metadata(description = "The Arango key to use for the operation.", javaType = "java.lang.String") public static final String ARANGO_KEY = "key"; + @Metadata(description = "The type of the result of the operation.", javaType = "java.lang.Class", + defaultValue = "BaseDocument.class or BaseEdgeDocument.class") public static final String RESULT_CLASS_TYPE = "ResultClassType"; + @Metadata(description = "The AQL query to execute.", javaType = "java.lang.String") public static final String AQL_QUERY = "CamelArangoDbAqlQuery"; + @Metadata(description = "The key/value pairs defining the variables to bind the query to.", + javaType = "java.util.Map") public static final String AQL_QUERY_BIND_PARAMETERS = "CamelArangoDbAqlParameters"; + @Metadata(label = "advanced", description = "The additional options that will be passed to the query API.", + javaType = "com.arangodb.model.AqlQueryOptions") public static final String AQL_QUERY_OPTIONS = "CamelArangoDbAqlOptions"; private ArangoDbConstants() { diff --git a/components/camel-arangodb/src/main/java/org/apache/camel/component/arangodb/ArangoDbEndpoint.java b/components/camel-arangodb/src/main/java/org/apache/camel/component/arangodb/ArangoDbEndpoint.java index c0b48c8..65c6fbc 100644 --- a/components/camel-arangodb/src/main/java/org/apache/camel/component/arangodb/ArangoDbEndpoint.java +++ b/components/camel-arangodb/src/main/java/org/apache/camel/component/arangodb/ArangoDbEndpoint.java @@ -32,7 +32,7 @@ import org.apache.camel.util.ObjectHelper; * Perform operations on ArangoDb when used as a Document Database, or as a Graph Database */ @UriEndpoint(firstVersion = "3.5.0", scheme = "arangodb", title = "ArangoDb", syntax = "arangodb:database", - category = { Category.DATABASE, Category.NOSQL }, producerOnly = true) + category = { Category.DATABASE, Category.NOSQL }, producerOnly = true, headersClass = ArangoDbConstants.class) public class ArangoDbEndpoint extends DefaultEndpoint { private ArangoDB arango;
