Class VirtualViewerUtil
- java.lang.Object
-
- com.saperion.ngc.viewer.virtualviewer.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 Summary
Constructors Constructor Description VirtualViewerUtil(javax.servlet.http.HttpServletRequest request)
Instantiates a new virtual viewer util.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getAnnotationsPostUrl(java.lang.String popupId)
Gets the URL to be used when posting annotations.java.lang.String
getBaseUrl()
Gets the base url.java.lang.String
getCodebase()
java.lang.String
getCustomAssetsFile()
Gets the name of the custom assets file for the current locale.java.lang.String
getDocIdWithoutElement(OpenDocumentBean bean)
Gets the doc-id without the element-id.static java.lang.String
getPropertiesAsAppletParams(java.lang.String filename)
Returns a string containing all applet parameters as read from the specified file.static DocumentId
getReleasedHdoc(DocumentId documentId, OpenDocumentBean openDocumentBean, DocumentService docService)
Gets the released hdoc.static java.util.Map<java.lang.Integer,java.lang.Integer>
getRotationAngles(OpenDocumentBean bean)
Gets the rotation angles from the bean.java.lang.String
getServletUrl()
Gets the url of the retrieval-servlet.java.util.Set<java.lang.String>
getSupportedFormats()
boolean
isSupportedFormat(DocumentArchiveMetaInfo.ElementArchiveMetaInfo elementInfo)
Checks if is supported format.boolean
isSupportedFormatByFilename(java.lang.String filename)
Checks if the format by the given filename is supported by the virtual viewer.static void
rememberRotationForPage(OpenDocumentBean bean, int page, int angle)
Stores the angle by wich the specified page was rotated.
-
-
-
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 hdocopenDocumentBean
- the open document bean to check edit modedocService
- 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 exceptionSystemException
- 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 OpenDocumentBeanpage
- current pageangle
- 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
-
-