|
|||||||||||
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.kernel.ACSObject
com.arsdigita.messaging.Message
A plain text message with optional attachments. The message body should have a MIME type of text/plain or text/html. Each attachment to the message can have an arbitrary MIME type and format. Messages can also refer to another object on the system, and in this way be attached to ContentItems, bboard forums, etc.
Field Summary | |
static String |
BASE_DATA_OBJECT_TYPE
Base DataObject type |
static String |
BODY
|
static String |
INREPLYTO
|
static String |
MESSAGE_ID
|
static String |
MESSAGE_PART
|
static String |
OBJECT_ID
|
static String |
REPLY_TO
|
static String |
SENDER
Keys for persistent data. |
static String |
SENT
|
static String |
SUBJECT
|
static String |
TYPE
|
Fields inherited from class com.arsdigita.kernel.ACSObject |
CONTAINER, DEFAULT_DOMAIN_CLASS, DISPLAY_NAME, ID, OBJECT_TYPE, versionId |
Fields inherited from interface com.arsdigita.util.MessageType |
TEXT_HTML, TEXT_PLAIN, TEXT_PREFORMATTED, TEXT_SMART |
Constructor Summary | |
Message()
Creates a new message with the sentDate initialized to the current time, but leaves all other parameters null. |
|
Message(BigDecimal id)
Creates a message by retrieving it from the database using its id. |
|
Message(DataObject dataObject)
Creates a message from its underlying data object. |
|
Message(OID oid)
Creates a message by retrieving it from the database using its OID. |
|
Message(Party f,
String s)
Creates a message from a party with a given subject. |
|
Message(Party f,
String s,
String b)
Creates a message from a party with a given subject and body. |
|
Message(String type)
Creates a new message of the specified data object type. |
Method Summary | |
protected void |
afterSave()
|
void |
attach(MessagePart part)
Attaches a MessagePart to this message. |
void |
attach(String text,
String name)
Adds a text/plain attachment to a message with a given name and a disposition of MessagePart.ATTACHMENT. |
void |
attach(String text,
String name,
String description)
Adds a text/plain attachment with the given name and description to a message, with a disposition of MessagePart.ATTACHMENT. |
void |
attach(String text,
String name,
String description,
String disposition)
Adds a text/plain attachment with the given name, description and disposition to a message. |
void |
doWriteCheck()
Allow writes if user has read on the parent (forum). |
static String |
generateHTMLText(String text,
String formatType)
Deprecated. Use com.arsdigita.util.HtmlToText.generateHTMLText. |
int |
getAttachmentCount()
Returns the number of items attached to this message. |
ListIterator |
getAttachments()
Returns an iterator over the attachments for this message. |
String |
getBody()
Returns the content of the message as a String. |
String |
getBodyAsHTML()
This returns the body in a form that can be displayed directly as HTML. |
String |
getBodyType()
Returns the MIME type of the message body. |
ACSObject |
getContainer()
Returns the Container for this Message. |
String |
getDisplayName()
Returns the name of the message |
Party |
getFrom()
Gets the sender of the message. |
BigDecimal |
getMessageID()
Deprecated. Use getID in place of getMessageID |
BigDecimal |
getRefersTo()
Returns the ID of an ACSObject which this message refers to. |
protected void |
getReplyInfo(Message msg)
Copies the necessary reply information from a parent message to this one. |
String |
getReplyTo()
Gets the return email address of the message. |
String |
getRFCMessageID()
Return the RFC 822 Message-ID header for this message. |
Date |
getSentDate()
Returns the date this message was sent. |
String |
getSubject()
Gets the subject of the message. |
boolean |
isContainerModified()
Returns true if this object has been moved to a new container, or null if the container has not changed. |
boolean |
isMimeType(String mimeType)
Returns true if this message is of the specified
MIME type. |
Message |
reply()
Gets a new message that is suitable for a reply to this message. |
void |
setBody(String body,
String type)
Sets the body of the message to the given string with the specified MIME type. |
void |
setFrom(Party f)
Sets the sender of the message. |
void |
setRefersTo(ACSObject obj)
Sets the ACSObject which this message refers to. |
void |
setRefersTo(BigDecimal id)
Sets the ID of an ACSObject which this message refers to. |
void |
setReplyTo(String addr)
Sets the return email address of the message. |
void |
setRFCMessageID(String messageID)
Set RFC 822 Message-ID header for this message. |
void |
setSentDate(Date sentDate)
Sets the sent date of a message. |
void |
setSubject(String s)
Sets the subject of the message. |
void |
setText(String text)
A convenience method that sets the body of the message to a string with a MIME type of "text/plain". |
Methods inherited from class com.arsdigita.kernel.ACSObject |
assertPrivilege, beforeSave, checkPrivilege, doCreateCheck, getBaseDataObjectType, getDefaultDomainClass, getID, getSpecificObjectType, getSpecificOID, gimmeContainer, initialize, setID, setID |
Methods inherited from class com.arsdigita.domain.ObservableDomainObject |
addObserver, getObservers |
Methods inherited from class com.arsdigita.domain.DomainObject |
add, add, addToAssociation, afterDelete, beforeDelete, clear, delete, disconnect, equals, get, getObjectType, getOID, getSession, hashCode, 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 SENDER
public static final String REPLY_TO
public static final String SUBJECT
public static final String BODY
public static final String TYPE
public static final String SENT
public static final String INREPLYTO
public static final String OBJECT_ID
public static final String MESSAGE_ID
public static final String MESSAGE_PART
Constructor Detail |
public Message()
public Message(String type)
type
- the DataObject type.public Message(Party f, String s)
f
- the party sending the messages
- the subject of the messagepublic Message(Party f, String s, String b)
f
- the party sending the messages
- the subject of the messageb
- the plain-text body of the messagepublic Message(DataObject dataObject)
dataObject
- the DataObject representing this message.public Message(BigDecimal id) throws DataObjectNotFoundException
id
- the id of the messagepublic Message(OID oid) throws DataObjectNotFoundException
oid
- the OID of the messageMethod Detail |
protected void getReplyInfo(Message msg)
msg
- the message to generate reply information frompublic String getDisplayName()
getDisplayName
in class ACSObject
public Message reply() throws MessagingException
MessagingException
public String getSubject()
public void setSubject(String s)
s
- the subjectpublic void setFrom(Party f)
f
- the party sending the messagepublic Party getFrom()
public void setReplyTo(String addr)
addr
- reply address.public String getReplyTo()
public String getBody()
public String getBodyAsHTML()
public void setBody(String body, String type)
MessageType
interface:
body
- the body of the messagetype
- the MIME typepublic void setText(String text)
public String getBodyType()
public boolean isMimeType(String mimeType)
true
if this message is of the specified
MIME type. Only compares the primary type and subtype, and
ignore any additional qualifiers.
true
if this message is of the specified
MIME type; false
otherwise.public Date getSentDate()
public void setSentDate(Date sentDate)
sentDate
- the date the message was sentpublic BigDecimal getRefersTo()
public void setRefersTo(BigDecimal id)
id
- the ID of the ACSObject this message refers to.public void setRefersTo(ACSObject obj)
obj
- the ACSObject this message refers to.public String getRFCMessageID()
public void setRFCMessageID(String messageID)
public void attach(String text, String name)
text
- the content of the attachmentname
- the name of the attachmentpublic void attach(String text, String name, String description)
text
- the content of the attachmentname
- the name of the attachmentdescription
- a description of the attachmentpublic void attach(String text, String name, String description, String disposition)
text
- the content of the attachmentname
- the name of the attachmentdescription
- a description of the attachmentpublic void attach(MessagePart part)
part
- the MessagePart to attachpublic int getAttachmentCount()
public ListIterator getAttachments()
public BigDecimal getMessageID()
public ACSObject getContainer()
getContainer
in class ACSObject
public void doWriteCheck()
doWriteCheck
in class ACSObject
public boolean isContainerModified()
ACSObject
com.arsdigita.persistence.metadata.Property.isComposite()==true
),
then we check whether the composite role property has been modified.
If no composite role is found, then the return value is false.
Subclasses should provide their own implementations if the metadata
driven default implementation is inadequate. See the example
mentioned in getContainer().
isContainerModified
in class ACSObject
ACSObject.getContainer()
public static String generateHTMLText(String text, String formatType)
protected void afterSave()
afterSave
in class DomainObject
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |