com.atlassian.confluence.content
Class DefaultContent

java.lang.Object
  extended by com.atlassian.core.bean.EntityObject
      extended by com.atlassian.confluence.core.ConfluenceEntityObject
          extended by com.atlassian.confluence.core.AbstractVersionedEntityObject
              extended by com.atlassian.confluence.core.ContentEntityObject
                  extended by com.atlassian.confluence.core.SpaceContentEntityObject
                      extended by com.atlassian.confluence.content.DefaultContent
All Implemented Interfaces:
com.atlassian.bonnie.Searchable, Content, Addressable, ContentTypeAware, Versioned, Labelable, Spaced, java.io.Serializable, java.lang.Cloneable, java.lang.Comparable

public class DefaultContent
extends SpaceContentEntityObject
implements Content

Default implementation of Content.

Note: This class implements SpaceContentEntityObject for the time being. This introduces some empty implementations of methods such as getSpace(). These implementations are explicitly defined to keep an eye on what is being used from the ContentEntityObject implementation so we know what we will need to (eventualy) implement.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.atlassian.confluence.core.ContentEntityObject
CREATED, CURRENT, DELETED, MODIFIED
 
Fields inherited from class com.atlassian.confluence.core.AbstractVersionedEntityObject
INITIAL_VERSION
 
Constructor Summary
protected DefaultContent()
          This exists only for hibernate.
  DefaultContent(ContentType contentType)
           
 
Method Summary
 Content getContainer()
          Get the container for this content.
 ContentType getContentType()
          Get the type of the content.
 java.util.List getLabels()
          Retrieve the labels that are associated with this object.
 java.lang.String getNameForComparison()
          Subclasses should implement this method, giving a String back so that the content can be alphabetically sorted in a mixed-type list of content-entities.
 Content getParent()
          Get the parent content of this content.
 Space getSpace()
          Get the space that the content belongs to
 java.lang.String getStatus()
          Get the status of the content, this can be used to allow/deny access/viewing of contents.
 java.lang.String getText()
          Get the text data of this content.
 java.lang.String getTitle()
          Get the title of this content.
 java.lang.String getType()
          An easy name for the type of this content: makes it easy for things like the #contentLink macro to work out what to draw.
 java.lang.String getUrlPath()
           
 void setParent(Content parent)
          Sets the parent of this content.
 void setSpace(Space space)
          Set the space this content belongs to
 void setStatus(java.lang.String status)
          Set ths status of this content.
 void setText(java.lang.String text)
          Sets the text data of this content.
 void setTitle(java.lang.String title)
          Sets the title of this content.
 
Methods inherited from class com.atlassian.confluence.core.SpaceContentEntityObject
addTrackbackLink, convertToHistoricalVersion, getSpaceKey, hashCode, isIndexable, isInSpace
 
Methods inherited from class com.atlassian.confluence.core.ContentEntityObject
addAttachment, addLabelling, addOutgoingLink, addPermission, addReferralLink, clone, compareTo, equals, getAttachmentNamed, getAttachments, getAttachmentsUrlPath, getBodyContents, getContent, getContentPermission, getContentPermissionSet, getContentStatus, getDisplayTitle, getExcerpt, getGlobalLabels, getIdAsString, getLabelCount, getLabellings, getLabelsForDisplay, getLabelUtil, getLatestVersionsOfAttachments, getOutgoingLinks, getPermissions, getPersonalLabels, getRealTitle, getReferralLinks, getRenderedVersionComment, getSearchableDependants, getTrackbackLinks, getUserAccessor, getVersionComment, getVisibleLabels, hasContentPermissions, hasPermissions, isCurrent, isDeleted, isFavourite, isRecentlyUpdatedFor, isVersionCommentAvailable, removeAttachment, removeContentPermissionSet, removeLabelling, removeOutgoingLink, removeReferralLink, removeTrackbackLink, setAttachments, setBodyContents, setContent, setContentStatus, setOutgoingLinks, setReferralLinks, setTrackbackLinks, setUserAccessor, setVersionComment, toPageContext, toString, trash
 
Methods inherited from class com.atlassian.confluence.core.AbstractVersionedEntityObject
getLatestVersion, getOriginalVersion, getVersion, isLatestVersion, isNew, setOriginalVersion, setVersion
 
Methods inherited from class com.atlassian.confluence.core.ConfluenceEntityObject
getCreatorName, getLastModifierName, getRealClass, isPersistent, setCreatorName, setLastModifierName
 
Methods inherited from class com.atlassian.core.bean.EntityObject
getCreationDate, getCurrentDate, getId, getLastModificationDate, setClock, setCreationDate, setId, setLastModificationDate
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.atlassian.bonnie.Searchable
getId
 
