Interface ContentEntityAdapter
-
- All Known Implementing Classes:
ContentEntityAdapterParent
,DefaultContentAdapter
,DummyAvailableContentEntityAdapter
,DummyUnavailableContentEntityAdapter
,JsonPropertyEntityAdapter
public interface ContentEntityAdapter
Class provided by a content type plugin to allow the resulting CustomContentEntityObject to return the right responses to various methods.In case of change to this interface, plugins should extend
ContentEntityAdapterParent
which will get default implementations of any new methods as they are createdMethods that return Option represent an optional feature. If an adapter returns None from these methods, some default value will be used instead.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description default Optional<String>
attachmentsUrlPath(CustomContentEntityObject pluginContentEntityObject)
Return the URL path to view the list of attachments on the contentdefault Optional<String>
attachmentUrlPath(CustomContentEntityObject pluginContentEntityObject, Attachment attachment)
Return the URL path to view the a particular attachment of the contentdefault Optional<String>
displayTitle(CustomContentEntityObject pluginContentEntityObject)
Gets the display-friendly title for the content.default Optional<String>
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.com.atlassian.fugue.Option<String>
getAttachmentsUrlPath(CustomContentEntityObject pluginContentEntityObject)
Deprecated.since 7.0.1.com.atlassian.fugue.Option<String>
getAttachmentUrlPath(CustomContentEntityObject pluginContentEntityObject, Attachment attachment)
Deprecated.since 7.0.1.BodyType
getDefaultBodyType(CustomContentEntityObject pluginContentEntityObject)
Get the default type for BodyContent objects attached to this content.com.atlassian.fugue.Option<String>
getDisplayTitle(CustomContentEntityObject pluginContentEntityObject)
Deprecated.since 7.0.1.com.atlassian.fugue.Option<String>
getExcerpt(CustomContentEntityObject pluginContentEntityObject)
Deprecated.since 7.0.1.com.atlassian.fugue.Option<String>
getNameForComparison(CustomContentEntityObject pluginContentEntityObject)
Deprecated.since 7.0.1.com.atlassian.fugue.Option<String>
getUrlPath(CustomContentEntityObject pluginContentEntityObject)
Deprecated.since 7.0.1.VersionChildOwnerPolicy
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 container)
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.default Optional<String>
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.default Optional<String>
urlPath(CustomContentEntityObject pluginContentEntityObject)
Gets the URL string (relative to the Confluence application context) at which this content can be viewed.
-
-
-
Method Detail
-
getUrlPath
@Deprecated com.atlassian.fugue.Option<String> getUrlPath(CustomContentEntityObject pluginContentEntityObject)
Deprecated.since 7.0.1. UseurlPath(CustomContentEntityObject)
Gets the URL string (relative to the Confluence application context) at which this content can be viewed.- Parameters:
pluginContentEntityObject
- the content to be viewed- Returns:
- the relative URL path to that content, or none to use to the default
-
urlPath
default Optional<String> urlPath(CustomContentEntityObject pluginContentEntityObject)
Gets the URL string (relative to the Confluence application context) at which this content can be viewed.- Parameters:
pluginContentEntityObject
- the content to be viewed- Returns:
- the relative URL path to that content, or none to use to the default
- Since:
- 7.0.1
-
getDisplayTitle
@Deprecated com.atlassian.fugue.Option<String> getDisplayTitle(CustomContentEntityObject pluginContentEntityObject)
Deprecated.since 7.0.1. UsedisplayTitle(CustomContentEntityObject)
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".- Parameters:
pluginContentEntityObject
- the content to calculate the display title for- Returns:
- the display title of that content, or none to use to the default
-
displayTitle
default Optional<String> displayTitle(CustomContentEntityObject pluginContentEntityObject)
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".- Parameters:
pluginContentEntityObject
- the content to calculate the display title for- Returns:
- the display title of that content, or none to use to the default
- Since:
- 7.0.1
-
getNameForComparison
@Deprecated com.atlassian.fugue.Option<String> getNameForComparison(CustomContentEntityObject pluginContentEntityObject)
Deprecated.since 7.0.1. UsenameForComparison(CustomContentEntityObject)
Return the sorting-friendly title for the content, if the content is to be sorted in alphabetical order.- Parameters:
pluginContentEntityObject
- the content to calculate the sorting title for- Returns:
- the sorting title of that content, or none to use to the default
-
nameForComparison
default Optional<String> nameForComparison(CustomContentEntityObject pluginContentEntityObject)
Return the sorting-friendly title for the content, if the content is to be sorted in alphabetical order.- Parameters:
pluginContentEntityObject
- the content to calculate the sorting title for- Returns:
- the sorting title of that content, or none to use to the default
- Since:
- 7.0.1
-
getAttachmentsUrlPath
@Deprecated com.atlassian.fugue.Option<String> getAttachmentsUrlPath(CustomContentEntityObject pluginContentEntityObject)
Deprecated.since 7.0.1. UseattachmentsUrlPath(CustomContentEntityObject)
Return the URL path to view the list of attachments on the content- Parameters:
pluginContentEntityObject
- the content to view attachments for- Returns:
- the URL path to view attachments on the content, or none to use to the default
-
attachmentsUrlPath
default Optional<String> attachmentsUrlPath(CustomContentEntityObject pluginContentEntityObject)
Return the URL path to view the list of attachments on the content- Parameters:
pluginContentEntityObject
- the content to view attachments for- Returns:
- the URL path to view attachments on the content, or none to use to the default
- Since:
- 7.0.1
-
getAttachmentUrlPath
@Deprecated com.atlassian.fugue.Option<String> getAttachmentUrlPath(CustomContentEntityObject pluginContentEntityObject, Attachment attachment)
Deprecated.since 7.0.1. UseattachmentUrlPath(CustomContentEntityObject, Attachment)
Return the URL path to view the a particular attachment of the content- Parameters:
pluginContentEntityObject
- the content to view attachments forattachment
- the attachment to link to- Returns:
- the URL path to view attachments on the content, or none to use to the default
-
attachmentUrlPath
default Optional<String> attachmentUrlPath(CustomContentEntityObject pluginContentEntityObject, Attachment attachment)
Return the URL path to view the a particular attachment of the content- Parameters:
pluginContentEntityObject
- the content to view attachments forattachment
- the attachment to link to- Returns:
- the URL path to view attachments on the content, or none to use to the default
- Since:
- 7.0.1
-
getDefaultBodyType
BodyType getDefaultBodyType(CustomContentEntityObject pluginContentEntityObject)
Get the default type for BodyContent objects attached to this content.- Parameters:
pluginContentEntityObject
- the content to get the body type of- Returns:
- the default BodyType for that content
-
getExcerpt
@Deprecated com.atlassian.fugue.Option<String> getExcerpt(CustomContentEntityObject pluginContentEntityObject)
Deprecated.since 7.0.1. Useexcerpt(CustomContentEntityObject)
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.- Parameters:
pluginContentEntityObject
- the content to excerpt- Returns:
- the excerpt for that content, or none to use the default
-
excerpt
default Optional<String> 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. The default implementation takes the first 255 characters of the content's main body with most markup characters removed.- Parameters:
pluginContentEntityObject
- the content to excerpt- Returns:
- the excerpt for that content, or none to use the default
- Since:
- 7.0.1
-
isAllowedParent
boolean isAllowedParent(CustomContentEntityObject child, CustomContentEntityObject parent)
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.
-
isAllowedContainer
boolean isAllowedContainer(ContentEntityObject child, ContentEntityObject container)
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.
-
isIndexable
boolean isIndexable(CustomContentEntityObject pluginContentEntityObject, boolean isDefaultIndexable)
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)- Parameters:
pluginContentEntityObject
- the entity to checkisDefaultIndexable
- if the entity would be indexed absent of this check.
-
shouldConvertToContent
boolean shouldConvertToContent(CustomContentEntityObject pluginContentEntityObject)
Determine if a particular content is going to be part of the core API. Defaults to true.- Parameters:
pluginContentEntityObject
- the entity to check
-
getVersionChildPolicy
VersionChildOwnerPolicy 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.- See Also:
VersionChildOwnerPolicy
-
-