public abstract class AbstractGenticsPortlet extends javax.portlet.GenericPortlet implements GenticsPortlet, PropertyModificationListener
Modifier and Type | Class and Description |
---|---|
protected class |
AbstractGenticsPortlet.SubPluginEventBrokerProvider
Internal helper class to provide the event broker for nested plugins
|
Modifier and Type | Field and Description |
---|---|
static String |
EVENT_ONCHANGE
constant for the name of the onChange event.
|
protected org.apache.log4j.Logger |
logger
module logger object for generating log messages in different log-levels
|
Constructor and Description |
---|
AbstractGenticsPortlet(String moduleId)
basic constructor that initializes the gentics portlet.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addListener(String eventPath)
Deprecated.
use
addListener(String, String) instead |
protected void |
addListener(String eventPath,
String actionCommand)
adds this module as listener to the portal
|
protected void |
addPluginListener(String pluginId,
EventHandler handler,
String actionCommand)
adds an event handler to the plugin with the given id
|
void |
afterProcessAction(javax.portlet.ActionRequest request,
javax.portlet.ActionResponse response)
perform required actions after
GenericPortlet.processAction(javax.portlet.ActionRequest, javax.portlet.ActionResponse)
(cleaning up, etc.) |
void |
afterProcessPluginAction(String pluginId,
javax.portlet.ActionRequest actionRequest,
javax.portlet.ActionResponse actionResponse)
This method is called by the portal after
processPluginAction(String, javax.portlet.ActionRequest, javax.portlet.ActionResponse) . |
boolean |
canResolve()
returns whether the module can resolve properties via calls to
getProperty(String) . |
void |
destroy() |
protected void |
doDispatch(javax.portlet.RenderRequest renderRequest,
javax.portlet.RenderResponse renderResponse) |
protected void |
doEditPNode(javax.portlet.RenderRequest renderRequest,
javax.portlet.RenderResponse renderResponse)
This method is called when the gentics portlet is rendered in PortletMode
GenticsPortletMode.EDITPNODE . |
protected void |
doFull(javax.portlet.RenderRequest request,
javax.portlet.RenderResponse response)
This method is called when the gentics portlet shall be rendered in
portlet mode
GenticsPortletMode.FULL . |
Object |
get(String key)
alias for
getProperty(String) |
Map |
getContainerRuntimeOptions() |
Datasource |
getDatasource(String id)
Get a datasource by id.
|
FileUploadProvider |
getFileUploadProvider()
Get a file upload provider for the module.
|
String |
getFullModuleType()
Get the full module type (including the application prefix)
|
GenticsPortletContext |
getGenticsPortletContext()
returns the specific GenticsPortletContext of this Module
|
GenticsImpInterface |
getImp(String impId)
Get an instance of the imp with the given id.
|
String |
getModuleId()
return the unique if of this module
|
String |
getModuleType()
get the module type
|
GenticsPlugin |
getPlugin(String id)
returns the plugin that was registered via
registerPlugin(String, GenticsPlugin) with the
given id |
protected Object |
getPortalProperty(String propertyPath)
returns the portal property (not implemented in abstractmodule)
|
PropertyResolver |
getPortalPropertyResolver()
Get a property resolver for resolving portal properties
|
javax.portlet.PortletRequest |
getPortletRequest()
get the current PortletRequest
|
Object |
getProperty(String key)
resolve the given property key to a property.
|
protected String |
getSessionPropertyName(String propertyName)
Get the session property name for the given property name (prefix it with the form name)
|
TemplateProcessor |
getTemplateProcessor(javax.portlet.RenderRequest renderRequest,
javax.portlet.RenderResponse renderResponse)
Deprecated.
|
String |
getTitle(javax.portlet.RenderRequest renderRequest)
get the module title as defined in the pnode of the module
|
void |
handleEvent(ActionEvent e)
handle an event this module listenes at
|
protected void |
handlePortalEvent(EventRequest request,
EventResponse response)
event handler method that can be overwritten by classes extending
AbstractGenticsPortlet.
|
I18nString |
i18n(String key)
Get a localized string for the given key.
|
void |
init(javax.portlet.PortletConfig config) |
protected void |
initSessionPropertyNames()
Initialize the session property names
|
protected void |
onChanged()
this is the primitive brother of onParameterChanged() it is called by the
default implementation of onParameterChanged and should update what the
module is about to render, because one of its parameters has changed.
|
protected void |
onLoad()
onload is called when the module is loaded for the first time.
|
protected void |
onParameterChanged(String parameterName,
ActionEvent e)
onParameterChanged() is called, whenever one of the paramters defined in
the module-description's parameter section changes.
|
void |
onPluginEvent(EventRequest eventRequest,
EventResponse eventResponse)
is called whenever a plugin is performing an event
|
protected void |
onPrepareRender()
onPrepareRender() is called every time the portal is displayed - after
action handling but before render stage (doView, doHelp, doFull, ....)
this is the last chance for a portlet to change what the render method
will display, and the last chance to trigger events.
|
protected void |
onSessionCreate()
onSessionCreate() is called when the user enters the portal.
|
void |
processPluginAction(String pluginId,
javax.portlet.ActionRequest actionRequest,
javax.portlet.ActionResponse actionResponse)
Processes a plugins action.
|
void |
propertyModified(String path,
String property,
Object value)
This method is called by the
PropertySetter when one of the
(sub-)properties of this object is modified |
void |
registerPlugin(String id,
GenticsPlugin plugin)
registers a plugin to this module.
|
void |
reloadModule()
This method is called if a module has to be reloaded.
|
protected void |
removeListener(String eventPath)
removes this module from the listeners collection
|
String |
renderPlugin(String id,
javax.portlet.RenderRequest request,
javax.portlet.RenderResponse response)
renders a specific plugin that was registered via
registerPlugin(String, GenticsPlugin) before |
void |
returnFileUploadProvider()
return a previously via
getFileUploadProvider() fetched file
upload provider to the portal. |
void |
returnTemplateProcessor(TemplateProcessor proc)
return an exclusive templateprocessor that was previously fetched via
getTemplateProcessor(RenderRequest, RenderResponse) . |
void |
setModuleType(String applicationPrefix,
String moduleType)
Set the application prefix and portlet name
|
boolean |
setProperty(String propertyName,
Object prop)
sets a specified property of the module.
|
void |
setRequest(javax.portlet.PortletRequest request)
set the current PortletRequest.
|
String |
toString() |
protected void |
triggerEvent(javax.portlet.PortletRequest request,
ActionEvent e)
convenience method to trigger a module event.
|
void |
unregisterPlugin(String id)
Unregister the plugin with the given id.
|
doEdit, doHeaders, doHelp, doView, getDefaultNamespace, getInitParameter, getInitParameterNames, getNextPossiblePortletModes, getPortletConfig, getPortletContext, getPortletName, getProcessingEventQNames, getPublicRenderParameterNames, getPublishingEventQNames, getResourceBundle, getSupportedLocales, init, processAction, processEvent, render, serveResource
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getPortletConfig, getPortletContext
public static final String EVENT_ONCHANGE
protected org.apache.log4j.Logger logger
public AbstractGenticsPortlet(String moduleId) throws javax.portlet.PortletException
moduleId
- the module id of this modulejavax.portlet.PortletException
- a portlet exception if anything problem during
execution occursprotected void initSessionPropertyNames()
protected String getSessionPropertyName(String propertyName)
propertyName
- property namepublic void init(javax.portlet.PortletConfig config) throws javax.portlet.PortletException
init
in interface javax.portlet.Portlet
init
in class javax.portlet.GenericPortlet
javax.portlet.PortletException
public void setRequest(javax.portlet.PortletRequest request)
setRequest
in interface GenticsPortlet
request
- PortletRequestpublic javax.portlet.PortletRequest getPortletRequest()
getPortletRequest
in interface GenticsPortlet
public String getModuleId()
getModuleId
in interface GenticsPortlet
public String getTitle(javax.portlet.RenderRequest renderRequest)
getTitle
in class javax.portlet.GenericPortlet
renderRequest
- a request for rendering this modulepublic Object getProperty(String key)
getProperty
in interface Resolvable
key
- the object keypublic Object get(String key)
getProperty(String)
get
in interface Resolvable
key
- the object keypublic boolean canResolve()
getProperty(String)
. this implementation always returns truecanResolve
in interface Resolvable
public boolean setProperty(String propertyName, Object prop)
setProperty
in interface Changeable
propertyName
- property nameprop
- property valueprotected void doDispatch(javax.portlet.RenderRequest renderRequest, javax.portlet.RenderResponse renderResponse) throws javax.portlet.PortletException, IOException
doDispatch
in class javax.portlet.GenericPortlet
javax.portlet.PortletException
IOException
protected void doFull(javax.portlet.RenderRequest request, javax.portlet.RenderResponse response) throws javax.portlet.PortletException, IOException
GenticsPortletMode.FULL
.request
- render requestresponse
- render responsejavax.portlet.PortletException
IOException
public GenticsPortletContext getGenticsPortletContext()
getGenticsPortletContext
in interface GenticsPortlet
protected Object getPortalProperty(String propertyPath) throws UnknownPropertyException
propertyPath
- the path for the propertyUnknownPropertyException
- is thrown if there is no such propertyprotected void removeListener(String eventPath)
eventPath
- for this event pathprotected void addListener(String eventPath)
addListener(String, String)
insteadeventPath
- event pathprotected void addListener(String eventPath, String actionCommand)
eventPath
- event pathactionCommand
- action command like "onSave" "onChange"protected void addPluginListener(String pluginId, EventHandler handler, String actionCommand)
pluginId
- id of the pluginhandler
- event handleractionCommand
- action command of the handled eventsprotected void triggerEvent(javax.portlet.PortletRequest request, ActionEvent e)
request
- portlet requeste
- event to be triggeredpublic final void handleEvent(ActionEvent e)
handleEvent
in interface EventHandler
e
- event to be handledprotected void handlePortalEvent(EventRequest request, EventResponse response) throws NoEventsAllowedException
handleEvent(ActionEvent)
.request
- event requestresponse
- event responseNoEventsAllowedException
- is thrown if there are no events
currently allowedprotected void onPrepareRender()
protected void onLoad()
protected void onParameterChanged(String parameterName, ActionEvent e)
parameterName
- the parameter that has changede
- the eventprotected void onChanged()
public GenticsPlugin getPlugin(String id)
registerPlugin(String, GenticsPlugin)
with the
given idgetPlugin
in interface GenticsPluginServer
id
- plugin idpublic void registerPlugin(String id, GenticsPlugin plugin)
registerPlugin
in interface GenticsPluginServer
id
- id of the pluginplugin
- the new pluginpublic void unregisterPlugin(String id)
GenticsPluginServer
unregisterPlugin
in interface GenticsPluginServer
id
- id of the plugin to unregisterpublic String renderPlugin(String id, javax.portlet.RenderRequest request, javax.portlet.RenderResponse response) throws javax.portlet.PortletException, IOException
registerPlugin(String, GenticsPlugin)
beforerenderPlugin
in interface GenticsPluginServer
id
- plugin idrequest
- portlet requestresponse
- portlet responsejavax.portlet.PortletException
- is thrown if there is an error during execution
of processingIOException
- is thrown if there is any i/o errorprotected void onSessionCreate()
public void onPluginEvent(EventRequest eventRequest, EventResponse eventResponse)
onPluginEvent
in interface GenticsPluginServer
eventRequest
- event requesteventResponse
- event responsepublic final void processPluginAction(String pluginId, javax.portlet.ActionRequest actionRequest, javax.portlet.ActionResponse actionResponse) throws javax.portlet.PortletException, IOException
processPluginAction
in interface GenticsPluginServer
pluginId
- plugin idactionRequest
- action requestactionResponse
- action responsejavax.portlet.PortletException
- is thrown if there is any error during
processingIOException
- is thrown if there is any i/o errorpublic void afterProcessPluginAction(String pluginId, javax.portlet.ActionRequest actionRequest, javax.portlet.ActionResponse actionResponse)
processPluginAction(String, javax.portlet.ActionRequest, javax.portlet.ActionResponse)
.
The call is forwarded to
GenticsPlugin.afterProcessAction(ActionRequest, ActionResponse)
of the addressed pluginafterProcessPluginAction
in interface GenticsPluginServer
pluginId
- id of the pluginactionRequest
- action requestactionResponse
- action responsepublic void afterProcessAction(javax.portlet.ActionRequest request, javax.portlet.ActionResponse response)
GenericPortlet.processAction(javax.portlet.ActionRequest, javax.portlet.ActionResponse)
(cleaning up, etc.)afterProcessAction
in interface GenticsPortlet
request
- action requestresponse
- action responsepublic FileUploadProvider getFileUploadProvider()
getFileUploadProvider
in interface GenticsPortlet
public void returnFileUploadProvider()
getFileUploadProvider()
fetched file
upload provider to the portal. This method is called in
afterProcessAction(ActionRequest, ActionResponse)
, so there is
no need to call it from within the module.returnFileUploadProvider
in interface GenticsPortlet
public I18nString i18n(String key)
i18n
in interface GenticsPortlet
key
- the key of the i18n item. the syntax is [a-z0-9.]+, and will
generate a warning if violated.public PropertyResolver getPortalPropertyResolver()
public GenticsImpInterface getImp(String impId)
impId
- id of the imp to getprotected void doEditPNode(javax.portlet.RenderRequest renderRequest, javax.portlet.RenderResponse renderResponse) throws javax.portlet.PortletException, IOException
GenticsPortletMode.EDITPNODE
. This implementation shows a form
with a big textfield to modify the pnoderenderRequest
- render requestrenderResponse
- render responsejavax.portlet.PortletException
IOException
public TemplateProcessor getTemplateProcessor(javax.portlet.RenderRequest renderRequest, javax.portlet.RenderResponse renderResponse)
GenticsPortletContext.getTemplateProcessor(GenticsPortlet, PortletConfig)
instead.returnTemplateProcessor(TemplateProcessor)
after usagegetTemplateProcessor
in interface GenticsPortlet
renderRequest
- render requestrenderResponse
- render responsepublic void returnTemplateProcessor(TemplateProcessor proc)
getTemplateProcessor(RenderRequest, RenderResponse)
.proc
- an recently fetched templateprocessor, which is not needed
any more.public Datasource getDatasource(String id)
getDatasource
in interface GenticsPortlet
id
- id of Datasource as defined in portalconfiguration.public void reloadModule()
GenticsPortlet
reloadModule
in interface GenticsPortlet
public String getModuleType()
GenticsPortlet
getModuleType
in interface GenticsPortlet
public String getFullModuleType()
GenticsPortlet
getFullModuleType
in interface GenticsPortlet
public void setModuleType(String applicationPrefix, String moduleType)
GenticsPortlet
setModuleType
in interface GenticsPortlet
applicationPrefix
- application prefixmoduleType
- module type (portlet name)public void destroy()
destroy
in interface javax.portlet.Portlet
destroy
in class javax.portlet.GenericPortlet
public Map getContainerRuntimeOptions()
getContainerRuntimeOptions
in interface javax.portlet.PortletConfig
getContainerRuntimeOptions
in class javax.portlet.GenericPortlet
public void propertyModified(String path, String property, Object value)
PropertyModificationListener
PropertySetter
when one of the
(sub-)properties of this object is modifiedpropertyModified
in interface PropertyModificationListener
path
- path of the changed property (not containing the actual name of the property)property
- name of the changed propertyvalue
- new value of the propertyCopyright © 2014 Gentics Software GmbH. All Rights Reserved.