twaver.alarm
Class AlarmState

java.lang.Object
  extended by twaver.alarm.AlarmState
All Implemented Interfaces:
ISerializable

public class AlarmState
extends java.lang.Object
implements ISerializable

告警状态


Constructor Summary
AlarmState()
          Default constructor
AlarmState(Element element)
          Create alarm state object that is initialized with the given element as the source element.
 
Method Summary
 void acknowledgeAlarm(AlarmSeverity severity)
          Acknowledges an alarm of a given severity.
 void acknowledgeAllAlarms()
          Acknowledges all alarms.
 void acknowledgeAllAlarms(AlarmSeverity severity)
          Acknowledges all alarms of a given severity.
 void addAcknowledgedAlarm(AlarmSeverity severity)
          Adds a acknowledged alarm with a given severity.
 void addNewAlarm(AlarmSeverity severity)
          Adds a new alarm with given severity.
 void clear()
          Removes all alarms, include all new, acknowledged or propagated alarms, all alarm severities.
 java.lang.Object clone()
          
 int compareTo(java.lang.Object o)
           
 void copyFrom(AlarmState alarmState)
           
 void decreaseAcknowledgedAlarm(AlarmSeverity severity)
           
 void decreaseAcknowledgedAlarm(AlarmSeverity severity, int decrement)
          Decrease acknowledged alarm count for given severity.
 void decreaseNewAlarm(AlarmSeverity severity)
           
 void decreaseNewAlarm(AlarmSeverity severity, int decrement)
          Decrease new alarm count for given severity.
 void deserialize(java.lang.String s)
          反序列化属性,根据字符串生成对象的属性
 int getAcknowledgedAlarmCount()
          Returns the number of acknowledged alarms, all alarm severities included.
 int getAcknowledgedAlarmCount(AlarmSeverity severity)
          Returns the total acknowledged alarm count of specified severity.
 int getAlarmCount()
          Returns the total number of alarms, acknowledged or otherwise, all alarm severities included.
 int getAlarmCount(AlarmSeverity severity)
          Returns the total number of alarms with the specified severity, acknowledged or new.
 AlarmSeverity getHighestAcknowledgedAlarmSeverity()
          Gets the highest acknowledged alarm severity
 AlarmSeverity getHighestNativeAlarmSeverity()
          Get the highest native alarm severity.
 AlarmSeverity getHighestNewAlarmSeverity()
          Get the highest new alarm severity
 AlarmSeverity getHighestOverallAlarmSeverity()
          Get the highest overall alarm severity.
 int getNewAlarmCount()
          Returns the number of all new alarms, all alarm severities included.
 int getNewAlarmCount(AlarmSeverity severity)
          Returns the total number of all new alarms of the given severity.
 AlarmSeverity getPropagateSeverity()
          Gets the propagate alarm severity.
 boolean hasLessSevereNewAlarms()
          Tells whether has non-highest severe new alarms.
 void increaseAcknowledgedAlarm(AlarmSeverity severity)
           
 void increaseAcknowledgedAlarm(AlarmSeverity severity, int increment)
          Increase acknowledged alarm count for given severity.
 void increaseNewAlarm(AlarmSeverity severity)
           
 void increaseNewAlarm(AlarmSeverity severity, int increment)
          Increase new alarm count for given severity.
 boolean isEmpty()
          Tells whether this alarm state object has any alarms.
 boolean isEnablePropagation()
          Returns true if the children's alarm state can propagate to the related element of this alarm state.
 void removeAcknowledgedAlarm(AlarmSeverity severity)
          Removes an acknowledged alarm on the given severity.
 void removeAllAcknowledgedAlarms()
          Removes all acknowledged alarms of all severities.
 void removeAllAcknowledgedAlarms(AlarmSeverity severity)
          Removes all acknowledged alarms of the given severity.
 void removeAllNewAlarms()
          Removes all new alarms of all severities.
 void removeAllNewAlarms(AlarmSeverity severity)
          Removes all new alarms of the given severity.
 void removeNewAlarm(AlarmSeverity severity)
          Removes a new alarm on the given severity.
 java.lang.String serialize()
          序列化该对象
 void setAcknowledgedAlarmCount(AlarmSeverity severity, int count)
          Sets a new total acknowledged alarm number for the given severity.
 void setElement(Element element)
          Change element object for this alarm state.
 void setEnablePropagation(boolean enablePropagationOfChildren)
          Determines whether or not the children's alarm state can propagate to the related element of this alarm state.
 void setNewAlarmCount(AlarmSeverity severity, int count)
          Sets the new alarm total count for given severity.
 void setPropagateSeverity(AlarmSeverity propagateSeverity)
          Set the propagate alarm severity.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AlarmState

