org.opengts.db
Class RuleFactoryExample

java.lang.Object
  extended by org.opengts.db.RuleFactoryAdapter
      extended by org.opengts.db.RuleFactoryExample
All Implemented Interfaces:
RuleFactory

public class RuleFactoryExample
extends RuleFactoryAdapter


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.opengts.db.RuleFactory
RuleFactory.NotifyAction
 
Field Summary
 
Fields inherited from interface org.opengts.db.RuleFactory
ACTION_DEFAULT, ACTION_EMAIL_ACCOUNT, ACTION_EMAIL_ALL, ACTION_EMAIL_DEVICE, ACTION_EMAIL_RULE, ACTION_NONE, ACTION_NOTIFY_ACCOUNT, ACTION_NOTIFY_ALL, ACTION_NOTIFY_DEVICE, ACTION_NOTIFY_MASK, ACTION_NOTIFY_RULE, ACTION_SAVE_LAST, ACTION_VIA_EMAIL, ACTION_VIA_LISTENER, ACTION_VIA_MASK, ACTION_VIA_QUEUE, PRIORITY_HIGH, PRIORITY_LOW, PRIORITY_MEDIUM, PRIORITY_UNDEFINED, PROP_rule_workHours_
 
Constructor Summary
RuleFactoryExample()
           
 
Method Summary
protected static boolean _sendNotification(EventData evdb, int actionMask)
           
 boolean checkRuntime()
          Initializes and returns true if successful
 boolean checkSelectorSyntax(java.lang.String selector)
          Return true if the specified selector is syntactically correct
static void DebugSetSendNotification(boolean send)
           
 java.lang.Object evaluateSelector(java.lang.String selector, Account account)
          Evaluates a selector against the specified Account and returns the result
 java.lang.Object evaluateSelector(java.lang.String selector, EventData event)
          Evaluates a selector against the specified event and returns the result
 int executeRule(java.lang.String ruleID, EventData event)
          Executes the specified ruleID against the specified EventData record, and return a mask containing the actions performed.
 int executeRules(EventData event)
          Executes all rules which apply to the specified EventData record, and return a mask containing the actions performed.
 int executeSelector(java.lang.String selector, EventData event)
          Executes the specified selector against the criteria contained win the event record, and return a mask containing the actions performed.
 java.lang.String getFunctionDescription(java.lang.String ftnName)
          Returns the description for the specified function name
 java.util.List<java.lang.String> getFunctionNames()
          Returns a list of all available selector function names
 java.lang.String getFunctionUsage(java.lang.String ftnName)
          Returns the function "usage" description for the specified function name
 java.lang.String getIdentifierDescription(java.lang.String idName)
          Returns the description for the specified identifier
 java.util.List<java.lang.String> getIdentifierNames()
          Returns a list of all available selector identifiers
 java.lang.String getName()
          Returns this RuleFactory name
 java.lang.String[] getRuleIDs(Account account)
          Returns a list of defined rule-ids for the specified Account.
 java.lang.String getRuleNotifyEmail(Account account, java.lang.String ruleID)
          Returns the rule notification email addresses for the specified rule-id, in the specified Account.
 java.lang.String getRuleSelector(Account account, java.lang.String ruleID)
          Return the selector for the specified rule-id
 java.lang.String getVersion()
          Return this RuleFactory version String
 boolean isSelectorMatch(java.lang.String selector, Account account)
           
 boolean isSelectorMatch(java.lang.String selector, EventData event)
          Return true if the specified 'event' matches the specified 'selector'
static void main(java.lang.String[] argv)
           
 
Methods inherited from class org.opengts.db.RuleFactoryAdapter
getGeoCorridorDescription, getPredefinedRuleActions, ValidateActionMask
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RuleFactoryExample

public RuleFactoryExample()
Method Detail

DebugSetSendNotification

public static void DebugSetSendNotification(boolean send)

getName

public java.lang.String getName()
Description copied from class: RuleFactoryAdapter
Returns this RuleFactory name

Specified by:
getName in interface RuleFactory
Specified by:
getName in class RuleFactoryAdapter
Returns:
This RuleFactory name

getVersion

public java.lang.String getVersion()
Description copied from class: RuleFactoryAdapter
Return this RuleFactory version String

Specified by:
getVersion in interface RuleFactory
Overrides:
getVersion in class RuleFactoryAdapter
Returns:
This RuleFactory version String

checkRuntime

public boolean checkRuntime()
Description copied from interface: RuleFactory
Initializes and returns true if successful

Returns:
True if initialization was succesful, false otherwise

getIdentifierNames

