com.wewebu.ow.server.app
Class OwDocumentFunction

java.lang.Object
  extended by com.wewebu.ow.server.app.OwFunction
      extended by com.wewebu.ow.server.app.OwDocumentFunction
All Implemented Interfaces:
OwPlugin

public abstract class OwDocumentFunction
extends OwFunction

Base Class for Document Function plugins.

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


Field Summary
 
Fields inherited from class com.wewebu.ow.server.app.OwFunction
DESCRIPTION_KEY_CLASSES, DESCRIPTION_KEY_OBJ_TYPES, DESCRIPTION_KEY_TYPE, DRAG_DROP_PROPERTY_MAX_FILESIZE, m_MainContext
 
Constructor Summary
OwDocumentFunction()
           
 
Method Summary
protected  void addHistoryEvent(Collection objects_p, OwObject oParent_p, int iEventType_p, int iStatus_p)
          add the plugin invoke event to the history manager
protected  void addHistoryEvent(OwObject oObject_p, OwObject oParent_p, int iEventType_p, int iStatus_p)
          add the plugin invoke event to the history manager
 String getBigDefaultIconHTML()
          get the HTML code for the big (24x24 pixels) icon for this plugin to be displayed in the object list.
 String getBigIconHTML(OwObject oObject_p, OwObject oParent_p)
          get the HTML code for the big (24 x 24 Pixels )icon for this plugin to be displayed in the object list.
 String getColumnTitle()
          get column title if defined
 boolean getContextMenu()
          get property from the XML plugin config node
 String getDefaultIconHTML()
          get the HTML code for the small (16x16 pixels) icon for this plugin to be displayed in the object list.
 String getDefaultLabel()
          get the label for the plugin, used in menus Used for context menus where no object information is available
protected  String getDisplayNameFromUserId(String checkedoutByID_p)
          Helper method that returns the display name of the user with a certain user id (login name), if the adapter implements or allows the methods, if not: the method returns the passed user id.
This method is used by a document function plugin to return information about a user, because it cannot be executed, e.g.:
- a object is checked out by a certain user:get the display name of this user
- a plugin cannot perform an action because the object is locked by a certain user
- a document is not enable, get detailed information why, check the user that is involved.
 boolean getEnableColumnClickEvent()
          check if plugin should generate a click event when the user clicked on the column (only when own column was defined using getColumnTitle())
 String getIconHTML(OwObject oObject_p, OwObject oParent_p)
          get the HTML code for the small (16x16 pixels) icon for this plugin to be displayed in the object list.
 String getLabel(OwObject oObject_p, OwObject oParent_p)
          get the label for the plugin, used in menus
 boolean getMultiselect()
          get property from the XML plugin config node
 boolean getNeedParent()
          check if plugin needs oParent_p parameter in onClick handler
 boolean getObjectInstance()
          get property from the XML plugin config node
 String getPluginType()
          get the plugin type
 Collection getRetrievalPropertyNames()
          Get a collection of property names that are needed to display the Objects in the list i.e.
 boolean getShowInEditViews()
          get property from the XML plugin config node
 void init(OwXMLUtil node_p, OwMainAppContext context_p)
          set the plugin description node
 boolean isEnabled(Collection objects_p, OwObject oParent_p, int iContext_p)
          check if function is enabled for the given objects (called only for multi select operations)
 boolean isEnabled(OwObject oObject_p, OwObject oParent_p, int iContext_p)
          check if function is enabled for the given object parameters (called only for single select operations)
 boolean isObjectTypeSupported(int iObjectType_p)
          check if the object type is supported by the plugin, used to filter out plugins NOTE: Only used to preselect plugins, you will still have to call isEnabled, to find out exactly if plugin supports a specific object
abstract  void onClickEvent(OwObject oObject_p, OwObject oParent_p, OwClientRefreshContext refreshCtx_p)
          event called when user clicked the plugin label / icon
 void onColumnClickEvent(OwObjectCollection objects_p, OwObject oParent_p, OwClientRefreshContext refreshCtx_p)
          event called when user clicked the plugin column (only when own column was defined using getColumnTitle())
 void onMultiselectClickEvent(Collection objects_p, OwObject oParent_p, OwClientRefreshContext refreshCtx_p)
          event called when user clicked the plugin for multiple selected items
 
Methods inherited from class com.wewebu.ow.server.app.OwFunction
getBigIcon, getConfigNode, getContext, getDragDropProperties, getEventManager, getHelpPath, getIcon, getName, getNoEvent, getPluginID, getPluginTitle, getPluginTypeDisplayName, getSafeSetting, getSupportedObjectClassesFromDescriptor, getSupportedObjectTypesFromDescriptor, getTooltip, isDragDropTarget, isObjectClassSupported, setSafeSetting
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OwDocumentFunction

