Package org.xwiki.mail.script
Class MailStorageScriptService
java.lang.Object
org.xwiki.mail.script.AbstractMailScriptService
org.xwiki.mail.script.MailStorageScriptService
- All Implemented Interfaces:
org.xwiki.script.service.ScriptService
@Component
@Named("mail.storage")
@Singleton
public class MailStorageScriptService
extends AbstractMailScriptService
Expose Mail Storage API to scripts.
- Since:
- 12.4RC1
- Version:
- $Id: c8008660a289bd0369d237f449d7de0d69d44a72 $
-
Field Summary
Fields inherited from class org.xwiki.mail.script.AbstractMailScriptService
componentManagerProvider, execution, mailSender, senderConfiguration, sessionFactory
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlong
Count the number of message statuses matching the passed filters.void
Delete all messages from a batch (both the statuses in the database and the serialized messages on the file system).void
Delete a message (both the status in the database and the serialized messages on the file system).void
Delete all messages having a status in the database and their serialized messages on the file system.protected String
Load message status for the message matching the given message Id.Loads all message statuses matching the passed filters.Resend the serialized MimeMessage synchronously.Resends all mails matching the passed filter map, synchronously (one mail after another).resendAsynchronously
(String batchId, String uniqueMessageId) Resend the serialized MimeMessage asynchronously.resendAsynchronously
(Map<String, Object> filterMap, int offset, int count) Resends all mails matching the passed filter map, asynchronously.Methods inherited from class org.xwiki.mail.script.AbstractMailScriptService
getLastError, sendAsynchronously, setError
-
Constructor Details
-
MailStorageScriptService
public MailStorageScriptService()
-
-
Method Details
-
resend
Resend the serialized MimeMessage synchronously.- Parameters:
batchId
- the name of the directory that contains serialized MimeMessageuniqueMessageId
- the unique id of the serialized MimeMessage- Returns:
- the result and status of the send batch; null if an error occurred when getting the message from the store
-
resendAsynchronously
Resend the serialized MimeMessage asynchronously.- Parameters:
batchId
- the name of the directory that contains serialized MimeMessageuniqueMessageId
- the unique id of the serialized MimeMessage- Returns:
- the result and status of the send batch; null if an error occurred when getting the message from the store
- Since:
- 9.3RC1
-
resendAsynchronously
public List<ScriptMailResult> resendAsynchronously(Map<String, Object> filterMap, int offset, int count) Resends all mails matching the passed filter map, asynchronously.- Parameters:
filterMap
- the map of Mail Status parameters to match (e.g. "state", "wiki", "batchId", etc)offset
- the number of rows to skip (0 means don't skip any row)count
- the number of rows to return. If 0 then all rows are returned- Returns:
- the mail results for the resent mails and null if an error occurred while loading the mail statuses from the store
- Since:
- 9.3RC1
-
resend
Resends all mails matching the passed filter map, synchronously (one mail after another).- Parameters:
filterMap
- the map of Mail Status parameters to match (e.g. "state", "wiki", "batchId", etc)offset
- the number of rows to skip (0 means don't skip any row)count
- the number of rows to return. If 0 then all rows are returned- Returns:
- the mail results for the resent mails and null if an error occurred while loading the mail statuses from the store
- Since:
- 12.10
-
load
Load message status for the message matching the given message Id.- Parameters:
uniqueMessageId
- the unique identifier of the message.- Returns:
- the loaded
MailStatus
or null if not allowed or an error happens - Since:
- 7.1M2
-
load
public List<MailStatus> load(Map<String, Object> filterMap, int offset, int count, String sortField, boolean sortAscending) Loads all message statuses matching the passed filters.- Parameters:
filterMap
- the map of Mail Status parameters to match (e.g. "status", "wiki", "batchId", etc)offset
- the number of rows to skip (0 means don't skip any row)count
- the number of rows to return. If 0 then all rows are returnedsortField
- the name of the field used to order returned statussortAscending
- when true, sort is done in ascending order of sortField, else in descending order- Returns:
- the loaded
MailStatus
instances or null if not allowed or an error happens - Since:
- 7.1M2
-
count
Count the number of message statuses matching the passed filters.- Parameters:
filterMap
- the map of Mail Status parameters to match (e.g. "status", "wiki", "batchId", etc)- Returns:
- the number of mail statuses or 0 if not allowed or an error happens
-
delete
Delete all messages from a batch (both the statuses in the database and the serialized messages on the file system).- Parameters:
batchId
- the id of the batch for which to delete all messages
-
deleteAll
public void deleteAll()Delete all messages having a status in the database and their serialized messages on the file system.- Since:
- 9.4RC1
-
delete
Delete a message (both the status in the database and the serialized messages on the file system).- Parameters:
batchId
- the id of the batch for the message to deleteuniqueMessageId
- the unique id of the message to delete
-
getConfiguration
- Returns:
- the configuration for the Mail Storage
-
getErrorKey
- Specified by:
getErrorKey
in classAbstractMailScriptService
-