com.scooterframework.builtin
Class CRUDController

java.lang.Object
  extended by com.scooterframework.builtin.CRUDController
Direct Known Subclasses:
RestfulCRUDController

public class CRUDController
extends java.lang.Object

CRUDController class serves as default controller class for a model.


Field Summary
static java.lang.String DEFAULT_RECORD_CLASS
           
protected  LogUtil log
           
 
Constructor Summary
CRUDController()
           
 
Method Summary
protected  java.lang.String actionPath(java.lang.String action)
          Returns url path to the action.
protected  java.lang.String actionPath(java.lang.String action, ActiveRecord record)
          Returns url path to the action for a record.
 java.lang.String add()
           
 java.lang.String create()
           
 java.lang.String delete()
           
 java.lang.String edit()
           
protected  ActiveRecord generateActiveRecordHomeInstance(java.lang.String model)
          Generates an ActiveRecord home instance of a model.
protected  ActiveRecord generateActiveRecordInstance(java.lang.String model)
          Generates an ActiveRecord instance of a model.
protected  java.lang.String getDefaultViewFilesDirectoryName()
          Returns default view file directory name.
 java.lang.String index()
           
 java.lang.String list()
           
 java.lang.String paged_list()
           
 java.lang.String show()
           
 java.lang.String update()
           
protected  java.lang.String viewPath(java.lang.String action)
          Returns url path to the view named "action".
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_RECORD_CLASS

public static final java.lang.String DEFAULT_RECORD_CLASS
See Also:
Constant Field Values

log

protected LogUtil log
Constructor Detail

CRUDController

public CRUDController()
Method Detail

index

public java.lang.String index()

list

public java.lang.String list()

paged_list

public java.lang.String paged_list()

show

public java.lang.String show()

add

public java.lang.String add()

create

public java.lang.String create()

edit

public java.lang.String edit()

update

public java.lang.String update()

delete

public java.lang.String delete()

generateActiveRecordInstance

protected ActiveRecord generateActiveRecordInstance(java.lang.String model)
Generates an ActiveRecord instance of a model. If the class corresponding to the model does not exist, then use the DEFAULT_RECORD_CLASS class type for the model.

Parameters:
model - model name
Returns:
an ActiveRecord instance of the model

generateActiveRecordHomeInstance

protected ActiveRecord generateActiveRecordHomeInstance(java.lang.String model)
Generates an ActiveRecord home instance of a model. See description of generateActiveRecordInstance(java.lang.String) method.

Parameters:
model - model name
Returns:
an ActiveRecord home instance of the model

actionPath

protected java.lang.String actionPath(java.lang.String action)
Returns url path to the action. See EnvConfig.getActionUriFor(String) for more details.


actionPath

protected java.lang.String actionPath(java.lang.String action,
                                      ActiveRecord record)
Returns url path to the action for a record. See EnvConfig.getActionUriFor(String) for more details. Primary key values of the record are converted to a query string appended in the path.


viewPath

protected java.lang.String viewPath(java.lang.String action)
Returns url path to the view named "action".


getDefaultViewFilesDirectoryName

protected java.lang.String getDefaultViewFilesDirectoryName()
Returns default view file directory name.

Returns:
default view file directory name.