public java.util.List<java.lang.String> getIdentifierNames()
Description copied from interface: RuleFactory
Returns a list of all available selector identifiers

Returns:
A list of all available selector identifiers

getIdentifierDescription

public java.lang.String getIdentifierDescription(java.lang.String idName)
Description copied from interface: RuleFactory
Returns the description for the specified identifier

Parameters:
idName - The name of the identifier for which the description is returned.
Returns:
The description for the specified identifier

getFunctionNames

public java.util.List<java.lang.String> getFunctionNames()
Description copied from interface: RuleFactory
Returns a list of all available selector function names

Returns:
A list of all available selector function names

getFunctionUsage

public java.lang.String getFunctionUsage(java.lang.String ftnName)
Description copied from interface: RuleFactory
Returns the function "usage" description for the specified function name

Parameters:
ftnName - The name of the function for which the "usage" description is returned.
Returns:
The "usage" description for the specified function name

getFunctionDescription

public java.lang.String getFunctionDescription(java.lang.String ftnName)
Description copied from interface: RuleFactory
Returns the description for the specified function name

Parameters:
ftnName - The name of the function for which the description is returned.
Returns:
The description for the specified function name

getRuleIDs

public java.lang.String[] getRuleIDs(Account account)
Returns a list of defined rule-ids for the specified Account.

Parameters:
account - The account from which the rule-id list is returned
Returns:
The list of rule-ids

getRuleSelector

public java.lang.String getRuleSelector(Account account,
                                        java.lang.String ruleID)
Return the selector for the specified rule-id

Parameters:
account - the Account
ruleID - the rule-id
Returns:
The rule selector, or null if the rule-id is not defined

getRuleNotifyEmail

public java.lang.String getRuleNotifyEmail(Account account,
                                           java.lang.String ruleID)
Returns the rule notification email addresses for the specified rule-id, in the specified Account. Email addresses are returned as a comma-separated String value.

Parameters:
account - The account which owns the rule-id from which the notify email addresses are returned
ruleID - The Rule-ID which contains the notify email addresses to return
Returns:
The rule notification email addresses for the specified account and rule-id

checkSelectorSyntax

public boolean checkSelectorSyntax(java.lang.String selector)
Description copied from interface: RuleFactory
Return true if the specified selector is syntactically correct

Parameters:
selector - The rule selector to syntax check
Returns:
True if the selector is syntactically correct, false otherwise

isSelectorMatch

public boolean isSelectorMatch(java.lang.String selector,
                               Account account)

isSelectorMatch

public boolean isSelectorMatch(java.lang.String selector,
                               EventData event)
Description copied from interface: RuleFactory
Return true if the specified 'event' matches the specified 'selector'

Parameters:
selector - The rule selector to check against the specified event
event - The event that contains the criteria used by the selector
Returns:
True if the events matches the specified selector, false otherwise

evaluateSelector

public java.lang.Object evaluateSelector(java.lang.String selector,
                                         Account account)
Description copied from interface: RuleFactory
Evaluates a selector against the specified Account and returns the result

Parameters:
selector - The selector to execute.
account - The Account that contains the criteria used by the selector
Returns:
An object containing the result of the executed selector.

evaluateSelector

public java.lang.Object evaluateSelector(java.lang.String selector,
                                         EventData event)
Description copied from interface: RuleFactory
Evaluates a selector against the specified event and returns the result

Parameters:
selector - The selector to execute.
event - The event that contains the criteria used by the selector
Returns:
An object containing the result of the executed selector.

executeSelector

public int executeSelector(java.lang.String selector,
                           EventData event)
Description copied from interface: RuleFactory
Executes the specified selector against the criteria contained win the event record, and return a mask containing the actions performed.

Parameters:
selector - The selector to execute.
event - The event that contains the criteria used by the selector
Returns:
The mask containing the 'actions' performed.

executeRules

public int executeRules(EventData event)
Description copied from interface: RuleFactory
Executes all rules which apply to the specified EventData record, and return a mask containing the actions performed.

Parameters:
event - The event that contains the criteria used by the rules
Returns:
The mask containing the 'actions' performed.

executeRule

public int executeRule(java.lang.String ruleID,
                       EventData event)
Description copied from interface: RuleFactory
Executes the specified ruleID against the specified EventData record, and return a mask containing the actions performed.

Parameters:
ruleID - The ruleID to execute against the specified event
event - The event that contains the criteria used by the rules
Returns:
The mask containing the 'actions' performed.

_sendNotification

protected static boolean _sendNotification(EventData evdb,
                                           int actionMask)

main

public static void main(java.lang.String[] argv)