com.wewebu.ow.server.app
Class OwMimeManager

java.lang.Object
  extended by com.wewebu.ow.server.ui.OwEventTarget
      extended by com.wewebu.ow.server.app.OwMimeManager

public class OwMimeManager
extends OwEventTarget

MIME Manager, holds the MIME table, creates Object hyper links, handles requests to view and open objects according to their MIME type.

NOTE: ALWAYS CALL Reset() in your onRender method before using the insertLink functions, otherwise the map increases to infinite.

Alfresco Workdesk
Copyright (c) Alfresco Software, Inc.
All rights reserved.

For licensing information read the license.txt file or
go to: http://wiki.alfresco.com


Nested Class Summary
static class OwMimeManager.OwOpenCommand
           Identifies a open command URL or script.
protected static class OwMimeManager.OwReplaceScanner
           Class to perform search and replace on strings.
Derive a subclass and implement getReplacement.
 
Field Summary
static String CONTENT_MIMETYPE_KEY
          query string key for the MIME type of the property based content
static String CONTENT_PROPERTY_KEY
          query string key for property name of the property based content
static String CONTENT_TYPE_KEY
          query string key for the content type parameter
static String DMSID_KEY
          query string key for the DMSID parameter
protected  String documentTitle
          label to use for tooltip on documents
use "app.OwMimeManager.documenttitle" to localize/control value
static String DWL_MODE_KEY
          query string key for the download mode parameter
static int DWL_MODE_OPEN
          download mode used with DWL_MODE_KEY: opens the document directly in the browser
static int DWL_MODE_SAVE_COPY
          download mode used with DWL_MODE_KEY: queries to save the document
static String FILE_PREVIEW_ATTRIBUTE_FILENAME
          session attribute file name for file preview
static String FILE_PREVIEW_ATTRIBUTE_MIMETYPE
          session attribute MIME type of file to preview
static String FILE_PREVIEW_ATTRIBUTE_NAME
          session attribute name for file preview
static String FILE_PREVIEW_DMSID
          DMSID for MimeManager file preview
protected  OwConfiguration m_Configuration
          application m_Configuration reference
protected  boolean m_fDEBUG_ResetCalled
          flag signal for debug reasons, to throw an error if client forgets to call reset
protected  OwMainAppContext m_MainContext
          reference to the cast AppContext
protected  String m_mimeTypeContext
          the context to be used for MIME type resolution
protected  NumberFormat m_NumberFormat
           
protected  Map m_ObjectMap
          map which keeps the objects to be opened and create links upon
protected  OwObject m_parent
           
protected  OwClientRefreshContext m_RefreshContext
          event listener for the function plugin refresh events
protected  String m_strMimeIconStyle
          style to be used for icons
protected  String m_strMimeItemStyle
          style to be used for items
static String MDI_OBJECTS_COLLECTION_ATTRIBUTE_NAME
          session attribute name for objects collection for MDI viewer
static String MIME_ATT_AUTOVIEWERMODE
          attribute name for autoviewermode of MIME node
static String MIME_DOCUMENTFUNCTION
          tag name for document function of MIME node
static String MIME_DOWNLOAD_URL
          tag name of the downloadurl in MIME node
static String MIME_EDITSERLVET
          tag name of the viewer servlet definition in MIME node
static String MIME_EVENTHANDLER
          tag name for eventhandler of MIME node
static String MIME_ICON_NAME
          tag name of the icon in the mimenode
static String MIME_ICON_SUBPATH
           
static String MIME_OPENICON_NAME
          tag name of the openicon in mimenode
static String MIME_TYPE_PREFIX_OW_CUSTOMOBJECT
          prefix for custom object, used to configure the MIME types in the owmimetable.xml file
static String MIME_TYPE_PREFIX_OW_DEFAULT
          prefix for default types (OBJECT_TYPE_DOCUMENT, OBJECT_TYPE_FOLDER, OBJECT_TYPE_HISTORY...), used to configure the MIME types in the owmimetable.xml file
static String MIME_TYPE_PREFIX_OW_FOLDER
          prefix for a specific folder class, used to configure the MIME types in the owmimetable.xml file
static String MIME_VIEWERSERLVET
          tag name of the viewer servlet definition in MIME node
protected static String OBJECT_INDEX_KEY
          query string key for the objectlist index to find the selected object upon onMimeOpenObject.
protected  String objectTitle
          label to use for tooltip on objects
use "app.OwMimeManager.objecttitle" to localize/control value
static String PAGE_KEY
          query string key for the page parameter
protected static OwMimeManager.OwReplaceScanner PAGECOUNT_REPLACE_SCANNER
          page count replacement scanner for high performance replacement
static String SCRIPT_URL_PREFIX
          prefix to create a URL out of a script command
protected static String SUBPATH_KEY
          query string key for the subpath of the record subfolder to open
protected  String undefName
          label to use when name is null
protected static OwMimeManager.OwReplaceScanner URL_REPLACE_SCANNER
          URL replacement scanner for high performance replacement
static int VIEWER_MODE_COMPARE
          autoviewermode to use: open one viewer for each document and try to put viewers next to each other for comparision
static int VIEWER_MODE_DEFAULT
          autoviewermode to use: use default mode of application
static int VIEWER_MODE_JAVASCRIPT
          autoviewermode to use: call given javascript, i.e.
static int VIEWER_MODE_MULTI
          autoviewermode to use: open one viewer for each document
static int VIEWER_MODE_SIMPLE
          autoviewermode to use: display upload link
static int VIEWER_MODE_SINGLE
          autoviewermode to use: open one single viewer for all documents
static String VIEWER_SERVLET_REPLACE_TOKEN_BASEDIR
          token in the viewer servlet to be replaced by the base dir of the server deploy
static String VIEWER_SERVLET_REPLACE_TOKEN_BASEURL
          token in the viewer servlet to be replaced by the base URL of the server with application context
static String VIEWER_SERVLET_REPLACE_TOKEN_CONTENT_TYPE
          token in the viewer servlet to be replaced by the requested page
static String VIEWER_SERVLET_REPLACE_TOKEN_DMSID
          token in the viewer servlet to be replaced by the DMSID
static String VIEWER_SERVLET_REPLACE_TOKEN_DOWNLOAD_URL
          token in the viewer servlet to be replaced by the requested page
static String VIEWER_SERVLET_REPLACE_TOKEN_PAGE
          token in the viewer servlet to be replaced by the requested page
static String VIEWER_SERVLET_REPLACE_TOKEN_PAGE_COUNT
          token in the viewer servlet to be replaced by the number of pages in the requested object
static char VIEWER_SERVLET_REPLACE_TOKEN_PROPERTY_ENCODE_CHAR
          char to indicate encoding of given property
static String VIEWER_SERVLET_REPLACE_TOKEN_PROPERTY_END
          token in the viewer servlet to be replaced by the property end delimiter
static char VIEWER_SERVLET_REPLACE_TOKEN_PROPERTY_JSENCODE_CHAR
          char to indicate JavaScript encoding of given property
static char VIEWER_SERVLET_REPLACE_TOKEN_PROPERTY_NOENCODE_CHAR
          char to indicate NO encoding of given property
static String VIEWER_SERVLET_REPLACE_TOKEN_PROPERTY_START
          token in the viewer servlet to be replaced by the property following the :
static String VIEWER_SERVLET_REPLACE_TOKEN_SECURITYTOKEN
          token in the viewer servlet to be replaced by the security token
static String VIEWER_SERVLET_REPLACE_TOKEN_SECURITYTOKEN_ENC
          token in the viewer servlet to be replaced by the encoded security token
static String VIEWER_SERVLET_REPLACE_TOKEN_SERVERURL
          token in the viewer servlet to be replaced by the base URL of the server
static String XSL_TRANSFORMATOR_ENCODING_KEY
          query string key for the xsl transformator encoding to use
static String XSL_TRANSFORMATOR_KEY
          query string key for the xsl transformator URL
 
