|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.openmrs.report.EvaluationContext
@Deprecated public class EvaluationContext
The EvaluationContext provides the following capabilities: - A baseCohort, i.e. the universe of patients relevant to this context (defaults to all patients) - An in-memory cache which can be used to persist and retrieve objects. Note that this cache is cleared whenever any changes are made to baseCohort or any parameter values. - Capabilities to add, remove, and retrieve parameter values - Capabilities to evaluate parametric expressions, e.g. ${someDateParameterName+30d}
Field Summary | |
---|---|
static java.util.regex.Pattern |
DATE_OPERATION_PATTERN
Deprecated. |
static java.lang.String |
END_OF_EXPRESSION
Deprecated. |
protected org.apache.commons.logging.Log |
log
Deprecated. |
static java.lang.String |
START_OF_EXPRESSION
Deprecated. |
Constructor Summary | |
---|---|
EvaluationContext()
Deprecated. |
Method Summary | |
---|---|
void |
addParameterValue(Parameterizable obj,
Parameter parameter,
java.lang.Object value)
Deprecated. Add a parameter to the context with the given value in the scope of the passed Parameterizable object |
void |
addParameterValue(Parameter parameter,
java.lang.Object value)
Deprecated. Add a parameter to the context with the given value with global scope |
void |
addToCache(java.lang.String key,
java.lang.Object value)
Deprecated. Add a value to the cache with a given key |
void |
clearCache()
Deprecated. Clear the entire cache |
java.lang.Object |
evaluateExpression(java.lang.String expression)
Deprecated. This method will parse the passed expression and return a value based on the following criteria: Any string that matches a parameter within the EvaluationContext will be replaced by the value of that parameter ** CURRENTLY REPLACEMENT PARAMETERS MUST EXIST IN THE GLOBAL SCOPE If this date is followed by an expression, it will attempt to evaluate this by incrementing/decrementing days/weeks/months/years as specified Examples: Given 2 parameters: report.startDate = java.util.Date with value of [2007-01-10] report.gender = "male" The following should result: |
Cohort |
getBaseCohort()
Deprecated. |
java.util.Map<java.lang.String,java.lang.Object> |
getCache()
Deprecated. Get the cache property |
java.lang.Object |
getFromCache(java.lang.String key)
Deprecated. Retrieve an entry from the cached with the given key |
Parameter |
getParameter(Parameterizable obj,
java.lang.String parameterName)
Deprecated. Retrieve a Parameter by Name. |
java.lang.Object |
getParameter(java.lang.String parameterName)
Deprecated. Retrieve Parameter from Global Scope only. |
java.lang.Object |
getParameterValue(Parameter parameter)
Deprecated. Retrieve parameter value in Global Scope only. |
java.lang.Object |
getParameterValue(Parameterizable obj,
Parameter parameter)
Deprecated. Retrieve parameter value by Parameter. |
java.lang.Object |
getParameterValue(Parameterizable obj,
java.lang.String parameterName)
Deprecated. Retrieve parameter value by parameter name. |
java.lang.Object |
getParameterValue(java.lang.String parameterName)
Deprecated. Retrieve global parameter value by name |
java.util.Map<Parameterizable,java.util.Map<Parameter,java.lang.Object>> |
getParameterValues()
Deprecated. Retrieve all parameter values |
boolean |
isCached(java.lang.String key)
Deprecated. Return true if a cache entry exists with the given key |
static boolean |
isExpression(java.lang.String s)
Deprecated. |
void |
removeFromCache(java.lang.String key)
Deprecated. Remove an entry cached with the given key |
void |
setBaseCohort(Cohort baseCohort)
Deprecated. |
void |
setCache(java.util.Map<java.lang.String,java.lang.Object> cache)
Deprecated. Set the cache property |
void |
setParameterValues(java.util.Map<Parameterizable,java.util.Map<Parameter,java.lang.Object>> parameterValues)
Deprecated. Set all parameter values |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected org.apache.commons.logging.Log log
public static final java.lang.String START_OF_EXPRESSION
public static final java.lang.String END_OF_EXPRESSION
public static final java.util.regex.Pattern DATE_OPERATION_PATTERN
Constructor Detail |
---|
public EvaluationContext()
Method Detail |
---|
public static boolean isExpression(java.lang.String s)
public java.util.Map<java.lang.String,java.lang.Object> getCache()
public void setCache(java.util.Map<java.lang.String,java.lang.Object> cache)
cache
- public void addToCache(java.lang.String key, java.lang.Object value)
public void removeFromCache(java.lang.String key)
key
- public java.lang.Object getFromCache(java.lang.String key)
key
- public boolean isCached(java.lang.String key)
key
- public void clearCache()
public void addParameterValue(Parameter parameter, java.lang.Object value)
parameter
- value
- public void addParameterValue(Parameterizable obj, Parameter parameter, java.lang.Object value)
obj
- Parametrizable
objectparameter
- value
- public java.util.Map<Parameterizable,java.util.Map<Parameter,java.lang.Object>> getParameterValues()
public void setParameterValues(java.util.Map<Parameterizable,java.util.Map<Parameter,java.lang.Object>> parameterValues)
parameterValues
- public Parameter getParameter(Parameterizable obj, java.lang.String parameterName)
obj
- Parametrizable
object to get fromparameterName
- public java.lang.Object getParameter(java.lang.String parameterName)
parameterName
- String
name for parameter to getpublic java.lang.Object getParameterValue(Parameterizable obj, Parameter parameter)
obj
- Parametrizable
objectparameter
- public java.lang.Object getParameterValue(Parameter parameter)
parameter
- public java.lang.Object getParameterValue(Parameterizable obj, java.lang.String parameterName)
obj
- Parametrizable
objectparameterName
- key of the parameter to look for
parameterName
public java.lang.Object getParameterValue(java.lang.String parameterName)
parameterName
- key of the parameter to look for
parameterName
public java.lang.Object evaluateExpression(java.lang.String expression) throws ParameterException
evaluateExpression("${report.startDate}") -> "2007-01-10" as Date evaluateExpression("${report.startDate+5d}") -> "2007-01-15" as Date evaluateExpression("${report.startDate-1w}") -> "2007-01-03" as Date evaluateExpression("${report.startDate+3m}") -> "2007-04-15" as Date evaluateExpression("${report.startDate+1y}") -> "2008-01-10" as Date
expression
-
Object
ParameterException
public Cohort getBaseCohort()
public void setBaseCohort(Cohort baseCohort)
|
OpenMRS-1.7.x | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |