|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.funambol.mail.Folder
public class Folder
Represents a mailbox folder on the device. Folders can contain
Message
objects, other Folder
objects or both.
This nesting capability enables a folder hierarchy for stored messages. The
different levels of hierarchy in a folder's full name are separated by the
hierarchy separator character FOLDER_SEPARATOR
. You can retrieve
a contained folder by name using getFolder()
, or a list of
contained folders by using list()
Field Summary | |
---|---|
protected java.util.Date |
created
The folder creation date |
static char |
FOLDER_ITEM_PREFIX
|
static char |
FOLDER_SEPARATOR
|
protected java.lang.String |
fullname
The folder fullname (e.g. |
protected int |
recordId
The record id in the record store |
protected java.lang.String |
role
The folder role (e.g. |
static java.lang.String |
ROOT_FOLDER_PATH
|
protected Store |
store
Each Folder contains a reference to the Store |
Constructor Summary | |
---|---|
Folder(Store store)
Constructs a new Folder providing a reference to the
Store in which it has to be created. |
|
Folder(java.lang.String fullname,
java.lang.String role,
java.util.Date created,
Store store)
Constructs a new Folder providing a name for it, the role,
the creation date and a reference to the Store in which it
has to be created. |
Method Summary | |
---|---|
void |
appendMessage(Message msg)
Appends the given Message to this Folder |
void |
deleteMessage(Message msg)
Deletes a Message from this Folder
The message is properly updated so that it is both complete (completely
loaded in memory) and its parent folder is cleared. |
void |
deleteMessage(java.lang.String recordId)
Deletes a Message from this Folder , using
the record id as key. |
void |
deserialize(java.io.DataInputStream din)
|
ChildrenEnumeration |
getChildren()
This method returns the ChildrenEnumeration of this
Folder . |
java.util.Date |
getCreated()
Returns the Folder creation date |
java.lang.String |
getFullName()
Returns the full name of this Folder . |
Message |
getMessage(java.lang.String recordId)
Gets the Message object corresponding to the given record
ID. |
int |
getMessageCount()
Get the total number of messages in this Folder |
java.lang.String |
getName()
Returns the name of this Folder , taking the last part of
the fullname |
Folder |
getParent()
Returns the parent Folder of this Folder |
int |
getRecordId()
|
java.lang.String |
getRole()
Returns the Folder role |
char |
getSeparator()
Returns the delimiter character that separates this Folder 's
pathname from the names of immediate subfolders
TODO: Perhaps it is better to define in a field the character used as
separator and not directly here (this adopted here is the solution by
Sun) |
static boolean |
isSupportedStream(char prefix)
Check whether the provided prefix char represents a Folder
DataInputStream |
Folder[] |
list()
This method returns the list of subfolders under this Folder |
void |
serialize(java.io.DataOutputStream dout)
|
void |
setRecordId(int id)
|
void |
setRole(java.lang.String role)
Set the Folder role |
void |
setStore(Store store)
Set the Store containing this Folder |
void |
updateMessage(Message msg)
Updates the given Message |
protected void |
writeRecordPrefix(java.io.DataOutputStream dout)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final char FOLDER_ITEM_PREFIX
public static final char FOLDER_SEPARATOR
public static final java.lang.String ROOT_FOLDER_PATH
protected java.lang.String fullname
protected java.lang.String role
protected java.util.Date created
protected Store store
Folder
contains a reference to the Store
protected int recordId
Constructor Detail |
---|
public Folder(Store store)
Folder
providing a reference to the
Store
in which it has to be created. It is used when
creating a Folder from a DataInputStream.
store
- The Store
in which the folder has to be createdpublic Folder(java.lang.String fullname, java.lang.String role, java.util.Date created, Store store)
Folder
providing a name for it, the role,
the creation date and a reference to the Store
in which it
has to be created.
fullname
- The fullname for this Folder
role
- The role for this Folder
created
- The creation date for this Folder
store
- The Store
in which the folder has to be createdMethod Detail |
---|
public java.lang.String getFullName()
Folder
.
Folder
public java.lang.String getName()
Folder
, taking the last part of
the fullname
Folder
public void setStore(Store store)
Store
containing this Folder
store
- A reference to the Store
containing this
Folder
public java.lang.String getRole()
Folder
role
Folder
rolepublic void setRole(java.lang.String role)
Folder
role
role
- The new rolepublic java.util.Date getCreated()
Folder
creation date
Folder
rolepublic Folder getParent() throws MailException
MailException
public char getSeparator()
Folder
's
pathname from the names of immediate subfolders
TODO: Perhaps it is better to define in a field the character used as
separator and not directly here (this adopted here is the solution by
Sun)
public Folder[] list() throws MailException
MailException
public void appendMessage(Message msg) throws MailException
Message
to this Folder
msg
- The Message
to be added
MailException
public void updateMessage(Message msg) throws MailException
Message
msg
- The Message
to be updated
MailException
public Message getMessage(java.lang.String recordId) throws MailException
Message
object corresponding to the given record
ID.
recordId
-
MailException
public ChildrenEnumeration getChildren() throws MailException
ChildrenEnumeration
of this
Folder
.
NOTE: the children could of different types: Message
,
Folder
or AccountFolder
Enumeration
of the Message
items
contained in this Folder
MailException
- If an error occurs accessing the Storepublic void deleteMessage(Message msg) throws MailException
Message
from this Folder
The message is properly updated so that it is both complete (completely
loaded in memory) and its parent folder is cleared. After this call the
Message object is valid and can be used in any operation.
msg
- A reference to the message to be deleted
MailException
public void deleteMessage(java.lang.String recordId) throws MailException
Message
from this Folder
, using
the record id as key. If the client has one or more Message objects that
hold the message at this record id position, there is no guarantee these
objects are still valid after this call. For such cases the client should
use @see deleteMessage(Message)
key
- A reference to the message to be deleted
MailException
public int getMessageCount() throws MailException
Folder
MailException
public static boolean isSupportedStream(char prefix)
Folder
DataInputStream
prefix
- The item prefix.
protected void writeRecordPrefix(java.io.DataOutputStream dout) throws java.io.IOException
java.io.IOException
public void serialize(java.io.DataOutputStream dout) throws java.io.IOException
java.io.IOException
com.funambol.storage.Serializable#serialize(java.io.DataOutputStream)
public void deserialize(java.io.DataInputStream din) throws java.io.IOException
java.io.IOException
com.funambol.storage.Serializable#deserialize(java.io.DataInputStream)
public void setRecordId(int id)
com.funambol.storage.RmsRecordItem#setRecordId(int)
public int getRecordId()
com.funambol.storage.RmsRecordItem#getRecordId()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |