public class EventManager
extends java.lang.Object
implements com.serotonin.util.ILifecycle
Modifier and Type | Class and Description |
---|---|
(package private) class |
EventManager.MyMap<K,V> |
(package private) class |
EventManager.MySet<T> |
Modifier and Type | Field and Description |
---|---|
private EventManager.MySet<java.lang.Integer> |
activeDatapointIds |
private java.util.List<EventInstance> |
activeEvents |
private java.util.Map<java.lang.Integer,java.util.concurrent.atomic.AtomicInteger> |
activeUserEventCount |
private EventDao |
eventDao |
private EventManager.MyMap<java.lang.Integer,java.util.List<java.lang.Integer>> |
eventUserPair |
private int |
highestActiveAlarmLevel |
private long |
lastAlarmTimestamp |
private org.apache.commons.logging.Log |
log |
private UserCache |
userCache |
Constructor and Description |
---|
EventManager() |
Modifier and Type | Method and Description |
---|---|
void |
cancelEventsForDataPoint(int dataPointId) |
void |
cancelEventsForDataSource(int dataSourceId) |
void |
cancelEventsForPublisher(int publisherId) |
boolean |
datapointHasActiveEvent(int dpId) |
private void |
deactivateEvent(EventInstance evt,
long time,
int inactiveCause) |
private EventInstance |
get(EventType type)
Returns the first event instance with the given type, or null is there is
none.
|
java.lang.Integer |
getActiveAlarmCountPerUser(java.lang.Integer userId) |
java.util.List<EventInstance> |
getActiveEventsByUser(int userId) |
private com.serotonin.web.i18n.LocalizableMessage |
getAlarmLevelChangeMessage(java.lang.String key,
int oldValue) |
private java.util.List<EventInstance> |
getAll(EventType type) |
int |
getHighestActiveEventLevelByUser(int userId) |
long |
getLastAlarmTimestamp() |
private void |
handleInactiveEvent(EventInstance evt) |
private void |
handleRaiseEvent(EventInstance evt,
java.util.Set<java.lang.String> defaultAddresses) |
void |
initialize() |
private boolean |
isSuppressed(EventType eventType) |
void |
joinTermination() |
void |
raiseEvent(EventType type,
long time,
boolean rtnApplicable,
int alarmLevel,
com.serotonin.web.i18n.LocalizableMessage message,
java.util.Map<java.lang.String,java.lang.Object> context) |
private EventInstance |
remove(EventType type)
Finds and removes the first event instance with the given type.
|
private void |
removeFromControlLists(EventInstance e) |
private void |
resetHighestAlarmLevel(long time,
boolean init) |
void |
returnToNormal(EventType type,
long time) |
void |
returnToNormal(EventType type,
long time,
int cause) |
private void |
setHandlers(EventInstance evt) |
void |
terminate() |
private final org.apache.commons.logging.Log log
private final java.util.List<EventInstance> activeEvents
private final EventManager.MySet<java.lang.Integer> activeDatapointIds
private final java.util.Map<java.lang.Integer,java.util.concurrent.atomic.AtomicInteger> activeUserEventCount
private final EventManager.MyMap<java.lang.Integer,java.util.List<java.lang.Integer>> eventUserPair
private EventDao eventDao
private UserCache userCache
private long lastAlarmTimestamp
private int highestActiveAlarmLevel
public void raiseEvent(EventType type, long time, boolean rtnApplicable, int alarmLevel, com.serotonin.web.i18n.LocalizableMessage message, java.util.Map<java.lang.String,java.lang.Object> context)
public void returnToNormal(EventType type, long time)
public void returnToNormal(EventType type, long time, int cause)
private void deactivateEvent(EventInstance evt, long time, int inactiveCause)
public long getLastAlarmTimestamp()
public void cancelEventsForDataPoint(int dataPointId)
public void cancelEventsForDataSource(int dataSourceId)
public void cancelEventsForPublisher(int publisherId)
private void resetHighestAlarmLevel(long time, boolean init)
private com.serotonin.web.i18n.LocalizableMessage getAlarmLevelChangeMessage(java.lang.String key, int oldValue)
public void initialize()
initialize
in interface com.serotonin.util.ILifecycle
public void terminate()
terminate
in interface com.serotonin.util.ILifecycle
public void joinTermination()
joinTermination
in interface com.serotonin.util.ILifecycle
private EventInstance get(EventType type)
private java.util.List<EventInstance> getAll(EventType type)
private EventInstance remove(EventType type)
type
- private void removeFromControlLists(EventInstance e)
private void setHandlers(EventInstance evt)
private void handleRaiseEvent(EventInstance evt, java.util.Set<java.lang.String> defaultAddresses)
private void handleInactiveEvent(EventInstance evt)
private boolean isSuppressed(EventType eventType)
public java.lang.Integer getActiveAlarmCountPerUser(java.lang.Integer userId)
public boolean datapointHasActiveEvent(int dpId)
public java.util.List<EventInstance> getActiveEventsByUser(int userId)
public int getHighestActiveEventLevelByUser(int userId)