use of cern.laser.business.data.AlarmChange in project ACS by ACS-Community.
the class AlarmCacheServerImpl method notify.
public void notify(Collection alarmChanges) {
try {
Iterator iterator = alarmChanges.iterator();
while (iterator.hasNext()) {
AlarmChange alarm_change = (AlarmChange) iterator.next();
Alarm current_alarm = alarm_change.getCurrent();
if (!current_alarm.getStatus().getActive().equals(alarm_change.getPrevious().getStatus().getActive())) {
if (current_alarm.getPiquetGSM() != null) {
sendSMS(current_alarm);
}
if (current_alarm.getPiquetEmail() != null) {
sendEmail(current_alarm);
}
}
}
} catch (Exception e) {
throw new LaserRuntimeException("unable to notify alarm(s)", e);
}
}
use of cern.laser.business.data.AlarmChange in project ACS by ACS-Community.
the class AlarmDefinitionServiceImpl method propagateRemovedAlarm.
private void propagateRemovedAlarm(Alarm alarm) {
try {
if (LOGGER.isDebugEnabled())
LOGGER.debug("propagating removed alarm : " + alarm.getTriplet());
if (alarm.getStatus().getActive().booleanValue()) {
Alarm terminated = (Alarm) ((AlarmImpl) alarm).clone();
terminated.getStatus().setActive(Boolean.FALSE);
terminated.getStatus().setSourceHostname("LASER");
Timestamp now = new Timestamp(System.currentTimeMillis());
terminated.getStatus().setSourceTimestamp(now);
terminated.getStatus().setSystemTimestamp(now);
terminated.getStatus().setUserTimestamp(now);
terminated.getStatus().getProperties().clear();
terminated.getStatus().getProperties().setProperty("REMOVED_BOOL", "TRUE");
alarmPublisher.publish(new AlarmChange(terminated, alarm));
alarmMessageProcessor.notifyReductionRelatives(alarm);
}
if (LOGGER.isDebugEnabled())
LOGGER.debug("propagated");
} catch (Exception e) {
LOGGER.error("unable to propagate removed alarm " + alarm.getTriplet() + " : " + e.getMessage());
}
}
Aggregations