com.atlassian.confluence.content
Class CustomContentEntityObject

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.AbstractLabelableEntityObject
                  extended by com.atlassian.confluence.core.ContentEntityObject
                      extended by com.atlassian.confluence.core.SpaceContentEntityObject
                          extended by com.atlassian.confluence.content.CustomContentEntityObject
All Implemented Interfaces:
com.atlassian.bonnie.Searchable, Content, Addressable, ContentTypeAware, Versioned, EditableLabelable, Labelable, Spaced, Serializable, Cloneable, Comparable

public class CustomContentEntityObject
extends SpaceContentEntityObject

Generic ContentEntityObject that plugins can use to extend Confluence's content system.

See Also:
Serialized Form

Field Summary
static String CONTENT_TYPE
           
 
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 CustomContentEntityObject()
          Protected.
 
Method Summary
 void convertToHistoricalVersion()
          Remove all data from the object that does not need to be saved by historical versions.
 String getAttachmentsUrlPath()
           
 String getAttachmentUrlPath(Attachment attachment)
          Gets the path relative to Confluence's base URL to view the given attachment in the context of this content (for example, highlighted in the content's list of attachments).
 BodyType getDefaultBodyType()
           
 String getDisplayTitle()
          Returns the display title.
 String getExcerpt()
           
 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.
 String getPluginModuleKey()
           
 String getPluginVersion()
           
 ContentProperties getProperties()
           
 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.
 String getUrlPath()
           
 void setAdapter(ContentEntityAdapter adapter)
           
 void setPluginModuleKey(String pluginModuleKey)
           
 void setPluginVersion(String pluginVersion)
           
 String toString()
           
 
Methods inherited from class com.atlassian.confluence.core.SpaceContentEntityObject
addTrackbackLink, getSpace, getSpaceKey, hashCode, isIndexable, isInSpace, setSpace
 
Methods inherited from class com.atlassian.confluence.core.ContentEntityObject
addAttachment, addComment, addOutgoingLink, addPermission, addReferralLink, clone, compareTo, ensureAttachmentBelongsToContent, equals, getAttachmentNamed, getAttachments, getBodyAsString, getBodyAsStringWithoutMarkup, getBodyContent, getBodyContent, getBodyContents, getComments, getContentPermission, getContentPermissionSet, getContentStatus, getEntity, getIdAsString, getLatestVersionsOfAttachments, getOutgoingLinks, getPermissions, getReferralLinks, getRenderedVersionComment, getSearchableDependants, getTitle, getTrackbackLinks, getTypeEnum, getUserAccessor, getVersionComment, hasContentPermissions, hasPermissions, isCurrent, isDeleted, isRecentlyUpdatedFor, isVersionCommentAvailable, removeAttachment, removeComment, removeContentPermissionSet, removeOutgoingLink, removeReferralLink, removeTrackbackLink, setAttachments, setBodyAsString, setBodyContent, setBodyContents, setComments, setContent, setContentStatus, setOutgoingLinks, setReferralLinks, setTitle, setTrackbackLinks, setUserAccessor, setVersionComment, toPageContext, trash
 
Methods inherited from class com.atlassian.confluence.core.AbstractLabelableEntityObject
addLabelling, getGlobalLabels, getLabelCount, getLabellings, getLabels, getLabelsForDisplay, getLabelUtil, getPersonalLabels, getTeamLabels, getVisibleLabels, isFavourite, removeLabelling, setLabellings
 
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
 
Methods inherited from interface com.atlassian.confluence.labels.EditableLabelable
getId, isPersistent
 

Field Detail

CONTENT_TYPE

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

CustomContentEntityObject

protected CustomContentEntityObject()
Protected. If you want a new CustomContentEntityObject, get it from the CustomContentManager

Method Detail

getType

public 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 ContentTypeAware
Specified by:
getType in class ContentEntityObject
Returns:
the content type

getUrlPath

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

getDisplayTitle

public String getDisplayTitle()
Description copied from class: ContentEntityObject
Returns the display title. Some entities don't have titles for identification. For example, personal information objects use the user's fullname. Override this method to provide a custom title.

Specified by:
getDisplayTitle in interface Addressable
Overrides:
getDisplayTitle in class ContentEntityObject
Returns:
the display title

getNameForComparison

public 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

getAttachmentUrlPath

public String getAttachmentUrlPath(Attachment attachment)
Description copied from class: ContentEntityObject
Gets the path relative to Confluence's base URL to view the given attachment in the context of this content (for example, highlighted in the content's list of attachments). Generally you will want to call Attachment.getUrlPath() instead of this method: if we ever implement view pages for individual attachments, that's the method that will be changed to point to them. The default implementation just returns the view page for this content.

Overrides:
getAttachmentUrlPath in class ContentEntityObject
Parameters:
attachment - one of this content's attachments
Returns:
the path relative to the base url to view the attachment in the context of this content.

getAttachmentsUrlPath

public String getAttachmentsUrlPath()
Overrides:
getAttachmentsUrlPath in class ContentEntityObject

getExcerpt

public String getExcerpt()
Overrides:
getExcerpt in class ContentEntityObject

getDefaultBodyType

public BodyType getDefaultBodyType()
Overrides:
getDefaultBodyType in class ContentEntityObject

getPluginModuleKey

public String getPluginModuleKey()

setPluginModuleKey

public void setPluginModuleKey(String pluginModuleKey)

getPluginVersion

public String getPluginVersion()

setPluginVersion

public void setPluginVersion(String pluginVersion)

getProperties

public ContentProperties getProperties()

setAdapter

public void setAdapter(ContentEntityAdapter adapter)

convertToHistoricalVersion

public void convertToHistoricalVersion()
Description copied from interface: Versioned
Remove all data from the object that does not need to be saved by historical versions. For versioned objects that are persisted, this includes removing associations with other persisted objects that may otherwise cause us to break the expected arity of the database relations.

When using Hibernate to persist versioned objects, take special care to null any field that might contain a Hibernate-persisted collection, as Hibernate does not allow two different persistent objects to refer to the same persisted collection at the same time.

Specified by:
convertToHistoricalVersion in interface Versioned
Overrides:
convertToHistoricalVersion in class SpaceContentEntityObject

toString

public String toString()
Overrides:
toString in class ContentEntityObject


Copyright © 2003-2013 Atlassian. All Rights Reserved.