public OwDocumentFunction()
Method Detail

init

public void init(OwXMLUtil node_p,
                 OwMainAppContext context_p)
          throws Exception
set the plugin description node

Overrides:
init in class OwFunction
Parameters:
node_p - OwXMLUtil wrapped DOM Node containing the plugin description
context_p - OwMainAppContext
Throws:
Exception

getColumnTitle

public String getColumnTitle()
get column title if defined

Returns:
String title HTML or empty string if not defined

getEnableColumnClickEvent

public boolean getEnableColumnClickEvent()
check if plugin should generate a click event when the user clicked on the column (only when own column was defined using getColumnTitle())

Returns:
boolean true = enable plugin only, if a oParent_p parameter is available for the selected object, false = oParent_p can be null.

getNeedParent

public boolean getNeedParent()
check if plugin needs oParent_p parameter in onClick handler

Returns:
boolean true = enable plugin only, if a oParent_p parameter is available for the selected object, false = oParent_p can be null.

getMultiselect

public boolean getMultiselect()
get property from the XML plugin config node

Returns:
boolean true = plugin supports multiselection and handles onMultiSelectClick, false = plugin can only work on one instance

getObjectInstance

public boolean getObjectInstance()
get property from the XML plugin config node

Returns:
boolean true = plugin will be available next to each instance of OwObject, false = it will not be available next to the objectinstance

getShowInEditViews

public boolean getShowInEditViews()
get property from the XML plugin config node

Returns:
boolean true = plugin will be available in object editing dialogs like OwEditPropertiesDialog

getContextMenu

public boolean getContextMenu()
get property from the XML plugin config node

Overrides:
getContextMenu in class OwFunction
Returns:
boolean true = plugin will be available in the context menu

getIconHTML

public String getIconHTML(OwObject oObject_p,
                          OwObject oParent_p)
                   throws Exception
get the HTML code for the small (16x16 pixels) icon for this plugin to be displayed in the object list. An anchor tag is wrapped around this HTML code to trigger events for the plugin. NOTE: you can return arbitrary HTML here, if you do not want to display an icon.

Parameters:
oObject_p - OwObject where event was triggered
oParent_p - Parent which listed the Object
Returns:
HTML code to be inserted for the document function plugin.
Throws:
Exception

getBigIconHTML

public String getBigIconHTML(OwObject oObject_p,
                             OwObject oParent_p)
                      throws Exception
get the HTML code for the big (24 x 24 Pixels )icon for this plugin to be displayed in the object list. An anchor tag is wrapped around this HTML code to trigger events for the plugin. NOTE: you can return arbitrary HTML here, if you do not want to display an icon.

Parameters:
oObject_p - OwObject where event was triggered
oParent_p - Parent which listed the Object
Returns:
HTML code to be inserted for the document function plugin.
Throws:
Exception

getDefaultLabel

public String getDefaultLabel()
                       throws Exception
get the label for the plugin, used in menus Used for context menus where no object information is available

Returns:
tooltip code to be inserted for the document function plugin.
Throws:
Exception

getLabel

public String getLabel(OwObject oObject_p,
                       OwObject oParent_p)
                throws Exception
get the label for the plugin, used in menus

Parameters:
oObject_p - OwObject where event was triggered
oParent_p - Parent which listed the Object
Returns:
tooltip code to be inserted for the document function plugin.
Throws:
Exception

getDefaultIconHTML

public String getDefaultIconHTML()
                          throws Exception
get the HTML code for the small (16x16 pixels) icon for this plugin to be displayed in the object list. An anchor tag is wrapped around this HTML code to trigger events for the plugin. Used for context menus where no object information is available NOTE: you can return arbitrary HTML here, if you do not want to display an icon.

Returns:
HTML code to be inserted for the document function plugin.
Throws:
Exception

getBigDefaultIconHTML

public String getBigDefaultIconHTML()
                             throws Exception
get the HTML code for the big (24x24 pixels) icon for this plugin to be displayed in the object list. An anchor tag is wrapped around this HTML code to trigger events for the plugin. Used for context menus where no object information is available NOTE: you can return arbitrary HTML here, if you do not want to display an icon.

Returns:
HTML code to be inserted for the document function plugin.
Throws:
Exception

isObjectTypeSupported

public boolean isObjectTypeSupported(int iObjectType_p)
check if the object type is supported by the plugin, used to filter out plugins NOTE: Only used to preselect plugins, you will still have to call isEnabled, to find out exactly if plugin supports a specific object

Parameters:
iObjectType_p - int OwObject type
Returns:
true = object type is supported, false otherwise

isEnabled