Constructor Summary
OwMimeManager()
           
 
Method Summary
static String createAutoViewerRestoreMainWindowScript(OwMainAppContext context_p, int viewermode_p)
          create a script that closes the autoviewer and rearrange the browser.
protected  StringBuffer createIconLink(OwObjectReference obj_p)
          Create the icon link for the given object
protected  String createLinkUrl(String eventName_p, OwObjectReference obj_p, String subpath_p)
          create the URL of the given event and the additional parameter
protected static void delegateToMasterPlugin(OwMainAppContext context_p, OwMasterDocument masterPlugin_p, OwObjectReference obj_p, String subpath_p)
          overridable handler function
static OwMimeManager.OwOpenCommand editObject(OwMainAppContext context_p, OwObjectReference obj_p)
          Creates an OwOpenCommand handling the <editservlet> tag from MIME node, if it exist or else an OwInvalidOperationException is thrown.
static OwMimeManager.OwOpenCommand editObject(OwMainAppContext context_p, OwObjectReference obj_p, int page_p)
          Creates an OwOpenCommand handling the <editservlet> tag from MIME node, if it exist or else an OwInvalidOperationException is thrown.
static OwMimeManager.OwOpenCommand editObject(OwMainAppContext context_p, OwObjectReference obj_p, String additionalParams_p, int page_p)
          Creates an OwOpenCommand handling the <editservlet> tag from MIME node, if it exist or else an OwInvalidOperationException is thrown.
static OwMimeManager.OwOpenCommand editObject(OwMainAppContext context_p, OwObjectReference obj_p, String mimeContext_p, String additionalParams_p, int page_p)
          Creates an OwOpenCommand handling the <editservlet> tag from MIME node, if it exist or else an OwInvalidOperationException is thrown.
static String getAutoViewerScript(OwMainAppContext context_p, String strOpenURL_p, int viewermode_p, String id_p, String sDmsID_p, int iPage_p)
          create a script that opens the URL in a viewer and automatically arranges the browser and the viewer the script can be applied with the addFinalScript() method.
static String getAutoViewerScript(OwMainAppContext context_p, String strOpenURL_p, int viewermode_p, String id_p, String sDmsID_p, int iPage_p, OwWindowPositions windowpos_p)
          create a script that opens the URL in a viewer and automatically arranges the browser and the viewer the script can be applied with the addFinalScript() method.
protected static String getDefaultDownloadURL(OwMainAppContext context_p, OwObjectReference obj_p, int iContentType_p, int iPage_p)
          create a default download URL where the content of the specified object, contenttype and page can be found
static String getDownloadLink(OwMainAppContext context_p, String strDisplayName_p, OwObjectReference obj_p)
          get a link to save/download the given OwObjectReference to the local hard drive
static String getDownloadURL(OwMainAppContext context_p, OwObjectReference obj_p, int iContentType_p, int iPage_p)
          create a download URL where the content of the specified object, contenttype and page can be found
static String getDownloadURL(OwMainAppContext context_p, OwObjectReference obj_p, int iContentType_p, int iPage_p, OwXMLUtil mimeNode_p)
          create a download URL where the content of the specified object, contenttype and page can be found
static OwDocumentFunction getHandlerDocumentPlugin(OwMainAppContext context_p, OwObjectReference obj_p)
          get the handler document plugin for the given object reference if defined.
static OwMasterDocument getHandlerMasterPlugin(OwMainAppContext context_p, OwObjectReference obj_p)
          get the handler master plugin for the given object reference if defined.
 String getIconStyle()
          Return the style for icons which are rendered by this MIME type manager.
static String getMimeIcon(OwMainAppContext context_p, OwObjectReference obj_p)
          get the icon path for the mimetype
static OwXMLUtil getMimeNode(OwConfiguration configuration_p, OwObjectReference obj_p)
          get the MIME info node from the MIME table for the requested object
 String getMimeTypeContext()
          Returns the context to be used for MIME type resolution
protected  NumberFormat getNumberFormater()
          get the formatter used for numbers
static OwMimeManager.OwOpenCommand getOpenCommand(OwMainAppContext context_p, OwObjectReference obj_p)
          Create URL or script command to open the object according to MIME settings.
static OwMimeManager.OwOpenCommand getOpenCommand(OwMainAppContext context_p, OwObjectReference obj_p, String additionalParams_p)
          Create an URL or script to open the object according to MIME settings.
static OwMimeManager.OwOpenCommand getOpenCommand(OwMainAppContext context_p, OwObjectReference obj_p, String additionalParams_p, int page_p)
          Create an URL or script to open the referenced object, according to the defined MIME settings.
static OwMimeManager.OwOpenCommand getOpenCommand(OwMainAppContext context_p, OwObjectReference obj_p, String mimeContext_p, String additionalParams_p)
          Create an URL or script to open the object according to MIME settings.
static OwMimeManager.OwOpenCommand getOpenCommand(OwMainAppContext context_p, OwObjectReference obj_p, String mimeContext_p, String additionalParams_p, int page_p)
          Create an URL or script to open the referenced object, according to the defined MIME settings.
 OwMimeManager.OwOpenCommand getOpenCommand(OwObjectReference obj_p)
          Create URL or script command to open the object according to MIME settings.
 OwMimeManager.OwOpenCommand getOpenCommand(OwObjectReference obj_p, String additionalParams_p)
          Create an URL or script using current instance of OwMimeManager.
 OwMimeManager.OwOpenCommand getOpenCommand(OwObjectReference obj_p, String additionalParams_p, int page_p)
          Create an URL or script using current instance of OwMimeManager.
static String getSaveDownloadURL(OwMainAppContext context_p, OwObjectReference obj_p)
          get a URL to save / download the given OwObjectReference to the local hard drive
protected static String getServletReplacedTokenString(String servletURL_p, OwMainAppContext currentContext_p, OwObjectReference obj_p, OwXMLUtil mimeNode_p, int page_p)
          Calls the getServletReplacedTokenString(String, OwMainAppContext, OwObjectReference, OwXMLUtil, int, int) method with following parameters
protected static String getServletReplacedTokenString(String servletURL_p, OwMainAppContext currentContext_p, OwObjectReference obj_p, OwXMLUtil mimeNode_p, int page_p, int contentType_p)
          This method is a Helper and replace the most used placeholder in a URL string.
 String getUndefinedLabel()
          Get label to use for rendering of text links, if the given display value is null.
protected  void init()
          init the target after the context is set.
 void insertHtmlLink(Writer w_p, String strHtmlCode_p, OwObjectReference obj_p, String subpath_p)
          insert a hyperlink wrapped around arbitrary HTML code to download or open a OwObjectReference in a viewer This function is useful for objects listed by OwObjectCollection
 void insertHtmlLink(Writer w_p, String strHtmlCode_p, OwObjectReference obj_p, String subpath_p, int page_p)
          insert a hyperlink wrapped around arbitrary HTML code to download or open a OwObjectReference in a viewer This function is useful for objects listed by OwObjectCollection
 void insertIconLink(Writer w_p, OwObjectReference obj_p)
          insert a icon object hyperlink to download or open a OwObjectReference in a viewer This function is useful for objects listed by OwObjectCollection
 void insertIconLink(Writer w_p, OwObjectReference obj_p, String subpath_p)
          insert a icon object hyperlink to download or open a OwObjectReference in a viewer This function is useful for objects listed by OwObjectCollection
 void insertIconLink(Writer w_p, OwObjectReference obj_p, String subpath_p, int page_p)
          insert a icon object hyperlink to download or open a OwObjectReference in a viewer This function is useful for objects listed by OwObjectCollection
 void insertTextLink(Writer w_p, String strDisplayName_p, OwObjectReference obj_p)
          insert a text object hyperlink to download or open a OwObjectReference in a viewer This function is useful for objects listed by OwObjectCollection
 void insertTextLink(Writer w_p, String strDisplayName_p, OwObjectReference obj_p, String subpath_p)
          insert a text object hyperlink to download or open a OwObjectReference in a viewer This function is useful for objects listed by OwObjectCollection
 void insertTextLink(Writer w_p, String strDisplayName_p, OwObjectReference obj_p, String subpath_p, int page_p)
          insert a text object hyperlink to download or open a OwObjectReference in a viewer This function is useful for objects listed by OwObjectCollection
