use of com.serotonin.m2m2.rt.event.AlarmLevels in project ma-core-public by infiniteautomation.
the class EventInstanceService method getUnacknowledgedSummary.
/**
*/
public List<UserEventLevelSummary> getUnacknowledgedSummary() {
PermissionHolder user = Common.getUser();
this.permissionService.ensurePermission(user, eventsViewPermission.getPermission());
Map<AlarmLevels, UserEventLevelSummary> summaries = new EnumMap<>(AlarmLevels.class);
for (AlarmLevels level : AlarmLevels.values()) {
if (level == AlarmLevels.IGNORE) {
continue;
}
int count = dao.countUnacknowledgedAlarms(level, user);
EventInstanceVO latest = dao.getLatestUnacknowledgedAlarm(level, user);
summaries.put(level, new UserEventLevelSummary(level, count, latest));
}
return new ArrayList<>(summaries.values());
}
use of com.serotonin.m2m2.rt.event.AlarmLevels in project ma-core-public by infiniteautomation.
the class AuditEventType method registerEventType.
private static void registerEventType(String subtype, String key) {
TYPE_NAMES.addElement(subtype);
AlarmLevels level = AlarmLevels.fromValue(SystemSettingsDao.getInstance().getIntValue(AUDIT_SETTINGS_PREFIX + subtype));
EVENT_TYPES.put(subtype, new EventTypeVO(new AuditEventType(subtype, 0, 0), new TranslatableMessage(key), level));
}
use of com.serotonin.m2m2.rt.event.AlarmLevels in project ma-core-public by infiniteautomation.
the class SystemEventType method registerEventType.
private static void registerEventType(String subtype, String key) {
TYPE_NAMES.addElement(subtype);
AlarmLevels level = AlarmLevels.fromValue(SystemSettingsDao.getInstance().getIntValue(SYSTEM_SETTINGS_PREFIX + subtype));
EVENT_TYPES.put(subtype, new EventTypeVO(new SystemEventType(subtype, 0, null), new TranslatableMessage(key), level));
}
use of com.serotonin.m2m2.rt.event.AlarmLevels in project ma-core-public by MangoAutomation.
the class DataSourceVO method jsonWrite.
@Override
public void jsonWrite(ObjectWriter writer) throws IOException, JsonException {
super.jsonWrite(writer);
// Write the type
writer.writeEntry("type", this.definition.getDataSourceTypeName());
ExportCodes eventCodes = getEventCodes();
if (eventCodes != null && eventCodes.size() > 0) {
Map<String, String> alarmCodeLevels = new HashMap<>();
for (int i = 0; i < eventCodes.size(); i++) {
int eventId = eventCodes.getId(i);
AlarmLevels level = getAlarmLevel(eventId, AlarmLevels.URGENT);
alarmCodeLevels.put(eventCodes.getCode(eventId), level.name());
}
writer.writeEntry("alarmLevels", alarmCodeLevels);
}
writer.writeEntry("purgeType", Common.TIME_PERIOD_CODES.getCode(purgeType));
}
use of com.serotonin.m2m2.rt.event.AlarmLevels in project ma-core-public by MangoAutomation.
the class DataSourceVO method setAlarmLevel.
/**
* Set an alarm level based on the sub-type of the data source event type
* which MUST (and already is) one of the codes in getEventCodes()
*/
public void setAlarmLevel(String subType, AlarmLevels level) throws ValidationException {
ExportCodes codes = getEventCodes();
int eventId = codes.getId(subType);
if (eventId == -1) {
ProcessResult result = new ProcessResult();
result.addContextualMessage("alarmLevel", "emport.error.eventCode", subType, codes.getCodeList());
throw new ValidationException(result);
}
alarmLevels.put(eventId, level);
}
Aggregations