Skip to content

Commit 1e0d9c8

Browse files
committed
CAMEL-21703: Add external functions to simple language such as camel-attachments
1 parent 5efd732 commit 1e0d9c8

File tree

3 files changed

+39
-2
lines changed
  • catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/languages
  • core/camel-core-languages/src

3 files changed

+39
-2
lines changed

catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/languages/simple.json

+9-1
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,14 @@
7676
"uuid(type)": { "index": 51, "kind": "function", "displayName": "Generate UUID", "group": "function", "label": "function", "required": false, "javaType": "String", "prefix": "${", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Returns a UUID using the Camel `UuidGenerator`. You can choose between `default`, `classic`, `short` and `simple` as the type. If no type is given, the default is used. It is also possible to use a custom `UuidGenerator` and bind the bean to the xref:manual::registry.adoc[Registry] with an id. For example `${uuid(myGenerator)}` where the ID is _myGenerator_.", "ognl": false, "suffix": "}" },
7777
"hash(exp,algorithm)": { "index": 52, "kind": "function", "displayName": "Compute Hash Value", "group": "function", "label": "function", "required": false, "javaType": "String", "prefix": "${", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Returns a hashed value (string in hex decimal) of the message body\/expression using JDK MessageDigest. The algorithm can be SHA-256 (default) or SHA3-256.", "ognl": false, "suffix": "}" },
7878
"empty(type)": { "index": 53, "kind": "function", "displayName": "Create Empty Object", "group": "function", "label": "function", "required": false, "javaType": "Object", "prefix": "${", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Creates a new empty object (decided by type). Use `string` to create an empty String. Use `list` to create an empty `java.util.ArrayList`. Use `map` to create an empty `java.util.HashMap`.", "ognl": false, "suffix": "}" },
79-
"iif(predicate,trueExp,falseExp)": { "index": 54, "kind": "function", "displayName": "If Then Else", "group": "function", "label": "function", "required": false, "javaType": "Object", "prefix": "${", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Evaluates the predicate and returns the value of trueExp or falseExp. This function is similar to the ternary operator in Java.", "ognl": false, "suffix": "}" }
79+
"iif(predicate,trueExp,falseExp)": { "index": 54, "kind": "function", "displayName": "If Then Else", "group": "function", "label": "function", "required": false, "javaType": "Object", "prefix": "${", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Evaluates the predicate and returns the value of trueExp or falseExp. This function is similar to the ternary operator in Java.", "ognl": false, "suffix": "}" },
80+
"attachments": { "index": 55, "kind": "function", "displayName": "Attachments", "group": "function", "label": "function", "required": false, "javaType": "java.util.Map", "prefix": "${", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "All the attachments as a Map<String,DataHandler.", "ognl": false, "suffix": "}" },
81+
"attachments.size": { "index": 56, "kind": "function", "displayName": "Attachments", "group": "function", "label": "function", "required": false, "javaType": "int", "prefix": "${", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The number of attachments. Is 0 if there are no attachments.", "ognl": false, "suffix": "}" },
82+
"attachmentContentAsText": { "index": 57, "kind": "function", "displayName": "Attachment Content As Text", "group": "function", "label": "function", "required": false, "javaType": "String", "prefix": "${", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The content of the attachment as text (ie String).", "ognl": false, "suffix": "}" },
83+
"attachmentContent": { "index": 58, "kind": "function", "displayName": "Attachment Content", "group": "function", "label": "function", "required": false, "javaType": "Object", "prefix": "${", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The content of the attachment", "ognl": false, "suffix": "}" },
84+
"attachmentContentAs(type)": { "index": 59, "kind": "function", "displayName": "Attachment Content As", "group": "function", "label": "function", "required": false, "javaType": "Object", "prefix": "${", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The content of the attachment, converted to the given type.", "ognl": false, "suffix": "}" },
85+
"attachmentHeader(key,name)": { "index": 60, "kind": "function", "displayName": "Attachment Header", "group": "function", "label": "function", "required": false, "javaType": "String", "prefix": "${", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The attachment header with the given name.", "ognl": false, "suffix": "}" },
86+
"attachmentHeader(key,name,type)": { "index": 61, "kind": "function", "displayName": "Attachment Header", "group": "function", "label": "function", "required": false, "javaType": "Object", "prefix": "${", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The attachment header with the given name, converted to the given type.", "ognl": false, "suffix": "}" },
87+
"attachment(key)": { "index": 62, "kind": "function", "displayName": "Attachment", "group": "function", "label": "function", "required": false, "javaType": "jakarta.activation.DataHandler", "prefix": "${", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The DataHandler for the given attachment.", "ognl": true, "suffix": "}" }
8088
}
8189
}

core/camel-core-languages/src/generated/resources/META-INF/org/apache/camel/language/simple/simple.json

