com.eventgnosis.filters
Class Condition

java.lang.Object
  extended bycom.eventgnosis.filters.Condition
All Implemented Interfaces:
EmmlParmBuilder

public class Condition
extends java.lang.Object
implements EmmlParmBuilder

Implements a set of expressions connected by logical operators to be built and evaluated against an incoming event.
Each expression has input values and can utilize operators form the following table.

Valid Valuetype for operators:
string and number:   equal, not equal, greater than, less than, less than or equal, greater than or equal, exists, is empty.
STRING ONLY: contains, isContainedinString, matchesRegularExpression, inList.


Operator Table

Condition Phrase

<negate>

<operator>

<valueType>

numerically equal

false

eq

number

equal to string

false

eq

string

equal to case insensitive string

false

eq

stringIgnoreCase

 

 

 

 

numerically not equal

false

neq

number

not equal to string

false

neq

string

not equal to case insensitive string

false

neq

stringIgnoreCase

 

 

 

 

numerically greater than

false

gt

number

ASCII greater than

false

gt

string

ASCII case insensitive greater than

false

gt

stringIgnoreCase

 

 

 

 

numerically greater than or equal to

false

geq

number

ASCII greater than or equal to

false

geq

string

ASCII case insensitive greater than or equal to

false

geq

stringIgnoreCase

 

 

 

 

numerically less than

false

lt

number

ASCII less than

false

lt

string

ASCII case insensitive less than

false

lt

stringIgnoreCase

 

 

 

 

numerically less than or equal to

false

leq

number

ASCII less than or equal to

false

leq

string

ASCII case insensitive less than or equal to

false

leq

stringIgnoreCase

 

 

 

 

contains string

false

containsString

string

contains string case insensitive

false

containsString

stringIgnoreCase

does not contain string

true

containsString

string

does not contain string case insensitive string

true

containsString

stringIgnoreCase

 

 

 

 

is substring of

false

isContainedInString

string

is case insensitive substring of

false

isContainedInString

stringIgnoreCase

is not substring of

true

isContainedInString

string

is not case insensitive substring of

true

isContainedInString

stringIgnoreCase

 

 

 

 

matches regular expression

false

matchesRegExp

string

does not match regular expression

true

matchesRegExp

stringIgnoreCase

 

 

 

 

matches one of value list

false

isInList

string

matches one of value case insensitive list

false

isInList

stringIgnoreCase

does not match one of value list

true

isInList

string

does not match one of value case insensitive list

true

isInList

stringIgnoreCase

 

 

 

 

exists

false

exists

n/a

does not exist

true

exists

n/a

 

 

 

 

is empty

false

isEmpty

n/a

is not empty

true

isEmpty

n/a


Special Cases

If there is more than one fieldName in the event, only the first will be considered.

Number

String or StringIgnoreCase



If the incoming event evaluates true (matches) againts this condition then specified actions can be taken.
This class forms bases for more complex evaluation objects, such as ConditionList and ConditionWeightList.


Field Summary
static int COND_ALL
           
static int COND_ANY
           
static java.lang.String COND_ANY_STR
           
static int DEF_COND_REL
           
static java.lang.String DEF_COND_REL_STR
           
 
Constructor Summary
Condition()
           
Condition(boolean negPrim, int condRel, java.util.ArrayList condList)
           
 
Method Summary
 java.lang.String build(Log log, com.eventgnosis.config.ConfigurationManager configMgr, org.w3c.dom.Element elem)
          After object is instantiated this method is called to parse the EMML DOM element, setting its internal state to the parsed values.
 java.util.ArrayList getConditionList()
           
 int getConditionListSize()
           
 int getConditionRelation()
           
 java.lang.String getConditionRelationAsString()
           
 java.lang.String getConfigXml()
           
static Condition getDefault()
           
 boolean getNegatePrimaryCondition()
           
 boolean match(Event event)
          Evaluates the incoming event against logically connected set of expressions.
static Condition parse(Log log, com.eventgnosis.config.ConfigurationManager configMgr, org.w3c.dom.Element elem)
          Parses emml dom element creating the Condition object.
 void setConditionList(java.util.ArrayList condList)
           
 void setConditionRelation(int condRel)
           
 void setNegatePrimaryCondition(boolean negPrim)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

COND_ALL

public static final int COND_ALL
See Also:
Constant Field Values

COND_ANY

public static final int COND_ANY
See Also:
Constant Field Values

COND_ANY_STR

public static java.lang.String COND_ANY_STR

DEF_COND_REL

public static final int DEF_COND_REL
See Also:
Constant Field Values

DEF_COND_REL_STR

public static final java.lang.String DEF_COND_REL_STR
Constructor Detail

Condition

public Condition()

Condition

public Condition(boolean negPrim,
                 int condRel,
                 java.util.ArrayList condList)
Method Detail

build

public java.lang.String build(Log log,
                              com.eventgnosis.config.ConfigurationManager configMgr,
                              org.w3c.dom.Element elem)
Description copied from interface: EmmlParmBuilder
After object is instantiated this method is called to parse the EMML DOM element, setting its internal state to the parsed values.

Specified by:
build in interface EmmlParmBuilder
Parameters:
log - logger instance for tracking error, warning and info messages.
configMgr - holds configuration data structure used to properly configure runtime setup based on input ECA(s).
elem - emml(dom) node to be parsed
Returns:
precise error statement if there are any errors; null is returned if there are no errors and object is build sucessfully.

getConditionList

public java.util.ArrayList getConditionList()

getConditionListSize

public int getConditionListSize()

getConditionRelation

public int getConditionRelation()

getConditionRelationAsString

public java.lang.String getConditionRelationAsString()

getConfigXml

public java.lang.String getConfigXml()

getDefault

public static Condition getDefault()

getNegatePrimaryCondition

public boolean getNegatePrimaryCondition()

match

public boolean match(Event event)
Evaluates the incoming event against logically connected set of expressions.

Parameters:
event - incoming event to be evaluated
Returns:
true if the condition is satisfied; otherwise false.

parse

public static Condition parse(Log log,
                              com.eventgnosis.config.ConfigurationManager configMgr,
                              org.w3c.dom.Element elem)
Parses emml dom element creating the Condition object.

Parameters:
log - logger instance for tracking error, warning and info messages.
configMgr - holds configuration data structure used to properly configure runtime setup based on input ECA(s).
elem - emml(dom) node to parse
Returns:
if element is null returns null. If there are parsing errors, returns default Condition; otherwise returns new, initialized Condition.

setConditionList

public void setConditionList(java.util.ArrayList condList)

setConditionRelation

public void setConditionRelation(int condRel)

setNegatePrimaryCondition

public void setNegatePrimaryCondition(boolean negPrim)

toString

public java.lang.String toString()