com.atlassian.confluence.content.render.xhtml.view.excerpt
Class DefaultExcerpter

java.lang.Object
  extended by com.atlassian.confluence.content.render.xhtml.view.excerpt.DefaultExcerpter
All Implemented Interfaces:
Excerpter

public class DefaultExcerpter
extends java.lang.Object
implements Excerpter


Field Summary
static java.util.Set<java.lang.String> DEFAULT_EXCLUDE_SET
           
static int DEFAULT_MAX_BLOCKS_FOR_EXCERPT
           
 
Constructor Summary
DefaultExcerpter(javax.xml.stream.XMLOutputFactory xmlFragmentOutputFactory, XmlEventReaderFactory xmlEventReaderFactory, HtmlToXmlConverter htmlToXmlConverter, SettingsManager settingsManager, Renderer viewRenderer, Unmarshaller<EmbeddedImage> embeddedImageUnmarshaller, FragmentTransformer fragmentTransformer, AttachmentResourceIdentifierResolver attachmentResolver, DataSourceFactory datasourceFactory, ThumbnailManager thumbnailManager, XhtmlContent xhtmlContent)
           
 
Method Summary
 java.lang.String createExcerpt(Content content)
          Creates an excerpt block from the provided content object without any tags excluded, using an implementation specific number of blocks.
 java.lang.String createExcerpt(ContentEntityObject contentEntity, java.lang.String outputType)
          Creates an excerpt of the contentEntityObject without any tags excluded including an implementation specific number of blocking
 java.lang.String createExcerpt(ContentEntityObject contentEntity, java.lang.String outputType, ExcerptConfig config)
          Creates an excerpt of the contentEntityObject excluding any html tags that are in the exclude set.
 java.lang.String createExcerpt(ContentEntityObject contentEntity, java.lang.String outputType, java.util.Set<java.lang.String> excludeSet, int maxBlocksForExcerpt)
           
 java.lang.String createExcerpt(java.lang.String contentHtml, ExcerptConfig config)
           
 java.util.List<javax.activation.DataSource> extractImageSrc(ContentEntityObject ceo, int maxImages)
           
 java.util.List<javax.activation.DataSource> extractImageSrc(ContentEntityObject ceo, int maxImages, boolean alwaysUseThumbnails)
           
 java.util.List<java.lang.String> extractImageSrc(java.lang.String contentHtml, int maxImages)
           
 java.util.List<java.net.URI> extractImageThumbnailUris(ContentEntityObject contentEntity, int maxUris)
          Returns the URIs of thumbnails for each of the images attached to the specified content entity.
protected  java.util.List<javax.xml.stream.events.XMLEvent> filterEmptyAndExcludedEvents(javax.xml.stream.XMLEventReader reader, java.util.Set<java.lang.String> excludeSet)
           
 java.lang.String renderContent(ContentEntityObject contentEntity, java.lang.String outputType)
          Deprecated. 
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_EXCLUDE_SET

public static final java.util.Set<java.lang.String> DEFAULT_EXCLUDE_SET

DEFAULT_MAX_BLOCKS_FOR_EXCERPT

public static final int DEFAULT_MAX_BLOCKS_FOR_EXCERPT
See Also:
Constant Field Values
Constructor Detail

DefaultExcerpter

public DefaultExcerpter(javax.xml.stream.XMLOutputFactory xmlFragmentOutputFactory,
                        XmlEventReaderFactory xmlEventReaderFactory,
                        HtmlToXmlConverter htmlToXmlConverter,
                        SettingsManager settingsManager,
                        Renderer viewRenderer,
                        Unmarshaller<EmbeddedImage> embeddedImageUnmarshaller,
                        FragmentTransformer fragmentTransformer,
                        AttachmentResourceIdentifierResolver attachmentResolver,
                        DataSourceFactory datasourceFactory,
                        ThumbnailManager thumbnailManager,
                        XhtmlContent xhtmlContent)
Method Detail

createExcerpt

public java.lang.String createExcerpt(Content content)
                               throws java.lang.Exception
Description copied from interface: Excerpter
Creates an excerpt block from the provided content object without any tags excluded, using an implementation specific number of blocks. This uses the EXPORT_VIEW content representation, and as such this should be already expanded