static boolean isObjectDownloadable(OwMainAppContext context_p, OwObjectReference obj_p)
          check if given object can be downloaded to hard drive
static boolean isObjectDownloadable(OwMainAppContext context_p, OwObjectReference obj_p, String mimeContext_p)
          check if given object can be downloaded to hard drive
static String makeViewerTitleString(String id_p)
          Make sure ID does not consist of invalid characters for java script window name
 void onDocumentFunctionHandler(javax.servlet.http.HttpServletRequest request_p)
          event called when user clicked on a name link of an object entry in the list Creates a new dialog for the clicked object
 void onPluginEventHandler(javax.servlet.http.HttpServletRequest request_p)
          event called when user clicked on a name link of an object entry in the list Dispatches the object to a plugin
static void openFilePreview(OwMainAppContext context_p, String mimeType_p, String path_p)
          open the given file according to MIME settings for preview
static void openFilePreview(OwMainAppContext context_p, String mimeType_p, String path_p, String fileName_p)
          open the given file according to the MIME settings for preview, Changes the file name to the given parameter fileName_p.
static void openObject(OwMainAppContext context_p, OwObjectReference obj_p, OwObject parent_p, int iViewerMode_p, OwClientRefreshContext refreshCtx_p)
          open the given object according to MIME settings
static void openObject(OwMainAppContext context_p, OwObjectReference obj_p, OwObject parent_p, int iViewerMode_p, OwClientRefreshContext refreshCtx_p, int iPage_p, OwWindowPositions windowpos_p, Collection objects_p)
          open the given object according to MIME settings
static void openObject(OwMainAppContext context_p, OwObjectReference obj_p, OwObject parent_p, int iViewerMode_p, OwClientRefreshContext refreshCtx_p, int iPage_p, OwWindowPositions windowpos_p, Collection objects_p, String additionalParams_p)
          open the given object according to the MIME settings, and add also the additional params to the caller URL.
static void openObject(OwMainAppContext context_p, OwObjectReference obj_p, OwObject parent_p, int iViewerMode_p, OwClientRefreshContext refreshCtx_p, int iPage_p, OwWindowPositions windowpos_p, Collection objects_p, String additionalParams_p, String mimeContext_p)
          open the given object according to the MIME settings, and add also the additional params to the caller URL.
static void openObject(OwMainAppContext context_p, OwObjectReference obj_p, OwObject parent_p, int iViewerMode_p, OwClientRefreshContext refreshCtx_p, String mimeContext_p)
          open the given object according to MIME settings
static void openObjectPreview(OwMainAppContext context_p, OwObjectReference obj_p, OwObject parent_p, int iViewerMode_p, OwClientRefreshContext refreshCtx_p)
          open the given object according to MIME settings
static void openObjectPreview(OwMainAppContext context_p, OwObjectReference obj_p, OwObject parent_p, int iViewerMode_p, OwClientRefreshContext refreshCtx_p, int iPage_p, OwWindowPositions windowpos_p, Collection objects_p)
          open the given object according to MIME settings
protected  void registerObject(OwObjectReference obj_p)
          register a object to find it later in the events
protected static String replaceProperties(OwMainAppContext context_p, String strIn_p, OwObjectReference obj_p)
          replace a object property placeholder
 void reset()
          clear the map before you call insertLink methods, otherwise the map would increase to infinite
 void setIconStyle(String strMimeIconStyle_p)
          set the style for the MIME icons
 void setItemStyle(String strMimeItemStyle_p)
          set the style for the MIME items
 void setMimeTypeContext(String context_p)
          Set the context to be used for MIME type resolution
 void setParent(OwObject parent_p)
          set parent to use in document functions
 void setRefreshContext(OwClientRefreshContext eventlister_p)
          register an eventlistener with this view to receive notifications
 void setUndefinedLabel(String undefLabel_p)
          Set the Label which should be used for rendering of text links, if given display value is null.
 
Methods inherited from class com.wewebu.ow.server.ui.OwEventTarget
attach, detach, disableRequestListener, enableRequestListener, getAjaxEventURL, getContext, getEventURL, getFormEventFunction, getFormEventURL, getFormName, getFormTarget, getID, onExternalRequest, onFormEvent, onRequest, setExternalFormTarget, updateExternalFormTarget
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

URL_REPLACE_SCANNER

protected static final OwMimeManager.OwReplaceScanner URL_REPLACE_SCANNER
URL replacement scanner for high performance replacement


PAGECOUNT_REPLACE_SCANNER

protected static final OwMimeManager.OwReplaceScanner PAGECOUNT_REPLACE_SCANNER
page count replacement scanner for high performance replacement


DWL_MODE_KEY

public static final String DWL_MODE_KEY
query string key for the download mode parameter

See Also:
Constant Field Values

DMSID_KEY

public static final String DMSID_KEY
query string key for the DMSID parameter

See Also:
Constant Field Values

CONTENT_TYPE_KEY

public static final String CONTENT_TYPE_KEY
query string key for the content type parameter

See Also:
Constant Field Values

CONTENT_PROPERTY_KEY

public static final String CONTENT_PROPERTY_KEY
query string key for property name of the property based content

See Also:
Constant Field Values

CONTENT_MIMETYPE_KEY

public static final String CONTENT_MIMETYPE_KEY
query string key for the MIME type of the property based content

See Also:
Constant Field Values

PAGE_KEY

public static final String PAGE_KEY
query string key for the page parameter

See Also:
Constant Field Values

XSL_TRANSFORMATOR_KEY

public static final String XSL_TRANSFORMATOR_KEY
query string key for the xsl transformator URL

See Also:
Constant Field Values

XSL_TRANSFORMATOR_ENCODING_KEY

public static final String XSL_TRANSFORMATOR_ENCODING_KEY
query string key for the xsl transformator encoding to use

See Also:
Constant Field Values

DWL_MODE_OPEN

public static final int DWL_MODE_OPEN
download mode used with DWL_MODE_KEY: opens the document directly in the browser

See Also:
Constant Field Values

DWL_MODE_SAVE_COPY

public static final int DWL_MODE_SAVE_COPY
download mode used with DWL_MODE_KEY: queries to save the document

See Also:
Constant Field Values

MDI_OBJECTS_COLLECTION_ATTRIBUTE_NAME

public static final String MDI_OBJECTS_COLLECTION_ATTRIBUTE_NAME
session attribute name for objects collection for MDI viewer

See Also:
Constant Field Values

FILE_PREVIEW_ATTRIBUTE_NAME

public static final String FILE_PREVIEW_ATTRIBUTE_NAME
session attribute name for file preview

See Also:
Constant Field Values

FILE_PREVIEW_ATTRIBUTE_FILENAME

public static final String FILE_PREVIEW_ATTRIBUTE_FILENAME
session attribute file name for file preview

See Also:
Constant Field Values

FILE_PREVIEW_ATTRIBUTE_MIMETYPE

public static final String FILE_PREVIEW_ATTRIBUTE_MIMETYPE
session attribute MIME type of file to preview

See Also:
Constant Field Values

FILE_PREVIEW_DMSID

public static final String FILE_PREVIEW_DMSID
DMSID for MimeManager file preview

See Also:
Constant Field Values

MIME_ICON_NAME

public static final String MIME_ICON_NAME
tag name of the icon in the mimenode

See Also:
Constant Field Values

MIME_OPENICON_NAME

public static final String MIME_OPENICON_NAME
tag name of the openicon in mimenode

Since:
2.5.2.0
See Also:
Constant Field Values

