com.atlassian.confluence.content.render.xhtml.links
Interface LinksUpdater

All Known Implementing Classes:
XhtmlLinksUpdater

public interface LinksUpdater

Used to update the links on a piece of content. This is required when the destination of a link has been updated. This includes when the destination is moved to a different space, renamed or both.


Nested Class Summary
static class LinksUpdater.AttachmentReferenceDetails
           
static class LinksUpdater.PartialReferenceDetails
           
 
Method Summary
 java.lang.String contractAbsoluteReferencesInContent(SpaceContentEntityObject content)
          A companion method to {expandRelativeReferencesInContent(SpaceContentEntityObject) that will convert any absolute references to itself to be relative.
 java.lang.String expandRelativeReferencesInContent(SpaceContentEntityObject content)
          Expand any relative links or embedded images encountered in the supplied content.
 java.lang.String updateAttachmentReferencesInContent(java.lang.String content, LinksUpdater.AttachmentReferenceDetails old, LinksUpdater.AttachmentReferenceDetails updated)
          Update all the attachment references in the content that referred to the 'old' attachment to now refer to the 'updated' attachment.
 java.lang.String updateReferencesInContent(java.lang.String content, LinksUpdater.PartialReferenceDetails oldLinkDetails, LinksUpdater.PartialReferenceDetails newLinkDetails)
          Update all the links and embedded image references in the content that referred to 'oldDetails' to now refer to 'newDetails'.
 

Method Detail

updateReferencesInContent

java.lang.String updateReferencesInContent(java.lang.String content,
                                           LinksUpdater.PartialReferenceDetails oldLinkDetails,
                                           LinksUpdater.PartialReferenceDetails newLinkDetails)
Update all the links and embedded image references in the content that referred to 'oldDetails' to now refer to 'newDetails'. It should be noted that any relative references encountered in the content will not be modified since it cannot be known whether they would be a match for the 'oldDetails' parameter. You should called expandRelativeReferencesInContent(SpaceContentEntityObject) prior to calling this method to ensure there are no relative links in the content to confuse matters.

Parameters:
content - the content to update references in
oldLinkDetails - specifies the references to be modified
newLinkDetails - specifies the reference to be used in place of those identified by 'oldDetails'.
Returns:
content with relevant references updated

updateAttachmentReferencesInContent

java.lang.String updateAttachmentReferencesInContent(java.lang.String content,
                                                     LinksUpdater.AttachmentReferenceDetails old,
                                                     LinksUpdater.AttachmentReferenceDetails updated)
Update all the attachment references in the content that referred to the 'old' attachment to now refer to the 'updated' attachment. It should be noted that any relative links encountered in the content will not be modified since it cannot be known whether they would be a match for the 'old' parameter. You should called expandRelativeReferencesInContent(SpaceContentEntityObject) prior to calling this method to ensure there are no relative attachment references in the content to confuse matters.

Parameters:
content - the content to update attachment references in
old - specifies the attachment references to be modified
updated - specifies the new attachment reference to replace the old one with
Returns:
content with specified attachment references updated.

expandRelativeReferencesInContent

java.lang.String expandRelativeReferencesInContent(SpaceContentEntityObject content)
Expand any relative links or embedded images encountered in the supplied content. A relative reference is one that either has no space key (implying "current space") or one with no ResourceIdentifier at all.

This method will convert such references to an absolute reference to either it's containing space or itself (in the case of an attachment or link with no resource identifier at all).

Parameters:
content - the content to be expanded
Returns:
the body of the supplied SpaceContentEntityObject with all relative references expanded.

contractAbsoluteReferencesInContent

java.lang.String contractAbsoluteReferencesInContent(SpaceContentEntityObject content)
A companion method to {expandRelativeReferencesInContent(SpaceContentEntityObject) that will convert any absolute references to itself to be relative. So in a ResourceIdentifier, if a space key is present for the same space as the supplied content then this will be dropped. If the ResourceIdentifier actually refers to the SpaceContentEntityObject supplied then it will be dropped altogether.

Parameters:
content - the content to have any suitable absolute references contracted.
Returns:
the body of the supplied SpaceContentEntityObject modified as appropriate.


Copyright © 2003-2014 Atlassian. All Rights Reserved.