Overview  Package   Class  Use  Tree  Deprecated  Index  Help 
PREV CLASS   NEXT CLASS FRAMES    NO FRAMES    All Classes
SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD

org.alfresco.web.evaluator
Class BaseEvaluator
java.lang.Object
  org.alfresco.web.evaluator.BaseEvaluator
All Implemented Interfaces:
Evaluator

public abstract class BaseEvaluator
extends Object
implements Evaluator
Base class for all UI evaluators.
Author:
mikeh

Field Summary
protected HashMap<String>
args
protected org.json.simple.JSONObject
metadata
protected boolean
negateOutput
Constructor Summary
BaseEvaluator()
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
Field Detail
args
protected HashMap<String> args

metadata
protected org.json.simple.JSONObject metadata

negateOutput
protected boolean negateOutput
Constructor Detail
BaseEvaluator
public BaseEvaluator()
Method Detail
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
public final boolean evaluate(Object record,
                              Object metadata,
                              HashMap<String> args)
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:
evaluate in interface Evaluator
Parameters:
jsonObject - The object the evaluation is for
Returns:
boolean indicating evaluator result

getArgs
public final HashMap<StringgetArgs()
Simple getter for optional webscript args
Returns:
HashMap args map (may be null)

getArg
public final String getArg(String name)
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
public final String getHeader(String name)
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

Overview  Package   Class  Use  Tree  Deprecated  Index  Help 
PREV CLASS   NEXT CLASS FRAMES    NO FRAMES    All Classes
SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD

Copyright © 2005–2016 Alfresco Software. All rights reserved.

Java API documentation generated with DocFlex/Javadoc 1.6.1 using JavadocPro template set.