public abstract class Action extends Object
| Constructor and Description |
|---|
Action() |
| Modifier and Type | Method and Description |
|---|---|
protected JCRNodeWrapper |
createNode(javax.servlet.http.HttpServletRequest req,
Map<String,List<String>> parameters,
JCRNodeWrapper node,
String nodeType,
String nodeName,
boolean forceCreation) |
abstract ActionResult |
doExecute(javax.servlet.http.HttpServletRequest req,
RenderContext renderContext,
Resource resource,
JCRSessionWrapper session,
Map<String,List<String>> parameters,
URLResolver urlResolver) |
protected JahiaUser |
getCurrentUser()
Returns the current user.
|
protected org.json.JSONObject |
getJSONConstraintError(javax.jcr.nodetype.ConstraintViolationException e) |
String |
getName() |
protected static String |
getParameter(Map<String,List<String>> parameters,
String paramName)
Returns a single value for the specified parameter.
|
protected static String |
getParameter(Map<String,List<String>> parameters,
String paramName,
String defaultValue)
Returns a single value for the specified parameter.
|
protected static String |
getRequiredParameter(Map<String,List<String>> parameters,
String paramName)
Returns a single value for the specified parameter.
|
String |
getRequiredPermission()
Returns a permission, required to execute this action or
null if no particular permission is required. |
String |
getRequiredWorkspace()
Returns JCR workspace name this action should be executed for;
null if there is no required workspace. |
boolean |
isPermitted(JCRNodeWrapper node) |
boolean |
isRequireAuthenticatedUser()
Returns
true if the action can be executed only by an authenticated user. |
void |
setName(String name)
Sets the action name.
|
protected void |
setProperties(JCRNodeWrapper newNode,
Map<String,List<String>> parameters) |
void |
setRequireAuthenticatedUser(boolean requireAuthenticatedUser)
Defines if the action can be executed only by an authenticated user.
|
void |
setRequiredPermission(String requiredPermission)
Defines a permission, required to execute this action or
null if no particular permission is required. |
void |
setRequiredWorkspace(String requiredWorkspace)
Sets the JCR workspace name this action should be executed for;
null if there is no required workspace. |
protected static String getRequiredParameter(Map<String,List<String>> parameters, String paramName) throws JahiaBadRequestException
JahiaBadRequestException.parameters - the map of action parametersparamName - the name of the parameter in questionJahiaBadRequestExceptionJahiaBadRequestException - if the specified parameter is not present in the requestprotected static String getParameter(Map<String,List<String>> parameters, String paramName)
null.parameters - the map of action parametersparamName - the name of the parameter in questionnullprotected static String getParameter(Map<String,List<String>> parameters, String paramName, String defaultValue)
parameters - the map of action parametersparamName - the name of the parameter in questiondefaultValue - the default value to be used if the parameter is not
present or its value is emptyprotected JCRNodeWrapper createNode(javax.servlet.http.HttpServletRequest req, Map<String,List<String>> parameters, JCRNodeWrapper node, String nodeType, String nodeName, boolean forceCreation) throws javax.jcr.RepositoryException
javax.jcr.RepositoryExceptionprotected void setProperties(JCRNodeWrapper newNode, Map<String,List<String>> parameters) throws javax.jcr.RepositoryException
javax.jcr.RepositoryExceptionprotected org.json.JSONObject getJSONConstraintError(javax.jcr.nodetype.ConstraintViolationException e)
throws javax.jcr.RepositoryException
javax.jcr.RepositoryExceptionpublic abstract ActionResult doExecute(javax.servlet.http.HttpServletRequest req, RenderContext renderContext, Resource resource, JCRSessionWrapper session, Map<String,List<String>> parameters, URLResolver urlResolver) throws Exception
Exceptionprotected JahiaUser getCurrentUser()
public String getName()
public String getRequiredPermission()
null if no particular permission is required.null if no particular permission is requiredpublic String getRequiredWorkspace()
null if there is no required workspace.null if there is no required workspace.public boolean isPermitted(JCRNodeWrapper node) throws javax.jcr.RepositoryException
javax.jcr.RepositoryExceptionpublic boolean isRequireAuthenticatedUser()
true if the action can be executed only by an authenticated user.true if the action can be executed only by an authenticated userpublic void setName(String name)
name - the action namepublic void setRequireAuthenticatedUser(boolean requireAuthenticatedUser)
requireAuthenticatedUser - true if the action can be executed only by an authenticated userpublic void setRequiredPermission(String requiredPermission)
null if no particular permission is required.requiredPermission - a permission, required to execute this action or null if no particular permission is requiredpublic void setRequiredWorkspace(String requiredWorkspace)
null if there is no required workspace.requiredWorkspace - the JCR workspace name this action should be executed for; null if there is no required workspaceCopyright © 2004–2020 Jahia Solutions Group SA. All rights reserved.