Methods inherited from interface com.atlassian.confluence.core.Addressable
getId
 

Constructor Detail

DefaultContent

protected DefaultContent()
This exists only for hibernate.


DefaultContent

public DefaultContent(ContentType contentType)
Method Detail

getTitle

public java.lang.String getTitle()
Description copied from interface: Content
Get the title of this content.

Specified by:
getTitle in interface Content
Overrides:
getTitle in class ContentEntityObject
Returns:
the String representation ot the content's title.

setTitle

public void setTitle(java.lang.String title)
Description copied from interface: Content
Sets the title of this content.

Specified by:
setTitle in interface Content
Overrides:
setTitle in class ContentEntityObject
Parameters:
title - the title of this content

getSpace

public Space getSpace()
Description copied from interface: Content
Get the space that the content belongs to

Specified by:
getSpace in interface Content
Specified by:
getSpace in interface Spaced
Overrides:
getSpace in class SpaceContentEntityObject
Returns:
Space the space which the content belongs to.

setSpace

public void setSpace(Space space)
Description copied from interface: Content
Set the space this content belongs to

Specified by:
setSpace in interface Content
Overrides:
setSpace in class SpaceContentEntityObject
Parameters:
space - the new space

getLabels

public java.util.List getLabels()
Description copied from interface: Labelable
Retrieve the labels that are associated with this object.

Specified by:
getLabels in interface Content
Specified by:
getLabels in interface Labelable
Overrides:
getLabels in class ContentEntityObject
Returns:
a list of label instances.

getType

public java.lang.String getType()
Description copied from class: ContentEntityObject
An easy name for the type of this content: makes it easy for things like the #contentLink macro to work out what to draw.

This is a bit of a hack, but it saves heaps of code elsewhere, especially since we tend to get back these objects wrapped in all sorts of Hibernate CGLIB stuff.

Specified by:
getType in interface Content
Specified by:
getType in interface ContentTypeAware
Specified by:
getType in class ContentEntityObject
Returns:
the content type

getUrlPath

public java.lang.String getUrlPath()
Specified by:
getUrlPath in interface Addressable
Specified by:
getUrlPath in class ContentEntityObject

getNameForComparison

public java.lang.String getNameForComparison()
Description copied from class: ContentEntityObject
Subclasses should implement this method, giving a String back so that the content can be alphabetically sorted in a mixed-type list of content-entities.

Overrides:
getNameForComparison in class SpaceContentEntityObject

getParent

public Content getParent()
Description copied from interface: Content

Get the parent content of this content. If the content doesn't have any parent then null will be returned.

Examples of parent/child relationship can be a page and a comment, where the comment has the page as a parent, but if you reply to a comment then its 'direct' parent will be the comment it is replying to.

Specified by:
getParent in interface Content
Returns:
the parent Content of this content. null if this content doesn't have a parent.

setParent

public void setParent(Content parent)
Description copied from interface: Content
Sets the parent of this content. Set this to null to indicate this content has no parent.

Specified by:
setParent in interface Content
Parameters:
parent - the new parent of this content
See Also:
Content.getParent()

getStatus

public java.lang.String getStatus()
Description copied from interface: Content

Get the status of the content, this can be used to allow/deny access/viewing of contents.

For example a page could be 'deleted' and therefore not be visible (except from the trash), a blogpost could have a status 'pending' and not be visible except by the author.

Specified by:
getStatus in interface Content
Returns:
the String representation of the content's status.

setStatus

public void setStatus(java.lang.String status)
Description copied from interface: Content
Set ths status of this content.

Specified by:
setStatus in interface Content
Parameters:
status - the new status

getContainer

public Content getContainer()
Description copied from interface: Content

Get the container for this content.

The container represents the closest parent that is of a different ContentType. For example, a comment, no matter how deeply threaded, has its page as a container.

Specified by:
getContainer in interface Content
Returns:
The Content that 'contains' this content. null if this content has no container.

getContentType

public ContentType getContentType()
Description copied from interface: Content

Get the type of the content.

The ContentType allow implementation of the strategy pattern. One can retrieve some (if not all) of a specific content behavior through the ContentType.

Specified by:
getContentType in interface Content
Returns:
the ContentType of this content.

getText

public java.lang.String getText()
Description copied from interface: Content

Get the text data of this content.

This should never return null

Specified by:
getText in interface Content
Returns:
the text data of this content. It will return an empty string if no text data has been set.
See Also:
Content.setText(String)

setText

public void setText(java.lang.String text)
Description copied from interface: Content

Sets the text data of this content.

Specified by:
setText in interface Content
Parameters:
text - the text to set this content to
See Also:
Content.getText()


Copyright © 2003-2009 Atlassian Pty Ltd. All Rights Reserved.