+9-1
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,14 @@
7676
"uuid(type)": { "index": 51, "kind": "function", "displayName": "Generate UUID", "group": "function", "label": "function", "required": false, "javaType": "String", "prefix": "${", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Returns a UUID using the Camel `UuidGenerator`. You can choose between `default`, `classic`, `short` and `simple` as the type. If no type is given, the default is used. It is also possible to use a custom `UuidGenerator` and bind the bean to the xref:manual::registry.adoc[Registry] with an id. For example `${uuid(myGenerator)}` where the ID is _myGenerator_.", "ognl": false, "suffix": "}" },
7777
"hash(exp,algorithm)": { "index": 52, "kind": "function", "displayName": "Compute Hash Value", "group": "function", "label": "function", "required": false, "javaType": "String", "prefix": "${", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Returns a hashed value (string in hex decimal) of the message body\/expression using JDK MessageDigest. The algorithm can be SHA-256 (default) or SHA3-256.", "ognl": false, "suffix": "}" },
7878
"empty(type)": { "index": 53, "kind": "function", "displayName": "Create Empty Object", "group": "function", "label": "function", "required": false, "javaType": "Object", "prefix": "${", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Creates a new empty object (decided by type). Use `string` to create an empty String. Use `list` to create an empty `java.util.ArrayList`. Use `map` to create an empty `java.util.HashMap`.", "ognl": false, "suffix": "}" },
79-
"iif(predicate,trueExp,falseExp)": { "index": 54, "kind": "function", "displayName": "If Then Else", "group": "function", "label": "function", "required": false, "javaType": "Object", "prefix": "${", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Evaluates the predicate and returns the value of trueExp or falseExp. This function is similar to the ternary operator in Java.", "ognl": false, "suffix": "}" }
79+
"iif(predicate,trueExp,falseExp)": { "index": 54, "kind": "function", "displayName": "If Then Else", "group": "function", "label": "function", "required": false, "javaType": "Object", "prefix": "${", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Evaluates the predicate and returns the value of trueExp or falseExp. This function is similar to the ternary operator in Java.", "ognl": false, "suffix": "}" },
80+
"attachments": { "index": 55, "kind": "function", "displayName": "Attachments", "group": "function", "label": "function", "required": false, "javaType": "java.util.Map", "prefix": "${", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "All the attachments as a Map<String,DataHandler.", "ognl": false, "suffix": "}" },
81+
"attachments.size": { "index": 56, "kind": "function", "displayName": "Attachments", "group": "function", "label": "function", "required": false, "javaType": "int", "prefix": "${", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The number of attachments. Is 0 if there are no attachments.", "ognl": false, "suffix": "}" },
82+
"attachmentContentAsText": { "index": 57, "kind": "function", "displayName": "Attachment Content As Text", "group": "function", "label": "function", "required": false, "javaType": "String", "prefix": "${", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The content of the attachment as text (ie String).", "ognl": false, "suffix": "}" },
83+
"attachmentContent": { "index": 58, "kind": "function", "displayName": "Attachment Content", "group": "function", "label": "function", "required": false, "javaType": "Object", "prefix": "${", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The content of the attachment", "ognl": false, "suffix": "}" },
84+
"attachmentContentAs(type)": { "index": 59, "kind": "function", "displayName": "Attachment Content As", "group": "function", "label": "function", "required": false, "javaType": "Object", "prefix": "${", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The content of the attachment, converted to the given type.", "ognl": false, "suffix": "}" },
85+
"attachmentHeader(key,name)": { "index": 60, "kind": "function", "displayName": "Attachment Header", "group": "function", "label": "function", "required": false, "javaType": "String", "prefix": "${", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The attachment header with the given name.", "ognl": false, "suffix": "}" },
86+
"attachmentHeader(key,name,type)": { "index": 61, "kind": "function", "displayName": "Attachment Header", "group": "function", "label": "function", "required": false, "javaType": "Object", "prefix": "${", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The attachment header with the given name, converted to the given type.", "ognl": false, "suffix": "}" },
87+
"attachment(key)": { "index": 62, "kind": "function", "displayName": "Attachment", "group": "function", "label": "function", "required": false, "javaType": "jakarta.activation.DataHandler", "prefix": "${", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The DataHandler for the given attachment.", "ognl": true, "suffix": "}" }
8088
}
8189
}

core/camel-core-languages/src/main/java/org/apache/camel/language/simple/SimpleConstants.java

+21
Original file line numberDiff line numberDiff line change
@@ -212,4 +212,25 @@ public final class SimpleConstants {
212212
@Metadata(description = "Evaluates the predicate and returns the value of trueExp or falseExp. This function is similar to the ternary operator in Java.",
213213
label = "function", javaType = "Object", displayName = "If Then Else")
214214
public static final String IIF = "iif(predicate,trueExp,falseExp)";
215+
@Metadata(description = "All the attachments as a Map<String,DataHandler.", javaType = "java.util.Map", label = "function")
216+
public static final String ATTACHMENTS = "attachments";
217+
@Metadata(description = "The number of attachments. Is 0 if there are no attachments.", javaType = "int",
218+
label = "function")
219+
public static final String ATTACHMENTS_SIZE = "attachments.size";
220+
@Metadata(description = "The content of the attachment as text (ie String).", javaType = "String", label = "function")
221+
public static final String ATTACHMENTS_CONTENT_AS_TEXT = "attachmentContentAsText";
222+
@Metadata(description = "The content of the attachment", javaType = "Object", label = "function")
223+
public static final String ATTACHMENTS_CONTENT = "attachmentContent";
224+
@Metadata(description = "The content of the attachment, converted to the given type.", javaType = "Object",
225+
label = "function")
226+
public static final String ATTACHMENTS_CONTENT_AS = "attachmentContentAs(type)";
227+
@Metadata(description = "The attachment header with the given name.", javaType = "String", label = "function")
228+
public static final String ATTACHMENTS_HEADER = "attachmentHeader(key,name)";
229+
@Metadata(description = "The attachment header with the given name, converted to the given type.", javaType = "Object",
230+
label = "function")
231+
public static final String ATTACHMENTS_HEADER_AS = "attachmentHeader(key,name,type)";
232+
@Metadata(description = "The DataHandler for the given attachment.", javaType = "jakarta.activation.DataHandler",
233+
label = "function,ognl")
234+
public static final String ATTACHMENT = "attachment(key)";
235+
215236
}

0 commit comments

Comments
 (0)