Search in sources :

Example 1 with CommentedAlarm

use of cern.laser.console.CommentedAlarm in project ACS by ACS-Community.

the class ConfigurationImpl method buildCommentedAlarmMap.

//
// -- PROTECTED METHODS -------------------------------------------
//
//
// -- PRIVATE METHODS ---------------------------------------------
//
private CommentedAlarmMap buildCommentedAlarmMap(Collection commentedAlarmRefs, boolean removeChanged) throws Exception {
    CommentedAlarmMap result = new CommentedAlarmMap();
    if ((commentedAlarmRefs == null) || (commentedAlarmRefs.size() == 0)) {
        return result;
    }
    Iterator iterator = commentedAlarmRefs.iterator();
    while (iterator.hasNext()) {
        CommentedAlarmRef ref = (CommentedAlarmRef) iterator.next();
        Alarm alarm = AlarmBrowsingHandler.get(orb, logger).getAlarmById(ref.getAlarmId());
        if ((!removeChanged) || (removeChanged && alarm.getStatus().getSourceTimestamp().equals(ref.getSourceTimestamp()))) {
            result.put(new CommentedAlarm(alarm, ref.getComment()));
        }
    }
    return result;
}
Also used : CommentedAlarmMap(cern.laser.console.CommentedAlarmMap) CommentedAlarm(cern.laser.console.CommentedAlarm) Alarm(cern.laser.client.data.Alarm) Iterator(java.util.Iterator) CommentedAlarm(cern.laser.console.CommentedAlarm)

Example 2 with CommentedAlarm

use of cern.laser.console.CommentedAlarm in project ACS by ACS-Community.

the class ConfigurationImpl method buildCommentedAlarmCollection.

private Collection buildCommentedAlarmCollection(CommentedAlarmMap alarms) {
    Collection result = new ArrayList();
    if ((alarms == null) || (alarms.size() == 0)) {
        return result;
    }
    Iterator iterator = alarms.values().iterator();
    while (iterator.hasNext()) {
        CommentedAlarm alarm = (CommentedAlarm) iterator.next();
        result.add(new CommentedAlarmRef(alarm.getAlarm().getAlarmId(), alarm.getAlarm().getStatus().getSourceTimestamp(), alarm.getComment()));
    }
    return result;
}
Also used : ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) Collection(java.util.Collection) CommentedAlarm(cern.laser.console.CommentedAlarm)

Aggregations

CommentedAlarm (cern.laser.console.CommentedAlarm)2 Iterator (java.util.Iterator)2 Alarm (cern.laser.client.data.Alarm)1 CommentedAlarmMap (cern.laser.console.CommentedAlarmMap)1 ArrayList (java.util.ArrayList)1 Collection (java.util.Collection)1