com.arsdigita.forum
Class Post

java.lang.Object
  extended bycom.arsdigita.domain.DomainObject
      extended bycom.arsdigita.domain.ObservableDomainObject
          extended bycom.arsdigita.kernel.ACSObject
              extended bycom.arsdigita.messaging.Message
                  extended bycom.arsdigita.messaging.ThreadedMessage
                      extended bycom.arsdigita.forum.Post
All Implemented Interfaces:
com.arsdigita.util.MessageType, com.arsdigita.messaging.MessageType

public class Post
extends com.arsdigita.messaging.ThreadedMessage

A Post represents a single posting to a discussion forum.

Author:
Kevin Scaldeferri (kevin@arsdigita.com), Nobuko Asakai (nasakai@redhat.com)

Field Summary
static String APPROVED
           
static String BASE_DATA_OBJECT_TYPE
           
static String MODERATOR
          ID of the administrator who last changed the status of a message
static String PENDING
          The status strings
static String POST_STATUS_SUBQUERY
           
static String REAPPROVE
           
static String REJECTED
           
static String STATUS
          PDL property for marking the approval state of a message, one of 'approved', 'rejected', 'reapprove', 'supressed'
static String SUPPRESSED
           
 
Fields inherited from class com.arsdigita.messaging.Message
BODY, INREPLYTO, MESSAGE_ID, MESSAGE_PART, OBJECT_ID, REPLY_TO, SENDER, SENT, SUBJECT, 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
  Post(com.arsdigita.persistence.DataObject obj)
           
  Post(com.arsdigita.persistence.OID oid)
           
protected Post(String typeName)
           
 
Method Summary
protected  void afterSave()
           
protected  void beforeDelete()
           
protected  void beforeSave()
          Sets the Message-ID header to <id>.bboard@somehost.com before saving.
 boolean canEdit(com.arsdigita.kernel.Party party)
          Determines if the User has permission to edit this Post.
 void clearCategories()
          Clears categories for this post.
static Post create(Forum forum)
          Creates a new Posting in a form.
static Post create(Forum forum, String status)
          Creates a new Posting in a form.
 void createThreadSubscription()
          creates a ThreadSubscription, but only if this is a root Note, you must save() the Post before calling this method.
protected  String getBaseDataObjectType()
           
 com.arsdigita.categorization.CategoryCollection getCategories()
          Gets the categories to which this post is assigned
 Forum getForum()
           
 com.arsdigita.kernel.Party getModerator()
           
 String getStatus()
           
 void mapCategory(com.arsdigita.categorization.Category category)
          Map this post to a category.
 com.arsdigita.messaging.ThreadedMessage newInstance()
           
 Post replyToPost()
          Deprecated. use replyTo() instead
 void sendModeratorAlerts()
          Send alerts to moderators.
 void sendNotifications()
          Sends out the notifications for any subscriptions to the forum or thread to which this message belongs.
 void setForum(Forum forum)
          Set the Forum that contains this post.
 void setModerator(com.arsdigita.kernel.Party moderator)
           
 void setStatus(String status)
           
protected  void setup(Forum forum, String status)
           
 
Methods inherited from class com.arsdigita.messaging.ThreadedMessage
getDepth, getNumReplies, getRoot, getRootMsg, getSortKey, getThread, replyTo, replyTo, replyTo, setRoot, setSortKey
 
Methods inherited from class com.arsdigita.messaging.Message
attach, attach, attach, attach, doWriteCheck, generateHTMLText, getAttachmentCount, getAttachments, getBody, getBodyAsHTML, getBodyType, getContainer, getDisplayName, getFrom, getMessageID, getRefersTo, getReplyInfo, getReplyTo, getRFCMessageID, getSentDate, getSubject, isContainerModified, isMimeType, reply, setBody, setFrom, setRefersTo, setRefersTo, setReplyTo, setRFCMessageID, setSentDate, setSubject, setText
 
