Class ContentBodyConversionServiceImpl
- java.lang.Object
-
- com.atlassian.confluence.api.impl.service.content.ContentBodyConversionServiceImpl
-
- All Implemented Interfaces:
ContentBodyConversionService
public class ContentBodyConversionServiceImpl extends Object implements ContentBodyConversionService
-
-
Constructor Summary
Constructors Constructor Description ContentBodyConversionServiceImpl(ContentEntityManagerInternal contentEntityManager, ContentBodyConversionManager contentBodyConversionManager)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ContentBodyconvert(ContentBody body, ContentRepresentation toFormat)Same as callingContentBodyConversionService.convert(ContentBody, ContentRepresentation, Expansion...)with an empty expansion.ContentBodyconvert(ContentBody contentBody, ContentRepresentation toFormat, Expansion... expansions)Convert a ContentBody value into another format, performing validation during the conversion.ContentBodyconvertBody(Content content, ContentRepresentation toFormat)Same as callingContentBodyConversionService.convertBody(Content, ContentRepresentation, Expansion...)with an empty expansion.ContentBodyconvertBody(Content content, ContentRepresentation toFormat, Expansion... expansions)Convert the single ContentBody value in aContentbody map into another format, performing validation during the conversion.com.atlassian.fugue.Option<ContentBody>getBodyToConvert(Content content, ContentRepresentation toFormat)Given aContentobject for which the body could be converted to a givenContentRepresentation, returns theContentBodythat would be used for the conversion.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.atlassian.confluence.api.service.content.ContentBodyConversionService
selectBodyForRepresentation
-
-
-
-
Constructor Detail
-
ContentBodyConversionServiceImpl
public ContentBodyConversionServiceImpl(ContentEntityManagerInternal contentEntityManager, ContentBodyConversionManager contentBodyConversionManager)
-
-
Method Detail
-
convertBody
public ContentBody convertBody(Content content, ContentRepresentation toFormat) throws ServiceException
Description copied from interface:ContentBodyConversionServiceSame as callingContentBodyConversionService.convertBody(Content, ContentRepresentation, Expansion...)with an empty expansion.- Specified by:
convertBodyin interfaceContentBodyConversionService- Parameters:
content- the content to convert the ContentBody of, if this specifies a contentId then the persisted content will be used to generated the conversionContext.toFormat- theContentRepresentationto convert to- Returns:
- the converted body
- Throws:
BadRequestException- if any validation errors are found during the conversionNotFoundException- if content specifies a contentId that does not existServiceException
-
convertBody
public ContentBody convertBody(Content content, ContentRepresentation toFormat, Expansion... expansions) throws ServiceException
Description copied from interface:ContentBodyConversionServiceConvert the single ContentBody value in aContentbody map into another format, performing validation during the conversion.This is a wrapper method for
ContentBodyConversionService.convert(ContentBody, ContentRepresentation, Expansion... expansions)that assumes a single entry in the Body map to save the calling code having to manually extract it.- Specified by:
convertBodyin interfaceContentBodyConversionService- Parameters:
content- the content to convert the ContentBody of, if this specifies a contentId then the persisted content will be used to generated the conversionContext.toFormat- theContentRepresentationto convert toexpansions- determins the expansion done on the conversion. This expansion must match the expansions available toContentBody. An example expansion string would be'webresource'.- Returns:
- the converted body
- Throws:
BadRequestException- if any validation errors are found during the conversionNotFoundException- if content specifies a contentId that does not existServiceException
-
convert
public ContentBody convert(ContentBody body, ContentRepresentation toFormat) throws ServiceException
Description copied from interface:ContentBodyConversionServiceSame as callingContentBodyConversionService.convert(ContentBody, ContentRepresentation, Expansion...)with an empty expansion.- Specified by:
convertin interfaceContentBodyConversionService- Parameters:
body- the content to converttoFormat- theContentRepresentationto convert to- Returns:
- the converted body
- Throws:
BadRequestException- if any validation errors are found during the conversionNotFoundException- if the contentBody specifies a contentId that does not existServiceException
-
convert
public ContentBody convert(ContentBody contentBody, ContentRepresentation toFormat, Expansion... expansions) throws ServiceException
Description copied from interface:ContentBodyConversionServiceConvert a ContentBody value into another format, performing validation during the conversion.- Specified by:
convertin interfaceContentBodyConversionService- Parameters:
contentBody- the content to converttoFormat- theContentRepresentationto convert toexpansions- determins the expansion done on the conversion. This expansion must match the expansions available toContentBody. An example expansion string would be'webresource'.- Returns:
- the converted body
- Throws:
BadRequestException- if any validation errors are found during the conversionNotFoundException- if the contentBody specifies a contentId that does not existServiceException
-
getBodyToConvert
public com.atlassian.fugue.Option<ContentBody> getBodyToConvert(Content content, ContentRepresentation toFormat)
Description copied from interface:ContentBodyConversionServiceGiven aContentobject for which the body could be converted to a givenContentRepresentation, returns theContentBodythat 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.
- Specified by:
getBodyToConvertin interfaceContentBodyConversionService- Parameters:
content- content to convert the body oftoFormat- the representation that will be converted to- Returns:
- an Option with either the ContentBody that will be used in the conversion, or nothing
-
-