Specified by:
createExcerpt in interface Excerpter
Parameters:
content - - the content entity object to create an excerpt of
Returns:
Throws:
java.lang.Exception - - if an excerpt cannot be created for this content object

createExcerpt

public java.lang.String createExcerpt(ContentEntityObject contentEntity,
                                      java.lang.String outputType)
                               throws java.lang.Exception
Description copied from interface: Excerpter
Creates an excerpt of the contentEntityObject without any tags excluded including an implementation specific number of blocking

Specified by:
createExcerpt in interface Excerpter
Parameters:
contentEntity - - contentEntityObject to create an excerpt of
outputType - - the output type in which to render the content, @see RenderContextOutputType
Returns:
a html excerpt of the content entity object
Throws:
java.lang.Exception - - if an excerpt could not be created for this ContentEntityObject

createExcerpt

public java.lang.String createExcerpt(ContentEntityObject contentEntity,
                                      java.lang.String outputType,
                                      java.util.Set<java.lang.String> excludeSet,
                                      int maxBlocksForExcerpt)
                               throws java.lang.Exception
Throws:
java.lang.Exception

createExcerpt

public java.lang.String createExcerpt(ContentEntityObject contentEntity,
                                      java.lang.String outputType,
                                      ExcerptConfig config)
                               throws javax.xml.stream.XMLStreamException
Description copied from interface: Excerpter
Creates an excerpt of the contentEntityObject excluding any html tags that are in the exclude set. The number of blocks with content to be included in the excerpt is specified with the maxBlocksForExcerpt parameter. A block with content is any element with a

Specified by:
createExcerpt in interface Excerpter
Parameters:
contentEntity - - contentEntityObject to create an excerpt of
outputType - - the output type in which to render the content, @see RenderContextOutputType
config - - a parameter object that allows the content of the excerpt to be customized. @see ExcerptConfig
Returns:
a html excerpt of the content entity object
Throws:
javax.xml.stream.XMLStreamException

renderContent

@Deprecated
public java.lang.String renderContent(ContentEntityObject contentEntity,
                                                 java.lang.String outputType)
Deprecated. 


createExcerpt

public java.lang.String createExcerpt(java.lang.String contentHtml,
                                      ExcerptConfig config)
                               throws javax.xml.stream.XMLStreamException
Throws:
javax.xml.stream.XMLStreamException

extractImageSrc

public java.util.List<javax.activation.DataSource> extractImageSrc(ContentEntityObject ceo,
                                                                   int maxImages)
                                                            throws javax.xml.stream.XMLStreamException,
                                                                   XhtmlException
Specified by:
extractImageSrc in interface Excerpter
Throws:
javax.xml.stream.XMLStreamException
XhtmlException

extractImageSrc

public java.util.List<javax.activation.DataSource> extractImageSrc(ContentEntityObject ceo,
                                                                   int maxImages,
                                                                   boolean alwaysUseThumbnails)
                                                            throws javax.xml.stream.XMLStreamException,
                                                                   XhtmlException
Specified by:
extractImageSrc in interface Excerpter
Throws:
javax.xml.stream.XMLStreamException
XhtmlException

extractImageSrc

public java.util.List<java.lang.String> extractImageSrc(java.lang.String contentHtml,
                                                        int maxImages)
                                                 throws javax.xml.stream.XMLStreamException
Specified by:
extractImageSrc in interface Excerpter
Throws:
javax.xml.stream.XMLStreamException

filterEmptyAndExcludedEvents

protected java.util.List<javax.xml.stream.events.XMLEvent> filterEmptyAndExcludedEvents(javax.xml.stream.XMLEventReader reader,
                                                                                        java.util.Set<java.lang.String> excludeSet)

extractImageThumbnailUris

public java.util.List<java.net.URI> extractImageThumbnailUris(ContentEntityObject contentEntity,
                                                              int maxUris)
                                                       throws XhtmlException
Description copied from interface: Excerpter
Returns the URIs of thumbnails for each of the images attached to the specified content entity. URIs are returned in order that the images appear in the document. Obviously only URIs for thumbnailable images will be returned.

Specified by:
extractImageThumbnailUris in interface Excerpter
Parameters:
contentEntity - the content entity
maxUris - the maximum URI's to return
Returns:
ordered list of thumbnails URIs
Throws:
XhtmlException - if there is an error parsing the contents for image references.


Copyright © 2003-2014 Atlassian. All Rights Reserved.