Methods inherited from class com.arsdigita.kernel.ACSObject
assertPrivilege, checkPrivilege, doCreateCheck, 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, 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

STATUS

public static final String STATUS
PDL property for marking the approval state of a message, one of 'approved', 'rejected', 'reapprove', 'supressed'

See Also:
Constant Field Values

MODERATOR

public static final String MODERATOR
ID of the administrator who last changed the status of a message

See Also:
Constant Field Values

PENDING

public static final String PENDING
The status strings

See Also:
Constant Field Values

APPROVED

public static final String APPROVED
See Also:
Constant Field Values

REJECTED

public static final String REJECTED
See Also:
Constant Field Values

REAPPROVE

public static final String REAPPROVE
See Also:
Constant Field Values

SUPPRESSED

public static final String SUPPRESSED
See Also:
Constant Field Values

POST_STATUS_SUBQUERY

public static final String POST_STATUS_SUBQUERY
See Also:
Constant Field Values

BASE_DATA_OBJECT_TYPE

public static final String BASE_DATA_OBJECT_TYPE
See Also:
Constant Field Values
Constructor Detail

Post

protected Post(String typeName)

Post

public Post(com.arsdigita.persistence.OID oid)
     throws com.arsdigita.domain.DataObjectNotFoundException

Post

public Post(com.arsdigita.persistence.DataObject obj)
Method Detail

create

public static Post create(Forum forum)
Creates a new Posting in a form. If the forum is moderated, then the post's status will be set to PENDING, otherwise it will be set to APPROVED

Parameters:
forum - the owner forum

create

public static Post create(Forum forum,
                          String status)
Creates a new Posting in a form. The approval status will be set as specified.

Parameters:
forum - the owner forum
status - the approval status

setup

protected void setup(Forum forum,
                     String status)

getBaseDataObjectType

protected String getBaseDataObjectType()

replyToPost

public Post replyToPost()
Deprecated. use replyTo() instead


newInstance

public com.arsdigita.messaging.ThreadedMessage newInstance()

beforeSave

protected void beforeSave()
Sets the Message-ID header to <id>.bboard@somehost.com before saving.


afterSave

protected void afterSave()

sendNotifications

public void sendNotifications()
Sends out the notifications for any subscriptions to the forum or thread to which this message belongs. Only sends notificatios if the post is approved.


sendModeratorAlerts

public void sendModeratorAlerts()
Send alerts to moderators. No-op if moderation is not turned on for the forum.


setForum

public void setForum(Forum forum)
Set the Forum that contains this post. Just a wrapper for the setRefersTo method of ThreadedMessage to make the notation a bit nicer.

Parameters:
forum - the Forum that contains this post.

getForum

public Forum getForum()

mapCategory

public void mapCategory(com.arsdigita.categorization.Category category)
                 throws com.arsdigita.persistence.PersistenceException
Map this post to a category. Creates a mapping saves it immediately. Throws a PersistenceException if called on a Post object that has not been saved.

Parameters:
category - the Category for this post.
Throws:
com.arsdigita.persistence.PersistenceException

clearCategories

public void clearCategories()
Clears categories for this post. Used when editing a post


getCategories

public com.arsdigita.categorization.CategoryCollection getCategories()
Gets the categories to which this post is assigned


createThreadSubscription

public void createThreadSubscription()
creates a ThreadSubscription, but only if this is a root Note, you must save() the Post before calling this method.


canEdit

public boolean canEdit(com.arsdigita.kernel.Party party)
Determines if the User has permission to edit this Post. Note that you probably don't want to use this over and over for a list of messages because the permission check on the forum is not cached.


setStatus

public void setStatus(String status)

getStatus

public String getStatus()

setModerator

public void setModerator(com.arsdigita.kernel.Party moderator)

getModerator

public com.arsdigita.kernel.Party getModerator()

beforeDelete

protected void beforeDelete()


Copyright (c) 2004 Red Hat, Inc. Corporation. All Rights Reserved. Generated at July 21 2004:2348 UTC