Class | Line # | Actions | |||||
---|---|---|---|---|---|---|---|
MailStatusResult | 30 | 0 | - | 0 | 0 |
1 | /* | |
2 | * See the NOTICE file distributed with this work for additional | |
3 | * information regarding copyright ownership. | |
4 | * | |
5 | * This is free software; you can redistribute it and/or modify it | |
6 | * under the terms of the GNU Lesser General Public License as | |
7 | * published by the Free Software Foundation; either version 2.1 of | |
8 | * the License, or (at your option) any later version. | |
9 | * | |
10 | * This software is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 | * Lesser General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU Lesser General Public | |
16 | * License along with this software; if not, write to the Free | |
17 | * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | |
18 | * 02110-1301 USA, or see the FSF site: http://www.fsf.org. | |
19 | */ | |
20 | package org.xwiki.mail; | |
21 | ||
22 | import java.util.Iterator; | |
23 | ||
24 | /** | |
25 | * Provides status for each mail in the batch of mails that have been sent. | |
26 | * | |
27 | * @version $Id: ea03ab4194916cb4be3c5322e91975ee960e5cb5 $ | |
28 | * @since 6.4M3 | |
29 | */ | |
30 | public interface MailStatusResult | |
31 | { | |
32 | /** | |
33 | * @return the total number of mails to be sent in this batch. Note that this value is known only once all mails | |
34 | * have been prepared on the Prepare Queue. Until then, the value returned is -1 signifying that the total | |
35 | * number is currently unknown. WARNING: If the preparation fails, this number will not reflect the total | |
36 | * number of mails that should have been processed, but the number of mail that have been prepared with | |
37 | * or without success. | |
38 | * @since 7.1M2 | |
39 | */ | |
40 | long getTotalMailCount(); | |
41 | ||
42 | /** | |
43 | * @return the current number of mails that have been processed (sent with success or failed at any stage). | |
44 | * @since 7.1M2 | |
45 | */ | |
46 | long getProcessedMailCount(); | |
47 | ||
48 | /** | |
49 | * Wait till all messages on the sending queue have been sent (for this batch) before returning. | |
50 | * | |
51 | * @param timeout the maximum amount of time to wait in milliseconds | |
52 | * @since 7.1M2 | |
53 | */ | |
54 | void waitTillProcessed(long timeout); | |
55 | ||
56 | /** | |
57 | * @return true if all the mails from this batch have been processed (sent successfully or not) or false otherwise | |
58 | * @since 7.1M2 | |
59 | */ | |
60 | boolean isProcessed(); | |
61 | ||
62 | /** | |
63 | * @return the status for all mails | |
64 | */ | |
65 | Iterator<MailStatus> getAll(); | |
66 | ||
67 | /** | |
68 | * @return the status for all messages in error. | |
69 | * @since 7.1RC1 | |
70 | */ | |
71 | Iterator<MailStatus> getAllErrors(); | |
72 | ||
73 | /** | |
74 | * @param state the state to match (prepare_success, prepare_error, send_success, send_error or send_fatal_error) | |
75 | * @return the status for all mails matching the passed state | |
76 | */ | |
77 | Iterator<MailStatus> getByState(MailState state); | |
78 | } |