Class DITAExternalObjectInsertionHandlerUtil


  • @API(type=INTERNAL,
         src=PUBLIC)
    public final class DITAExternalObjectInsertionHandlerUtil
    extends java.lang.Object
    Utility class for the DITA and DITA Map external object insertion handlers.
    • Method Detail

      • getReferenceAttributeNameAndValue

        public static java.lang.String[] getReferenceAttributeNameAndValue​(ContextKeyManagerProvider keysManagerProvider,
                                                                           AuthorAccess authorAccess,
                                                                           java.net.URL base,
                                                                           java.net.URL url,
                                                                           AuthorNode contextNode)
        Get the reference attribute name (href or keyref) 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 java.lang.String[] getMediaReferenceAttributeNameAndValue​(ContextKeyManagerProvider keysManagerProvider,
                                                                                java.net.URL editorLocation,
                                                                                java.net.URL base,
                                                                                java.net.URL url,
                                                                                AuthorNode contextNode)
        Get the reference attribute name (href / keyref or data / 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 be null
        Returns:
        An array of strings, containing the attribute name and the value.
      • getReferenceAttributeNameAndValueInternal

        public static java.lang.String[] getReferenceAttributeNameAndValueInternal​(ContextKeyManagerProvider keysManagerProvider,
                                                                                   java.net.URL editorLocation,
                                                                                   java.net.URL base,
                                                                                   java.net.URL url,
                                                                                   AuthorNode contextNode,
                                                                                   boolean isMediaElement)
        Get the reference attribute name (href / keyref or data / 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 be null
        isMediaElement - true to insert media objects.
        Returns:
        An array of strings, containing the attribute name and the value.
      • insertContentReference

        public static void insertContentReference​(ContextKeyManagerProvider keysManagerProvider,
                                                  AuthorAccess authorAccess,
                                                  java.net.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

        public static java.lang.String clearInternalQueryParamsFromExtractedRefAttrVal​(java.net.URL base,
                                                                                       java.lang.String refAttrValue)
        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​(java.net.URL urlToDrop,
                                                                               java.net.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 URL
        originatorURL - The URL for which the keys are requested.
        Returns:
        The key extracted from URL (fully qualified or relative, context aware key) or null.