Class EmailQueue

java.lang.Object
org.apache.cayenne.PersistentObject
org.apache.cayenne.BaseDataObject
org.apache.cayenne.CayenneDataObject
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:
  • Field Details

    • NUMBER_OF_ATTACHMENTS_PROPERTY

      public static final String NUMBER_OF_ATTACHMENTS_PROPERTY
      The number of attachments
      See Also:
    • 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:
    • EMAIL_STATUS_READY

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

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

      public static final String EMAIL_STATUS_COMPLETED
      Indicates that the email has been sent successfully
      See Also:
    • 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:
    • 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:
    • 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:
  • Constructor Details

    • EmailQueue

      public EmailQueue()
  • Method Details

    • 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
    • getAttachmentMap

      public Map<String,byte[]> getAttachmentMap() throws IOException, ClassNotFoundException
      Return the deserialized attachment map
      Returns:
      the attachment map
      Throws:
      IOException - if an input/output error occurs
      ClassNotFoundException - if the class of a serialized object could not be found
    • 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
    • setCreatedTimestamp

      public void setCreatedTimestamp(Date createdTimestamp)
      Description copied from class: _EmailQueue
      Set the createdTimestamp value.
      Overrides:
      setCreatedTimestamp in class _EmailQueue
      Parameters:
      createdTimestamp - the createdTimestamp value to set