org.codehaus.groovy.grails.scaffolding
Class DefaultGrailsScaffolder

java.lang.Object
  extended by org.codehaus.groovy.grails.scaffolding.DefaultGrailsScaffolder
All Implemented Interfaces:
GrailsScaffolder

public class DefaultGrailsScaffolder
extends Object
implements GrailsScaffolder

The default implementation of scaffolding for Grails domain class and controller. Implements the GrailsScaffolder interface. Requires a ScaffoldRequestHandler and ScaffoldResponseHandlerFactory. The ScaffoldRequestHandler is responsible for handling requests to CRUD operations, whilst the ScaffoldResponseHandlerFactory creates ScaffoldResponseHandler instances that are responsible for delivering the response to the user in whatever format is required.

Since:
0.1 Created 30 Nov 2005
Author:
Graeme Rocher
See Also:
GrailsScaffolder, ScaffoldRequestHandler, ScaffoldResponseHandlerFactory

Nested Class Summary
(package private) static class DefaultGrailsScaffolder.AbstractAction
          Abstract base class that extends closure and retrieves the necessary arguments from the controller This is used to inject closure properties into controllers so controller actions appear as if by magic.
(package private)  class DefaultGrailsScaffolder.CreateAction
          A closure that handles a call to a scaffolded list action
(package private)  class DefaultGrailsScaffolder.DeleteAction
          A closure action that implements deletion of a scaffolded instance by id.
(package private)  class DefaultGrailsScaffolder.EditAction
          A closure action that implements editing a scaffolded instance by id.
(package private)  class DefaultGrailsScaffolder.IndexAction
          A closure that handles a call to a scaffolded list action
(package private)  class DefaultGrailsScaffolder.ListAction
          A closure that handles a call to a scaffolded list action
(package private)  class DefaultGrailsScaffolder.SaveAction
          A closure action that implements the saving of new scaffoled instances.
(package private)  class DefaultGrailsScaffolder.ShowAction
          A closure action that implements showing a scaffolded instance by id.
(package private)  class DefaultGrailsScaffolder.UpdateAction
          A closure action that implements the updating of an existing scaffoled instances.
 
Field Summary
protected static Map actionClassToNameMap
           
protected static Map actions
           
 
Fields inherited from interface org.codehaus.groovy.grails.scaffolding.GrailsScaffolder
ACTION_NAMES, CREATE_ACTION, DELETE_ACTION, EDIT_ACTION, FIND_ACTION, INDEX_ACTION, LIST_ACTION, SAVE_ACTION, SEARCH_ACTION, SHOW_ACTION, UPDATE_ACTION
 
Constructor Summary
DefaultGrailsScaffolder()
           
 
Method Summary
 groovy.lang.Closure getAction(groovy.lang.GroovyObject controller, String actionName)
           
 String getActionName(groovy.lang.Closure action)
          Returns the action name for the specified closure instance
 ScaffoldRequestHandler getScaffoldRequestHandler()
           
 String[] getSupportedActionNames()
           
 void setScaffoldRequestHandler(ScaffoldRequestHandler scaffoldRequestHandler)
           
 void setScaffoldResponseHandlerFactory(ScaffoldResponseHandlerFactory scaffoldResponseHandlerFactory)
           
 boolean supportsAction(String actionName)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

actions

protected static Map actions

actionClassToNameMap

protected static Map actionClassToNameMap
Constructor Detail

DefaultGrailsScaffolder

public DefaultGrailsScaffolder()
Method Detail

supportsAction

public boolean supportsAction(String actionName)
Specified by:
supportsAction in interface GrailsScaffolder
Parameters:
actionName - The name of the action
Returns:
True if the action is supported by the scaffolder

getAction

public groovy.lang.Closure getAction(groovy.lang.GroovyObject controller,
                                     String actionName)
Specified by:
getAction in interface GrailsScaffolder
Returns:
A Closure instance for the specified action name

setScaffoldRequestHandler

public void setScaffoldRequestHandler(ScaffoldRequestHandler scaffoldRequestHandler)
Parameters:
scaffoldRequestHandler - The scaffoldRequestHandler to set.

setScaffoldResponseHandlerFactory

public void setScaffoldResponseHandlerFactory(ScaffoldResponseHandlerFactory scaffoldResponseHandlerFactory)
Parameters:
scaffoldResponseHandlerFactory - The scaffoldResponseHandlerFactory to set.

getSupportedActionNames

public String[] getSupportedActionNames()
Specified by:
getSupportedActionNames in interface GrailsScaffolder
Returns:
A String array of actions names supported by the scaffolder

getActionName

public String getActionName(groovy.lang.Closure action)
Description copied from interface: GrailsScaffolder
Returns the action name for the specified closure instance

Specified by:
getActionName in interface GrailsScaffolder
Parameters:
action - The closure action
Returns:
The name of the action

getScaffoldRequestHandler

public ScaffoldRequestHandler getScaffoldRequestHandler()
Specified by:
getScaffoldRequestHandler in interface GrailsScaffolder
Returns:
The ScaffoldRequestHandler instance


Copyright (c) 2005-2006 The Grails project