Class VirtualViewerUtil

java.lang.Object
com.saperion.ngc.viewer.virtualviewer.VirtualViewerUtil
All Implemented Interfaces:
Serializable

public final class VirtualViewerUtil extends Object implements Serializable
Utility class for Virtual Viewer.
See Also:
  • Constructor Details

    • VirtualViewerUtil

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

    • getCodebase

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

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

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

      public 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 String getPropertiesAsAppletParams(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 String getAnnotationsPostUrl(String popupId)
      Gets the URL to be used when posting annotations.
      Parameters:
      popupId - id of the viewer-popup
      Returns:
      URL as string
    • getDocIdWithoutElement

      public 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(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 Map<Integer,Integer> getRotationAngles(OpenDocumentBean bean)
      Gets the rotation angles from the bean.
      Parameters:
      bean - current OpenDocumentBean
      Returns:
      the rotation angles
    • getSupportedFormats

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