001: /***
002: * jwma Java WebMail
003: * Copyright (c) 2000-2003 jwma team
004: *
005: * jwma is free software; you can distribute and use this source
006: * under the terms of the BSD-style license received along with
007: * the distribution.
008: ***/package dtw.webmail.model;
009:
010: import javax.mail.Folder;
011:
012: /**
013: * An interface defining the contract for interaction with
014: * the JwmaFolder model.
015: * <p>
016: * The JwmaFolder allows a view programmer to obtain
017: * information about a folder.
018: *
019: * @author Dieter Wimberger
020: * @version 0.9.7 07/02/2003
021: */
022: public interface JwmaFolder {
023:
024: /**
025: * Returns a <tt>String</tt> representing the name
026: * of this folder.
027: *
028: * @return the name of this folder as String.
029: */
030: public String getName();
031:
032: /**
033: * Returns a <tt>String</tt> representing the path
034: * of this folder object.
035: *
036: * @return the path of this folder as String.
037: */
038: public String getPath();
039:
040: /**
041: * Returns an <tt>int</tt> representing the type
042: * of this folder.
043: *
044: * @return the type of this folder object as <tt>int</tt>.
045: */
046: public int getType();
047:
048: /**
049: * Tests if this folder is of a given type.
050: *
051: * @return true if this folder is of the given type, false otherwise.
052: */
053: public boolean isType(int type);
054:
055: /**
056: * Tests if this folder contains subfolders.
057: *
058: * @return true if this folder contains subfolders, false otherwise.
059: */
060: public boolean hasSubfolders();
061:
062: /**
063: * Tests if this folder object contains messages.
064: *
065: * @return true if this folder contains messages, false otherwise.
066: */
067: public boolean hasMessages();
068:
069: /**
070: * Tests if this folder is subscribed.
071: *
072: * @return true if subscribed, false otherwise.
073: */
074: public boolean isSubscribed();
075:
076: /**
077: * Returns a<tt>JwmaFolder[]</tt> containing all subfolders of
078: * the given type within this folder, observing subscription.
079: * <p>
080: * If the store does not contain any matching folder, then this
081: * method returns an empty array. Otherwise it contains
082: * one <tt>JwmaFolder</tt> for each subfolder of the given type.
083: *
084: * @return a <tt>JwmaFolder[]</tt> containing all subfolders of
085: * the given type within this folder. The array will be
086: * empty if there are none.
087: */
088: public JwmaFolder[] listSubfolders(int type, boolean subscribed);
089:
090: /**
091: * Returns a<tt>JwmaFolder[]</tt> containing all subfolders of
092: * the given type within this folder.
093: * <p>
094: * If the store does not contain any matching folder, then this
095: * method returns an empty array. Otherwise it contains
096: * one <tt>JwmaFolder</tt> for each subfolder of the given type.
097: *
098: * @return a <tt>JwmaFolder[]</tt> containing all subfolders of
099: * the given type within this folder. The array will be
100: * empty if there are none.
101: */
102: public JwmaFolder[] listSubfolders(int type);
103:
104: /**
105: * Convenience method that returns a<tt>JwmaFolder[]</tt>
106: * containing all subfolders within this folder.
107: * <p>
108: * If this folder does not contain any subfolder, then this
109: * method returns an empty array. Otherwise it contains
110: * one <tt>JwmaFolder</tt> for each subfolder.
111: *
112: * @return a <tt>JwmaFolder[]</tt> containing all subfolders of
113: * this folder. The array will be empty if there are none.
114: */
115: public JwmaFolder[] listSubfolders();
116:
117: /**
118: * Returns a <tt>JwmaMessageInfo[]</tt>.
119: * <p>
120: * If this folder does not contain any messages, then this
121: * method returns an empty array. Otherwise it contains
122: * one <tt>JwmaMessageInfo</tt> instance for each message
123: * in this folder, encapsulating all necessary information
124: * for list displaying of the message.
125: *
126: * @return a <tt>JwmaMessageInfo[]</tt> containing a info instance
127: * for each message in this folder. The array will be empty if
128: * there are no messages in this folder.
129: *
130: * @see dtw.webmail.model.JwmaMessageInfo
131: */
132: public JwmaMessageInfo[] listMessageInfos();
133:
134: /**
135: * Defines folder type that can only hold messages.
136: */
137: public static final int TYPE_MAILBOX = Folder.HOLDS_MESSAGES;
138:
139: /**
140: * Defines folder type that can only hold folders.
141: */
142: public static final int TYPE_FOLDER = Folder.HOLDS_FOLDERS;
143:
144: /**
145: * Defines folder type that can hold messages and folders.
146: */
147: public static final int TYPE_MIXED = TYPE_MAILBOX + TYPE_FOLDER;
148:
149: /**
150: * Defines a virtual type that represents all folders that
151: * can hold messages.
152: */
153: public static final int TYPE_MESSAGE_CONTAINER = TYPE_MAILBOX
154: + TYPE_MIXED;
155:
156: /**
157: * Defines a virtual type that represents all folders that can
158: * hold folders.
159: */
160: public static final int TYPE_FOLDER_CONTAINER = TYPE_FOLDER
161: + TYPE_MIXED;
162:
163: /**
164: * Defines a virtual type that represents all of the above.
165: */
166: public static final int TYPE_ALL = 10;
167:
168: }//JwmaFolder
|