org.alfresco.web.evaluator
Class BaseEvaluator
org.alfresco.web.evaluator.BaseEvaluator All Implemented Interfaces:
-
public abstract class BaseEvaluator
Base class for all UI evaluators.
Author:
-
mikeh
Method Summary |
abstract boolean |
evaluate(org.json.simple.JSONObject jsonObject) Evaluator implementations abstract method. |
boolean |
evaluate(Object record) Optional entry point from Rhino script. |
boolean |
evaluate(Object record, Object metadata) Optional entry point from Rhino script. |
boolean |
evaluate(Object record, Object metadata, HashMap<String> args) Main entry point from Rhino script. |
|
getArg(String name) Get webscript argument by name |
|
getArgs() Simple getter for optional webscript args |
|
getContainerType(org.json.simple.JSONObject jsonObject) Get the container node type (e.g. |
boolean |
getHasContent(org.json.simple.JSONObject jsonObject) Get a boolean value indicating whether the node has binary content |
|
getHeader(String name) Get request header value |
boolean |
getIsLocked(org.json.simple.JSONObject jsonObject) Get a boolean value indicating whether the node is locked or not |
boolean |
getIsPortlet() Get flag indicating portlet or standalone mode |
boolean |
getIsWorkingCopy(org.json.simple.JSONObject jsonObject) Get a boolean value indicating whether the node is a working copy or not |
|
getJSONValue(org.json.simple.JSONObject jsonObject, String accessor) Retrieve a JSON value given an accessor string containing dot notation (e.g. |
boolean |
getMatchesCurrentUser(org.json.simple.JSONObject jsonObject, String propertyName) Checks whether the current user matches that of a given user property |
org.json.simple.JSONObject |
getMetadata() Get metadata |
org.json.simple.JSONArray |
getNodeAspects(org.json.simple.JSONObject jsonObject) Retrieve a JSONArray of aspects for a node |
|
getNodeType(org.json.simple.JSONObject jsonObject) Retrieves the type for a node |
|
getProperty(org.json.simple.JSONObject jsonObject, String propertyName) Retrieve a JSONArray of aspects for a node |
|
getSiteId(org.json.simple.JSONObject jsonObject) Get the site shortName applicable to this node (if requested via a site-based page context) |
|
getSitePreset(org.json.simple.JSONObject jsonObject) Get the site preset (e.g. |
|
getUserId() Get the current user associated with this request |
void |
setNegateOutput(boolean negateOutput) Sets optional negateOutput flag which applies when one of the main entry points is used |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
args
metadata
protected org.json.simple.JSONObject metadata
negateOutput
protected boolean negateOutput
BaseEvaluator
public BaseEvaluator()
setNegateOutput
public void setNegateOutput(boolean negateOutput)
-
Sets optional negateOutput flag which applies when one of the main entry points is used
evaluate
public final boolean evaluate(Object record) -
Optional entry point from Rhino script. Converts JSON String to a JSONObject
and calls the overridable evaluate() method.
Parameters:
-
record - JSON String representing the record wrapping the node as received from a Rhino script
Returns:
-
boolean indicating evaluator result
evaluate
public final boolean evaluate(Object record, Object metadata) -
Optional entry point from Rhino script. Converts JSON String to a JSONObject
and calls the overridable evaluate() method.
Parameters:
-
record - JSON String representing the record wrapping the node as received from a Rhino script
-
metadata - JSON String containing metadata which may be relevant to the evaluation
Returns:
-
boolean indicating evaluator result
evaluate
-
Main entry point from Rhino script. Converts JSON String to a JSONObject
and calls the overridable evaluate() method.
Parameters:
-
record - JSON String or JSONObject as received from a Rhino script
-
metadata - JSON String or JSONObject as received from a Rhino script
-
args - URL arguments passed to calling webscript
Returns:
-
boolean indicating evaluator result
evaluate
public abstract boolean evaluate(org.json.simple.JSONObject jsonObject)
-
Evaluator implementations abstract method.
Specified by:
-
Parameters:
-
jsonObject - The object the evaluation is for
Returns:
-
boolean indicating evaluator result
getArgs
-
Simple getter for optional webscript args
Returns:
-
HashMap args map (may be null)
getArg
-
Get webscript argument by name
Parameters:
-
name - Argument name
Returns:
-
string argument value or null
getMetadata
public final org.json.simple.JSONObject getMetadata()
-
Get metadata
Returns:
-
JSONObject metadata
getHeader
-
Get request header value
Parameters:
-
name - Header name to retrieve
Returns:
-
string value or null
getIsPortlet
public final boolean getIsPortlet()
-
Get flag indicating portlet or standalone mode
Returns:
-
boolean true for portlet mode, false otherwise
getNodeType
public final String getNodeType(org.json.simple.JSONObject jsonObject) -
Retrieves the type for a node
Parameters:
-
jsonObject - JSONObject containing a "node" object as returned from the ApplicationScriptUtils class.
Returns:
-
String containing the node type
getNodeAspects
public final org.json.simple.JSONArray getNodeAspects(org.json.simple.JSONObject jsonObject)
-
Retrieve a JSONArray of aspects for a node
Parameters:
-
jsonObject - JSONObject containing a "node" object as returned from the ApplicationScriptUtils class.
Returns:
-
JSONArray containing aspects on the node
getProperty
public final Object getProperty(org.json.simple.JSONObject jsonObject, String propertyName) -
Retrieve a JSONArray of aspects for a node
Parameters:
-
jsonObject - JSONObject containing a "node" object as returned from the ApplicationScriptUtils class.
-
propertyName - Name of the property to retrieve
Returns:
-
Object property value
getUserId
public final String getUserId() -
Get the current user associated with this request
Returns:
-
String userId
getSiteId
public final String getSiteId(org.json.simple.JSONObject jsonObject) -
Get the site shortName applicable to this node (if requested via a site-based page context)
Parameters:
-
jsonObject - JSONObject containing a "node" object as returned from the ApplicationScriptUtils class.
Returns:
-
String siteId or null
getSitePreset
public final String getSitePreset(org.json.simple.JSONObject jsonObject) -
Get the site preset (e.g. "site-dashboard") applicable to this node (if requested via a site-based page context)
Parameters:
-
jsonObject - JSONObject containing a "node" object as returned from the ApplicationScriptUtils class.
Returns:
-
String site preset or null
getContainerType
public final String getContainerType(org.json.simple.JSONObject jsonObject) -
Get the container node type (e.g. "cm:folder") applicable to this node (if requested via a site-based page context)
Parameters:
-
jsonObject - JSONObject containing a "node" object as returned from the ApplicationScriptUtils class.
Returns:
-
String container type or null
getIsLocked
public final boolean getIsLocked(org.json.simple.JSONObject jsonObject)
-
Get a boolean value indicating whether the node is locked or not
Parameters:
-
jsonObject - JSONObject containing a "node" object as returned from the ApplicationScriptUtils class.
Returns:
-
True if the node is locked
getIsWorkingCopy
public final boolean getIsWorkingCopy(org.json.simple.JSONObject jsonObject)
-
Get a boolean value indicating whether the node is a working copy or not
Parameters:
-
jsonObject - JSONObject containing a "node" object as returned from the ApplicationScriptUtils class.
Returns:
-
True if the node is a working copy
getMatchesCurrentUser
public final boolean getMatchesCurrentUser(org.json.simple.JSONObject jsonObject, String propertyName) -
Checks whether the current user matches that of a given user property
Parameters:
-
jsonObject - JSONObject containing a "node" object as returned from the ApplicationScriptUtils class.
-
propertyName - String containing dotted notation path to value
Returns:
-
True if the property value matches the current user
getJSONValue
public final Object getJSONValue(org.json.simple.JSONObject jsonObject, String accessor) -
Retrieve a JSON value given an accessor string containing dot notation (e.g. "node.isContainer")
Parameters:
-
jsonObject - JSONObject containing a "node" object as returned from the ApplicationScriptUtils class.
-
accessor - String containing dotted notation path to value
Returns:
-
Object value or null
getHasContent
public final boolean getHasContent(org.json.simple.JSONObject jsonObject)
-
Get a boolean value indicating whether the node has binary content
Parameters:
-
jsonObject - JSONObject containing a "node" object as returned from the ApplicationScriptUtils class.
Returns:
-
True if the node has content