org.norther.tammi.spray.loader.task
Class Submit

java.lang.Object
  extended by org.norther.tammi.spray.loader.task.Action
      extended by org.norther.tammi.spray.loader.task.Submit
All Implemented Interfaces:
Serializable, Task
Direct Known Subclasses:
FlowStepAction, TemplateAction

public abstract class Submit
extends Action

Submit is an alternative to Action that allows you to do event based submits. Essentially, you label all your submit buttons and methods with the prefix of "submit". For example, "submitDelete". Then any class that subclasses this class will get its submitDelete method executed.

If the named submit method was not implemented, it executes the generic submit method, named "submit", which it implements as a nop.

Methods returning Task$Control may act as submit methods, too, without specific naming rules.

Based on ActionEvent in the Apache Jakarta Turbine project.

Version:
$Id: Submit.java,v 1.1 2010-05-28 12:52:22 cvsimp Exp $
Author:
Jon S. Stevens, Ilkka Priha
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.norther.tammi.spray.loader.task.Task
Task.Control
 
Field Summary
static String EXECUTE_METHOD
          The execute method itself to discard.
static String SUBMIT_PREFIX
          The prefix of the submit method to look for.
 
Constructor Summary
Submit()
          Constructs a new action event.
 
Method Summary
 Task.Control execute(ServletRequest request, ServletResponse response, FilterChain chain, Object context)
          Executes customized functionality.
protected  Method getAction(Map<String,String[]> params, String... className)
          Gets the qualified submit method present in a parameter map.
protected  Method getAction(String action)
          Gets the named submit method.
protected  Class<?>[] getSignature()
          Gets the action class specific signature.
 void initialize(ServletRequest request, ServletResponse response, FilterChain chain, Object context)
          Initializes customized functionality after construction but before the first execution.
protected  Task.Control invoke(Method method, Object[] args, ServletRequest request, ServletResponse response, FilterChain chain, Object context)
          Invokes a method.
 Task.Control submit(ServletRequest request, ServletResponse response, FilterChain chain, Object context)
          Implements the default submit method if the specific one is not implemented.
 
Methods inherited from class org.norther.tammi.spray.loader.task.Action
find, find, getFilter, getMBeanServer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SUBMIT_PREFIX

public static final String SUBMIT_PREFIX
The prefix of the submit method to look for.

See Also:
Constant Field Values

EXECUTE_METHOD

public static final String EXECUTE_METHOD
The execute method itself to discard.

See Also:
Constant Field Values
Constructor Detail

Submit

public Submit()
Constructs a new action event.

Method Detail

initialize

public void initialize(ServletRequest request,
                       ServletResponse response,
                       FilterChain chain,
                       Object context)
Description copied from interface: Task
Initializes customized functionality after construction but before the first execution. The initialization parameters are the same as given to the first execution.

Specified by:
initialize in interface Task
Overrides:
initialize in class Action
Parameters:
request - the request.
response - the response.
chain - the filter chain.
context - a task specific context.

execute

public Task.Control execute(ServletRequest request,
                            ServletResponse response,
                            FilterChain chain,
                            Object context)
                     throws Exception
Description copied from interface: Task
Executes customized functionality.

Specified by:
execute in interface Task
Specified by:
execute in class Action
Parameters:
request - the request.
response - the response.
chain - the filter chain.
context - a task specific context.
Returns:
the execution control or null.
Throws:
Exception - on errors.

submit

public Task.Control submit(ServletRequest request,
                           ServletResponse response,
                           FilterChain chain,
                           Object context)
                    throws Exception
Implements the default submit method if the specific one is not implemented. The default implementation does nothing.

Parameters:
request - the request.
response - the response.
chain - the filter chain.
context - the context.
Returns:
the execution control.
Throws:
Exception - on errors.

invoke

protected Task.Control invoke(Method method,
                              Object[] args,
                              ServletRequest request,
                              ServletResponse response,
                              FilterChain chain,
                              Object context)
                       throws Exception
Invokes a method.

Parameters:
method - the method.
args - the arguments.
request - the request.
response - the response.
chain - the filter chain.
context - the context.
Returns:
the execution control.
Throws:
Exception - on errors.

getAction

protected Method getAction(String action)
Gets the named submit method.

Parameters:
action - the action name.
Returns:
the submit method or null.

getAction

protected Method getAction(Map<String,String[]> params,
                           String... className)
Gets the qualified submit method present in a parameter map. If an exactly named method is not available, but some submit parameter was present, the generic submit method is returned.

An optional class name is appended to the action parameter name to get a qualified submit method. If a qualified method is not available, the class name is removed and a non-qualified method returned.

Parameters:
params - the parameter map.
className - an optional class name.
Returns:
the action method or null.

getSignature

protected Class<?>[] getSignature()
Gets the action class specific signature.

Returns:
the action signature.


Copyright © 2004 The Norther Organization. All rights reserved.