Documentation home page

cfrails
Component Controller

Controller

The base Controller class, from which all controllers should be derived.

Method Summary
public Controller init()
          Returns the derived Controller. Objects of type Controller cannot be instantiated (i.e., this is supposed to be an abstract class).
public any after([String noneExcept=""], [String allExcept=""], string run)
          Runs function run() after the list of functions in noneExcept is executed or after all functions except those in allExcept, only if using the default url/action mapper.
public any before([String noneExcept=""], [String allExcept=""], string run)
          Runs function run() before the list of functions in noneExcept is executed or before all functions except those in allExcept, only if using the default url/action mapper.
public any create()
          Initializes the model with the contents of the form, and saves the new record to the database. Upon success, executes after_create() method, which defaults to redirect to the list() action. Upon failure, executes after_create_failure() sending a · (alt-250) delimited list of the errors.
public any destroy()
          Deletes a row from the table the model references.
public any edit()
          Renders and populates the form for the controller's model, and instantiates an object of the model, with all member variables initialized to the values found in the row of the id passed in url.
public any getAfterAllButThisList()
          This function shouldn't really be used, it may not exist later when I figure out a better way to accomplish the goal.
public any getAfterNoneButThisList()
          This function shouldn't really be used, it may not exist later when I figure out a better way to accomplish the goal.
public any getBeforeAllButThisList()
          This function shouldn't really be used, it may not exist later when I figure out a better way to accomplish the goal.
public any getBeforeNoneButThisList()
          This function shouldn't really be used, it may not exist later when I figure out a better way to accomplish the goal.
public any getModelType()
public any index()
          The default action of the controller. cfrails by default calls the list action.
public any list([any filter=""])
          Lists all of the rows in the table the model refers to.
public any new()
          Renders and populates the form for the controller's model, and instantiates an object of the model, with all member variables initialized to blank values.
public any render([any controller="#listdeleteat(variables.thisControllerName,listlen(variables.thisControllerName,"], any action, [any message=""], [struct args="#structNew()#"])
          Outputs the given controller/action
public any setModelType([any modelType])
public any show()
public any update()
          Initializes the model with the contents of the form, and saves the new record to the database. Upon success, executes after_update() method, which defaults to redirect to the list() action. Upon failure, executes after_create_failure() sending a · (alt-250) delimited list of the errors.
 

Method Detail

after

public any after([String noneExcept=""], [String allExcept=""], string run)
Runs function run() after the list of functions in noneExcept is executed or after all functions except those in allExcept, only if using the default url/action mapper.

Parameters:
[String noneExcept=""] - A comma delimited list of functions that run should be run after.
[String allExcept=""] - A comma delimited list of functions that run should not be run after.
string run

before

public any before([String noneExcept=""], [String allExcept=""], string run)
Runs function run() before the list of functions in noneExcept is executed or before all functions except those in allExcept, only if using the default url/action mapper.

Parameters:
[String noneExcept=""] - A comma delimited list of functions that run should be run before.
[String allExcept=""] - A comma delimited list of functions that run should be run before.
string run

create

public any create()
Initializes the model with the contents of the form, and saves the new record to the database. Upon success, executes after_create() method, which defaults to redirect to the list() action. Upon failure, executes after_create_failure() sending a · (alt-250) delimited list of the errors.


destroy

public any destroy()
Deletes a row from the table the model references.


edit

public any edit()
Renders and populates the form for the controller's model, and instantiates an object of the model, with all member variables initialized to the values found in the row of the id passed in url.


getAfterAllButThisList

public any getAfterAllButThisList()
This function shouldn't really be used, it may not exist later when I figure out a better way to accomplish the goal.


getAfterNoneButThisList

public any getAfterNoneButThisList()
This function shouldn't really be used, it may not exist later when I figure out a better way to accomplish the goal.


getBeforeAllButThisList

public any getBeforeAllButThisList()
This function shouldn't really be used, it may not exist later when I figure out a better way to accomplish the goal.


getBeforeNoneButThisList

public any getBeforeNoneButThisList()
This function shouldn't really be used, it may not exist later when I figure out a better way to accomplish the goal.


getModelType

public any getModelType()

index

public any index()
The default action of the controller. cfrails by default calls the list action.


init

public Controller init()
Returns the derived Controller. Objects of type Controller cannot be instantiated (i.e., this is supposed to be an abstract class).


list

public any list([any filter=""])
Lists all of the rows in the table the model refers to.

Parameters:
[any filter=""] - Filters the results for the list. For instance, you might have: name like '%joe%'

new

public any new()
Renders and populates the form for the controller's model, and instantiates an object of the model, with all member variables initialized to blank values.


render

public any render([any controller="#listdeleteat(variables.thisControllerName,listlen(variables.thisControllerName,"], any action, [any message=""], [struct args="#structNew()#"])
Outputs the given controller/action

Parameters:
[any controller="#listdeleteat(variables.thisControllerName,listlen(variables.thisControllerName,"] - The controller in which the given action to be rendered can be found. If not given, uses the current controller.
any action - The action whose view should be shown.
[any message=""] - A message to display in the view, if it displays a message.
[struct args="#structNew()#"] - Arguments to pass to view

setModelType

public any setModelType([any modelType])
Parameters:
[any modelType] - The full name of model type, since cfrails will be trying to instantiate it, likely from a different directory than the one in which you're calling it. For example, 'org.eclipse.cfeclipse.somepackage.somecomponent'

show

public any show()

update

public any update()
Initializes the model with the contents of the form, and saves the new record to the database. Upon success, executes after_update() method, which defaults to redirect to the list() action. Upon failure, executes after_create_failure() sending a · (alt-250) delimited list of the errors.