Package com.atlassian.confluence.content
Class DefaultContentAdapter
java.lang.Object
com.atlassian.confluence.content.DefaultContentAdapter
- All Implemented Interfaces:
ContentEntityAdapter
This gets set on content if the plugin content adapter for that content type can't be found (it's broken,
disabled or deleted)
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionattachmentsUrlPath
(CustomContentEntityObject pluginContentEntityObject) Return the URL path to view the list of attachments on the contentattachmentUrlPath
(CustomContentEntityObject pluginContentEntityObject, Attachment attachment) Return the URL path to view the a particular attachment of the contentdisplayTitle
(CustomContentEntityObject pluginContentEntityObject) Gets the display-friendly title for the content.excerpt
(CustomContentEntityObject pluginContentEntityObject) Get a text-only summary of the content that is suitable for use in activity streams, search results and other places where a short placeholder for the content is necessary.getDefaultBodyType
(CustomContentEntityObject pluginContentEntityObject) Get the default type for BodyContent objects attached to this content.getVersionChildPolicy
(ContentType contentType) This will be called byVersioned.getVersionChildPolicy(com.atlassian.confluence.api.model.content.ContentType)
to determine the policy to be used when saving the CCEO.boolean
isAllowedContainer
(ContentEntityObject child, ContentEntityObject owner) Determine if a particular content is an acceptable container for a particular child.boolean
isAllowedParent
(CustomContentEntityObject child, CustomContentEntityObject parent) Determine if a particular content is an acceptable parent for this content.boolean
isIndexable
(CustomContentEntityObject pluginContentEntityObject, boolean isDefaultIndexable) Determine if a particular content should be indexed.nameForComparison
(CustomContentEntityObject pluginContentEntityObject) Return the sorting-friendly title for the content, if the content is to be sorted in alphabetical order.boolean
shouldConvertToContent
(CustomContentEntityObject pluginContentEntityObject) Determine if a particular content is going to be part of the core API.urlPath
(CustomContentEntityObject pluginContentEntityObject) Gets the URL string (relative to the Confluence application context) at which this content can be viewed.
-
Field Details
-
INSTANCE
-
-
Method Details
-
urlPath
Description copied from interface:ContentEntityAdapter
Gets the URL string (relative to the Confluence application context) at which this content can be viewed.- Specified by:
urlPath
in interfaceContentEntityAdapter
- Parameters:
pluginContentEntityObject
- the content to be viewed- Returns:
- url path to view the content
-
displayTitle
Description copied from interface:ContentEntityAdapter
Gets the display-friendly title for the content. For example, a Comment does not have a title of its own, but where the UI needs to display the title of a comment, it uses "Re: Title Of Page Being Commented On".- Specified by:
displayTitle
in interfaceContentEntityAdapter
- Parameters:
pluginContentEntityObject
- the content to be displayed- Returns:
- display title for the content
-
nameForComparison
Description copied from interface:ContentEntityAdapter
Return the sorting-friendly title for the content, if the content is to be sorted in alphabetical order.- Specified by:
nameForComparison
in interfaceContentEntityAdapter
- Parameters:
pluginContentEntityObject
- the content for name comparison- Returns:
- name for comparison
-
attachmentsUrlPath
Description copied from interface:ContentEntityAdapter
Return the URL path to view the list of attachments on the content- Specified by:
attachmentsUrlPath
in interfaceContentEntityAdapter
- Parameters:
pluginContentEntityObject
- the content to view attachments for- Returns:
- url path to view attachments for the content
-
attachmentUrlPath
public Optional<String> attachmentUrlPath(CustomContentEntityObject pluginContentEntityObject, Attachment attachment) Description copied from interface:ContentEntityAdapter
Return the URL path to view the a particular attachment of the content- Specified by:
attachmentUrlPath
in interfaceContentEntityAdapter
- Parameters:
pluginContentEntityObject
- the content to view attachments forattachment
- the attachment to link to- Returns:
- url path to view the attachment
-
getDefaultBodyType
Description copied from interface:ContentEntityAdapter
Get the default type for BodyContent objects attached to this content.- Specified by:
getDefaultBodyType
in interfaceContentEntityAdapter
- Parameters:
pluginContentEntityObject
- the content to get the body type of- Returns:
- the default BodyType for that content
-
excerpt
Description copied from interface:ContentEntityAdapter
Get a text-only summary of the content that is suitable for use in activity streams, search results and other places where a short placeholder for the content is necessary. The default implementation takes the first 255 characters of the content's main body with most markup characters removed.- Specified by:
excerpt
in interfaceContentEntityAdapter
- Parameters:
pluginContentEntityObject
- the content to excerpt- Returns:
- excerpt of the content
-
isAllowedParent
Description copied from interface:ContentEntityAdapter
Determine if a particular content is an acceptable parent for this content. The content object will ensure that there are no loops in the parent/child chain, and that the parent is in the same space as the child (if any), so implementations do not need to check that.Parent and child are required to be
CustomContentEntityObject
s. Typically this should be used ifCustomContentEntityObject.getPluginModuleKey()
returns the same value for both objects.- Specified by:
isAllowedParent
in interfaceContentEntityAdapter
- See Also:
-
isAllowedContainer
Description copied from interface:ContentEntityAdapter
Determine if a particular content is an acceptable container for a particular child. The content object will ensure that there are no loops in the container/child chain, and that the container is in the same space as the child (if any), so implementations do not need to check that.Will be invoked for the child adapter and the container adapter, if applicable.
Only one of container or child are required to be
CustomContentEntityObject
s. If both types areCustomContentEntityObject
s, this must only be used ifCustomContentEntityObject.getPluginModuleKey()
also returns distinct values for both objects.- Specified by:
isAllowedContainer
in interfaceContentEntityAdapter
- See Also:
-
isIndexable
public boolean isIndexable(CustomContentEntityObject pluginContentEntityObject, boolean isDefaultIndexable) Description copied from interface:ContentEntityAdapter
Determine if a particular content should be indexed. The isDefaultIndexable parameter will contain the value of super.isIndexable(), so the plugin may choose to follow or override the standard reasons not to index SpaceContentEntityObject (trashed content, content that is not in a space, content that is an old version are all not indexed by default)- Specified by:
isIndexable
in interfaceContentEntityAdapter
- Parameters:
pluginContentEntityObject
- the entity to checkisDefaultIndexable
- if the entity would be indexed absent of this check.
-
shouldConvertToContent
Description copied from interface:ContentEntityAdapter
Determine if a particular content is going to be part of the core API. Defaults to true.- Specified by:
shouldConvertToContent
in interfaceContentEntityAdapter
- Parameters:
pluginContentEntityObject
- the entity to check
-
getVersionChildPolicy
Description copied from interface:ContentEntityAdapter
This will be called byVersioned.getVersionChildPolicy(com.atlassian.confluence.api.model.content.ContentType)
to determine the policy to be used when saving the CCEO.- Specified by:
getVersionChildPolicy
in interfaceContentEntityAdapter
- See Also:
-