org.liquidsite.core.content
Class ContentPost

java.lang.Object
  extended byorg.liquidsite.core.content.PersistentObject
      extended byorg.liquidsite.core.content.Content
          extended byorg.liquidsite.core.content.ContentPost

public class ContentPost
extends Content

A discussion forum post.


Field Summary
static int PLAIN_TEXT_TYPE
          The plain text type constant.
static int TAGGED_TEXT_TYPE
          The tagged text type constant.
 
Fields inherited from class org.liquidsite.core.content.Content
DOCUMENT_CATEGORY, FILE_CATEGORY, FOLDER_CATEGORY, FORUM_CATEGORY, NAME_CHARS, PAGE_CATEGORY, POST_CATEGORY, SECTION_CATEGORY, SITE_CATEGORY, TEMPLATE_CATEGORY, TOPIC_CATEGORY, TRANSLATOR_CATEGORY
 
Fields inherited from class org.liquidsite.core.content.PersistentObject
BINDERS, LOWER_CASE, NUMBERS, UPPER_CASE
 
Constructor Summary
protected ContentPost(ContentManager manager, ContentData data, DataSource src)
          Creates a new post.
  ContentPost(ContentManager manager, ContentTopic parent)
          Creates a new post with default values.
 
Method Summary
protected  void doInsert(DataSource src, User user, boolean restore)
          Inserts the object data into the database.
protected  void doValidate()
          Validates the object data before writing to the database.
 java.lang.String getSubject()
          Returns the post subject.
 java.lang.String getText()
          Returns the post text.
 int getTextType()
          Returns the post text type.
 void setName(java.lang.String name)
          Sets the post name.
 void setSubject(java.lang.String subject)
          Sets the post subject.
 void setText(java.lang.String text)
          Sets the post text.
 void setTextType(int type)
          Sets the post text type.
 
Methods inherited from class org.liquidsite.core.content.Content
deleteRevision, doDelete, doUpdate, equals, equals, getAllRevisions, getAttribute, getAttributeNames, getAuthor, getAuthorName, getCategory, getComment, getDomain, getDomainName, getId, getLock, getMaxRevisionNumber, getModifiedDate, getName, getOfflineDate, getOnlineDate, getParent, getParentId, getPermissions, getRevision, getRevisionNumber, isLatestRevision, isOnline, isPublishedRevision, setAttribute, setAuthorName, setComment, setId, setModifiedDate, setOfflineDate, setOnlineDate, setParent, setParentId, setRevisionNumber, toString
 
Methods inherited from class org.liquidsite.core.content.PersistentObject
decodeMap, delete, delete, encodeMap, getContentManager, hasAdminAccess, hasPublishAccess, hasReadAccess, hasWriteAccess, isPersistent, restore, restore, save, save, validateChars, validateSize
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PLAIN_TEXT_TYPE

public static final int PLAIN_TEXT_TYPE
The plain text type constant. This text type is used for text without other formatting than linebreaks. All text will appear just as typed and may be escaped depending on output media.

See Also:
Constant Field Values

TAGGED_TEXT_TYPE

public static final int TAGGED_TEXT_TYPE
The tagged text type constant. This text type is used for text with simplified tag formatting, similar to the tagged text used document properties.

See Also:
Constant Field Values
Constructor Detail

ContentPost

public ContentPost(ContentManager manager,
                   ContentTopic parent)
            throws ContentException
Creates a new post with default values.

Parameters:
manager - the content manager to use
parent - the parent content topic
Throws:
ContentException - if the database couldn't be accessed properly

ContentPost

protected ContentPost(ContentManager manager,
                      ContentData data,
                      DataSource src)
               throws ContentException
Creates a new post.

Parameters:
manager - the content manager to use
data - the content data object
src - the data source to use
Throws:
ContentException - if the database couldn't be accessed properly
Method Detail

setName

public void setName(java.lang.String name)
Sets the post name. The post name must be numeric and strictly increasing. If no name is set one will be assigned automatically upon insertion in the database. Post names should NEVER be changed.

Overrides:
setName in class Content
Parameters:
name - the new name

getSubject

public java.lang.String getSubject()
Returns the post subject.

Returns:
the post subject

setSubject

public void setSubject(java.lang.String subject)
Sets the post subject.

Parameters:
subject - the new post subject

getText

public java.lang.String getText()
Returns the post text.

Returns:
the post text

setText

public void setText(java.lang.String text)
Sets the post text.

Parameters:
text - the new post text

getTextType

public int getTextType()
Returns the post text type.

Returns:
the post text type
See Also:
PLAIN_TEXT_TYPE, TAGGED_TEXT_TYPE

setTextType

public void setTextType(int type)
Sets the post text type.

Parameters:
type - the new post text type
See Also:
PLAIN_TEXT_TYPE, TAGGED_TEXT_TYPE

doValidate

protected void doValidate()
                   throws ContentException
Validates the object data before writing to the database.

Overrides:
doValidate in class Content
Throws:
ContentException - if the object data wasn't valid

doInsert

protected void doInsert(DataSource src,
                        User user,
                        boolean restore)
                 throws ContentException
Inserts the object data into the database. If the restore flag is set, no automatic changes should be made to the data before writing to the database.

Overrides:
doInsert in class Content
Parameters:
src - the data source to use
user - the user performing the operation
restore - the restore flag
Throws:
ContentException - if the database couldn't be accessed properly