com.cc.framework.adapter.struts
Class FWDispatchAction

java.lang.Object
  extended byorg.apache.struts.action.Action
      extended byorg.apache.struts.actions.BaseAction
          extended byorg.apache.struts.actions.DispatchAction
              extended bycom.cc.framework.adapter.struts.FWDispatchAction
All Implemented Interfaces:
FrameworkAction

public abstract class FWDispatchAction
extends org.apache.struts.actions.DispatchAction
implements FrameworkAction

Framework Dispatch Action

Version:
$Revision: 1.1 $
Author:
Harald Schulz

Field Summary
private static org.apache.commons.logging.Log fwlog
          Private Logger instance
protected  org.apache.commons.logging.Log log
          Commons Logging instance.
 
Fields inherited from class org.apache.struts.actions.DispatchAction
clazz, methods, types
 
Fields inherited from class org.apache.struts.actions.BaseAction
messages
 
Fields inherited from class org.apache.struts.action.Action
servlet
 
Constructor Summary
FWDispatchAction()
          Constructor
 
Method Summary
 void applyControlStates(ActionContext ctx)
          Applies the serialized control state from the HTTPRequest to the corresponding control instances.
 void cleanup(ActionContext ctx)
          This method do some cleanup after the action finished.
 ActionContext createActionContext(org.apache.struts.action.ActionMapping mapping, org.apache.struts.action.ActionForm form, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          This method is called to create the ActionContext wrapper.
 void doPostExecute(ActionContext ctx)
          A template method.
 boolean doPreExecute(ActionContext ctx)
          A template method.
 void doRenderAjaxResponse(ActionContext ctx, javax.servlet.jsp.PageContext pageContext)
          Renders the AJAX XML response
 void doSetMenuContext(ActionContext ctx, MenuContext menuCtx)
          Sets the menu context.
 void execute(ActionContext ctx)
          This method is called instead the struts execute.
 org.apache.struts.action.ActionForward execute(org.apache.struts.action.ActionMapping mapping, org.apache.struts.action.ActionForm form, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          This method gets called when no FWRequestProcessor is used!
 java.lang.reflect.Method getActionHandler(ControlActionContext ctx, java.lang.Object[] params)
          Searches the action class for a handler method.
 Control getControlByName(ActionContext ctx, java.lang.String name)
          The framework has a default pattern where to search a control instance.
 DialogContext getDialogContext(ActionContext ctx, boolean create)
          Returns or creates a dialog context
 ActionContext handleControlAction(ActionContext ctx, ControlMethodInvocation cmi)
          Handles an action which comes from a control on the form an delegates the request to the control.
 void handleControlAction(ControlActionContext ctx, java.lang.Object[] params)
          Handles an action which comes from a control on the form.
 ActionContext handleFormAction(ActionContext ctx)
          Checks if the request comes from a form button (save, cancel, ...) and delegates the request to the corresponding handler for the button which must be implemented in the (action) subclass.
 void setControlValue(ActionContext ctx, ControlValuePath path, java.lang.String[] values)
          This method is called to set a control element value
 void setControlValuesFromRequest(ActionContext ctx)
          This method is called to updates any control element data from request values.
 
Methods inherited from class org.apache.struts.actions.DispatchAction
cancelled, dispatchMethod, getMethod, getMethodName, getParameter, unspecified
 
Methods inherited from class org.apache.struts.action.Action
addErrors, addMessages, execute, generateToken, getErrors, getLocale, getMessages, getResources, getResources, getServlet, isCancelled, isTokenValid, isTokenValid, resetToken, saveErrors, saveErrors, saveMessages, saveMessages, saveToken, setLocale, setServlet
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.cc.framework.adapter.struts.FrameworkAction
doExecute
 

Field Detail

log

protected org.apache.commons.logging.Log log
Commons Logging instance.


fwlog

private static org.apache.commons.logging.Log fwlog
Private Logger instance

Constructor Detail

FWDispatchAction

public FWDispatchAction()
Constructor

Method Detail

cleanup

public void cleanup(ActionContext ctx)
Description copied from interface: FrameworkAction
This method do some cleanup after the action finished. The default implementation removes the form bean.

Specified by:
cleanup in interface FrameworkAction
Parameters:
ctx - ActionContext
See Also:
FrameworkAction.cleanup(com.cc.framework.adapter.struts.ActionContext)

getControlByName

public Control getControlByName(ActionContext ctx,
                                java.lang.String name)
                         throws java.lang.Exception
Description copied from interface: FrameworkAction
The framework has a default pattern where to search a control instance. If the control can not be found by the implemented pattern, this method can be overwritten to implement an additional or own processing. First the control will be searched in the session, then the control will be searched in the FormBean which is associated with the action.

Specified by:
getControlByName in interface FrameworkAction
Parameters:
ctx - The ActionContext
name - The name of the bean
Returns:
Control
Throws:
java.lang.Exception - If an exception occurred
See Also:
FrameworkAction.getControlByName(com.cc.framework.adapter.struts.ActionContext, java.lang.String)

applyControlStates

public void applyControlStates(ActionContext ctx)
                        throws java.lang.Exception
Description copied from interface: FrameworkAction
Applies the serialized control state from the HTTPRequest to the corresponding control instances.

Specified by:
applyControlStates in interface FrameworkAction
Parameters:
ctx - ActionContext
Throws:
java.lang.Exception - if an exception occurs
See Also:
FrameworkAction.applyControlStates(com.cc.framework.adapter.struts.ActionContext)

handleControlAction

public ActionContext handleControlAction(ActionContext ctx,
                                         ControlMethodInvocation cmi)
                                  throws java.lang.Exception
Description copied from interface: FrameworkAction
Handles an action which comes from a control on the form an delegates the request to the control.

Specified by:
handleControlAction in interface FrameworkAction
Parameters:
ctx - ActionContext
cmi - ControlMethodInvocation
Returns:
ActionContext
Throws:
java.lang.Exception - if an exception occurs
See Also:
FrameworkAction.handleControlAction(com.cc.framework.adapter.struts.ActionContext, com.cc.framework.ui.control.ControlMethodInvocation)

handleControlAction

public void handleControlAction(ControlActionContext ctx,
                                java.lang.Object[] params)
                         throws java.lang.Exception
Description copied from interface: FrameworkAction
Handles an action which comes from a control on the form. If the subclass does not implement a special processing for this event, the event will be forwarded to the control. So the control can do some default processing. This default behavior can be changed if an event handler in the subclass is implemented. This handler must follow the naming convention "controlname_onEventname(ControlRequestContext ctx, parameters ...) For example: users_onDrilldown(ControlRequestContext ctx, String key) Note: An other way to change the default behavior of an existing control is to subclass the control an write an new control.

Specified by:
handleControlAction in interface FrameworkAction
Parameters:
ctx - ControlRequestContext
params - Parameters
Throws:
java.lang.Exception - if an exception occurs
See Also:
FrameworkAction.handleControlAction(com.cc.framework.ui.control.ControlActionContext, java.lang.Object[])

getActionHandler

public java.lang.reflect.Method getActionHandler(ControlActionContext ctx,
                                                 java.lang.Object[] params)
Description copied from interface: FrameworkAction
Searches the action class for a handler method. The search order is

Specified by:
getActionHandler in interface FrameworkAction
Parameters:
ctx - the action context
params - actual parameters
Returns:
returns a handler method or null when no such method is defined
See Also:
FrameworkAction.getActionHandler(com.cc.framework.ui.control.ControlActionContext, java.lang.Object[])

setControlValue

public void setControlValue(ActionContext ctx,
                            ControlValuePath path,
                            java.lang.String[] values)
                     throws java.lang.Exception
Description copied from interface: FrameworkAction
This method is called to set a control element value

Specified by:
setControlValue in interface FrameworkAction
Parameters:
ctx - The ActionContext
path - The Pathname of the value
values - The value itself
Throws:
java.lang.Exception - is thrown when a value could not be set
See Also:
FrameworkAction.setControlValue(com.cc.framework.adapter.struts.ActionContext, com.cc.framework.ui.control.ControlValuePath, java.lang.String[])

setControlValuesFromRequest

public void setControlValuesFromRequest(ActionContext ctx)
                                 throws java.lang.Exception
Description copied from interface: FrameworkAction
This method is called to updates any control element data from request values. All nested control element values follow the naming convention documented in ControlValuePath

Specified by:
setControlValuesFromRequest in interface FrameworkAction
Parameters:
ctx - The ActionContext
Throws:
java.lang.Exception - is thrown when a value could not be set
See Also:
FrameworkAction.setControlValuesFromRequest(com.cc.framework.adapter.struts.ActionContext)

handleFormAction

public ActionContext handleFormAction(ActionContext ctx)
                               throws java.lang.Exception
Description copied from interface: FrameworkAction
Checks if the request comes from a form button (save, cancel, ...) and delegates the request to the corresponding handler for the button which must be implemented in the (action) subclass. This handler must follow the naming convention "buttonname_onEventname(FormActionContext ctx) For example save_onClick(FormActionContext ctx)

Specified by:
handleFormAction in interface FrameworkAction
Parameters:
ctx - The ActionContext
Returns:
ActionContext
Throws:
java.lang.Exception - If an exception occurred
See Also:
FrameworkAction.handleFormAction(com.cc.framework.adapter.struts.ActionContext)

getDialogContext

public DialogContext getDialogContext(ActionContext ctx,
                                      boolean create)
Returns or creates a dialog context

Specified by:
getDialogContext in interface FrameworkAction
Parameters:
ctx - The ActionContext
create - Indicates if an existing context should be returned (false); otherwise a new context is started (true)
Returns:
DialogContext

doPreExecute

public boolean doPreExecute(ActionContext ctx)
                     throws java.lang.Exception
Description copied from interface: FrameworkAction
A template method. Can be overridden by a subclass and is executed before the doExecute method is called. The method must return true if the doExecute method should be called.

Specified by:
doPreExecute in interface FrameworkAction
Parameters:
ctx - The ActionContext
Returns:
true if the doExecute() should be processed; false otherwise
Throws:
java.lang.Exception - If an exception occurred
See Also:
FrameworkAction.doPreExecute(com.cc.framework.adapter.struts.ActionContext)

doPostExecute

public void doPostExecute(ActionContext ctx)
                   throws java.lang.Exception
Description copied from interface: FrameworkAction
A template method. Can be overridden by a subclass and is executed after the doExecute method was called.

Specified by:
doPostExecute in interface FrameworkAction
Parameters:
ctx - The ActionContext
Throws:
java.lang.Exception - If an exception occurred
See Also:
FrameworkAction.doPostExecute(com.cc.framework.adapter.struts.ActionContext)

doSetMenuContext

public void doSetMenuContext(ActionContext ctx,
                             MenuContext menuCtx)
                      throws java.lang.Exception
Description copied from interface: FrameworkAction
Sets the menu context. If used, the processing must be implemented in the subclass

Specified by:
doSetMenuContext in interface FrameworkAction
Parameters:
ctx - The ActionContext
menuCtx - The MenuContext
Throws:
java.lang.Exception - If an exception occurred
See Also:
FrameworkAction.doSetMenuContext(com.cc.framework.adapter.struts.ActionContext, com.cc.framework.ui.control.MenuContext)

createActionContext

public ActionContext createActionContext(org.apache.struts.action.ActionMapping mapping,
                                         org.apache.struts.action.ActionForm form,
                                         javax.servlet.http.HttpServletRequest request,
                                         javax.servlet.http.HttpServletResponse response)
Description copied from interface: FrameworkAction
This method is called to create the ActionContext wrapper. Overwrite this method to use your own implementation

Specified by:
createActionContext in interface FrameworkAction
Parameters:
mapping - Struts Action Mapping
form - Struts Action Form
request - HTTPServletRequest
response - HTTPServletResponse
Returns:
ActionContext which is passed to the doExecute() method
See Also:
FrameworkAction.createActionContext(org.apache.struts.action.ActionMapping, org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)

execute

public void execute(ActionContext ctx)
             throws java.lang.Exception
Description copied from interface: FrameworkAction
This method is called instead the struts execute.

Specified by:
execute in interface FrameworkAction
Parameters:
ctx - ActionContext
Throws:
java.lang.Exception - if an exception occurs
See Also:
FrameworkAction.execute(com.cc.framework.adapter.struts.ActionContext)

execute

public org.apache.struts.action.ActionForward execute(org.apache.struts.action.ActionMapping mapping,
                                                      org.apache.struts.action.ActionForm form,
                                                      javax.servlet.http.HttpServletRequest request,
                                                      javax.servlet.http.HttpServletResponse response)
                                               throws java.lang.Exception
This method gets called when no FWRequestProcessor is used!

Throws:
java.lang.Exception
See Also:
Action.execute(org.apache.struts.action.ActionMapping, org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)

doRenderAjaxResponse

public void doRenderAjaxResponse(ActionContext ctx,
                                 javax.servlet.jsp.PageContext pageContext)
                          throws java.lang.Exception
Description copied from interface: FrameworkAction
Renders the AJAX XML response

Specified by:
doRenderAjaxResponse in interface FrameworkAction
Parameters:
ctx - ActionContext
pageContext - PageContext
Throws:
java.lang.Exception - Indicates an error during rendering
See Also:
FrameworkAction.doRenderAjaxResponse(com.cc.framework.adapter.struts.ActionContext, javax.servlet.jsp.PageContext)


Copyright © 2000-2005 SCC Informationssysteme GmbH. All Rights Reserved.