org.openmrs.logic
Interface Rule


public interface Rule

Base class for all logic rules.


Method Summary
 Result eval(LogicContext context, java.lang.Integer patientId, java.util.Map<java.lang.String,java.lang.Object> parameters)
          Evaluate rule for a given patient and applying the given criteria.
 Result.Datatype getDefaultDatatype()
          Gets the default datatype that the rule returns, when supplied with a given token.
 java.lang.String[] getDependencies()
          Returns a list of dependencies (tokens for rules upon which this rule may depend).
 java.util.Set<RuleParameterInfo> getParameterList()
          Returns the list of arguments.
 int getTTL()
          Gets the time (in seconds) during which the Rule's results are considered to be valid.
 

Method Detail

eval

Result eval(LogicContext context,
            java.lang.Integer patientId,
            java.util.Map<java.lang.String,java.lang.Object> parameters)
            throws LogicException
Evaluate rule for a given patient and applying the given criteria.

Parameters:
context - the context this rule is being evaluated in
patientId - id of the patient for whom rule is to be calculated
parameters - parameters passed to this rule
Returns:
result of the rule for the given patient with given criteria applied
Throws:
LogicException - TODO

getParameterList

java.util.Set<RuleParameterInfo> getParameterList()
Returns the list of arguments.

Returns:
list of arguments or null if no arguments

getDependencies

java.lang.String[] getDependencies()
Returns a list of dependencies (tokens for rules upon which this rule may depend).

Returns:
tokens for all rules that may be called by this rule

getTTL

int getTTL()
Gets the time (in seconds) during which the Rule's results are considered to be valid. This is used to prevent the use of invalid (old) items from a cache

Returns:
duration (in seconds) the results are considered valid for this rule

getDefaultDatatype

Result.Datatype getDefaultDatatype()
Gets the default datatype that the rule returns, when supplied with a given token. While results are loosely typed, this method allows rules to declare a default datatype to simplify user interfaces and defaults when working with rules.

Returns:
datatype

OpenMRS-1.7.x

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