|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.arsdigita.domain.DomainObject
com.arsdigita.domain.ObservableDomainObject
com.arsdigita.messaging.MessagePart
Represents a message part (that is, an attachment). Each part has a content represented as an arbitrary block of bytes and a MIME type that identifies the format of the content.
| Field Summary | |
static String |
ATTACHMENT
Disposition of "attachment" |
static String |
BASE_DATA_OBJECT_TYPE
Base DataObject type |
static String |
INLINE
Disposition of "inline" |
| Fields inherited from class com.arsdigita.domain.ObservableDomainObject |
versionId |
| Fields inherited from interface com.arsdigita.util.MessageType |
TEXT_HTML, TEXT_PLAIN, TEXT_PREFORMATTED, TEXT_SMART |
| Constructor Summary | |
MessagePart()
Default constructor. |
|
MessagePart(DataObject dataObject)
Creates a part from its underlying DataObject. |
|
MessagePart(OID oid)
Retrieves an existing part from the database using its OID. |
|
MessagePart(String name)
Creates a new MessagePart with a given name and default disposition of ATTACHMENT. |
|
MessagePart(String name,
String description)
Creates a new MessagePart with a given name and description, and a disposition of ATTACHMENT. |
|
MessagePart(String name,
String description,
String disposition)
Creates a new MessagePart with a given name, description and disposition. |
|
| Method Summary | |
protected String |
getBaseDataObjectType()
Gets the base DataObject type. |
Object |
getContent()
Returns the content of this part as an Object. |
String |
getContentType()
Returns the MIME type of this part. |
javax.activation.DataHandler |
getDataHandler()
Gets the DataHandler for this part. |
String |
getDescription()
Gets the description of this part. |
String |
getDisposition()
Gets the disposition of this part. |
String |
getName()
Gets the name of this part. |
int |
getSize()
Gets the size of the content of this part in bytes, or -1 if the size cannot be determined. |
void |
setContent(File file,
String name,
String description)
Sets the content of this part to a file with a given name and description. |
void |
setContent(String text,
String type)
Convenience method that sets the given String as this part's content, with the specified MIME type. |
protected void |
setContentType(String type)
Sets the MIME type of this part. |
void |
setDataHandler(javax.activation.DataHandler dh)
Provides the mechanism to set this part's content for anything other than plain text attachments. |
void |
setDescription(String description)
Sets the description of this part. |
void |
setDisposition(String disposition)
Sets the disposition of this part. |
void |
setName(String name)
Sets the name of this part. |
void |
setText(String text)
Convenience method that sets the given String as this part's content, with a MIME type of "text/plain". |
| Methods inherited from class com.arsdigita.domain.ObservableDomainObject |
addObserver, getObservers |
| Methods inherited from class com.arsdigita.domain.DomainObject |
add, add, addToAssociation, afterDelete, afterSave, beforeDelete, beforeSave, clear, delete, disconnect, equals, get, getObjectType, getOID, getSession, hashCode, initialize, isDeleted, isDisconnected, isModified, isNew, isPropertyModified, isValid, remove, remove, remove, removeFromAssociation, save, set, setAssociation, setAssociation, specializeDataObject, specializeDataObject, toString |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static final String BASE_DATA_OBJECT_TYPE
public static final String INLINE
public static final String ATTACHMENT
| Constructor Detail |
public MessagePart()
public MessagePart(OID oid)
throws DataObjectNotFoundException
oid - the OID of the part
public MessagePart(DataObject dataObject)
throws DataObjectNotFoundException
dataObject - the DataObject that represents this partpublic MessagePart(String name)
name - the name of the part.
public MessagePart(String name,
String description)
name - the name of the part.description - a description of the part.
public MessagePart(String name,
String description,
String disposition)
name - the name of the part.description - a description of the part.disposition - the disposition of the part, INLINE or ATTACHMENT| Method Detail |
protected String getBaseDataObjectType()
getBaseDataObjectType in class DomainObjectpublic String getName()
public void setName(String name)
name - the name of this partpublic String getDescription()
public void setDescription(String description)
description - the description of this partpublic String getContentType()
protected void setContentType(String type)
type - the content type of this partpublic String getDisposition()
public void setDisposition(String disposition)
disposition - the disposition of this partpublic int getSize()
public Object getContent()
public void setText(String text)
text - the plain text content of this part.
public void setContent(String text,
String type)
text - the plain text content of this part.type - the MIME type of this part.
public void setContent(File file,
String name,
String description)
throws MessagingException
file - the File to attach content fromname - the name of the filedescription - the description of the file
MessagingExceptionpublic javax.activation.DataHandler getDataHandler()
public void setDataHandler(javax.activation.DataHandler dh)
throws MessagingException
Therefore, if you call setDataHandler / getDataHandler you will get two distinct DataHandlers, one for the input data and one for the internal byte array that holds the content.
dh - the DataHandler for this part's content
MessagingException
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||