Class VirtualViewerUtil

  • All Implemented Interfaces:
    java.io.Serializable

    public final class VirtualViewerUtil
    extends java.lang.Object
    implements java.io.Serializable
    Utility class for Virtual Viewer.
    See Also:
    Serialized Form
    • Constructor Detail

      • VirtualViewerUtil

        public VirtualViewerUtil​(javax.servlet.http.HttpServletRequest request)
        Instantiates a new virtual viewer util.
        Parameters:
        request - the request
    • Method Detail

      • getCodebase

        public java.lang.String getCodebase()
        Returns:
        the location of the applet's jar-file
      • getBaseUrl

        public java.lang.String getBaseUrl()
        Gets the base url.
        Returns:
        the base url
      • getServletUrl

        public java.lang.String getServletUrl()
        Gets the url of the retrieval-servlet.
        Returns:
        the url of the retrieval servlet
      • getCustomAssetsFile

        public java.lang.String getCustomAssetsFile()
        Gets the name of the custom assets file for the current locale.
        Returns:
        the name of the custom assets file
      • getPropertiesAsAppletParams

        public static java.lang.String getPropertiesAsAppletParams​(java.lang.String filename)
        Returns a string containing all applet parameters as read from the specified file.
        Parameters:
        filename - file to read
        Returns:
        string with properties to be added to an applet-tag
      • getAnnotationsPostUrl

        public java.lang.String getAnnotationsPostUrl​(java.lang.String popupId)
        Gets the URL to be used when posting annotations.
        Parameters:
        popupId - id of the viewer-popup
        Returns:
        URL as string
      • getDocIdWithoutElement

        public java.lang.String getDocIdWithoutElement​(OpenDocumentBean bean)
        Gets the doc-id without the element-id. Needed in JSP for element-switching.
        Parameters:
        bean - the document bean
        Returns:
        the doc id without element-id
      • getReleasedHdoc

        public static DocumentId getReleasedHdoc​(DocumentId documentId,
                                                 OpenDocumentBean openDocumentBean,
                                                 DocumentService docService)
                                          throws AuthenticationException,
                                                 SystemException
        Gets the released hdoc. If viewer is not in edit mode, a backend lookup for the released hdoc is performed and current released hdoc is returned, if exists.
        Parameters:
        documentId - the document id to get current hdoc
        openDocumentBean - the open document bean to check edit mode
        docService - the doc service to make backend call to get possible released hdoc
        Returns:
        the released hdoc in new DocumentId object, if released hdoc was found
        Throws:
        AuthenticationException - the authentication exception
        SystemException - the system exception
      • isSupportedFormat

        public boolean isSupportedFormat​(DocumentArchiveMetaInfo.ElementArchiveMetaInfo elementInfo)
        Checks if is supported format. First checks the element type of the given element. Second checks the supported format by the given elements filename.
        Parameters:
        elementInfo - the filename
        Returns:
        true, if is supported format
      • isSupportedFormatByFilename

        public boolean isSupportedFormatByFilename​(java.lang.String filename)
        Checks if the format by the given filename is supported by the virtual viewer.
        Parameters:
        filename - The file to check the extension of.
        Returns:
        true if the format is supported, false otherwise.
      • rememberRotationForPage

        public static void rememberRotationForPage​(OpenDocumentBean bean,
                                                   int page,
                                                   int angle)
        Stores the angle by wich the specified page was rotated.
        Parameters:
        bean - current OpenDocumentBean
        page - current page
        angle - last angle
      • getRotationAngles

        public static java.util.Map<java.lang.Integer,​java.lang.Integer> getRotationAngles​(OpenDocumentBean bean)
        Gets the rotation angles from the bean.
        Parameters:
        bean - current OpenDocumentBean
        Returns:
        the rotation angles
      • getSupportedFormats

        public java.util.Set<java.lang.String> getSupportedFormats()
        Returns:
        set of supported formats as configured in virtualviewer.properties