Represents a logical "unit of work" that includes a request context, JSP, URLPattern, content template and (optionally) a target and required security permission. Examples of Commands include "view a page," "create a group," and "edit user preferences."
Commands come in two flavors: "static" and "targeted."
final
, threadsafe, and immutable. They have no intrinsic idea of the context they are acting in. For example, the static command {@link PageCommand#VIEW} embodies the idea of viewing a page —but exactly which page is left undefined. Static commands exist so that they can be freely shared and passed around without incurring the penalties of object creation. Static commands are a lot like naked request contexts ("edit", "view", etc.) except that they include additional, essential properites such as the associated URL pattern and content JSP.Concrete implementations of Command include:
For a given targeted Command, its {@link #getTarget()} method will return anon-null
value. In addition, its {@link #requiredPermission()} method will generally also return a non-null
value. It is each implementation's responsibility to construct and store the correct Permission for a given Command and Target. For example, when PageCommand.VIEW is targeted at the WikiPage Main
, the Command's associated permission is PagePermission "theWiki:Main", "view".
Static Commands, and targeted Commands that do not require specific permissions to execute, return a null
result for {@link #requiredPermission()}.
|
|
|
|
|
|
|
|