25 |
|
|
26 |
|
public static final String[] thresholdLevels = {"NORMAL", "LOWER", "UPPER"}; |
27 |
|
|
28 |
+ |
// not OK and FINAL MUST be present...at the beginning and the end |
29 |
+ |
|
30 |
|
public static final int alertOK = 0; |
31 |
|
public static final int alertNOTICE = 1; |
32 |
|
public static final int alertWARNING = 2; |
47 |
|
* |
48 |
|
* @param level the level of the alert |
49 |
|
*/ |
50 |
< |
public Alert(int alertLevel, int lastAlert, int thresholdLevel, String source, String thresholdValue, String value, String attributeName, String timeTillNextAlert) { |
50 |
> |
public Alert(int alertLevel, int lastAlert, int thresholdLevel, String source, String thresholdValue, String value, String attributeName, String timeTillNextAlert, long initialAlertTime) { |
51 |
|
_alertLevel = alertLevel; |
52 |
|
_lastAlert = lastAlert; |
53 |
|
_thresholdLevel = thresholdLevel; |
56 |
|
_value = value; |
57 |
|
_attributeName = attributeName; |
58 |
|
_timeTillNextAlert = timeTillNextAlert; |
59 |
+ |
_initialAlertTime = initialAlertTime; |
60 |
|
} |
61 |
|
|
62 |
|
//---PUBLIC METHODS--- |
63 |
+ |
|
64 |
+ |
/** |
65 |
+ |
* Prints a String representation of the Alert object. It |
66 |
+ |
* is designed to resemble a HashMap.toString(), such that |
67 |
+ |
* it is similar to the XMLPacket.printAll() method. |
68 |
+ |
* |
69 |
+ |
* @return a String representation of this Alert object. |
70 |
+ |
*/ |
71 |
+ |
public String printAll() { |
72 |
+ |
String result = "{"; |
73 |
+ |
result += "alertLevel="+_alertLevel+", "; |
74 |
+ |
result += "lastAlert="+_lastAlert+", "; |
75 |
+ |
result += "thresholdLevel="+_thresholdLevel+", "; |
76 |
+ |
result += "source="+_source+", "; |
77 |
+ |
result += "thresholdValue="+_thresholdValue+", "; |
78 |
+ |
result += "value="+_value+", "; |
79 |
+ |
result += "attributeName="+_attributeName+", "; |
80 |
+ |
result += "timeTillNextAlert="+_timeTillNextAlert+", "; |
81 |
+ |
result += "initialAlertTime="+_initialAlertTime; |
82 |
+ |
result += "}"; |
83 |
+ |
return result; |
84 |
+ |
} |
85 |
|
|
86 |
|
/** |
87 |
|
* Overrides the {@link java.lang.Object#toString() Object.toString()} |
137 |
|
public String getTimeTillNextAlert() { |
138 |
|
return _timeTillNextAlert; |
139 |
|
} |
140 |
+ |
|
141 |
+ |
public long getInitialAlertTime () { |
142 |
+ |
return _initialAlertTime; |
143 |
+ |
} |
144 |
|
|
145 |
|
//---ATTRIBUTES--- |
146 |
|
|
169 |
|
private String _thresholdValue; |
170 |
|
private String _attributeName; |
171 |
|
private String _timeTillNextAlert; |
172 |
+ |
|
173 |
+ |
private long _initialAlertTime; |
174 |
|
|
175 |
|
//---STATIC ATTRIBUTES--- |
176 |
|
|