public class AttachmentUtil
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static Attachment |
addAttachment(java.util.List<Attachment> attachments,
java.lang.Object content,
java.lang.String type)
Creates an Attachment and adds it to the provided list.
|
static Attachment |
createAttachment(ImmutableConnectorMessage connectorMessage,
java.lang.Object content,
java.lang.String type)
Creates an attachment associated with a given connector message, and inserts it into the
database.
|
static java.util.List<Attachment> |
getMessageAttachments(ImmutableConnectorMessage connectorMessage)
Retrieves all attachments associated with a connector message.
|
static java.lang.String |
reAttachMessage(ImmutableConnectorMessage connectorMessage)
Replaces any unique attachment tokens (e.g.
|
static java.lang.String |
reAttachMessage(java.lang.String raw,
ImmutableConnectorMessage connectorMessage)
Replaces any unique attachment tokens (e.g.
|
static byte[] |
reAttachMessage(java.lang.String raw,
ImmutableConnectorMessage connectorMessage,
java.lang.String charsetEncoding,
boolean binary)
Replaces any unique attachment tokens (e.g.
|
public static byte[] reAttachMessage(java.lang.String raw, ImmutableConnectorMessage connectorMessage, java.lang.String charsetEncoding, boolean binary)
raw
- The message string to re-attach attachments to.connectorMessage
- The connector message associated with the attachments.charsetEncoding
- The charset encoding to use when returning the re-attached messagebinary
- If true, the message string passed in is assumed to be Base64 encoded.public static java.lang.String reAttachMessage(ImmutableConnectorMessage connectorMessage)
connectorMessage
- The connector message associated with the attachments. The encoded data will be
used as the raw message string to re-attach attachments to, if it exists.
Otherwise, the connector message's raw data will be used.public static java.lang.String reAttachMessage(java.lang.String raw, ImmutableConnectorMessage connectorMessage)
raw
- The message string to re-attach attachments to.connectorMessage
- The connector message associated with the attachments. The raw data will be used
as the raw message string to re-attach attachments to.public static java.util.List<Attachment> getMessageAttachments(ImmutableConnectorMessage connectorMessage) throws com.mirth.connect.donkey.model.message.XmlSerializerException
connectorMessage
- The connector message associated with the attachments.com.mirth.connect.donkey.model.message.XmlSerializerException
public static Attachment addAttachment(java.util.List<Attachment> attachments, java.lang.Object content, java.lang.String type) throws javax.activation.UnsupportedDataTypeException
attachments
- The list of attachments to add to.content
- The attachment content (must be a string or byte array).type
- The MIME type of the attachment.javax.activation.UnsupportedDataTypeException
public static Attachment createAttachment(ImmutableConnectorMessage connectorMessage, java.lang.Object content, java.lang.String type) throws javax.activation.UnsupportedDataTypeException
connectorMessage
- The connector message to be associated with the attachment.content
- The attachment content (must be a string or byte array).type
- The MIME type of the attachment.javax.activation.UnsupportedDataTypeException