Class | Line # | Actions | |||||
---|---|---|---|---|---|---|---|
MailStatusStore | 34 | 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.List; | |
23 | import java.util.Map; | |
24 | ||
25 | import org.xwiki.component.annotation.Role; | |
26 | ||
27 | /** | |
28 | * Save, load and search mail results. | |
29 | * | |
30 | * @version $Id: b8d1034f6b8891bf410e4df4787ffc514eb2ca92 $ | |
31 | * @since 6.4M3 | |
32 | */ | |
33 | @Role | |
34 | public interface MailStatusStore | |
35 | { | |
36 | /** | |
37 | * Saves mail status in the store. | |
38 | * | |
39 | * @param status the mail status to be saved | |
40 | * @param parameters some parameters specifying addition context data (for example the current wiki is stored under | |
41 | * the {@code wiki} key) | |
42 | * @throws MailStoreException when an error occurs saving the data | |
43 | */ | |
44 | void save(MailStatus status, Map<String, Object> parameters) throws MailStoreException; | |
45 | ||
46 | /** | |
47 | * Load message status for the message matching the given message Id. | |
48 | * | |
49 | * @param uniqueMessageId the unique identifier of the message. | |
50 | * @return the status of the message, or null if no status was found. | |
51 | * @throws MailStoreException when an error occurs while loading the data | |
52 | * @since 7.1M2 | |
53 | */ | |
54 | MailStatus load(String uniqueMessageId) throws MailStoreException; | |
55 | ||
56 | /** | |
57 | * Loads all message statuses matching the passed filters. | |
58 | * | |
59 | * @param filterMap the map of Mail Status parameters to match (e.g. "status", "wiki", "batchId", etc) | |
60 | * @param offset the number of rows to skip (0 means don't skip any row) | |
61 | * @param count the number of rows to return. If 0 then all rows are returned | |
62 | * @param sortField the name of the field used to order returned status | |
63 | * @param sortAscending when true, sort is done in ascending order of sortField, else in descending order | |
64 | * @return the loaded {@link org.xwiki.mail.MailStatus} instances | |
65 | * @throws MailStoreException when an error occurs while loading the data | |
66 | * @since 7.1M2 | |
67 | */ | |
68 | List<MailStatus> load(Map<String, Object> filterMap, int offset, int count, String sortField, boolean sortAscending) | |
69 | throws MailStoreException; | |
70 | ||
71 | /** | |
72 | * Count the number of message statuses matching the passed filters. | |
73 | * | |
74 | * @param filterMap the map of Mail Status parameters to match (e.g. "status", "wiki", "batchId", etc) | |
75 | * @return the number of emails matching the passed filters | |
76 | * @throws MailStoreException when an error occurs when loading the data | |
77 | */ | |
78 | long count(Map<String, Object> filterMap) throws MailStoreException; | |
79 | ||
80 | /** | |
81 | * Delete a message. | |
82 | * | |
83 | * @param uniqueMessageId the id of the message to delete | |
84 | * @param parameters some parameters specifying addition context data (for example the current wiki is stored under | |
85 | * the {@code wiki} key) | |
86 | * @throws MailStoreException when an error occurs deleting the message | |
87 | */ | |
88 | void delete(String uniqueMessageId, Map<String, Object> parameters) throws MailStoreException; | |
89 | } |