MIME_DOWNLOAD_URL

public static final String MIME_DOWNLOAD_URL
tag name of the downloadurl in MIME node

Since:
2.5.2.0
See Also:
Constant Field Values

MIME_VIEWERSERLVET

public static final String MIME_VIEWERSERLVET
tag name of the viewer servlet definition in MIME node

Since:
2.5.2.0
See Also:
Constant Field Values

MIME_EDITSERLVET

public static final String MIME_EDITSERLVET
tag name of the viewer servlet definition in MIME node

Since:
2.5.2.0
See Also:
Constant Field Values

MIME_EVENTHANDLER

public static final String MIME_EVENTHANDLER
tag name for eventhandler of MIME node

Since:
2.5.2.0
See Also:
Constant Field Values

MIME_DOCUMENTFUNCTION

public static final String MIME_DOCUMENTFUNCTION
tag name for document function of MIME node

Since:
2.5.2.0
See Also:
Constant Field Values

MIME_ATT_AUTOVIEWERMODE

public static final String MIME_ATT_AUTOVIEWERMODE
attribute name for autoviewermode of MIME node

Since:
2.5.2.0
See Also:
Constant Field Values

MIME_ICON_SUBPATH

public static final String MIME_ICON_SUBPATH
See Also:
Constant Field Values

VIEWER_MODE_SIMPLE

public static final int VIEWER_MODE_SIMPLE
autoviewermode to use: display upload link

See Also:
Constant Field Values

VIEWER_MODE_DEFAULT

public static final int VIEWER_MODE_DEFAULT
autoviewermode to use: use default mode of application

See Also:
Constant Field Values

VIEWER_MODE_SINGLE

public static final int VIEWER_MODE_SINGLE
autoviewermode to use: open one single viewer for all documents

See Also:
Constant Field Values

VIEWER_MODE_MULTI

public static final int VIEWER_MODE_MULTI
autoviewermode to use: open one viewer for each document

See Also:
Constant Field Values

VIEWER_MODE_COMPARE

public static final int VIEWER_MODE_COMPARE
autoviewermode to use: open one viewer for each document and try to put viewers next to each other for comparision

See Also:
Constant Field Values

VIEWER_MODE_JAVASCRIPT

public static final int VIEWER_MODE_JAVASCRIPT
autoviewermode to use: call given javascript, i.e. treat URL as java script statement

See Also:
Constant Field Values

VIEWER_SERVLET_REPLACE_TOKEN_DMSID

public static final String VIEWER_SERVLET_REPLACE_TOKEN_DMSID
token in the viewer servlet to be replaced by the DMSID

See Also:
Constant Field Values

VIEWER_SERVLET_REPLACE_TOKEN_SERVERURL

public static final String VIEWER_SERVLET_REPLACE_TOKEN_SERVERURL
token in the viewer servlet to be replaced by the base URL of the server

See Also:
Constant Field Values

VIEWER_SERVLET_REPLACE_TOKEN_BASEURL

public static final String VIEWER_SERVLET_REPLACE_TOKEN_BASEURL
token in the viewer servlet to be replaced by the base URL of the server with application context

See Also:
Constant Field Values

VIEWER_SERVLET_REPLACE_TOKEN_BASEDIR

public static final String VIEWER_SERVLET_REPLACE_TOKEN_BASEDIR
token in the viewer servlet to be replaced by the base dir of the server deploy

See Also:
Constant Field Values

VIEWER_SERVLET_REPLACE_TOKEN_SECURITYTOKEN

public static final String VIEWER_SERVLET_REPLACE_TOKEN_SECURITYTOKEN
token in the viewer servlet to be replaced by the security token

See Also:
Constant Field Values

VIEWER_SERVLET_REPLACE_TOKEN_SECURITYTOKEN_ENC

public static final String VIEWER_SERVLET_REPLACE_TOKEN_SECURITYTOKEN_ENC
token in the viewer servlet to be replaced by the encoded security token

See Also:
Constant Field Values

VIEWER_SERVLET_REPLACE_TOKEN_PAGE_COUNT

public static final String VIEWER_SERVLET_REPLACE_TOKEN_PAGE_COUNT
token in the viewer servlet to be replaced by the number of pages in the requested object

See Also:
Constant Field Values

VIEWER_SERVLET_REPLACE_TOKEN_PAGE

public static final String VIEWER_SERVLET_REPLACE_TOKEN_PAGE
token in the viewer servlet to be replaced by the requested page

See Also:
Constant Field Values

VIEWER_SERVLET_REPLACE_TOKEN_CONTENT_TYPE

public static final String VIEWER_SERVLET_REPLACE_TOKEN_CONTENT_TYPE
token in the viewer servlet to be replaced by the requested page

See Also:
Constant Field Values

VIEWER_SERVLET_REPLACE_TOKEN_DOWNLOAD_URL

public static final String VIEWER_SERVLET_REPLACE_TOKEN_DOWNLOAD_URL
token in the viewer servlet to be replaced by the requested page

See Also:
Constant Field Values

VIEWER_SERVLET_REPLACE_TOKEN_PROPERTY_START

public static final String VIEWER_SERVLET_REPLACE_TOKEN_PROPERTY_START
token in the viewer servlet to be replaced by the property following the :

See Also:
Constant Field Values

VIEWER_SERVLET_REPLACE_TOKEN_PROPERTY_ENCODE_CHAR

public static final char VIEWER_SERVLET_REPLACE_TOKEN_PROPERTY_ENCODE_CHAR
char to indicate encoding of given property

See Also:
Constant Field Values

VIEWER_SERVLET_REPLACE_TOKEN_PROPERTY_JSENCODE_CHAR

public static final char VIEWER_SERVLET_REPLACE_TOKEN_PROPERTY_JSENCODE_CHAR
char to indicate JavaScript encoding of given property

See Also:
Constant Field Values

VIEWER_SERVLET_REPLACE_TOKEN_PROPERTY_NOENCODE_CHAR

public static final char VIEWER_SERVLET_REPLACE_TOKEN_PROPERTY_NOENCODE_CHAR
char to indicate NO encoding of given property

See Also:
Constant Field Values

VIEWER_SERVLET_REPLACE_TOKEN_PROPERTY_END

public static final String VIEWER_SERVLET_REPLACE_TOKEN_PROPERTY_END
token in the viewer servlet to be replaced by the property end delimiter

See Also:
Constant Field Values

OBJECT_INDEX_KEY

protected static final String OBJECT_INDEX_KEY
query string key for the objectlist index to find the selected object upon onMimeOpenObject.

See Also:
Constant Field Values

SUBPATH_KEY

protected static final String SUBPATH_KEY
query string key for the subpath of the record subfolder to open

See Also:
Constant Field Values

SCRIPT_URL_PREFIX

public static final String SCRIPT_URL_PREFIX
prefix to create a URL out of a script command

See Also:
Constant Field Values

MIME_TYPE_PREFIX_OW_FOLDER

public static final String MIME_TYPE_PREFIX_OW_FOLDER
prefix for a specific folder class, used to configure the MIME types in the owmimetable.xml file

See Also:
Constant Field Values

MIME_TYPE_PREFIX_OW_DEFAULT

public static final String MIME_TYPE_PREFIX_OW_DEFAULT
prefix for default types (OBJECT_TYPE_DOCUMENT, OBJECT_TYPE_FOLDER, OBJECT_TYPE_HISTORY...), used to configure the MIME types in the owmimetable.xml file

See Also:
Constant Field Values

MIME_TYPE_PREFIX_OW_CUSTOMOBJECT

public static final String MIME_TYPE_PREFIX_OW_CUSTOMOBJECT
prefix for custom object, used to configure the MIME types in the owmimetable.xml file

See Also:
Constant Field Values

m_MainContext

protected OwMainAppContext m_MainContext
reference to the cast AppContext


m_Configuration

protected OwConfiguration m_Configuration
application m_Configuration reference


