Accessing event-related information

The following examples indicate how you can access event-related information through the variables that are provided by the Active Correlation Technology.

Example of accessing the current event:
The following code shows how to use the act_event variable to obtain the hostname attribute for an event:
act_event.getAttribute("hostname");
Example of accessing events through the event list by index:
The following code shows how to use the act_eventList variable to obtain the first event in the event list:
act_eventList.get(0);
Example of accessing events through the event list by alias:
Unlike other rule types, the sequence rule allows multiple event selectors and actually requires a minimum of two event selectors. The alias attribute on the <eventSelector> element is valid only within a sequence rule, and it uniquely names an event that is selected by a certain event selector in the sequence rule. In an expression within a filtering predicate or action, you can use the act_eventList variable to access an event in a sequence rule by its alias name.
The following code shows two event selectors for a sequence rule. The alias names are TECevent and WASevent.
<eventSelector alias="TECevent">
	<eventType type="serverStatus"/>
	<filteringPredicate expressionLanguage="java">
		return act_event.getStringAttribute("source").equals("TEC");
	</filteringPredicate>
</eventSelector>
<eventSelector alias="WASevent">
	<eventType type="serverStatus"/>
	<filteringPredicate expressionLanguage="java">
		return act_event.getStringAttribute("source").equals("WAS");
	</filteringPredicate>
</eventSelector>
The following code shows how to use the act_eventList variable to obtain the event that has been accepted by the first event selector, which is named TECevent:
act_eventList.get("TECevent");