public boolean isEnabled(OwObject oObject_p,
                         OwObject oParent_p,
                         int iContext_p)
                  throws Exception
check if function is enabled for the given object parameters (called only for single select operations)

Parameters:
oObject_p - OwObject where event was triggered
oParent_p - Parent which listed the Object
iContext_p - OwStatusContextDefinitions
Returns:
true = enabled, false otherwise
Throws:
Exception

isEnabled

public boolean isEnabled(Collection objects_p,
                         OwObject oParent_p,
                         int iContext_p)
                  throws Exception
check if function is enabled for the given objects (called only for multi select operations)

Parameters:
objects_p - Collection of OwObject
oParent_p - Parent which listed the Object
iContext_p - OwStatusContextDefinitions
Returns:
true = enabled, false otherwise
Throws:
Exception

onClickEvent

public abstract void onClickEvent(OwObject oObject_p,
                                  OwObject oParent_p,
                                  OwClientRefreshContext refreshCtx_p)
                           throws Exception
event called when user clicked the plugin label / icon

Parameters:
oObject_p - OwObject where event was triggered
oParent_p - Parent which listed the Object
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

onMultiselectClickEvent

public void onMultiselectClickEvent(Collection objects_p,
                                    OwObject oParent_p,
                                    OwClientRefreshContext refreshCtx_p)
                             throws Exception
event called when user clicked the plugin for multiple selected items

Parameters:
objects_p - Collection of OwObject
oParent_p - Parent which listed the Objects
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

onColumnClickEvent

public void onColumnClickEvent(OwObjectCollection objects_p,
                               OwObject oParent_p,
                               OwClientRefreshContext refreshCtx_p)
                        throws Exception
event called when user clicked the plugin column (only when own column was defined using getColumnTitle())

Parameters:
objects_p - OwObjectCollection of all OwObject s in the list
oParent_p - Parent which listed the Objects
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

addHistoryEvent

protected void addHistoryEvent(OwObject oObject_p,
                               OwObject oParent_p,
                               int iEventType_p,
                               int iStatus_p)
                        throws Exception
add the plugin invoke event to the history manager

Parameters:
oObject_p - OwObject where event was triggered
oParent_p - Parent which listed the Object
iEventType_p - int one out of: OwEventManger.HISTORY_EVENT_TYPE_PLUGIN_INVOKE_UI OwEventManger.HISTORY_EVENT_TYPE_PLUGIN_INVOKE_VIEW OwEventManger.HISTORY_EVENT_TYPE_PLUGIN_INVOKE_EDIT
iStatus_p - int Status as defined in OwEventManger.HISTORY_STATUS_...
Throws:
Exception

addHistoryEvent

protected void addHistoryEvent(Collection objects_p,
                               OwObject oParent_p,
                               int iEventType_p,
                               int iStatus_p)
                        throws Exception
add the plugin invoke event to the history manager

Parameters:
objects_p - Collection of OwObject
oParent_p - Parent which listed the Object
iEventType_p - int one out of: OwEventManger.HISTORY_EVENT_TYPE_PLUGIN_INVOKE_UI OwEventManger.HISTORY_EVENT_TYPE_PLUGIN_INVOKE_VIEW OwEventManger.HISTORY_EVENT_TYPE_PLUGIN_INVOKE_EDIT
iStatus_p - int Status as defined in OwEventManger.HISTORY_STATUS_...
Throws:
Exception

getPluginType

public final String getPluginType()
get the plugin type

Returns:
String as defined in OwConfiguration.PLUGINTYPE_...

getRetrievalPropertyNames

public Collection getRetrievalPropertyNames()
                                     throws Exception
Get a collection of property names that are needed to display the Objects in the list i.e. these properties should be requested in advance to save server roundtrips.

ATTENTION: Define here the collection of property names, which are needed by this document function! This method is used by other plugins to create a request with all properties against the (back-end) ECM system, so no more roundtrips have to be made by additional retrieval.

Returns:
Collection of String, or null if no properties are needed
Throws:
Exception

getDisplayNameFromUserId

protected String getDisplayNameFromUserId(String checkedoutByID_p)
Helper method that returns the display name of the user with a certain user id (login name), if the adapter implements or allows the methods, if not: the method returns the passed user id.
This method is used by a document function plugin to return information about a user, because it cannot be executed, e.g.:
- a object is checked out by a certain user:get the display name of this user
- a plugin cannot perform an action because the object is locked by a certain user
- a document is not enable, get detailed information why, check the user that is involved.

Parameters:
checkedoutByID_p - user id which should be used to return the display name
Returns:
display name of the user
Since:
3.1.0.0


Copyright © 2013 Alfresco Business Solutions. All Rights Reserved.