m_parent

protected OwObject m_parent

m_RefreshContext

protected OwClientRefreshContext m_RefreshContext
event listener for the function plugin refresh events


m_fDEBUG_ResetCalled

protected boolean m_fDEBUG_ResetCalled
flag signal for debug reasons, to throw an error if client forgets to call reset


m_ObjectMap

protected Map m_ObjectMap
map which keeps the objects to be opened and create links upon


m_strMimeItemStyle

protected String m_strMimeItemStyle
style to be used for items


m_strMimeIconStyle

protected String m_strMimeIconStyle
style to be used for icons


undefName

protected String undefName
label to use when name is null


documentTitle

protected String documentTitle
label to use for tooltip on documents
use "app.OwMimeManager.documenttitle" to localize/control value


objectTitle

protected String objectTitle
label to use for tooltip on objects
use "app.OwMimeManager.objecttitle" to localize/control value


m_NumberFormat

protected NumberFormat m_NumberFormat

m_mimeTypeContext

protected String m_mimeTypeContext
the context to be used for MIME type resolution

Since:
2.5.3.0
Constructor Detail

OwMimeManager

public OwMimeManager()
Method Detail

init

protected void init()
             throws Exception
init the target after the context is set.

Specified by:
init in class OwEventTarget
Throws:
Exception

setIconStyle

public void setIconStyle(String strMimeIconStyle_p)
set the style for the MIME icons

Parameters:
strMimeIconStyle_p - String new CSS style

getIconStyle

public String getIconStyle()
Return the style for icons which are rendered by this MIME type manager.

Returns:
String name of CSS class name
Since:
2.5.2.0

setItemStyle

public void setItemStyle(String strMimeItemStyle_p)
set the style for the MIME items

Parameters:
strMimeItemStyle_p - String new CSS style

setUndefinedLabel

public void setUndefinedLabel(String undefLabel_p)
Set the Label which should be used for rendering of text links, if given display value is null.

Parameters:
undefLabel_p - String label to use, should be non-null value
Since:
2.5.2.0

getUndefinedLabel

public String getUndefinedLabel()
Get label to use for rendering of text links, if the given display value is null.

Returns:
String to use for rendering links
Since:
2.5.2.0
See Also:
setUndefinedLabel(String)

setMimeTypeContext

public void setMimeTypeContext(String context_p)
Set the context to be used for MIME type resolution

Parameters:
context_p - the context to be used for MIME type resolution, can be null
Since:
2.5.3.0

getMimeTypeContext

public String getMimeTypeContext()
Returns the context to be used for MIME type resolution

Returns:
the context to be used for MIME type resolution, can be null

getMimeNode

public static OwXMLUtil getMimeNode(OwConfiguration configuration_p,
                                    OwObjectReference obj_p)
                             throws Exception
get the MIME info node from the MIME table for the requested object

Parameters:
configuration_p - OwConfiguration object for static use
obj_p - OwObjectReference to retrieve MIME info for
Returns:
OwXMLUtil wrapped DOM node, may be empty if no MIME type definition was found
Throws:
Exception

getMimeIcon

public static String getMimeIcon(OwMainAppContext context_p,
                                 OwObjectReference obj_p)
                          throws Exception
get the icon path for the mimetype

Parameters:
context_p - OwMainAppContext current context
obj_p - OwObjectReference for which to retrieve the MIME icon
Returns:
String containing the path to the icon
Throws:
Exception

insertIconLink

public void insertIconLink(Writer w_p,
                           OwObjectReference obj_p,
                           String subpath_p)
                    throws Exception
insert a icon object hyperlink to download or open a OwObjectReference in a viewer This function is useful for objects listed by OwObjectCollection

Parameters:
w_p -
obj_p -
subpath_p - optional path to the subitem to open or null
Throws:
Exception

insertIconLink

public void insertIconLink(Writer w_p,
                           OwObjectReference obj_p,
                           String subpath_p,
                           int page_p)
                    throws Exception
insert a icon object hyperlink to download or open a OwObjectReference in a viewer This function is useful for objects listed by OwObjectCollection

Parameters:
w_p -
obj_p -
subpath_p - optional path to the subitem to open or null
page_p - int requested page number
Throws:
Exception

createIconLink

protected StringBuffer createIconLink(OwObjectReference obj_p)
                               throws Exception
Create the icon link for the given object

Parameters:
obj_p - - the OwObjectReference object
Returns:
- a StringBuffer object containing the link.
Throws:
Exception
Since:
3.0.0.0

insertIconLink

public void insertIconLink(Writer w_p,
                           OwObjectReference obj_p)
                    throws Exception
insert a icon object hyperlink to download or open a OwObjectReference in a viewer This function is useful for objects listed by OwObjectCollection

Parameters:
w_p -
obj_p -
Throws:
Exception

getDownloadURL

public static String getDownloadURL(OwMainAppContext context_p,
                                    OwObjectReference obj_p,
                                    int iContentType_p,
                                    int iPage_p,
                                    OwXMLUtil mimeNode_p)
                             throws Exception
create a download URL where the content of the specified object, contenttype and page can be found

Parameters:
context_p - OwMainAppContext since method is static
obj_p - OwObjectReference to retrieve the URL
iContentType_p - int requested content type as specified in OwContentCollection
iPage_p - int requested page number
mimeNode_p - OwXMLUtil MIME node
Returns:
String download URL for content
Throws:
Exception

getDefaultDownloadURL

protected static String getDefaultDownloadURL(OwMainAppContext context_p,
                                              OwObjectReference obj_p,
                                              int iContentType_p,
                                              int iPage_p)
                                       throws Exception
create a default download URL where the content of the specified object, contenttype and page can be found

Parameters:
context_p - OwMainAppContext since method is static
obj_p - OwObjectReference to retrieve the URL
iContentType_p - int requested content type as specified in OwContentCollection
iPage_p - int requested page number
Returns:
String download URL for content
Throws:
Exception

replaceProperties

protected static String replaceProperties(OwMainAppContext context_p,
                                          String strIn_p,
                                          OwObjectReference obj_p)
                                   throws Exception
replace a object property placeholder

Parameters:
strIn_p - String to search and replace
obj_p - OwObjectReference
Returns:
String
Throws:
Exception

insertTextLink

public void insertTextLink(Writer w_p,
                           String strDisplayName_p,
                           OwObjectReference obj_p)
                    throws Exception
insert a text object hyperlink to download or open a OwObjectReference in a viewer This function is useful for objects listed by OwObjectCollection

Parameters:
w_p - Writer where to write the text as link
strDisplayName_p - String text/name/label to use in link representation
obj_p - OwObjectReference which is mapped to the link
Throws:
Exception

insertTextLink

public void insertTextLink(Writer w_p,
                           String strDisplayName_p,
                           OwObjectReference obj_p,
                           String subpath_p)
                    throws Exception
insert a text object hyperlink to download or open a OwObjectReference in a viewer This function is useful for objects listed by OwObjectCollection

Parameters:
w_p -
strDisplayName_p -
obj_p -
subpath_p - optional path to the subitem to open or null
Throws:
Exception

insertTextLink

public void insertTextLink(Writer w_p,
                           String strDisplayName_p,
                           OwObjectReference obj_p,
                           String subpath_p,
                           int page_p)
                    throws Exception
insert a text object hyperlink to download or open a OwObjectReference in a viewer This function is useful for objects listed by OwObjectCollection

Parameters:
w_p -
strDisplayName_p -
obj_p -
subpath_p - subpath_p optional path to the subitem to open or null
page_p - integer representing the value of page to open
Throws:
Exception

insertHtmlLink

public void insertHtmlLink(Writer w_p,
                           String strHtmlCode_p,
                           OwObjectReference obj_p,
                           String subpath_p)
                    throws Exception
insert a hyperlink wrapped around arbitrary HTML code to download or open a OwObjectReference in a viewer This function is useful for objects listed by OwObjectCollection

