Class MailStatus


  • public class MailStatus
    extends Object
    Contains information about a mail (when it was sent, its status, etc).
    Since:
    6.4M3
    Version:
    $Id: 0589283b87376e488ee75b90eff2b198457afa16 $
    • Constructor Detail

      • MailStatus

        public MailStatus()
        Default constructor used by Hibernate to load an instance from the Database.
      • MailStatus

        public MailStatus​(String batchId,
                          ExtendedMimeMessage message,
                          MailState state)
        Constructor initializing the MailStatus with mandatory fields (message id, batch id and recipients are extracted from the passed message, the date is set as now and the state is passed). Also sets the Type if set in the passed message.
        Parameters:
        batchId - the identifier of the batch sending the message
        message - the message for which to construct a status
        state - the state of the referenced mail (ready, failed to send, success)
        Since:
        7.4.1
    • Method Detail

      • getMessageId

        public String getMessageId()
        Returns:
        the unique message ID used for identifying the mime message matching this status. Between XWiki 7.1rc1 and 7.4, this identifier is equivalent to the message-id header, but you should not rely on this fact. Since XWiki 7.4.1, this value is equivalent to ExtendedMimeMessage.getUniqueMessageId().
      • setMessageId

        public void setMessageId​(String messageId)
        Parameters:
        messageId - see getMessageId()
      • getState

        public String getState()
        Note: the returned value is a String and not MailState to allow Hibernate to save that property to the database.
        Returns:
        the state of the mail: ready to be sent, sent successfully, failed to be sent
        See Also:
        MailState
      • setState

        public void setState​(String state)
        Used by Hibernate to load that property from the database.
        Parameters:
        state - see getState()
      • getBatchId

        public String getBatchId()
        Used by Hibernate to save that property to the database.
        Returns:
        the ID of the batch mail sender
      • setBatchId

        public void setBatchId​(String batchId)
        Used by Hibernate to load that property from the database.
        Parameters:
        batchId - the ID of the batch mail sender
      • getDate

        public Date getDate()
        Used by Hibernate to save that property to the database.
        Returns:
        the date of status of mail
      • setDate

        public void setDate​(Date date)
        Used by Hibernate to load that property from the database.
        Parameters:
        date - of status of mail
      • getRecipients

        public String getRecipients()
        Used by Hibernate to save that property to the database (hence the String).
        Returns:
        the comma-separated list of email addresses to which the mail was addressed to
      • setRecipients

        public void setRecipients​(String recipients)
        Used by Hibernate to load that property from the database (hence the reason why it's a String).
        Parameters:
        recipients - see getRecipients()
      • getType

        public String getType()
        Used by Hibernate to save that property to the database.
        Returns:
        the type of batch mail (Watchlist, news ...)
      • setType

        public void setType​(String type)
        Used by Hibernate to load that property from the database.
        Parameters:
        type - of batch mail (Watchlist, news ...)
      • getErrorSummary

        public String getErrorSummary()
        Used by Hibernate to save that property to the database.
        Returns:
        the error message summary when the mail has failed to be sent
      • getErrorDescription

        public String getErrorDescription()
        Used by Hibernate to save that property to the database.
        Returns:
        the error message description (the full stack trace for example) when the mail has failed to be sent
      • setErrorSummary

        public void setErrorSummary​(String errorSummary)
        Used by Hibernate to load that property from the database.
        Parameters:
        errorSummary - see getErrorSummary()
      • setErrorDescription

        public void setErrorDescription​(String errorDescription)
        Used by Hibernate to load that property from the database.
        Parameters:
        errorDescription - see getErrorDescription()
      • setError

        public void setError​(Exception exception)
        Parameters:
        exception - the exception that was encountered during sending mail
      • getWiki

        public String getWiki()
        Used by Hibernate to save that property to the database.
        Returns:
        the wiki in which the message is trying to be sent (can be null, in which case it means the main wiki)
      • setWiki

        public void setWiki​(String wiki)
        Used by Hibernate to load that property from the database.
        Parameters:
        wiki - see getWiki()