use of com.cosylab.acs.laser.dao.utils.AlarmRefMatcher in project ACS by ACS-Community.
the class ACSAlarmDAOImpl method updateAlarmReductionRule.
/**
* Update the reduction rules involving the passed alarm
*
* @param alarm The parent alarm whose reduction rule has to be
* updated
*/
private void updateAlarmReductionRule(AlarmImpl alarm) {
if (alarm == null) {
throw new IllegalArgumentException("The passed alarm can't be null");
}
Collection<Alarm> cc = alarmDefs.values();
AlarmImpl[] allAlarms = new AlarmImpl[cc.size()];
cc.toArray(allAlarms);
int num = allAlarms.length;
LinkSpec[] ls = new LinkSpec[reductionRules.size()];
reductionRules.toArray(ls);
for (LinkSpec lsb : ls) {
if (lsb.matchChild(alarm)) {
AlarmRefMatcher parentMatcher = lsb._parent;
boolean isMulti = lsb.isMultiplicity();
for (int c = 0; c < num; c++) {
if (alarm.getAlarmId().equals(allAlarms[c].getAlarmId())) {
continue;
}
AlarmImpl aic = allAlarms[c];
if (parentMatcher.isMatch(aic)) {
if (isMulti) {
addMultiplicityChild(aic, alarm);
aic.setMultiplicityThreshold(theThreshods.get(aic.getAlarmId()));
} else {
addNodeChild(aic, alarm);
}
}
}
} else if (lsb.matchParent(alarm)) {
AlarmRefMatcher childMatcher = lsb._child;
boolean isMulti = lsb.isMultiplicity();
for (int c = 0; c < num; c++) {
if (alarm.getAlarmId().equals(allAlarms[c].getAlarmId())) {
continue;
}
AlarmImpl aic = allAlarms[c];
if (childMatcher.isMatch(aic)) {
if (isMulti) {
addMultiplicityChild(alarm, aic);
alarm.setMultiplicityThreshold(theThreshods.get(alarm.getAlarmId()));
} else {
addNodeChild(alarm, aic);
}
}
}
}
}
}
Aggregations