Parameters:
w_p -
strHtmlCode_p -
obj_p -
subpath_p - optional path to the subitem to open or null
Throws:
Exception

insertHtmlLink

public void insertHtmlLink(Writer w_p,
                           String strHtmlCode_p,
                           OwObjectReference obj_p,
                           String subpath_p,
                           int page_p)
                    throws Exception
insert a hyperlink wrapped around arbitrary HTML code to download or open a OwObjectReference in a viewer This function is useful for objects listed by OwObjectCollection

Parameters:
w_p -
strHtmlCode_p -
obj_p -
subpath_p - optional path to the subitem to open or null
page_p - integer representing the value of page to open
Throws:
Exception

createLinkUrl

protected String createLinkUrl(String eventName_p,
                               OwObjectReference obj_p,
                               String subpath_p)
create the URL of the given event and the additional parameter

Parameters:
eventName_p -
obj_p -
subpath_p - String subpath or null to open root
Returns:
a String

reset

public void reset()
clear the map before you call insertLink methods, otherwise the map would increase to infinite

NOTE: Never forget to call this function in your onRender Method

Since:
3.2.0.0

setParent

public void setParent(OwObject parent_p)
set parent to use in document functions


onDocumentFunctionHandler

public void onDocumentFunctionHandler(javax.servlet.http.HttpServletRequest request_p)
                               throws Exception
event called when user clicked on a name link of an object entry in the list Creates a new dialog for the clicked object

Parameters:
request_p - HttpServletRequest
Throws:
Exception

setRefreshContext

public void setRefreshContext(OwClientRefreshContext eventlister_p)
register an eventlistener with this view to receive notifications

Parameters:
eventlister_p - OwClientRefreshContext interface

onPluginEventHandler

public void onPluginEventHandler(javax.servlet.http.HttpServletRequest request_p)
                          throws Exception
event called when user clicked on a name link of an object entry in the list Dispatches the object to a plugin

Parameters:
request_p - HttpServletRequest
Throws:
Exception

getNumberFormater

protected NumberFormat getNumberFormater()
get the formatter used for numbers

Returns:
NumberFormat

delegateToMasterPlugin

protected static void delegateToMasterPlugin(OwMainAppContext context_p,
                                             OwMasterDocument masterPlugin_p,
                                             OwObjectReference obj_p,
                                             String subpath_p)
                                      throws Exception
overridable handler function

Parameters:
masterPlugin_p - OwMasterDocument of the handler plugin to open the object
obj_p - the OwObjectReference to open
subpath_p - String subpath or null to open root
Throws:
Exception

getHandlerMasterPlugin

public static OwMasterDocument getHandlerMasterPlugin(OwMainAppContext context_p,
                                                      OwObjectReference obj_p)
                                               throws Exception
get the handler master plugin for the given object reference if defined.

Parameters:
context_p - OwMainAppContext
obj_p - OwObjectReference to open
Returns:
OwMasterDocument of plugin or null if not found. (throws a OwConfigurationException if handlerkey is found but can not be resolved)
Throws:
Exception, - OwConfigurationException
Exception

getHandlerDocumentPlugin

public static OwDocumentFunction getHandlerDocumentPlugin(OwMainAppContext context_p,
                                                          OwObjectReference obj_p)
                                                   throws Exception
get the handler document plugin for the given object reference if defined.

Parameters:
context_p - OwMainAppContext
obj_p - OwObjectReference to open
Returns:
OwDocumentFunction of plugin or null if not found. (throws a OwConfigurationException if handlerkey is found but can not be resolved)
Throws:
Exception, - OwAccessDeniedException
Exception

openObject

public static void openObject(OwMainAppContext context_p,
                              OwObjectReference obj_p,
                              OwObject parent_p,
                              int iViewerMode_p,
                              OwClientRefreshContext refreshCtx_p,
                              String mimeContext_p)
                       throws Exception
open the given object according to MIME settings

Parameters:
context_p - OwMainAppContext
obj_p - OwObjectReference
parent_p - OwObject
iViewerMode_p - mode as defined in VIEWER_MODE_...
refreshCtx_p - OwClientRefreshContext callback interface for the function plugins to signal refresh events to clients, can be null if no refresh is needed
mimeContext_p - String context for MIME retrieval, can be null
Throws:
Exception
Since:
3.1.0.0

openObject

public static void openObject(OwMainAppContext context_p,
                              OwObjectReference obj_p,
                              OwObject parent_p,
                              int iViewerMode_p,
                              OwClientRefreshContext refreshCtx_p)
                       throws Exception
open the given object according to MIME settings

Parameters:
context_p - OwMainAppContext
obj_p - OwObjectReference
parent_p - OwObject
iViewerMode_p - mode as defined in VIEWER_MODE_...
refreshCtx_p - OwClientRefreshContext callback interface for the function plugins to signal refresh events to clients, can be null if no refresh is needed
Throws:
Exception

openObjectPreview

public static void openObjectPreview(OwMainAppContext context_p,
                                     OwObjectReference obj_p,
                                     OwObject parent_p,
                                     int iViewerMode_p,
                                     OwClientRefreshContext refreshCtx_p)
                              throws Exception
open the given object according to MIME settings

Parameters:
context_p - OwMainAppContext
obj_p - OwObjectReference
parent_p - OwObject
iViewerMode_p - mode as defined in VIEWER_MODE_...
refreshCtx_p - OwClientRefreshContext callback interface for the function plugins to signal refresh events to clients, can be null if no refresh is needed
Throws:
Exception

openObject

public static void openObject(OwMainAppContext context_p,
                              OwObjectReference obj_p,
                              OwObject parent_p,
                              int iViewerMode_p,
                              OwClientRefreshContext refreshCtx_p,
                              int iPage_p,
                              OwWindowPositions windowpos_p,
                              Collection objects_p)
                       throws Exception
open the given object according to MIME settings

Parameters:
context_p - OwMainAppContext
obj_p - OwObjectReference
parent_p - OwObject
iViewerMode_p - mode as defined in VIEWER_MODE_...
refreshCtx_p - OwClientRefreshContext callback interface for the function plugins to signal refresh events to clients, can be null if no refresh is needed
iPage_p - int page number
windowpos_p - OwWindowPositions
objects_p - optional Collection of objects to view in MDI mode, can be null
Throws:
Exception

openObject

public static void openObject(OwMainAppContext context_p,
                              OwObjectReference obj_p,
                              OwObject parent_p,
                              int iViewerMode_p,
                              OwClientRefreshContext refreshCtx_p,
                              int iPage_p,
                              OwWindowPositions windowpos_p,
                              Collection objects_p,
                              String additionalParams_p,
                              String mimeContext_p)
                       throws Exception
open the given object according to the MIME settings, and add also the additional params to the caller URL.

Parameters:
context_p - OwMainAppContext of the app
obj_p - OwObjectReference to the object which should be opened
parent_p - OwObject parent of the referenced object
iViewerMode_p - mode as defined in VIEWR_MODE_...
refreshCtx_p - OwClientRefreshContext callback interface for the function plugins to signal refresh events to clients, can be null if no refresh is needed
iPage_p - int page number
windowpos_p - OwWindowPositions
objects_p - optional Collection of objects to view in MDI mode, can be null
additionalParams_p - String additional params which should be added to the URL
mimeContext_p - String context for MIME retrieval, can be null
Throws:
Exception - if the context can not resolve the the object reference, or MIME settings.

openObject

public static void openObject(OwMainAppContext context_p,
                              OwObjectReference obj_p,
                              OwObject parent_p,
                              int iViewerMode_p,
                              OwClientRefreshContext refreshCtx_p,
                              int iPage_p,
                              OwWindowPositions windowpos_p,
                              Collection objects_p,
                              String additionalParams_p)
                       throws Exception
open the given object according to the MIME settings, and add also the additional params to the caller URL.

