Class DefaultResourceIdentifierContextUtility
- java.lang.Object
-
- com.atlassian.confluence.content.render.xhtml.model.resource.identifiers.DefaultResourceIdentifierContextUtility
-
- All Implemented Interfaces:
ResourceIdentifierContextUtility
public class DefaultResourceIdentifierContextUtility extends Object implements ResourceIdentifierContextUtility
-
-
Constructor Summary
Constructors Constructor Description DefaultResourceIdentifierContextUtility(ResourceIdentifierFactory riFactory, ResourceIdentifierMatcher matcher)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ResourceIdentifier
convertToAbsolute(ResourceIdentifier ri, ContentEntityObject ceo)
Create and return a fully populated version of the supplied ResourceIdentifier with any missing attributes derived from the supplied context ContentEntityObject.ResourceIdentifier
convertToRelative(ResourceIdentifier ri, ContentEntityObject ceo)
Make the provided ResourceIdentifier as relative as possible to the provided ContentEntityObject.ResourceIdentifier
createAbsolutePageTemplateResourceIdentifier(PageTemplate template)
Create a ResourceIdentifier from the supplied PageTemplate.ResourceIdentifier
createAbsoluteResourceIdentifier(ContentEntityObject ceo)
Create a fully populated (absolute) ResourceIdentifier from the supplied ContentEntityObject.ResourceIdentifier
innerConvertToRelative(ResourceIdentifier ri, ContentEntityObject ceo)
-
-
-
Constructor Detail
-
DefaultResourceIdentifierContextUtility
public DefaultResourceIdentifierContextUtility(ResourceIdentifierFactory riFactory, ResourceIdentifierMatcher matcher)
-
-
Method Detail
-
createAbsoluteResourceIdentifier
public ResourceIdentifier createAbsoluteResourceIdentifier(ContentEntityObject ceo)
Description copied from interface:ResourceIdentifierContextUtility
Create a fully populated (absolute) ResourceIdentifier from the supplied ContentEntityObject.This differs from
ResourceIdentifierFactory
in that it is intended for use in the context of a conversion and therefore understandings relevant details such as that when converting aComment
the relevant ResourceIdentifier is that of the Comment's owner.- Specified by:
createAbsoluteResourceIdentifier
in interfaceResourceIdentifierContextUtility
- Parameters:
ceo
- The ContentEntityObject to get a conversion suitable ResourceIdentifier for.- Returns:
- the relevant ResourceIdentifier.
-
createAbsolutePageTemplateResourceIdentifier
public ResourceIdentifier createAbsolutePageTemplateResourceIdentifier(PageTemplate template)
Description copied from interface:ResourceIdentifierContextUtility
Create a ResourceIdentifier from the supplied PageTemplate.To be used in place of
ResourceIdentifierContextUtility.createAbsoluteResourceIdentifier(ContentEntityObject)
whenever the conversion context is that of a PageTemplate. Necessary because aPageTemplate
is not aContentEntityObject
- Specified by:
createAbsolutePageTemplateResourceIdentifier
in interfaceResourceIdentifierContextUtility
- Parameters:
template
- The PageTemplate to get a conversion suitable ResourceIdentifer for.- Returns:
- the relevant ResourceIdentifier
-
convertToAbsolute
public ResourceIdentifier convertToAbsolute(ResourceIdentifier ri, ContentEntityObject ceo)
Description copied from interface:ResourceIdentifierContextUtility
Create and return a fully populated version of the supplied ResourceIdentifier with any missing attributes derived from the supplied context ContentEntityObject.- Specified by:
convertToAbsolute
in interfaceResourceIdentifierContextUtility
- Parameters:
ri
- the ResourceIdentifier to be expanded. If it is null then a new resource identifier will be returned based on the type of the supplied ContentEntityObject.ceo
- the ContentEntityObject to be used as context. If this is null then the ResourceIdentifier will be returned unchanged.- Returns:
- a fully expanded ResourceIdentifier. May be null if a null ResourceIdentifier was provided along with a null ContentEntityObject
-
convertToRelative
public ResourceIdentifier convertToRelative(ResourceIdentifier ri, ContentEntityObject ceo)
Description copied from interface:ResourceIdentifierContextUtility
Make the provided ResourceIdentifier as relative as possible to the provided ContentEntityObject.For instance if the RI and the CEO share the same space key then the space key will be dropped from the RI. If the RI and the CEO share all attributes then a null RI will be returned indicating that it is unnecessary.
This is a centralisation of the logic required for CONF-23328 which is to make links as relative as possible in storage.
- Specified by:
convertToRelative
in interfaceResourceIdentifierContextUtility
- Parameters:
ri
- The ResourceIdentifier to make relativeceo
- the ContentEntityObject to be used as context. If this is null then the ResourceIdentifier will be returned unchanged.- Returns:
- a new ResourceIdentifier as sparsely populated as possible or null if the RI would not be required at all.
-
innerConvertToRelative
public ResourceIdentifier innerConvertToRelative(ResourceIdentifier ri, ContentEntityObject ceo)
-
-