Currently the following methods are available to the user:
getAttachments() – Returns all attachments for the current message
addAttachment(data, type) – Adds a new attachment to the current message
AttachmentUtil.getMessageAttachments – Returns all attachments for the current message
AttachmentUtil.getMessageAttachment – Returns a specific attachment for a specific channel/message
AttachmentUtil.reAttachMessage – Replaces all attachment tokens and returns the full message
AttachmentUtil.getMessageAttachmentsFromSourceChannel – Returns all attachments for the source message of an upstream channel
The following methods should be added:
getAttachmentIds() – Returns all attachment IDs (not replacement tokens) for the current message
getAttachmentIds(channelId, messageId) – Returns all attachment IDs for a specific channel / message
getAttachment(attachmentId, base64Decode) – Returns a single attachment for the current message
Optional parameter base64Decode indicates that the attachment content should be Base64 decoded first
Default if not specified is false
getAttachment(channelId, messageId, attachmentId, base64Decode) – Returns a single attachment from a specific channel / message
updateAttachment(attachmentId, data, type, base64Encode) – Updates a specific attachment for the current message
Optional parameter base64Encode indicates that the content should be Base64 encoded first
Default if not specified is false
updateAttachment(channelId, messageId, attachmentId, data, type, base64Encode) – Updates a specific attachment for a specific channel / message
updateAttachment(attachment, base64Encode) – Similar to above
updateAttachment(channelId, messageId, attachment, base64Encode) – Similar to above
Attachment.getContentString() – Returns the UTF-8 string representation of the content bytes
Attachment.getContentString(charset) – Returns the string representation of the content bytes using a specific charset
Attachment.setContentString(content) – Sets the content of the attachment to the UTF-8 byte representation of the string
Attachment.setContentString(content, charset) – Sets the content of the attachment to the byte representation of the string using a specific charset
new Attachment(String id, String content, String type) – Creates a new attachment, using the UTF-8 byte representation of the string
new Attachment(String id, String content, String charset, String type) – Creates a new attachment, using the byte representation of the string with the given charset
Dev Notes:
Currently the following methods are available to the user:
The following methods should be added:
getAttachmentIds() – Returns all attachment IDs (not replacement tokens) for the current message
getAttachmentIds(channelId, messageId) – Returns all attachment IDs for a specific channel / message
getAttachment(attachmentId, base64Decode) – Returns a single attachment for the current message Optional parameter base64Decode indicates that the attachment content should be Base64 decoded first Default if not specified is false
getAttachment(channelId, messageId, attachmentId, base64Decode) – Returns a single attachment from a specific channel / message
updateAttachment(attachmentId, data, type, base64Encode) – Updates a specific attachment for the current message Optional parameter base64Encode indicates that the content should be Base64 encoded first Default if not specified is false
updateAttachment(channelId, messageId, attachmentId, data, type, base64Encode) – Updates a specific attachment for a specific channel / message
updateAttachment(attachment, base64Encode) – Similar to above
updateAttachment(channelId, messageId, attachment, base64Encode) – Similar to above
Attachment.getContentString() – Returns the UTF-8 string representation of the content bytes
Attachment.getContentString(charset) – Returns the string representation of the content bytes using a specific charset
Attachment.setContentString(content) – Sets the content of the attachment to the UTF-8 byte representation of the string
Attachment.setContentString(content, charset) – Sets the content of the attachment to the byte representation of the string using a specific charset
new Attachment(String id, String content, String type) – Creates a new attachment, using the UTF-8 byte representation of the string
new Attachment(String id, String content, String charset, String type) – Creates a new attachment, using the byte representation of the string with the given charset
The following methods should be modified:
The above added / modified methods should also have equivalent counterparts in AttachmentUtil.
The user should be able to modify an incoming CCD attachment like so: ` var ccd = new XML(getAttachment(attachmentId, true).getContentString());
ccd.id.@root = 'testing';
updateAttachment(attachmentId, ccd.toString(), 'text/xml', true); `
Imported Issue. Original Details: Jira Issue Key: MIRTH-4276 Reporter: narupley Created: 2018-05-25T13:10:23.000-0700