Parameters:
context_p - OwMainAppContext of the app
obj_p - OwObjectReference to the object which should be opened
parent_p - OwObject parent of the referenced object
iViewerMode_p - mode as defined in VIEWR_MODE_...
refreshCtx_p - OwClientRefreshContext callback interface for the function plugins to signal refresh events to clients, can be null if no refresh is needed
iPage_p - int page number
windowpos_p - OwWindowPositions
objects_p - optional Collection of objects to view in MDI mode, can be null
additionalParams_p - String additional params which should be added to the URL
Throws:
Exception - if the context can not resolve the the object reference, or MIME settings.
Since:
3.1.0.0

openObjectPreview

public static void openObjectPreview(OwMainAppContext context_p,
                                     OwObjectReference obj_p,
                                     OwObject parent_p,
                                     int iViewerMode_p,
                                     OwClientRefreshContext refreshCtx_p,
                                     int iPage_p,
                                     OwWindowPositions windowpos_p,
                                     Collection objects_p)
                              throws Exception
open the given object according to MIME settings

Parameters:
context_p - OwMainAppContext
obj_p - OwObjectReference
parent_p - OwObject
iViewerMode_p - mode as defined in VIEWER_MODE_...
refreshCtx_p - OwClientRefreshContext callback interface for the function plugins to signal refresh events to clients, can be null if no refresh is needed
iPage_p - int page number
windowpos_p - OwWindowPositions
objects_p - optional Collection of objects to view in MDI mode, can be null
Throws:
Exception

editObject

public static OwMimeManager.OwOpenCommand editObject(OwMainAppContext context_p,
                                                     OwObjectReference obj_p)
                                              throws Exception
Creates an OwOpenCommand handling the <editservlet> tag from MIME node, if it exist or else an OwInvalidOperationException is thrown.

Parameters:
context_p - OwMainAppContext current context to use
obj_p - OwObjectReference which should be open over edit servlet
Returns:
OwOpenCommand with the information to create the link/JavaScript
Throws:
Exception
Since:
2.5.2.0

editObject

public static OwMimeManager.OwOpenCommand editObject(OwMainAppContext context_p,
                                                     OwObjectReference obj_p,
                                                     int page_p)
                                              throws Exception
Creates an OwOpenCommand handling the <editservlet> tag from MIME node, if it exist or else an OwInvalidOperationException is thrown.

Parameters:
context_p - OwMainAppContext current context to use
obj_p - OwObjectReference which should be open over edit servlet
page_p - int load content of the obj_p
Returns:
OwOpenCommand with the information to create the link/JavaScript
Throws:
Exception
Since:
2.5.2.0

editObject

public static OwMimeManager.OwOpenCommand editObject(OwMainAppContext context_p,
                                                     OwObjectReference obj_p,
                                                     String additionalParams_p,
                                                     int page_p)
                                              throws Exception
Creates an OwOpenCommand handling the <editservlet> tag from MIME node, if it exist or else an OwInvalidOperationException is thrown.

Parameters:
context_p - OwMainAppContext current context to use
obj_p - OwObjectReference which should be open over edit servlet
additionalParams_p - String parameter which should be added to the created URL
page_p - int load content of the obj_p
Returns:
OwOpenCommand with the information to create the link/JavaScript
Throws:
Exception
Since:
2.5.2.0

editObject

public static OwMimeManager.OwOpenCommand editObject(OwMainAppContext context_p,
                                                     OwObjectReference obj_p,
                                                     String mimeContext_p,
                                                     String additionalParams_p,
                                                     int page_p)
                                              throws Exception
Creates an OwOpenCommand handling the <editservlet> tag from MIME node, if it exist or else an OwInvalidOperationException is thrown.

