@ExperimentalApi
public interface ContentBodyConversionService
ContentBody
instances to other ContentRepresentation
s. Converting
a ContentBody to the same ContentRepresentation will perform a validation/sanitisation of the body.
When creating or updating content, the incoming ContentBody will be converted to ContentRepresentation.STORAGE
format. Note that currently, the only officially supported STORAGE conversions are from
ContentRepresentation.STORAGE
(checked for validity) and from ContentRepresentation.EDITOR
.
Modifier and Type | Method and Description |
---|---|
ContentBody |
convert(ContentBody body,
ContentRepresentation representation)
Same as calling
convert(ContentBody, ContentRepresentation, Expansion...) with an empty expansion. |
ContentBody |
convert(ContentBody body,
ContentRepresentation representation,
Expansion... expansions)
Convert a ContentBody value into another format, performing validation during the conversion.
|
ContentBody |
convertBody(Content content,
ContentRepresentation representation)
Same as calling
convertBody(Content, ContentRepresentation, Expansion...) with an empty expansion. |
ContentBody |
convertBody(Content content,
ContentRepresentation representation,
Expansion... expansions)
Convert the single ContentBody value in a
Content body map into another format, performing
validation during the conversion. |
com.atlassian.fugue.Option<ContentBody> |
getBodyToConvert(Content content,
ContentRepresentation representation)
Given a
Content object for which the body could be converted to a given ContentRepresentation ,
returns the ContentBody that would be used for the conversion. |
ContentBody convertBody(Content content, ContentRepresentation representation, Expansion... expansions) throws ServiceException
Content
body map into another format, performing
validation during the conversion.
This is a wrapper method for convert(ContentBody, ContentRepresentation, Expansion... expansions)
that assumes
a single entry in the Body map to save the calling code having to manually extract it.
content
- the content to convert the ContentBody of, if this specifies a contentId then the persisted
content will be used to generated the conversionContext.representation
- the ContentRepresentation
to convert toexpansions
- determins the expansion done on the conversion. This expansion must match the expansions
available to ContentBody
. An example expansion string would be 'webresource'
.BadRequestException
- if any validation errors are found during the conversionNotFoundException
- if content specifies a contentId that does not existServiceException
ContentBody convertBody(Content content, ContentRepresentation representation) throws ServiceException
convertBody(Content, ContentRepresentation, Expansion...)
with an empty expansion.content
- the content to convert the ContentBody of, if this specifies a contentId then the persisted
content will be used to generated the conversionContext.representation
- the ContentRepresentation
to convert toBadRequestException
- if any validation errors are found during the conversionNotFoundException
- if content specifies a contentId that does not existServiceException
ContentBody convert(ContentBody body, ContentRepresentation representation, Expansion... expansions) throws ServiceException
body
- the content to convertrepresentation
- the ContentRepresentation
to convert toexpansions
- determins the expansion done on the conversion. This expansion must match the expansions
available to ContentBody
. An example expansion string would be 'webresource'
.BadRequestException
- if any validation errors are found during the conversionNotFoundException
- if the contentBody specifies a contentId that does not existServiceException
ContentBody convert(ContentBody body, ContentRepresentation representation) throws ServiceException
convert(ContentBody, ContentRepresentation, Expansion...)
with an empty expansion.body
- the content to convertrepresentation
- the ContentRepresentation
to convert toBadRequestException
- if any validation errors are found during the conversionNotFoundException
- if the contentBody specifies a contentId that does not existServiceException
com.atlassian.fugue.Option<ContentBody> getBodyToConvert(Content content, ContentRepresentation representation)
Content
object for which the body could be converted to a given ContentRepresentation
,
returns the ContentBody
that would be used for the conversion.
If the supplied Content contains no ContentBody objects, or if none of those ContentBodies are suitable for conversion into the ContentRepresentation, an Option.none() result will be returned.
content
- content to convert the body ofrepresentation
- the representation that will be converted toCopyright © 2003–2017 Atlassian. All rights reserved.