public AlarmState()
Default constructor


AlarmState

public AlarmState(Element element)
Create alarm state object that is initialized with the given element as the source element.

Parameters:
element - Element the source element
Method Detail

setElement

public void setElement(Element element)
Change element object for this alarm state.

Parameters:
element - Element new source element object

getHighestAcknowledgedAlarmSeverity

public AlarmSeverity getHighestAcknowledgedAlarmSeverity()
Gets the highest acknowledged alarm severity

Returns:
AlarmSeverity the highest acknowledged alarm severity

getHighestNewAlarmSeverity

public AlarmSeverity getHighestNewAlarmSeverity()
Get the highest new alarm severity

Returns:
AlarmSeverity the highest new alarm severity

hasLessSevereNewAlarms

public boolean hasLessSevereNewAlarms()
Tells whether has non-highest severe new alarms. When this is true, the alarm bubble will display "+" in the end of the alarm bubble text to indicate that this alarm state has more less severe new alarms.

Returns:
boolean whether has less severe new alarms in this alarm state.

getHighestOverallAlarmSeverity

public AlarmSeverity getHighestOverallAlarmSeverity()
Get the highest overall alarm severity. The highest overall severity is the highest alarm among acknowledged alarms, new alarms and propagated alarms.

Returns:
AlarmSeverity the highest overall alarm severity

getHighestNativeAlarmSeverity

public AlarmSeverity getHighestNativeAlarmSeverity()
Get the highest native alarm severity. The highest native severity is the highest severity among acknowledged alarms and new alarms.

Returns:
AlarmSeverity the highest native alarm severity.

increaseAcknowledgedAlarm

public void increaseAcknowledgedAlarm(AlarmSeverity severity)

increaseAcknowledgedAlarm

public void increaseAcknowledgedAlarm(AlarmSeverity severity,
                                      int increment)
Increase acknowledged alarm count for given severity.

Parameters:
severity - AlarmSeverity the severity need to be changed.
increment - int the number need to be increased

increaseNewAlarm

public void increaseNewAlarm(AlarmSeverity severity)

increaseNewAlarm

public void increaseNewAlarm(AlarmSeverity severity,
                             int increment)
Increase new alarm count for given severity.

Parameters:
severity - AlarmSeverity the severity need to be changed.
increment - int the number need to be increased

decreaseAcknowledgedAlarm

public void decreaseAcknowledgedAlarm(AlarmSeverity severity)

decreaseAcknowledgedAlarm

public void decreaseAcknowledgedAlarm(AlarmSeverity severity,
                                      int decrement)
Decrease acknowledged alarm count for given severity.

Parameters:
severity - AlarmSeverity the severity need to be changed.
decrement - int the number need to be decreased

decreaseNewAlarm

public void decreaseNewAlarm(AlarmSeverity severity)

decreaseNewAlarm

public void decreaseNewAlarm(AlarmSeverity severity,
                             int decrement)
Decrease new alarm count for given severity.

Parameters:
severity - AlarmSeverity the severity need to be changed.
decrement - int the number need to be decreased

acknowledgeAlarm

public void acknowledgeAlarm(AlarmSeverity severity)
Acknowledges an alarm of a given severity. The alarm is moved from the "new" category to the "acknowledged" category.

Parameters:
severity - the severity need to be acknowledged

acknowledgeAllAlarms

public void acknowledgeAllAlarms(AlarmSeverity severity)
Acknowledges all alarms of a given severity.

Parameters:
severity - the severity need to be acknowledged

acknowledgeAllAlarms

public void acknowledgeAllAlarms()
Acknowledges all alarms.


addAcknowledgedAlarm

public void addAcknowledgedAlarm(AlarmSeverity severity)
Adds a acknowledged alarm with a given severity.

Parameters:
severity - the severity need to be acknowledged.

addNewAlarm

public void addNewAlarm(AlarmSeverity severity)
Adds a new alarm with given severity.

Parameters:
severity - the severity need to be added.

getAcknowledgedAlarmCount

public int getAcknowledgedAlarmCount()
Returns the number of acknowledged alarms, all alarm severities included.

Returns:
the total number of the all acknowledged alarms

getAcknowledgedAlarmCount

public int getAcknowledgedAlarmCount(AlarmSeverity severity)
Returns the total acknowledged alarm count of specified severity.

Parameters:
severity - AlarmSeverity the constraint severity
Returns:
int the total number of acknowledged alarms of specified severity

