public class XhtmlLinksUpdater extends Object implements LinksUpdater
LinksUpdater.AttachmentReferenceDetails, LinksUpdater.PartialReferenceDetails
Constructor and Description |
---|
XhtmlLinksUpdater(XmlEventReaderFactory xmlEventReaderFactory,
XMLOutputFactory xmlOutputFactory,
XMLEventFactory xmlEventFactory,
Marshaller<ResourceIdentifier> resourceIdentifierMarshaller,
ResourceIdentifierFactory resourceIdentifierFactory) |
Modifier and Type | Method and Description |
---|---|
String |
canonicalize(String content)
Applies the same rewriter as on any of contract/expand methods.
|
String |
contractAbsoluteReferencesInContent(SpaceContentEntityObject content)
A companion method to {
LinksUpdater.expandRelativeReferencesInContent(SpaceContentEntityObject) that will convert any absolute
references to itself to be relative. |
String |
expandRelativeReferencesInContent(Comment comment)
Expand any relative links or embedded files/images encountered in the supplied comment.
|
String |
expandRelativeReferencesInContent(SpaceContentEntityObject content)
Expand any relative links or embedded images encountered in the supplied content.
|
String |
updateAttachmentReferencesInContent(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.
|
String |
updateAttachmentReferencesInContent(String content,
Map<LinksUpdater.AttachmentReferenceDetails,LinksUpdater.AttachmentReferenceDetails> oldToNewLinkDetails)
Update all the attachment references in the content that referred to the 'old' attachment to now refer to the 'updated' attachment.
|
String |
updateReferencesInContent(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'.
|
String |
updateReferencesInContent(String content,
Map<LinksUpdater.PartialReferenceDetails,LinksUpdater.PartialReferenceDetails> oldToNewLinkDetails)
Update all the links and embedded image references in the content that referred to 'oldDetails' to now refer to 'newDetails'.
|
public XhtmlLinksUpdater(XmlEventReaderFactory xmlEventReaderFactory, XMLOutputFactory xmlOutputFactory, XMLEventFactory xmlEventFactory, Marshaller<ResourceIdentifier> resourceIdentifierMarshaller, ResourceIdentifierFactory resourceIdentifierFactory)
public String updateReferencesInContent(String content, LinksUpdater.PartialReferenceDetails oldLinkDetails, LinksUpdater.PartialReferenceDetails newLinkDetails)
LinksUpdater
LinksUpdater.expandRelativeReferencesInContent(SpaceContentEntityObject)
prior to calling this method to ensure there are no relative links in the content to confuse matters.updateReferencesInContent
in interface LinksUpdater
content
- the content to update references inoldLinkDetails
- specifies the references to be modifiednewLinkDetails
- specifies the reference to be used in place of those identified by 'oldDetails'.public String updateReferencesInContent(String content, Map<LinksUpdater.PartialReferenceDetails,LinksUpdater.PartialReferenceDetails> oldToNewLinkDetails)
LinksUpdater
LinksUpdater.expandRelativeReferencesInContent(SpaceContentEntityObject)
prior to calling this method to ensure there are no relative links in the content to confuse matters.updateReferencesInContent
in interface LinksUpdater
content
- the content to update references inoldToNewLinkDetails
- the map from old reference to new referencepublic String expandRelativeReferencesInContent(SpaceContentEntityObject content)
LinksUpdater
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).
expandRelativeReferencesInContent
in interface LinksUpdater
content
- the content to be expandedpublic String expandRelativeReferencesInContent(Comment comment)
LinksUpdater
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).
expandRelativeReferencesInContent
in interface LinksUpdater
comment
- the comment to be expandedpublic String updateAttachmentReferencesInContent(String content, LinksUpdater.AttachmentReferenceDetails old, LinksUpdater.AttachmentReferenceDetails updated)
LinksUpdater
LinksUpdater.expandRelativeReferencesInContent(SpaceContentEntityObject)
prior to calling this
method to ensure there are no relative attachment references in the content to confuse matters.updateAttachmentReferencesInContent
in interface LinksUpdater
content
- the content to update attachment references inold
- specifies the attachment references to be modifiedupdated
- specifies the new attachment reference to replace the old one withpublic String updateAttachmentReferencesInContent(String content, Map<LinksUpdater.AttachmentReferenceDetails,LinksUpdater.AttachmentReferenceDetails> oldToNewLinkDetails)
LinksUpdater
LinksUpdater.expandRelativeReferencesInContent(SpaceContentEntityObject)
prior to calling this
method to ensure there are no relative attachment references in the content to confuse matters.updateAttachmentReferencesInContent
in interface LinksUpdater
content
- the content to update attachment references inoldToNewLinkDetails
- the map from old reference to new referencepublic String contractAbsoluteReferencesInContent(SpaceContentEntityObject content)
LinksUpdater
LinksUpdater.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.contractAbsoluteReferencesInContent
in interface LinksUpdater
content
- the content to have any suitable absolute references contracted.public String canonicalize(String content)
LinksUpdater
This method is needed because even if xml structure of content is the same entity replacing by javax.xml.* and substitution done in ConfluenceXMLEventWriter will make two equal contents look different on equals method.
canonicalize
in interface LinksUpdater
Copyright © 2003–2021 Atlassian. All rights reserved.