jACOB 2.7 API Documentation.

de.tif.jacob.messaging
Class Message

java.lang.Object
  extended by de.tif.jacob.messaging.Message

public class Message
extends java.lang.Object

Common messaging class to either send

  • alerts,
  • (HTML) emails,
  • SMS messages,
  • FAX messages,
  • or user-definied (i.e. other message protocol) messages.

    Except of alerts, messages will first by queued and afterwards processed (asynchronously) by means of the jAN application.

    Note: By default jAN supports email and HTML email only. Nevertheless, the jAN application can be extended accordingly to support further kinds of message protocols.


    Field Summary
    static java.lang.String EMAIL_HTML_PROTOCOL_NAME
              Html email protocol name, i.e.
    static java.lang.String EMAIL_PROTOCOL_NAME
              Email protocol name, i.e.
    static java.lang.String FAX_PROTOCOL_NAME
              FAX protocol name, i.e.
    static java.lang.String PROTOCOL_HEADER_SUFFIX
              The protocol header suffix to be used in recipient urls, i.e.
    static java.lang.String RCS_ID
              The internal revision control system id.
    static java.lang.String RCS_REV
              The internal revision control system id in short form.
    static java.lang.String SMS_PROTOCOL_NAME
              SMS protocol name, i.e.
     
    Constructor Summary
    Message(java.lang.String recipientUrl, java.lang.String message)
              Generic message constructor.
     
    Method Summary
     void addAttachment(DataDocumentValue document)
              Adds a document as attachment to this message.
     void addAttachment(java.lang.String mimeType, DataDocumentValue document)
              Adds a document as attachment to this message.
     void addAttachment(java.lang.String mimeType, java.lang.String fileName, byte[] fileContent)
              Adds a file as attachment to this message.
    static Message createEMailMessage(java.lang.String recipient, java.lang.String message)
              Creates an email message.
    static Message createHtmlEMailMessage(java.lang.String recipient, java.lang.String message)
              Creates a HTML formated email message.
    static java.lang.String getMimeType(java.lang.String fileName)
              Returns the default mime type of a given file name.
     void send()
              Sends the message, i.e. the message is queued for jAN processing.
    static void sendAlert(java.lang.String recipient, java.lang.String message)
              Sends an alert message.
    static void sendAlert(java.lang.String recipient, java.lang.String message, java.lang.String url)
              Sends an alert message with an url.
    static void sendEMail(java.lang.String recipient, java.lang.String message)
              Deprecated. Use createEMailMessage(String, String) instead.
    static void sendFAX(java.lang.String recipient, java.lang.String message)
              Sends a fax message via jAN.
    static void sendHtmlEMail(java.lang.String recipient, java.lang.String message)
              Deprecated. Use createHtmlEMailMessage(String, String) instead.
    static void sendSMS(java.lang.String recipient, java.lang.String message)
              Sends a SMS message via jAN.
     void setSender(java.lang.String sender)
              Sets the sender of the message.
     void setSenderAddr(java.lang.String senderAddr)
              Sets the address of the sender of the message.
     
    Methods inherited from class java.lang.Object
    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
     

    Field Detail

    RCS_ID

    public static final transient java.lang.String RCS_ID
    The internal revision control system id.

    See Also:
    Constant Field Values

    RCS_REV

    public static final transient java.lang.String RCS_REV
    The internal revision control system id in short form.

    See Also:
    Constant Field Values

    PROTOCOL_HEADER_SUFFIX

    public static final java.lang.String PROTOCOL_HEADER_SUFFIX
    The protocol header suffix to be used in recipient urls, i.e. "://".

    See Also:
    Message(String, String), Constant Field Values

    EMAIL_PROTOCOL_NAME

    public static final java.lang.String EMAIL_PROTOCOL_NAME
    Email protocol name, i.e. "email".

    Email recipient urls should be as follows:
    email://my@email.com[,my2@email.com,my3@email.com]

    See Also:
    Message(String, String), Constant Field Values

    EMAIL_HTML_PROTOCOL_NAME

    public static final java.lang.String EMAIL_HTML_PROTOCOL_NAME
    Html email protocol name, i.e. "htmlemail".

    Html email recipient urls should be as follows:
    htmlemail://my@email.com[,my2@email.com,my3@email.com]

    See Also:
    Message(String, String), Constant Field Values

    SMS_PROTOCOL_NAME

    public static final java.lang.String SMS_PROTOCOL_NAME
    SMS protocol name, i.e. "sms".

    SMS recipient urls should be as follows:
    sms://phonenbr[,phonenbr2,phonenbr3]

    See Also:
    Message(String, String), Constant Field Values

    FAX_PROTOCOL_NAME

    public static final java.lang.String FAX_PROTOCOL_NAME
    FAX protocol name, i.e. "fax".

    FAX recipient urls should be as follows:
    fax://phonenbr[,phonenbr2,phonenbr3]

    See Also:
    Message(String, String), Constant Field Values
    Constructor Detail

    Message

    public Message(java.lang.String recipientUrl,
                   java.lang.String message)
    Generic message constructor.

    Use this constructor to send a jAN message via any type of protocol. Nevertheless, the jAN application has to be extended accordingly.

    Parameters:
    recipientUrl - the recipient URL of this message, which must be structured as follows:
    protocol://recipientInfoPart
    message - the message to send
    Since:
    2.6
    Method Detail

    setSender

    public void setSender(java.lang.String sender)
    Sets the sender of the message.

    Note: If the sender is not explicitly set by this method, the sender will be set implicitly to the full name (@link IUser#getFullName()) of the invoking user (@link Context#getUser()}.

    Parameters:
    sender - the sender to set or null to let jAN determine the sender.
    Since:
    2.6

    setSenderAddr

    public void setSenderAddr(java.lang.String senderAddr)
    Sets the address of the sender of the message.

    Note: If the sender address is not explicitly set by this method, the sender address will be set implicitly to the email address (@link IUser#getEMail()) of the invoking user (@link Context#getUser()}.

    Parameters:
    senderAddr - the sender address to set or null to let jAN determine the sender address.
    Since:
    2.6

    addAttachment

    public void addAttachment(DataDocumentValue document)
    Adds a document as attachment to this message.

    Parameters:
    document - the document value to add as attachment
    Since:
    2.6
    See Also:
    IDataRecord.getDocumentValue(String)

    addAttachment

    public void addAttachment(java.lang.String mimeType,
                              DataDocumentValue document)
    Adds a document as attachment to this message.

    Parameters:
    mimeType - the mime type to use or null for default mime type
    document - the document value to add as attachment
    Since:
    2.6
    See Also:
    IDataRecord.getDocumentValue(String), getMimeType(String)

    addAttachment

    public void addAttachment(java.lang.String mimeType,
                              java.lang.String fileName,
                              byte[] fileContent)
    Adds a file as attachment to this message.

    Parameters:
    mimeType - the mime type to use or null for default mime type
    fileName - the file name
    fileContent - the file content
    Since:
    2.6

    getMimeType

    public static java.lang.String getMimeType(java.lang.String fileName)
    Returns the default mime type of a given file name.

    Parameters:
    fileName - the file name
    Returns:
    the default mime type
    Since:
    2.6

    send

    public void send()
              throws java.lang.Exception
    Sends the message, i.e. the message is queued for jAN processing.

    Throws:
    java.lang.Exception - if the message could not be queued
    Since:
    2.6

    sendSMS

    public static void sendSMS(java.lang.String recipient,
                               java.lang.String message)
                        throws java.lang.Exception
    Sends a SMS message via jAN.

    Parameters:
    recipient - the SMS recipient
    message - the SMS message
    Throws:
    java.lang.Exception - on any problem sending this message

    sendEMail

    public static void sendEMail(java.lang.String recipient,
                                 java.lang.String message)
                          throws java.lang.Exception
    Deprecated. Use createEMailMessage(String, String) instead.

    Sends an email message via jAN.

    Parameters:
    recipient - the email recipient.

    Note: To send an email message to multiple recipients recipient must be a comma separated list of email addresses.

    message - the email message.
    Note: First line is treated as email subject.
    Throws:
    java.lang.Exception - on any problem sending this message

    createEMailMessage

    public static Message createEMailMessage(java.lang.String recipient,
                                             java.lang.String message)
    Creates an email message.

    Call send() to really release the returned message.

    Parameters:
    recipient - the email recipient.

    Note: To send an email message to multiple recipients recipient must be a comma separated list of email addresses.

    message - the email content.
    Note: First line is treated as email subject.
    Returns:
    the email message
    Since:
    2.6

    sendHtmlEMail

    public static void sendHtmlEMail(java.lang.String recipient,
                                     java.lang.String message)
                              throws java.lang.Exception
    Deprecated. Use createHtmlEMailMessage(String, String) instead.

    Sends a HTML formated email via the jAN.

    Parameters:
    recipient - the email recipient.

    Note: To send an email message to multiple recipients recipient must be a comma separated list of email addresses.

    message - the email message.
    Note: First line is treated as email subject.
    Throws:
    java.lang.Exception - on any problem sending this message

    createHtmlEMailMessage

    public static Message createHtmlEMailMessage(java.lang.String recipient,
                                                 java.lang.String message)
    Creates a HTML formated email message.

    Call send() to really release the returned message.

    Parameters:
    recipient - the email recipient.

    Note: To send an email message to multiple recipients recipient must be a comma separated list of email addresses.

    message - the email content.
    Note: First line is treated as email subject.
    Returns:
    the HTML formated email message
    Since:
    2.6

    sendFAX

    public static void sendFAX(java.lang.String recipient,
                               java.lang.String message)
                        throws java.lang.Exception
    Sends a fax message via jAN.

    Parameters:
    recipient - the FAX recipient
    message - the fax message
    Throws:
    java.lang.Exception - on any problem

    sendAlert

    public static void sendAlert(java.lang.String recipient,
                                 java.lang.String message)
                          throws java.lang.Exception
    Sends an alert message.

    Parameters:
    recipient - the alert recipient
    message - the alert message
    Throws:
    java.lang.Exception - on any problem

    sendAlert

    public static void sendAlert(java.lang.String recipient,
                                 java.lang.String message,
                                 java.lang.String url)
                          throws java.lang.Exception
    Sends an alert message with an url.

    Attention: This does not work for Quintus migration projects!

    Parameters:
    recipient - the alert recipient
    message - the alert message
    url - the (entrypoint) url to be invoked, if the alert is selected by an user
    Throws:
    java.lang.Exception - on any problem

    jACOB 2.7 API Documentation.