getAlarmCount

public int getAlarmCount()
Returns the total number of alarms, acknowledged or otherwise, all alarm severities included.

Returns:
the the total number of alarms

getAlarmCount

public int getAlarmCount(AlarmSeverity severity)
Returns the total number of alarms with the specified severity, acknowledged or new.

Parameters:
severity - the severity constraint
Returns:
the total number of alarms.

getNewAlarmCount

public int getNewAlarmCount()
Returns the number of all new alarms, all alarm severities included.

Returns:
the total count of all new alarms.

getNewAlarmCount

public int getNewAlarmCount(AlarmSeverity severity)
Returns the total number of all new alarms of the given severity.

Parameters:
severity - AlarmSeverity the alarm severity constraint
Returns:
int the total number of the new alarms.

setNewAlarmCount

public void setNewAlarmCount(AlarmSeverity severity,
                             int count)
Sets the new alarm total count for given severity.

Parameters:
severity - the alarm severity constrain
count - the new total number for the specified severity.

removeNewAlarm

public void removeNewAlarm(AlarmSeverity severity)
Removes a new alarm on the given severity. This is an equivalent of
   decreaseNewAlarm(severity, 1)
 

Parameters:
severity - the alarm severity constraint

removeAllNewAlarms

public void removeAllNewAlarms(AlarmSeverity severity)
Removes all new alarms of the given severity.

Parameters:
severity - the alarm severity constraint

removeAllNewAlarms

public void removeAllNewAlarms()
Removes all new alarms of all severities.


setAcknowledgedAlarmCount

public void setAcknowledgedAlarmCount(AlarmSeverity severity,
                                      int count)
Sets a new total acknowledged alarm number for the given severity.

Parameters:
severity - AlarmSeverity the alarm severity constraint
count - int the new total acknowledged alarm number for the given severity.

removeAcknowledgedAlarm

public void removeAcknowledgedAlarm(AlarmSeverity severity)
Removes an acknowledged alarm on the given severity.

Parameters:
severity - AlarmSeverity the alarm severity constraint

removeAllAcknowledgedAlarms

public void removeAllAcknowledgedAlarms(AlarmSeverity severity)
Removes all acknowledged alarms of the given severity.

Parameters:
severity - AlarmSeverity severity constraint

removeAllAcknowledgedAlarms

public void removeAllAcknowledgedAlarms()
Removes all acknowledged alarms of all severities.


clear

public void clear()
Removes all alarms, include all new, acknowledged or propagated alarms, all alarm severities.


copyFrom

public void copyFrom(AlarmState alarmState)

getPropagateSeverity

public AlarmSeverity getPropagateSeverity()
Gets the propagate alarm severity. Normally the propagated alarm severity is the highest severity of all children elements of the related element, if you use the default TWaver alarm propatator on the DataBox.

Please note that AlarmState does not save any number information for the propagate alarm. Only the propagate alarm severity provided.

Returns:
AlarmSeverity the propagated alarm severity.

setPropagateSeverity

public void setPropagateSeverity(AlarmSeverity propagateSeverity)
Set the propagate alarm severity. Normally the propagated alarm severity is the highest severity of all children elements of the related element, if the default alarm propagator has been used on DataBox.

Note:In most cases, don't call this method to change the propagated alarm severity out of an alarm propagator(see twaver.AlarmPropatator).

Please note that AlarmState does not save any number information for the propagate alarm. Only the propagate alarm severity provided.

Parameters:
propagateSeverity - AlarmSeverity the new propagate alarm severity.

isEmpty

public boolean isEmpty()
Tells whether this alarm state object has any alarms.

Returns:
boolean true is no any alarms.

clone

public java.lang.Object clone()

Overrides:
clone in class java.lang.Object
Returns:
Object

compareTo

public int compareTo(java.lang.Object o)

isEnablePropagation

public boolean isEnablePropagation()
Returns true if the children's alarm state can propagate to the related element of this alarm state.

Returns:
boolean

setEnablePropagation

public void setEnablePropagation(boolean enablePropagationOfChildren)
Determines whether or not the children's alarm state can propagate to the related element of this alarm state.

Parameters:
enablePropagationOfChildren - boolean

serialize

public java.lang.String serialize()
Description copied from interface: ISerializable
序列化该对象

Specified by:
serialize in interface ISerializable
Returns:
字符串

deserialize

public void deserialize(java.lang.String s)
Description copied from interface: ISerializable
反序列化属性,根据字符串生成对象的属性

Specified by:
deserialize in interface ISerializable
Parameters:
s - 字符串