com.atlassian.confluence.api.impl.service.content
Class ContentBodyConversionServiceImpl

java.lang.Object
  extended by com.atlassian.confluence.api.impl.service.content.ContentBodyConversionServiceImpl
All Implemented Interfaces:
ContentBodyConversionService

public class ContentBodyConversionServiceImpl
extends java.lang.Object
implements ContentBodyConversionService


Constructor Summary
ContentBodyConversionServiceImpl(FormatConverter formatConverter, ContentEntityManagerInternal contentEntityManager, ExceptionTolerantMigrator xhtmlRoundTripMigrator, WikiToXhtmlMigrator wikiToXhtmlMigrator, Renderer viewRenderer, SettingsManager settingsManager)
           
 
Method Summary
 ContentBody convert(ContentBody contentBody, ContentRepresentation toFormat)
          Convert a ContentBody value into another format, performing validation during the conversion.
 ContentBody convertBody(Content content, ContentRepresentation toFormat)
          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 toFormat)
          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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ContentBodyConversionServiceImpl

public ContentBodyConversionServiceImpl(FormatConverter formatConverter,
                                        ContentEntityManagerInternal contentEntityManager,
                                        ExceptionTolerantMigrator xhtmlRoundTripMigrator,
                                        WikiToXhtmlMigrator wikiToXhtmlMigrator,
                                        Renderer viewRenderer,
                                        SettingsManager settingsManager)
Method Detail

convertBody

public ContentBody convertBody(Content content,
                               ContentRepresentation toFormat)
                        throws ServiceException
Description copied from interface: ContentBodyConversionService
Convert the single ContentBody value in a Content body map into another format, performing validation during the conversion.

This is a wrapper method for ContentBodyConversionService.convert(ContentBody, ContentRepresentation) that assumes a single entry in the Body map to save the calling code having to manually extract it.

Specified by:
convertBody in interface ContentBodyConversionService
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 - the ContentRepresentation to convert to
Returns:
the converted body
Throws:
BadRequestException - if any validation errors are found during the conversion
ServiceException

convert

public ContentBody convert(ContentBody contentBody,
                           ContentRepresentation toFormat)
                    throws ServiceException
Description copied from interface: ContentBodyConversionService
Convert a ContentBody value into another format, performing validation during the conversion.

Specified by:
convert in interface ContentBodyConversionService
Parameters:
contentBody - the content to convert
toFormat - the ContentRepresentation to convert to
Returns:
the converted body
Throws:
BadRequestException - if any validation errors are found during the conversion
ServiceException

getBodyToConvert

public com.atlassian.fugue.Option<ContentBody> getBodyToConvert(Content content,
                                                                ContentRepresentation toFormat)
Description copied from interface: ContentBodyConversionService
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.

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:
getBodyToConvert in interface ContentBodyConversionService
Parameters:
content - content to convert the body of
toFormat - the representation that will be converted to
Returns:
an Option with either the ContentBody that will be used in the conversion, or nothing


Copyright © 2003-2014 Atlassian. All Rights Reserved.