Parameters:
context_p - OwMainAppContext current context to use
obj_p - OwObjectReference which should be open over edit servlet
mimeContext_p - context used to determine the object MIME configuration (see getMimeNode(OwConfiguration, OwObjectReference, String)
additionalParams_p - String parameter which should be added to the created URL
page_p - int load content of the obj_p
Returns:
OwOpenCommand with the information to create the link/JavaScript
Throws:
Exception
Since:
3.1.0.0

openFilePreview

public static void openFilePreview(OwMainAppContext context_p,
                                   String mimeType_p,
                                   String path_p)
                            throws Exception
open the given file according to MIME settings for preview

Parameters:
context_p - OwMainAppContext
mimeType_p - the MIME type of the preview file
path_p - absolute path to file on server to preview
Throws:
Exception

openFilePreview

public static void openFilePreview(OwMainAppContext context_p,
                                   String mimeType_p,
                                   String path_p,
                                   String fileName_p)
                            throws Exception
open the given file according to the MIME settings for preview, Changes the file name to the given parameter fileName_p.

Parameters:
context_p - OwMainAppContext to use for requesting MIME-settings
mimeType_p - String MIME type of the preview file
path_p - String representing full path of the preview file
fileName_p - String can be null, name is then extracted from path_p
Throws:
Exception
Since:
2.5.2.0

isObjectDownloadable

public static boolean isObjectDownloadable(OwMainAppContext context_p,
                                           OwObjectReference obj_p)
                                    throws Exception
check if given object can be downloaded to hard drive

Parameters:
context_p - OwMainAppContext
obj_p - OwObjectReference
Returns:
true = object can be downloaded, false = object has no content or can not be downloaded
Throws:
Exception

isObjectDownloadable

public static boolean isObjectDownloadable(OwMainAppContext context_p,
                                           OwObjectReference obj_p,
                                           String mimeContext_p)
                                    throws Exception
check if given object can be downloaded to hard drive

Parameters:
context_p - OwMainAppContext
obj_p - OwObjectReference
mimeContext_p - optional context for MIME node resolution. Can be null.
Returns:
true = object can be downloaded, false = object has no content or can not be downloaded
Throws:
Exception
Since:
3.1.0.0

getDownloadLink

public static String getDownloadLink(OwMainAppContext context_p,
                                     String strDisplayName_p,
                                     OwObjectReference obj_p)
                              throws Exception
get a link to save/download the given OwObjectReference to the local hard drive

Parameters:
context_p - OwMainAppContext
strDisplayName_p - String link name
obj_p - OwObjectReference
Returns:
String href link
Throws:
Exception

getSaveDownloadURL

public static String getSaveDownloadURL(OwMainAppContext context_p,
                                        OwObjectReference obj_p)
                                 throws Exception
get a URL to save / download the given OwObjectReference to the local hard drive

Parameters:
context_p - OwMainAppContext
obj_p - OwObjectReference
Returns:
String href link
Throws:
Exception

getDownloadURL

public static String getDownloadURL(OwMainAppContext context_p,
                                    OwObjectReference obj_p,
                                    int iContentType_p,
                                    int iPage_p)
                             throws Exception
create a download URL where the content of the specified object, contenttype and page can be found

Parameters:
context_p - OwMainAppContext since method is static
obj_p - OwObjectReference to retrieve the URL
iContentType_p - int requested content type as specified in OwContentCollection
iPage_p - int requested page number
Returns:
String download URL for content
Throws:
Exception

getOpenCommand

public static OwMimeManager.OwOpenCommand getOpenCommand(OwMainAppContext context_p,
                                                         OwObjectReference obj_p)
                                                  throws Exception
Create URL or script command to open the object according to MIME settings. The first content page is selected by default.

Parameters:
context_p - OwMainAppContext
obj_p - OwObjectReference
Throws:
Exception

getOpenCommand

public static OwMimeManager.OwOpenCommand getOpenCommand(OwMainAppContext context_p,
                                                         OwObjectReference obj_p,
                                                         String additionalParams_p)
                                                  throws Exception
Create an URL or script to open the object according to MIME settings. The first content page is selected by default.

Parameters:
context_p - OwMainAppContext to handle/request MIME settings
obj_p - OwObjectRefernce which should be opened
additionalParams_p - String representing additional parameter, can be null
Returns:
OwOpenCommand
Throws:
Exception - if the object reference is null, if the MIME handling definition is wrong

getOpenCommand

public static OwMimeManager.OwOpenCommand getOpenCommand(OwMainAppContext context_p,
                                                         OwObjectReference obj_p,
                                                         String mimeContext_p,
                                                         String additionalParams_p)
                                                  throws Exception
Create an URL or script to open the object according to MIME settings. The first content page is selected by default.

Parameters:
context_p - OwMainAppContext to handle/request MIME settings
obj_p - OwObjectRefernce which should be opened
mimeContext_p - context used to determine the object MIME configuration (see getMimeNode(OwConfiguration, OwObjectReference, String)
additionalParams_p - String representing additional parameter, can be null
Returns:
OwOpenCommand
Throws:
Exception - if the object reference is null, if the MIME handling definition is wrong
Since:
3.1.0.0

getOpenCommand

public static OwMimeManager.OwOpenCommand getOpenCommand(OwMainAppContext context_p,
                                                         OwObjectReference obj_p,
                                                         String additionalParams_p,
                                                         int page_p)
                                                  throws Exception
Create an URL or script to open the referenced object, according to the defined MIME settings.

Parameters:
context_p - OwmainAppCotnext to handle/request MIME settings
obj_p - OwObjectReference which should be opened
additionalParams_p -
page_p -
Returns:
OwOpenCommand
Throws:
Exception - if the object reference is null, if the MIME handling definition is wrong

getOpenCommand

public static OwMimeManager.OwOpenCommand getOpenCommand(OwMainAppContext context_p,
                                                         OwObjectReference obj_p,
                                                         String mimeContext_p,
                                                         String additionalParams_p,
                                                         int page_p)
                                                  throws Exception
Create an URL or script to open the referenced object, according to the defined MIME settings.

Parameters:
context_p - OwmainAppCotnext to handle/request MIME settings
obj_p - OwObjectReference which should be opened
mimeContext_p - context used to determine the object MIME configuration (see getMimeNode(OwConfiguration, OwObjectReference, String)
additionalParams_p -
page_p -
Returns:
OwOpenCommand
Throws:
Exception - if the object reference is null, if the MIME handling definition is wrong

getOpenCommand

public OwMimeManager.OwOpenCommand getOpenCommand(OwObjectReference obj_p)
                                           throws Exception
Create URL or script command to open the object according to MIME settings. The first content page is selected by default.

Parameters:
obj_p - OwObjectReference
Throws:
Exception

getOpenCommand

public OwMimeManager.OwOpenCommand getOpenCommand(OwObjectReference obj_p,
                                                  String additionalParams_p)
                                           throws Exception
Create an URL or script using current instance of OwMimeManager. The first content page is selected by default.

Parameters:
obj_p - OwObjectReference the object reference which should be handled
additionalParams_p - String additional parameters which should be added, can be null
Returns:
OwOpenCommand containing the created URL or script
Throws:
Exception

getOpenCommand

public OwMimeManager.OwOpenCommand getOpenCommand(OwObjectReference obj_p,
                                                  String additionalParams_p,
                                                  int page_p)
                                           throws Exception
Create an URL or script using current instance of OwMimeManager.

Parameters:
obj_p - OwObjectReference the object reference which should be handled
additionalParams_p - String additional parameters which should be added, can be null
page_p - integer representing the value of page to open
Returns:
OwOpenCommand containing the created URL or script
Throws:
Exception

registerObject

protected void registerObject(OwObjectReference obj_p)
register a object to find it later in the events

Parameters:
obj_p - OwObjectReference

createAutoViewerRestoreMainWindowScript

public static String createAutoViewerRestoreMainWindowScript(OwMainAppContext context_p,
                                                             int viewermode_p)
create a script that closes the autoviewer and rearrange the browser. the script can be applied with the addFinalScript() method.

Returns:
String JavaScript

makeViewerTitleString

public static String makeViewerTitleString(String id_p)
Make sure ID does not consist of invalid characters for java script window name

Parameters:
id_p -
Returns:
a String

getAutoViewerScript

public static String getAutoViewerScript(OwMainAppContext context_p,
                                         String strOpenURL_p,
                                         int viewermode_p,
                                         String id_p,
                                         String sDmsID_p,
                                         int iPage_p)
create a script that opens the URL in a viewer and automatically arranges the browser and the viewer the script can be applied with the addFinalScript() method.

Parameters:
strOpenURL_p - String URL to view
viewermode_p - int mode as defined in OwMimeManager.VIEWER_MODE_...
id_p - String unique ID of document to distinguish viewer instances
sDmsID_p - String DMSID of document to open
iPage_p - int page to open
Returns:
String JavaScript

getAutoViewerScript

public static String getAutoViewerScript(OwMainAppContext context_p,
                                         String strOpenURL_p,
                                         int viewermode_p,
                                         String id_p,
                                         String sDmsID_p,
                                         int iPage_p,
                                         OwWindowPositions windowpos_p)
create a script that opens the URL in a viewer and automatically arranges the browser and the viewer the script can be applied with the addFinalScript() method.

Parameters:
strOpenURL_p - String URL to view
viewermode_p - int mode as defined in OwMimeManager.VIEWER_MODE_...
id_p - String unique ID of document to distinguish viewer instances
sDmsID_p - String DMSID of document to open
iPage_p - int page to open
Returns:
String JavaScript

getServletReplacedTokenString

protected static String getServletReplacedTokenString(String servletURL_p,
                                                      OwMainAppContext currentContext_p,
                                                      OwObjectReference obj_p,
                                                      OwXMLUtil mimeNode_p,
                                                      int page_p)
                                               throws UnsupportedEncodingException,
                                                      Exception
Calls the getServletReplacedTokenString(String, OwMainAppContext, OwObjectReference, OwXMLUtil, int, int) method with following parameters

getServletReplacedTokenString(servletURL, currentContext, obj, mimeNode, page, Integer.MIN_VALUE)

Parameters:
servletURL_p - String URL with placeholders to replace
currentContext_p - OwMainAppContext which is currently used
obj_p - OwObjectReference to use for replacement
mimeNode_p - OwXMLUtil XML node from owmimetable
page_p - int page number to use for replacing VIEWER_SERVLET_REPLACE_TOKEN_PAGE placeholder
Returns:
String where the placeholders are replaced with the values given as parameters
Throws:
UnsupportedEncodingException - if URL encoding of values fails
Exception
Since:
2.5.2.0
See Also:
getServletReplacedTokenString(String, OwMainAppContext, OwObjectReference, OwXMLUtil, int, int)

getServletReplacedTokenString

protected static String getServletReplacedTokenString(String servletURL_p,
                                                      OwMainAppContext currentContext_p,
                                                      OwObjectReference obj_p,
                                                      OwXMLUtil mimeNode_p,
                                                      int page_p,
                                                      int contentType_p)
                                               throws UnsupportedEncodingException,
                                                      Exception
This method is a Helper and replace the most used placeholder in a URL string. Also the String is processed by replacement scanners for The servletURL String is explored of containment for a placeholder, before replacing these with a value.

ATTENTION: This method calls obj.getDMSID() and many other methods, if this can lead to an exception replace the placeholder in servletURL before calling this method.

Parameters:
servletURL_p - String URL with tokens that should be replaced
currentContext_p - OwMainAppContext current context to use for replacing
obj_p - OwObjectReference object to use for replacement of DMSID and properties placeholders
mimeNode_p - OwXMLUtil XML MIME node from owmimetable
page_p - int page number to replace VIEWER_SERVLET_REPLACE_TOKEN_PAGE
contentType_p - int should be some of OwContentCollection.CONTENT_TYPE_... if equals Integer.MIN_VALUE it is ignored
Returns:
String where the placeholders are replaced by the values
Throws:
UnsupportedEncodingException - if values cannot be encoded to a URL
Exception
Since:
2.5.2.0


Copyright © 2013 Alfresco Business Solutions. All Rights Reserved.