Package ro.sync.ecss.extensions.dita
Class DITAExternalObjectInsertionHandlerUtil
java.lang.Object
ro.sync.ecss.extensions.dita.DITAExternalObjectInsertionHandlerUtil
@API(type=INTERNAL,
src=PUBLIC)
public final class DITAExternalObjectInsertionHandlerUtil
extends Object
Utility class for the DITA and DITA Map external object insertion handlers.
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringclearInternalQueryParamsFromExtractedRefAttrVal(URL base, String refAttrValue) Removes internal query from a relative URL.static ro.sync.ecss.dita.reference.keyref.KeyInfodetectKeyInfo(URL urlToDrop, URL originatorURL) Extracts the KeyInfo (can be a fully qualified KeyInfo) from current URL and returns the appropriate key (can be the relative key).static String[]getMediaReferenceAttributeNameAndValue(ContextKeyManagerProvider keysManagerProvider, URL editorLocation, URL base, URL url, AuthorNode contextNode) Get the reference attribute name (href / keyrefordata / datakeyref) and value.static String[]getReferenceAttributeNameAndValue(ContextKeyManagerProvider keysManagerProvider, AuthorAccess authorAccess, URL base, URL url, AuthorNode contextNode) Get the reference attribute name (hreforkeyref) and value.static String[]getReferenceAttributeNameAndValueInternal(ContextKeyManagerProvider keysManagerProvider, URL editorLocation, URL base, URL url, AuthorNode contextNode, boolean isMediaElement) Get the reference attribute name (href / keyrefordata / datakeyref) and value.static voidinsertContentReference(ContextKeyManagerProvider keysManagerProvider, AuthorAccess authorAccess, URL url) Inserts a content reference to the given URL.
-
Method Details
-
getReferenceAttributeNameAndValue
public static String[] getReferenceAttributeNameAndValue(ContextKeyManagerProvider keysManagerProvider, AuthorAccess authorAccess, URL base, URL url, AuthorNode contextNode) Get the reference attribute name (hreforkeyref) and value.- Parameters:
keysManagerProvider- The keys manager provider.authorAccess- The Author access.base- The base URL.url- The current URL.contextNode- Context node- Returns:
- An array of strings, containing the attribute name and the value.
-
getMediaReferenceAttributeNameAndValue
public static String[] getMediaReferenceAttributeNameAndValue(ContextKeyManagerProvider keysManagerProvider, URL editorLocation, URL base, URL url, AuthorNode contextNode) Get the reference attribute name (href / keyrefordata / datakeyref) and value.- Parameters:
keysManagerProvider- The keys manager provider.editorLocation- The URL location of the current editor.base- The base URL.url- The current URL.contextNode- Context node, can benull- Returns:
- An array of strings, containing the attribute name and the value.
-
getReferenceAttributeNameAndValueInternal
public static String[] getReferenceAttributeNameAndValueInternal(ContextKeyManagerProvider keysManagerProvider, URL editorLocation, URL base, URL url, AuthorNode contextNode, boolean isMediaElement) Get the reference attribute name (href / keyrefordata / datakeyref) and value.- Parameters:
keysManagerProvider- The keys manager provider.editorLocation- The URL location of the current editor.base- The base URL.url- The current URL.contextNode- The context node, can benullisMediaElement-trueto insert media objects.- Returns:
- An array of strings, containing the attribute name and the value.
-
insertContentReference
public static void insertContentReference(ContextKeyManagerProvider keysManagerProvider, AuthorAccess authorAccess, URL url) throws AuthorOperationException Inserts a content reference to the given URL.- Parameters:
keysManagerProvider- The keys manager provider.authorAccess- Access to the current document.url- Target for the conref.- Throws:
AuthorOperationException- If it fails.
-
clearInternalQueryParamsFromExtractedRefAttrVal
Removes internal query from a relative URL.- Parameters:
base- The original base URL of the relative value.refAttrValue- The relative value.- Returns:
- The relative value without internal query params or original value if no cleanup should be done.
-
detectKeyInfo
public static ro.sync.ecss.dita.reference.keyref.KeyInfo detectKeyInfo(URL urlToDrop, URL originatorURL) Extracts the KeyInfo (can be a fully qualified KeyInfo) from current URL and returns the appropriate key (can be the relative key).- Parameters:
urlToDrop- The dropped URLoriginatorURL- The URL for which the keys are requested.- Returns:
- The key extracted from URL (fully qualified or relative, context aware key) or
null.
-