01: package org.claros.commons.mail.utility;
02:
03: import javax.mail.Folder;
04:
05: import org.claros.commons.mail.models.ConnectionProfile;
06:
07: /**
08: * @author Umut Gokbayrak
09: *
10: */
11: public class Constants {
12: public static final String POP3 = "pop3";
13: public static final String IMAP = "imap";
14:
15: public static final int CONNECTION_READ_ONLY = Folder.READ_ONLY;
16: public static final int CONNECTION_READ_WRITE = Folder.READ_WRITE;
17:
18: private static final String STR_FOLDER_INBOX = "INBOX";
19: private static final String STR_FOLDER_JUNK = "Junk Mail";
20: private static final String STR_FOLDER_SENT = "Sent Mail";
21: private static final String STR_FOLDER_TRASH = "Trash";
22: private static final String STR_FOLDER_DRAFTS = "Drafts";
23:
24: /**
25: *
26: * @param profile
27: * @return
28: */
29: public static String FOLDER_INBOX(ConnectionProfile profile) {
30: return STR_FOLDER_INBOX;
31: }
32:
33: /**
34: *
35: * @param profile
36: * @return
37: */
38: public static String FOLDER_JUNK(ConnectionProfile profile) {
39: if (profile.getProtocol().equals(IMAP)) {
40: return profile.getFolderNameSpace() + STR_FOLDER_JUNK;
41: }
42: return STR_FOLDER_JUNK;
43: }
44:
45: /**
46: *
47: * @param profile
48: * @return
49: */
50: public static String FOLDER_SENT(ConnectionProfile profile) {
51: if (profile.getProtocol().equals(IMAP)) {
52: return profile.getFolderNameSpace() + STR_FOLDER_SENT;
53: }
54: return STR_FOLDER_SENT;
55: }
56:
57: /**
58: *
59: * @param profile
60: * @return
61: */
62: public static String FOLDER_TRASH(ConnectionProfile profile) {
63: if (profile.getProtocol().equals(IMAP)) {
64: return profile.getFolderNameSpace() + STR_FOLDER_TRASH;
65: }
66: return STR_FOLDER_TRASH;
67: }
68:
69: /**
70: *
71: * @param profile
72: * @return
73: */
74: public static String FOLDER_DRAFTS(ConnectionProfile profile) {
75: if (profile.getProtocol().equals(IMAP)) {
76: return profile.getFolderNameSpace() + STR_FOLDER_DRAFTS;
77: }
78: return STR_FOLDER_DRAFTS;
79: }
80: }
|