org.openmrs.logic
Interface LogicContext


public interface LogicContext


Method Summary
 Result eval(java.lang.Integer patientId, LogicCriteria criteria, java.util.Map<java.lang.String,java.lang.Object> parameters)
          Evaluate a rule with criteria and parameters for a single patient
 Result eval(java.lang.Integer patientId, java.lang.String token)
          Evaluate a rule for a single patient
 Result eval(java.lang.Integer patientId, java.lang.String token, java.util.Map<java.lang.String,java.lang.Object> parameters)
          Evaluate a rule with parameters for a single patient
 java.lang.Object getGlobalParameter(java.lang.String id)
          Fetches a global parameter value by name
 java.util.Collection<java.lang.String> getGlobalParameters()
           
 java.util.Date getIndexDate()
           
 LogicDataSource getLogicDataSource(java.lang.String name)
          Fetches a logic data source by name
 Patient getPatient(java.lang.Integer patientId)
          Gets the patient object for the given patient id (this patient must be in the cohort of this context)
 Result read(java.lang.Integer patientId, LogicCriteria criteria)
          Reads a key with criteria from a logic data source
 Result read(java.lang.Integer patientId, LogicDataSource dataSource, LogicCriteria criteria)
          Reads a key with criteria from a logic data source
 Result read(java.lang.Integer patientId, LogicDataSource dataSource, java.lang.String key)
          Reads a key from a logic data source
 Result read(java.lang.Integer patientId, java.lang.String key)
          Reads a key from a logic data source
 java.lang.Object setGlobalParameter(java.lang.String id, java.lang.Object value)
          Assigns a value to a global parameters within this logic context
 void setIndexDate(java.util.Date indexDate)
          Changes the index date for this logic context
 java.util.Date today()
           
 

Method Detail

getPatient

Patient getPatient(java.lang.Integer patientId)
Gets the patient object for the given patient id (this patient must be in the cohort of this context)

Parameters:
patientId -
Returns:

eval

Result eval(java.lang.Integer patientId,
            java.lang.String token)
            throws LogicException
Evaluate a rule for a single patient

Parameters:
patientId -
token -
Returns:
Result of the evaluation
Throws:
LogicException
See Also:
LogicService.eval(Patient, String)

eval

Result eval(java.lang.Integer patientId,
            java.lang.String token,
            java.util.Map<java.lang.String,java.lang.Object> parameters)
            throws LogicException
Evaluate a rule with parameters for a single patient

Parameters:
patientId -
token -
parameters -
Returns:
Result of the evaluation
Throws:
LogicException
See Also:
LogicService.eval(Patient, String, Map)

eval

Result eval(java.lang.Integer patientId,
            LogicCriteria criteria,
            java.util.Map<java.lang.String,java.lang.Object> parameters)
            throws LogicException
Evaluate a rule with criteria and parameters for a single patient

Parameters:
patientId -
criteria -
parameters -
Returns:
A Result object with the result of the evaluation
Throws:
LogicException
See Also:
LogicService.eval(Patient, LogicCriteria, Map)

getLogicDataSource

LogicDataSource getLogicDataSource(java.lang.String name)
Fetches a logic data source by name

Parameters:
name -
Returns:
the requested LogicDataSource

read

Result read(java.lang.Integer patientId,
            LogicDataSource dataSource,
            java.lang.String key)
            throws LogicException
Reads a key from a logic data source

Parameters:
patientId -
dataSource -
key -
Returns:
Result of the read operation
Throws:
LogicException

read

Result read(java.lang.Integer patientId,
            java.lang.String key)
            throws LogicException
Reads a key from a logic data source

Parameters:
patientId -
key -
Returns:
Result of the read operation
Throws:
LogicException

read

Result read(java.lang.Integer patientId,
            LogicCriteria criteria)
            throws LogicException
Reads a key with criteria from a logic data source

Parameters:
patientId -
criteria -
Returns:
Result of the read
Throws:
LogicException

read

Result read(java.lang.Integer patientId,
            LogicDataSource dataSource,
            LogicCriteria criteria)
            throws LogicException
Reads a key with criteria from a logic data source

Parameters:
patientId -
dataSource -
criteria -
Returns:
Result of the read
Throws:
LogicException

setIndexDate

void setIndexDate(java.util.Date indexDate)
Changes the index date for this logic context

Parameters:
indexDate - the new Date value for "today" to be used by rules within this logic context

getIndexDate

java.util.Date getIndexDate()
Returns:
the value of "today" within this logic context

today

java.util.Date today()
Returns:
the index date for the logic context (effective value of "today")
See Also:
getIndexDate()

setGlobalParameter

java.lang.Object setGlobalParameter(java.lang.String id,
                                    java.lang.Object value)
Assigns a value to a global parameters within this logic context

Parameters:
id -
value -
Returns:
the value of the parameter that was set

getGlobalParameter

java.lang.Object getGlobalParameter(java.lang.String id)
Fetches a global parameter value by name

Parameters:
id -
Returns:
The requested Global parameter Object

getGlobalParameters

java.util.Collection<java.lang.String> getGlobalParameters()
Returns:
all global parameters defined within this logic context

OpenMRS-1.7.x

Generated Apr 27 2012 10:06 PM. NOTE - these libraries are in active development and subject to change