Class EmailQueue

  • All Implemented Interfaces:
    IEntity, Serializable, org.apache.cayenne.DataObject, org.apache.cayenne.Persistent, org.apache.cayenne.Validating

    public class EmailQueue
    extends _EmailQueue
    Provides an email queue entry that can be queued and automatically retried.
    See Also:
    Serialized Form
    • Field Detail

      • NUMBER_OF_ATTACHMENTS_PROPERTY

        public static final String NUMBER_OF_ATTACHMENTS_PROPERTY
        The number of attachments
        See Also:
        Constant Field Values
      • EMAIL_STATUS_NOT_READY

        public static final String EMAIL_STATUS_NOT_READY
        Indicates that the email is not yet ready to be sent (e.g. waiting on receipt generation)
        See Also:
        Constant Field Values
      • EMAIL_STATUS_READY

        public static final String EMAIL_STATUS_READY
        Indicates that the email is ready to be sent
        See Also:
        Constant Field Values
      • EMAIL_STATUS_CLONED

        public static final String EMAIL_STATUS_CLONED
        Indicates that the email is just cloned
        See Also:
        Constant Field Values
      • EMAIL_STATUS_COMPLETED

        public static final String EMAIL_STATUS_COMPLETED
        Indicates that the email has been sent successfully
        See Also:
        Constant Field Values
      • EMAIL_STATUS_ERROR

        public static final String EMAIL_STATUS_ERROR
        Indicates that an error has occurred but that the email will be resent later
        See Also:
        Constant Field Values
      • EMAIL_STATUS_MAX_RETRIES

        public static final String EMAIL_STATUS_MAX_RETRIES
        Indicates that the email has been retried unsuccessfully too many times and will not be automatically resent.
        See Also:
        Constant Field Values
      • EMAIL_STATUS_VALUES

        public static final String[] EMAIL_STATUS_VALUES
        The full set of status values an email queue entry can assume
      • CATEGORY_USER_RECEIPT

        public static final String CATEGORY_USER_RECEIPT
        Indicates that the email concerns a receipt sent to a user
        See Also:
        Constant Field Values
    • Constructor Detail

      • EmailQueue

        public EmailQueue()
    • Method Detail

      • toAddressMaxLength

        public static int toAddressMaxLength()
        Returns the maximum length of the toAddresses attribute.
        Returns:
        the maximum length of the toAddresses attribute.
      • isCompleted

        public boolean isCompleted()
        Determine whether the email has been sent successfully.
        Returns:
        true if the status is EMAIL_STATUS_COMPLETED
      • isMaxRetriesExceeded

        public boolean isMaxRetriesExceeded()
        Determine whether the email has been retried unsuccessfully too many times and will not be automatically resent.
        Returns:
        true if the status is EMAIL_STATUS_MAX_RETRIES
      • setAttachmentMap

        public void setAttachmentMap​(Map<String,​byte[]> attachmentMap)
                              throws IOException
        Set the map of email attachments
        Parameters:
        attachmentMap - the new attachment map
        Throws:
        IOException - of the attachment map cannot be serialized
      • getNumberOfAttachments

        public int getNumberOfAttachments()
        Return the number of attachments in the attachment map
        Returns:
        the number of attachments, or 0 if the attachment map could not be deserialized
      • getBody

        public String getBody()
        Return the body value.
        Overrides:
        getBody in class _EmailQueue
        Returns:
        body the body value
      • setBody

        public void setBody​(String body)
        Set the body value.
        Overrides:
        setBody in class _EmailQueue
        Parameters:
        body - the body value to set