org.sakaiproject.entitybroker.entityprovider.extension
Class CustomAction

java.lang.Object
  extended by org.sakaiproject.entitybroker.entityprovider.extension.CustomAction

public class CustomAction
extends Object

This defines a custom entity action, this will be used to define which custom actions are allowed to be performed on entities or collections of entities

Author:
Aaron Zeckoski (azeckoski @ gmail.com)

Field Summary
 String action
          The action key which will be used to trigger the action (e.g. promote), will be triggered by a URL like so: /user/aaronz/promote
 Class<?>[] methodArgTypes
          These are the argument types found in the custom action method in order, this should not be populated manually as any value in this will be overwritten
 String methodName
          This will be non-null if there is a custom action method which was found or identified by the annotation EntityCustomAction or if the developer has defined this explicitly
 String viewKey
          (optional) Must match one of the VIEW constants from EntityView
The view type which this action goes with, this roughly translates to the GET/POST/PUT/DELETE in http
e.g.
 
Constructor Summary
CustomAction(String action, String viewKey)
          Construct a custom action for entities
CustomAction(String action, String viewKey, String methodName)
          Adds the methodName arg, use this version when using this with ActionsDefineable
 
Method Summary
 CustomAction copy()
           
static CustomAction copy(CustomAction ca)
           
 Method getMethod()
          INTERNAL USE ONLY
 void setMethod(Method m)
          INTERNAL USE ONLY
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

action

public final String action
The action key which will be used to trigger the action (e.g. promote), will be triggered by a URL like so: /user/aaronz/promote


viewKey

public final String viewKey
(optional) Must match one of the VIEW constants from EntityView
The view type which this action goes with, this roughly translates to the GET/POST/PUT/DELETE in http
e.g. GET /user/action would be EntityView.VIEW_LIST while POST /user/aaronz/action would be EntityView.VIEW_NEW, can be null to match all viewkeys (i.e. to allow this action from any http method type and on collections and entities)


methodName

public final String methodName
This will be non-null if there is a custom action method which was found or identified by the annotation EntityCustomAction or if the developer has defined this explicitly


methodArgTypes

public Class<?>[] methodArgTypes
These are the argument types found in the custom action method in order, this should not be populated manually as any value in this will be overwritten

Constructor Detail

CustomAction

public CustomAction(String action,
                    String viewKey)
Construct a custom action for entities

Parameters:
action - key which will be used to trigger the action (e.g. promote), will be triggered by a URL like so: /user/aaronz/promote,
this cannot be null or empty string
viewKey - (optional) this is the view type which this action goes with, this roughly translates to the GET/POST/PUT/DELETE in http
e.g. GET /user/action would be EntityView.VIEW_LIST while POST /user/aaronz/action would be EntityView.VIEW_SHOW
this must match one of the VIEW constants from EntityView, null indicates that this action can be run on entities and collections using any http method (POST, GET)
See Also:
for details about what the method should return, what arguments are allowed, and what exceptions mean

CustomAction

public CustomAction(String action,
                    String viewKey,
                    String methodName)
Adds the methodName arg, use this version when using this with ActionsDefineable

Parameters:
action - the action key
viewKey - the view key OR null
methodName - the name of the method in your entity provider to execute when the custom action is requested
See Also:
for details about what the method should return, what arguments are allowed, and what exceptions mean, for more details
Method Detail

getMethod

public Method getMethod()
INTERNAL USE ONLY


setMethod

public void setMethod(Method m)
INTERNAL USE ONLY


copy

public CustomAction copy()
Returns:
a copy of this object

copy

public static CustomAction copy(CustomAction ca)
Parameters:
ca -
Returns:
a copy of the supplied object

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2007-2012 Sakai Project. All Rights Reserved.