Package org.sakaiproject.entitybroker.entityprovider.annotations

Annotation Types Summary
EntityContent Marks a getter method or field as the main content text for an entity, Example: the main text body for a blog entry or email, the main content of an article or posting, the convention is to run toString on the return from the "getContent" method or the value in the "content" field
NOTE: This annotation should only be used once in a class, the getter method must take no arguments and return an object
EntityCustomAction This annotation indicates that this method is a custom action from ActionsExecutable, this should not be placed on any methods defined by a capability but should be placed on methods which you want to be exposed as custom actions
By default the name of the method is used as the action key and this will work for read requests (viewKey is set to EntityView.VIEW_SHOW), you can add in action and viewKey annotation params to change those settings
You can describe this action using the key: .action.
EntityDateCreated Marks a getter method or field as the date created time code (unix time code) for an entity, this can be a Date, Long, long, or String (will attempt to convert this to a long)
the convention is to try to convert the return from the "getDateCreated" method or the value in the "dateCreated" field
NOTE: This annotation should only be used once in a class, the getter method must take no arguments and return an object
EntityFieldRequired Marks a getter method or field as required to be non-null and non-empty for an entity, this can be used many times in a class, this is mostly for documentation purposes and has little effect on operations
EntityHttpParam This annotation indicates that this method parameter should be replaced by the value in the HTTP query parameter, header, or form parameter whose name matches the name set in the annotation
Binds the value(s) of a HTTP query parameter to a resource method parameter.
EntityId Marks a getter method or field as the unique local Id for an entity, the convention is to run toString on the return from the "getId" method or the value in the "id" field
NOTE: This annotation should only be used once in a class, the getter method must take no arguments and return an object
EntityLastModified Marks a getter method or field as the last modified time code (unix time code) for an entity, this can be a Date, Long, long, or String (will attempt to convert this to a long)
the convention is to try to convert the return from the "getLastModified" method or the value in the "lastModified" field
NOTE: This annotation should only be used once in a class, the getter method must take no arguments and return an object
EntityModifiedBy Marks a getter method or field as the user ref of the last user to modify an entity
the convention is to run toString on the return from the "getModifiedBy" method or the value in the "modifiedBy" field
NOTE: This annotation should only be used once in a class, the getter method must take no arguments and return an object
EntityOwner Marks a getter method or field as the user ref of the creator/owner of an entity, the convention is to run toString on the return from the "getOwner" method or the value in the "owner" field
NOTE: This annotation should only be used once in a class, the getter method must take no arguments and return an object
EntityParameters This annotation indicates that this method is accepts or expects certain parameters to be present before it can be executed, these parameters are accessible in the params map
Any parameters included in this annotation can be documented using the i18n properties files by placing a message at: prefix.action.actionname.field.fieldname OR prefix.view.viewkey.field.fieldname
NOTE: there is no need to list the field names of the fields which are included in the entity class or map here, this is for additional parameters only

EntitySummary Marks a getter method or field as the summary or description text for an entity, Example: the summary for a blog entry or email, the instructions text for a test or survey the convention is to run toString on the return from the "getSummary" method or the value in the "summary" field
NOTE: This annotation should only be used once in a class, the getter method must take no arguments and return an object
EntityTitle Marks a getter method or field as the display title for an entity, the convention is to run toString on the return from the "getTitle" method or the value in the "title" field
NOTE: This annotation should only be used once in a class, the getter method must take no arguments and return an object
EntityURLRedirect This annotation indicates that this method will handle an incoming URL and do some processing to turn it into an outgoing URL OR just do some processing OR indicate that a failure has occurred
Define the URL pattern to match AFTER the /prefix using {name} to indicate variables
Example: /{thing}/site/{siteId} will match the following URL:
/myprefix/123/site/456, the variables will be {prefix => myprefix, thing => 123, siteId => 456}
NOTE: all incoming URL templates must start with "/{prefix}" (TemplateParseUtil.TEMPLATE_PREFIX)

NOTE: The method template patterns will be compared in the order they appear in your source code so be careful that you do not have a really simple redirect pattern as the first one as this can cause the other patterns to never be reached
The methods that this annotates should return a String or void
They can have the following parameter types:
(type => data which will be given to the method)
String : incoming URL
EntityView.Method : the submission method (GET,POST,etc)
String[] : incoming URL segments, Example: /myprefix/123/apple => {'prefix','123','apple'}
Map (String => String) : a map of the variable values in the {}, Example: pattern: /{prefix}/{thing}/apple, url: /myprefix/123/apple, would yield: {'thing' => '123','prefix' => 'mypreifx'}
Don't forget to handle the extensions as they will not automatically pass through, use the TemplateParseUtil.DOT_EXTENSION and TemplateParseUtil.EXTENSION values from the variable map which will contain the extension that was passed in

Return should be one of the following:
1) the URL to redirect to, will be processed as an external redirect if it starts with "http" or "/" (unless it starts with "/{prefix}"), otherwise it will be processed as an internal forward
2) "" (empty string) to not redirect and return an empty success response
3) null to not redirect and allow standard processing of the URL to continue
For failures: if there is a failure you should throw an IllegalStateException to indicate failure
This is the convention part of the Redirectable capability
 



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