diff --git a/WebContent/WEB-INF/jsp/systemSettings.jsp b/WebContent/WEB-INF/jsp/systemSettings.jsp index 909650ca38..5a284c0e98 100644 --- a/WebContent/WEB-INF/jsp/systemSettings.jsp +++ b/WebContent/WEB-INF/jsp/systemSettings.jsp @@ -98,6 +98,8 @@ $set("", settings.); $set("", settings.); + $set("", settings.); + $set("", settings.); var sel = $(""); sel.options[sel.options.length] = new Option("${lang.value}", "${lang.key}"); @@ -269,6 +271,8 @@ $get(""), $get(""), $get(""), + $get(""), + $get(""), function(response) { stopImageFader("saveMiscSettingsImg"); if (response.hasMessages) @@ -872,6 +876,18 @@ "/>" /> + + + + "/>" type="checkbox" /> + + + + + + "/>" type="number" class="formShort"/> + + diff --git a/scadalts-ui/src/locales/en.json b/scadalts-ui/src/locales/en.json index ce58dd947a..59013031af 100644 --- a/scadalts-ui/src/locales/en.json +++ b/scadalts-ui/src/locales/en.json @@ -1053,5 +1053,7 @@ "systemsettings.view.hideShortcutDisableFullScreen": "Hide shortcut to disable full screen", "userDetails.view.forceAdminTitle": "The function is enforced by the Admin", "userDetails.view.enableFullScreen": "Enable full screen mode", - "userDetails.view.hideShortcutDisableFullScreen": "Hide shortcut to disable full screen" + "userDetails.view.hideShortcutDisableFullScreen": "Hide shortcut to disable full screen", + "systemsettings.event.pendingLimit": "Event Pending Limit", + "systemsettings.event.pendingCacheEnabled": "Enabled Event Pending Cache" } diff --git a/scadalts-ui/src/views/System/SystemSettings/MiscSettingsComponent.vue b/scadalts-ui/src/views/System/SystemSettings/MiscSettingsComponent.vue index bc3bf31aed..eb0cf2112f 100644 --- a/scadalts-ui/src/views/System/SystemSettings/MiscSettingsComponent.vue +++ b/scadalts-ui/src/views/System/SystemSettings/MiscSettingsComponent.vue @@ -45,7 +45,23 @@ @change="watchDataChange()" > - + + + + + + + diff --git a/src/br/org/scadabr/api/dao/MangoDaoImpl.java b/src/br/org/scadabr/api/dao/MangoDaoImpl.java index 6f03faa3ba..2e79b56767 100644 --- a/src/br/org/scadabr/api/dao/MangoDaoImpl.java +++ b/src/br/org/scadabr/api/dao/MangoDaoImpl.java @@ -33,7 +33,8 @@ import com.serotonin.util.StringUtils; import com.serotonin.web.dwr.DwrResponseI18n; import org.scada_lts.ds.state.ApiChangeEnableStateDs; - +import org.scada_lts.mango.adapter.MangoEvent; +import org.scada_lts.mango.service.EventService; import java.util.*; public class MangoDaoImpl implements ScadaBRAPIDao { @@ -51,6 +52,7 @@ private void checkUser() throws ScadaBRAPIException { } private PointHierarchy pH; + private final MangoEvent eventService = new EventService(); @Override public List getItemValueList(String[] itemList, @@ -537,7 +539,7 @@ public List getDataHistory(String itemQName, public List getEventNotifications( AlarmLevel minimumAlarmLevel) throws ScadaBRAPIException { List alarms = new ArrayList(); - List events = new EventDao().getPendingEvents(1); + List events = eventService.getPendingEvents(1); checkUser(); if (events == null || events.size() == 0) { APIError error = new APIError(); @@ -565,7 +567,7 @@ public EventNotification ackEvent(int eventId) throws ScadaBRAPIException { if (eventInstance != null) { // alternateAckSource? - REM - new EventDao().ackEvent(eventId, 1, 0, 0); + eventService.ackEvent(eventId, 1, 0, 0); // new EventDao().ackEvent(eventId, 1); return APIUtils.toEventNotification(eventInstance); } else { @@ -577,7 +579,7 @@ public EventNotification ackEvent(int eventId) throws ScadaBRAPIException { } private EventInstance getEvent(int eventId) { - List events = new EventDao().getPendingEvents(1); + List events = eventService.getPendingEvents(1); for (EventInstance eventInstance : events) { if (eventInstance.getId() == eventId) return eventInstance; @@ -588,7 +590,7 @@ private EventInstance getEvent(int eventId) { private List getAcknowledgedEvents() { // Adicionados parametros novos (?) // return new EventDao().search(0, -1, null, -1, null, 20000, 1, null); - return new EventDao().search(0, -1, null, -1, null, 1, null, 0, 5000, + return eventService.search(0, -1, null, -1, null, 1, null, 0, 5000, null); } @@ -632,7 +634,7 @@ public EventMessage[] annotateEvent(int eventId, EventMessage message) checkUser(); EventInstance event = getEvent(eventId); if (event != null) { - new EventDao().insertEventComment(eventId, + eventService.insertEventComment(eventId, APIUtils.toUserComment(message)); event = getEvent(eventId); diff --git a/src/br/org/scadabr/view/component/AlarmListComponent.java b/src/br/org/scadabr/view/component/AlarmListComponent.java index cf53dc73e6..6241cf93af 100644 --- a/src/br/org/scadabr/view/component/AlarmListComponent.java +++ b/src/br/org/scadabr/view/component/AlarmListComponent.java @@ -14,11 +14,10 @@ import com.serotonin.json.JsonRemoteEntity; import com.serotonin.json.JsonRemoteProperty; import com.serotonin.mango.Common; -import com.serotonin.mango.db.dao.EventDao; -import com.serotonin.mango.rt.event.AlarmLevels; import com.serotonin.mango.rt.event.EventInstance; import com.serotonin.mango.view.ImplDefinition; import com.serotonin.mango.web.dwr.BaseDwr; +import org.scada_lts.mango.service.EventService; @JsonRemoteEntity public class AlarmListComponent extends CustomComponent { @@ -58,16 +57,11 @@ public String generateContent() { Map model = new HashMap(); WebContext webContext = WebContextFactory.get(); HttpServletRequest request = webContext.getHttpServletRequest(); - List toViewEvents = new EventDao().getPendingEvents(Common - .getUser().getId()); - - List events = new ArrayList<>(toViewEvents); - filter(events, minAlarmLevel); - - int max = events.size() > maxListSize ? maxListSize : events.size(); + List toViewEvents = new EventService().getPendingEventsAlarmLevelMin(Common + .getUser().getId(), minAlarmLevel, maxListSize, true); model.put("nome", "marlon"); - model.put("events", events.subList(0, max)); + model.put("events",toViewEvents); model.put("width", width > 0 ? width : 500); model.put("hideIdColumn", hideIdColumn); model.put("hideAlarmLevelColumn", hideAlarmLevelColumn); @@ -80,40 +74,6 @@ public String generateContent() { return content; } - private void filter(List list, int alarmLevel) { - - if (AlarmLevels.INFORMATION == alarmLevel) { - removeAlarmLevel(list, AlarmLevels.NONE); - } - if (AlarmLevels.URGENT == alarmLevel) { - removeAlarmLevel(list, AlarmLevels.NONE); - removeAlarmLevel(list, AlarmLevels.INFORMATION); - } - if (AlarmLevels.CRITICAL == alarmLevel) { - removeAlarmLevel(list, AlarmLevels.NONE); - removeAlarmLevel(list, AlarmLevels.INFORMATION); - removeAlarmLevel(list, AlarmLevels.URGENT); - } - if (AlarmLevels.LIFE_SAFETY == alarmLevel) { - removeAlarmLevel(list, AlarmLevels.NONE); - removeAlarmLevel(list, AlarmLevels.INFORMATION); - removeAlarmLevel(list, AlarmLevels.URGENT); - removeAlarmLevel(list, AlarmLevels.CRITICAL); - } - } - - private void removeAlarmLevel(List source, int alarmLevel) { - List copy = new ArrayList(); - - for (EventInstance eventInstance : source) { - if (eventInstance.getAlarmLevel() == alarmLevel) - copy.add(eventInstance); - } - - source.removeAll(copy); - - } - @Override public boolean containsValidVisibleDataPoint(int dataPointId) { return false; diff --git a/src/com/serotonin/mango/db/dao/EventDao.java b/src/com/serotonin/mango/db/dao/EventDao.java index d81bb1d352..9da777843c 100644 --- a/src/com/serotonin/mango/db/dao/EventDao.java +++ b/src/com/serotonin/mango/db/dao/EventDao.java @@ -36,6 +36,7 @@ * * @author Grzesiek Bylica Abil'I.T. development team, sdt@abilit.eu */ +@Deprecated public class EventDao { private MangoEvent eventService = new EventService(); diff --git a/src/com/serotonin/mango/rt/event/type/SystemEventType.java b/src/com/serotonin/mango/rt/event/type/SystemEventType.java index 09c21b77a2..ca497541c3 100644 --- a/src/com/serotonin/mango/rt/event/type/SystemEventType.java +++ b/src/com/serotonin/mango/rt/event/type/SystemEventType.java @@ -18,15 +18,18 @@ */ package com.serotonin.mango.rt.event.type; -import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.concurrent.CopyOnWriteArrayList; import com.serotonin.json.JsonException; import com.serotonin.json.JsonObject; import com.serotonin.json.JsonReader; import com.serotonin.json.JsonRemoteEntity; import com.serotonin.mango.Common; +import com.serotonin.mango.util.LoggingUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.scada_lts.dao.SystemSettingsDAO; import com.serotonin.mango.rt.event.AlarmLevels; import com.serotonin.mango.util.ExportCodes; @@ -40,6 +43,7 @@ public class SystemEventType extends EventType { // / Static stuff // / // + private static final Log LOG = LogFactory.getLog(SystemEventType.class); private static final String SYSTEM_SETTINGS_PREFIX = "systemEventAlarmLevel"; public static final int TYPE_SYSTEM_STARTUP = 1; @@ -74,7 +78,7 @@ public class SystemEventType extends EventType { public static List getSystemEventTypes() { if (systemEventTypes == null) { - systemEventTypes = new ArrayList(); + systemEventTypes = new CopyOnWriteArrayList<>(); addEventTypeVO(TYPE_SYSTEM_STARTUP, "event.system.startup", AlarmLevels.INFORMATION); @@ -118,18 +122,26 @@ public static EventTypeVO getEventType(int type) { public static void setEventTypeAlarmLevel(int type, int alarmLevel) { EventTypeVO et = getEventType(type); - et.setAlarmLevel(alarmLevel); + if(et != null) { + et.setAlarmLevel(alarmLevel); - SystemSettingsDAO dao = new SystemSettingsDAO(); - dao.setIntValue(SYSTEM_SETTINGS_PREFIX + type, alarmLevel); + SystemSettingsDAO dao = new SystemSettingsDAO(); + dao.setIntValue(SYSTEM_SETTINGS_PREFIX + type, alarmLevel); + } else { + LOG.warn(LoggingUtils.eventTypeInfo(type, alarmLevel)); + } } public static void raiseEvent(SystemEventType type, long time, boolean rtn, LocalizableMessage message) { EventTypeVO vo = getEventType(type.getSystemEventTypeId()); - int alarmLevel = vo.getAlarmLevel(); - Common.ctx.getEventManager().raiseEvent(type, time, rtn, alarmLevel, - message, null); + if(vo != null) { + int alarmLevel = vo.getAlarmLevel(); + Common.ctx.getEventManager().raiseEvent(type, time, rtn, alarmLevel, + message, null); + } else { + LOG.warn(LoggingUtils.systemEventTypInfo(type)); + } } public static void returnToNormal(SystemEventType type, long time) { diff --git a/src/com/serotonin/mango/rt/maint/DataPurge.java b/src/com/serotonin/mango/rt/maint/DataPurge.java index bbd0263301..f7081f4f8d 100644 --- a/src/com/serotonin/mango/rt/maint/DataPurge.java +++ b/src/com/serotonin/mango/rt/maint/DataPurge.java @@ -30,7 +30,6 @@ import com.serotonin.ShouldNeverHappenException; import com.serotonin.mango.Common; import com.serotonin.mango.db.dao.DataPointDao; -import com.serotonin.mango.db.dao.EventDao; import com.serotonin.mango.db.dao.PointValueDao; import com.serotonin.mango.db.dao.ReportDao; import org.scada_lts.dao.SystemSettingsDAO; @@ -40,6 +39,7 @@ import com.serotonin.mango.vo.DataPointVO; import com.serotonin.timer.CronTimerTrigger; import com.serotonin.timer.TimerTask; +import org.scada_lts.mango.service.EventService; public class DataPurge { private final Log log = LogFactory.getLog(DataPurge.class); @@ -132,7 +132,7 @@ private void eventPurge() { cutoff = DateUtils.minus(cutoff, SystemSettingsDAO.getIntValue(SystemSettingsDAO.EVENT_PURGE_PERIOD_TYPE), SystemSettingsDAO.getIntValue(SystemSettingsDAO.EVENT_PURGE_PERIODS)); - int deleteCount = new EventDao().purgeEventsBefore(cutoff.getMillis()); + int deleteCount = new EventService().purgeEventsBefore(cutoff.getMillis()); if (deleteCount > 0) log.info("Event purge ended, " + deleteCount + " events deleted"); } diff --git a/src/com/serotonin/mango/util/LoggingUtils.java b/src/com/serotonin/mango/util/LoggingUtils.java index f7b69726e6..4cafc496f9 100644 --- a/src/com/serotonin/mango/util/LoggingUtils.java +++ b/src/com/serotonin/mango/util/LoggingUtils.java @@ -6,11 +6,13 @@ import com.serotonin.mango.rt.dataImage.SetPointSource; import com.serotonin.mango.rt.dataSource.DataSourceRT; import com.serotonin.mango.rt.event.EventInstance; +import com.serotonin.mango.rt.event.type.SystemEventType; import com.serotonin.mango.view.component.ScriptComponent; import com.serotonin.mango.vo.DataPointVO; import com.serotonin.mango.vo.User; import com.serotonin.mango.vo.dataSource.DataSourceVO; import com.serotonin.mango.vo.event.EventHandlerVO; +import com.serotonin.mango.vo.event.EventTypeVO; import com.serotonin.mango.vo.event.PointEventDetectorVO; import com.serotonin.mango.vo.link.PointLinkVO; import com.serotonin.mango.vo.mailingList.MailingList; @@ -164,4 +166,27 @@ public static String mailingListInfo(MailingList mailingList) { String info = "mailingList: {0} (id: {1}, xid: {2})"; return MessageFormat.format(info, mailingList.getName(), mailingList.getId(), mailingList.getXid()); } + + public static String eventTypeInfo(EventTypeVO event) { + if(event == null) + return ""; + String info = "event type: {0} (typeId: {1}, typeRef1: {2}, typeRef2: {3}, alarmLevel: {4}, eventDetectorKey: {4})"; + return MessageFormat.format(info, event.getDescription(), event.getTypeId(), event.getTypeRef1(), event.getTypeRef2(), event.getAlarmLevel(), event.getEventDetectorKey()); + } + + public static String systemEventTypInfo(SystemEventType event) { + if(event == null) + return ""; + String info = "system event type (systemEventTypeId: {0}, dataSourceId: {1}, dataPointId: {2}, eventSourceId: {3}, " + + "duplicateHandling: {4}, referenceId1: {5}, referenceId2: {6}, compoundEventDetectorId: {7}, scheduleId: {8}, " + + "publisherId: {9}, systemMessage: {10})"; + return MessageFormat.format(info, event.getSystemEventTypeId(), event.getDataSourceId(), event.getDataPointId(), + event.getEventSourceId(), event.getDuplicateHandling(), event.getReferenceId1(), event.getReferenceId2(), + event.getCompoundEventDetectorId(), event.getScheduleId(), event.getPublisherId(), event.isSystemMessage()); + } + + public static String eventTypeInfo(int type, int alarmLevel) { + String info = "event type: {0} (alarmLevel: {1})"; + return MessageFormat.format(info, type, alarmLevel); + } } diff --git a/src/com/serotonin/mango/vo/event/EventHandlerVO.java b/src/com/serotonin/mango/vo/event/EventHandlerVO.java index 57275b53e0..d4b29ba603 100644 --- a/src/com/serotonin/mango/vo/event/EventHandlerVO.java +++ b/src/com/serotonin/mango/vo/event/EventHandlerVO.java @@ -38,7 +38,6 @@ import com.serotonin.mango.Common; import com.serotonin.mango.DataTypes; import com.serotonin.mango.db.dao.DataPointDao; -import com.serotonin.mango.db.dao.EventDao; import com.serotonin.mango.db.dao.MailingListDao; import com.serotonin.mango.db.dao.UserDao; import com.serotonin.mango.rt.event.handlers.EmailHandlerRT; @@ -58,6 +57,7 @@ import com.serotonin.util.StringUtils; import com.serotonin.web.dwr.DwrResponseI18n; import com.serotonin.web.i18n.LocalizableMessage; +import org.scada_lts.mango.service.EventService; import org.scada_lts.mango.service.ScriptService; @JsonRemoteEntity @@ -819,7 +819,7 @@ private void readObject(ObjectInputStream in) throws IOException, public void jsonSerialize(Map map) { DataPointDao dataPointDao = new DataPointDao(); - map.put("eventType", new EventDao().getEventHandlerType(id)); + map.put("eventType", new EventService().getEventHandlerType(id)); map.put("xid", xid); map.put("handlerType", TYPE_CODES.getCode(handlerType)); diff --git a/src/com/serotonin/mango/web/dwr/BaseDwr.java b/src/com/serotonin/mango/web/dwr/BaseDwr.java index 89c3b9f56e..4d8e003388 100644 --- a/src/com/serotonin/mango/web/dwr/BaseDwr.java +++ b/src/com/serotonin/mango/web/dwr/BaseDwr.java @@ -36,7 +36,6 @@ import com.serotonin.ShouldNeverHappenException; import com.serotonin.mango.Common; import com.serotonin.mango.db.dao.DataPointDao; -import com.serotonin.mango.db.dao.EventDao; import com.serotonin.mango.db.dao.UserDao; import com.serotonin.mango.rt.dataImage.DataPointRT; import com.serotonin.mango.rt.dataImage.PointValueTime; @@ -60,16 +59,18 @@ import com.serotonin.web.i18n.I18NUtils; import com.serotonin.web.i18n.LocalizableMessage; import org.scada_lts.dao.pointvalues.PointValueAdnnotationsDAO; +import org.scada_lts.mango.adapter.MangoEvent; +import org.scada_lts.mango.service.EventService; abstract public class BaseDwr { public static final String MODEL_ATTR_EVENTS = "events"; public static final String MODEL_ATTR_HAS_UNACKED_EVENT = "hasUnacknowledgedEvent"; public static final String MODEL_ATTR_RESOURCE_BUNDLE = "bundle"; - protected static EventDao EVENT_DAO; + protected static MangoEvent EVENT_SERVICE; public static void initialize() { - EVENT_DAO = new EventDao(); + EVENT_SERVICE = new EventService(); } protected ResourceBundle changeSnippetMap = ResourceBundle.getBundle("changeSnippetMap"); @@ -81,8 +82,8 @@ public static void initialize() { * @param componentId * a unique id for the browser side component. Required for set point snippets. * @param state + * @param pointVO * @param point - * @param status * @param model * @return */ @@ -110,7 +111,7 @@ protected void setEvents(DataPointVO pointVO, User user, Map mod int userId = 0; if (user != null) userId = user.getId(); - List events = EVENT_DAO.getPendingEventsForDataPoint(pointVO.getId(), userId); + List events = EVENT_SERVICE.getPendingEventsForDataPoint(pointVO.getId(), userId); if (events != null) { model.put(MODEL_ATTR_EVENTS, events); for (EventInstance event : events) { @@ -223,7 +224,8 @@ public void forcePointRead(int pointId) { /** * Logs a user comment after validation. * - * @param eventId + * @param typeId + * @param referenceId * @param comment * @return */ @@ -239,7 +241,7 @@ public UserComment addUserComment(int typeId, int referenceId, String comment) { c.setUsername(user.getUsername()); if (typeId == UserComment.TYPE_EVENT) - EVENT_DAO.insertEventComment(referenceId, c); + EVENT_SERVICE.insertEventComment(referenceId, c); else if (typeId == UserComment.TYPE_POINT) new UserDao().insertUserComment(UserComment.TYPE_POINT, referenceId, c); else diff --git a/src/com/serotonin/mango/web/dwr/DataSourceEditDwr.java b/src/com/serotonin/mango/web/dwr/DataSourceEditDwr.java index 8de65f71e7..8b72471c70 100644 --- a/src/com/serotonin/mango/web/dwr/DataSourceEditDwr.java +++ b/src/com/serotonin/mango/web/dwr/DataSourceEditDwr.java @@ -386,7 +386,7 @@ public DwrResponseI18n togglePoint(int dataPointId) { public List getAlarms() { DataSourceVO> ds = Common.getUser().getEditDataSource(); List events = new EventService() - .getPendingSimpleEventsForDataSource(ds.getId(), Common.getUser() + .getPendingEventsForDataSource(ds.getId(), Common.getUser() .getId()); Collections.sort(events, new Comparator() { @Override diff --git a/src/com/serotonin/mango/web/dwr/EmportDwr.java b/src/com/serotonin/mango/web/dwr/EmportDwr.java index 44b6edad76..635a882653 100644 --- a/src/com/serotonin/mango/web/dwr/EmportDwr.java +++ b/src/com/serotonin/mango/web/dwr/EmportDwr.java @@ -39,7 +39,6 @@ import com.serotonin.mango.db.dao.CompoundEventDetectorDao; import com.serotonin.mango.db.dao.DataPointDao; import com.serotonin.mango.db.dao.DataSourceDao; -import com.serotonin.mango.db.dao.EventDao; import com.serotonin.mango.db.dao.MailingListDao; import com.serotonin.mango.db.dao.MaintenanceEventDao; import com.serotonin.mango.db.dao.PointLinkDao; @@ -60,10 +59,7 @@ import com.serotonin.mango.vo.permission.Permissions; import com.serotonin.mango.web.dwr.beans.ImportTask; import com.serotonin.web.dwr.DwrResponseI18n; -import org.scada_lts.mango.service.ReportService; -import org.scada_lts.mango.service.ScriptService; -import org.scada_lts.mango.service.UsersProfileService; -import org.scada_lts.mango.service.ViewService; +import org.scada_lts.mango.service.*; /** * @author Matthew Lohbihler @@ -161,7 +157,7 @@ public static String createExportJSON(int prettyIndent, data.put(POINT_HIERARCHY, new DataPointDao().getPointHierarchy() .getRoot().getSubfolders()); if (eventHandlers) - data.put(EVENT_HANDLERS, new EventDao().getEventHandlers()); + data.put(EVENT_HANDLERS, new EventService().getEventHandlers()); if (watchLists) { WatchListDao watchListDao = new WatchListDao(); List wls = watchListDao.getWatchLists(); diff --git a/src/com/serotonin/mango/web/dwr/EventsDwr.java b/src/com/serotonin/mango/web/dwr/EventsDwr.java index 4548be57d4..f3fb0269e1 100644 --- a/src/com/serotonin/mango/web/dwr/EventsDwr.java +++ b/src/com/serotonin/mango/web/dwr/EventsDwr.java @@ -30,7 +30,6 @@ import org.joda.time.DateTime; import com.serotonin.mango.Common; -import com.serotonin.mango.db.dao.EventDao; import com.serotonin.mango.rt.event.EventInstance; import com.serotonin.mango.util.DateUtils; import com.serotonin.mango.vo.User; @@ -39,6 +38,8 @@ import com.serotonin.util.StringUtils; import com.serotonin.web.dwr.DwrResponseI18n; import com.serotonin.web.i18n.LocalizableMessage; +import org.scada_lts.mango.adapter.MangoEvent; +import org.scada_lts.mango.service.EventService; public class EventsDwr extends BaseDwr { private static final int PAGE_SIZE = 50; @@ -78,7 +79,8 @@ public DwrResponseI18n searchOld(int eventId, int eventSourceType, keywords.toArray(keywordArr); } - List results = new EventDao().searchOld(eventId, + MangoEvent eventService = new EventService(); + List results = eventService.searchOld(eventId, eventSourceType, status, alarmLevel, keywordArr, maxResults, user.getId(), getResourceBundle()); @@ -132,22 +134,22 @@ public DwrResponseI18n search(int eventId, int eventSourceType, fromHour, fromMinute, fromSecond, toNone, toYear, toMonth, toDay, toHour, toMinute, toSecond); - EventDao eventDao = new EventDao(); - List results = eventDao.search(eventId, eventSourceType, + MangoEvent eventService = new EventService(); + List results = eventService.search(eventId, eventSourceType, status, alarmLevel, getKeywords(keywordStr), dateRange.getL1(), dateRange.getL2(), user.getId(), getResourceBundle(), from, to, date); Map model = new HashMap(); - int searchRowCount = eventDao.getSearchRowCount(); + int searchRowCount = eventService.getSearchRowCount(); int pages = (int) Math.ceil(((double) searchRowCount) / PAGE_SIZE); if (date != null) { - int startRow = eventDao.getStartRow(); + int startRow = eventService.getStartRow(); if (startRow == -1) page = pages - 1; else - page = eventDao.getStartRow() / PAGE_SIZE; + page = eventService.getStartRow() / PAGE_SIZE; } if (pages > 1) { diff --git a/src/com/serotonin/mango/web/dwr/MiscDwr.java b/src/com/serotonin/mango/web/dwr/MiscDwr.java index cea1b79417..705a3cd1f3 100644 --- a/src/com/serotonin/mango/web/dwr/MiscDwr.java +++ b/src/com/serotonin/mango/web/dwr/MiscDwr.java @@ -48,7 +48,6 @@ import com.serotonin.io.StreamUtils; import com.serotonin.mango.Common; -import com.serotonin.mango.db.dao.EventDao; import com.serotonin.mango.db.dao.MailingListDao; import com.serotonin.mango.db.dao.UserDao; import com.serotonin.mango.rt.event.EventInstance; @@ -103,10 +102,10 @@ public DwrResponseI18n toggleSilence(int eventId) { public DwrResponseI18n silenceAll() { List silenced = new ArrayList(); User user = Common.getUser(); - MangoEvent eventDao = new EventService(); - for (EventInstance evt : eventDao.getPendingEvents(user.getId())) { + MangoEvent eventService = new EventService(); + for (EventInstance evt : eventService.getPendingEvents(user.getId())) { if (!evt.isSilenced()) { - eventDao.toggleSilence(evt.getId(), user.getId()); + eventService.toggleSilence(evt.getId(), user.getId()); silenced.add(evt.getId()); } } @@ -120,8 +119,9 @@ public DwrResponseI18n silenceAll() { public int acknowledgeEvent(int eventId) { User user = Common.getUser(); + MangoEvent eventService = new EventService(); if (user != null) { - new EventDao().ackEvent(eventId, System.currentTimeMillis(), + eventService.ackEvent(eventId, System.currentTimeMillis(), user.getId(), 0); resetLastAlarmLevelChange(); } @@ -131,10 +131,10 @@ public int acknowledgeEvent(int eventId) { public void acknowledgeAllPendingEvents() { User user = Common.getUser(); if (user != null) { - MangoEvent eventDao = new EventService(); + MangoEvent eventService = new EventService(); long now = System.currentTimeMillis(); - for (EventInstance evt : eventDao.getPendingEvents(user.getId())) - eventDao.ackEvent(evt.getId(), now, user.getId(), 0); + for (EventInstance evt : eventService.getPendingEvents(user.getId())) + eventService.ackEvent(evt.getId(), now, user.getId(), 0); resetLastAlarmLevelChange(); } } @@ -298,7 +298,7 @@ public Map doLongPoll(int pollSessionId) { HttpServletRequest httpRequest = WebContextFactory.get() .getHttpServletRequest(); User user = Common.getUser(httpRequest); - MangoEvent eventDao = new EventService(); + MangoEvent eventService = new EventService(); LongPollData data = getLongPollData(pollSessionId, false); data.updateTimestamp(); @@ -425,7 +425,7 @@ public Map doLongPoll(int pollSessionId) { if (pollRequest.isPendingAlarms() && user != null) { // Create the list of most current pending alarm content. Map model = new HashMap(); - model.put("events", eventDao.getPendingEvents(user.getId())); + model.put("events", eventService.getPendingEvents(user.getId())); model.put("pendingEvents", true); model.put("noContentWhenEmpty", true); String currentContent = generateContent(httpRequest, diff --git a/src/com/serotonin/mango/web/dwr/SystemSettingsDwr.java b/src/com/serotonin/mango/web/dwr/SystemSettingsDwr.java index 14610c6e38..1e1c4ede29 100644 --- a/src/com/serotonin/mango/web/dwr/SystemSettingsDwr.java +++ b/src/com/serotonin/mango/web/dwr/SystemSettingsDwr.java @@ -22,7 +22,6 @@ import com.serotonin.InvalidArgumentException; import com.serotonin.mango.Common; import com.serotonin.mango.db.dao.DataPointDao; -import com.serotonin.mango.db.dao.EventDao; import com.serotonin.mango.web.email.IMsgSubjectContent; import com.serotonin.mango.web.mvc.controller.ScadaLocaleUtils; import org.scada_lts.dao.SystemSettingsDAO; @@ -39,6 +38,8 @@ import com.serotonin.web.dwr.DwrResponseI18n; import com.serotonin.web.i18n.I18NUtils; import com.serotonin.web.i18n.LocalizableMessage; +import org.scada_lts.mango.adapter.MangoEvent; +import org.scada_lts.mango.service.EventService; import org.scada_lts.mango.service.SystemSettingsService; import org.scada_lts.utils.ColorUtils; import org.scada_lts.web.mvc.api.json.JsonSettingsHttp; @@ -153,13 +154,16 @@ public Map getSettings() { settings.put(SystemSettingsDAO.DATAPOINT_RUNTIME_VALUE_SYNCHRONIZED, systemSettingsService.getDataPointRtValueSynchronized().getName()); - settings.put(SystemSettingsDAO.HTTP_RESPONSE_HEADERS, SystemSettingsDAO - .getValue(SystemSettingsDAO.HTTP_RESPONSE_HEADERS)); + settings.put(SystemSettingsDAO.HTTP_RESPONSE_HEADERS, systemSettingsService.getHttpResponseHeaders()); settings.put(SystemSettingsDAO.VIEW_HIDE_SHORTCUT_DISABLE_FULL_SCREEN, - SystemSettingsDAO.getBooleanValue(SystemSettingsDAO.VIEW_HIDE_SHORTCUT_DISABLE_FULL_SCREEN, false)); + systemSettingsService.getMiscSettings().isHideShortcutDisableFullScreen()); settings.put(SystemSettingsDAO.VIEW_FORCE_FULL_SCREEN_MODE, - SystemSettingsDAO.getBooleanValue(SystemSettingsDAO.VIEW_FORCE_FULL_SCREEN_MODE, false)); + systemSettingsService.getMiscSettings().isEnableFullScreen()); + settings.put(SystemSettingsDAO.EVENT_PENDING_LIMIT, + systemSettingsService.getMiscSettings().getEventPendingLimit()); + settings.put(SystemSettingsDAO.EVENT_PENDING_CACHE_ENABLED, + systemSettingsService.getMiscSettings().isEventPendingCacheEnabled()); return settings; } @@ -209,7 +213,8 @@ public Map getDatabaseSize() { data.put("historyCount", sum); data.put("topPoints", counts); - data.put("eventCount", new EventDao().getEventCount()); + MangoEvent eventService = new EventService(); + data.put("eventCount", eventService.getEventCount()); return data; } @@ -307,7 +312,8 @@ public DwrResponseI18n saveHttpSettings(boolean useProxy, String host, int port, public DwrResponseI18n saveMiscSettings(int uiPerformance, String dataPointRtValueSynchronized, - boolean viewEnableFullScreen, boolean viewHideShortcutDisableFullScreen) { + boolean viewEnableFullScreen, boolean viewHideShortcutDisableFullScreen, + int eventPendingLimit, boolean eventPendingCacheEnabled) { Permissions.ensureAdmin(); SystemSettingsDAO systemSettingsDAO = new SystemSettingsDAO(); DwrResponseI18n response = new DwrResponseI18n(); @@ -322,6 +328,12 @@ public DwrResponseI18n saveMiscSettings(int uiPerformance, String dataPointRtVal systemSettingsDAO.setBooleanValue(SystemSettingsDAO.VIEW_FORCE_FULL_SCREEN_MODE, viewEnableFullScreen); systemSettingsDAO.setBooleanValue(SystemSettingsDAO.VIEW_HIDE_SHORTCUT_DISABLE_FULL_SCREEN, viewHideShortcutDisableFullScreen); + if(eventPendingLimit < 0) { + response.addContextualMessage(SystemSettingsDAO.EVENT_PENDING_LIMIT, "validate.invalidValue"); + } else { + systemSettingsDAO.setIntValue(SystemSettingsDAO.EVENT_PENDING_LIMIT, eventPendingLimit); + } + systemSettingsDAO.setBooleanValue(SystemSettingsDAO.EVENT_PENDING_CACHE_ENABLED, eventPendingCacheEnabled); return response; } diff --git a/src/com/serotonin/mango/web/mvc/controller/DataPointDetailsController.java b/src/com/serotonin/mango/web/mvc/controller/DataPointDetailsController.java index efdfebf4c1..21f45fbf8e 100644 --- a/src/com/serotonin/mango/web/mvc/controller/DataPointDetailsController.java +++ b/src/com/serotonin/mango/web/mvc/controller/DataPointDetailsController.java @@ -26,6 +26,8 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import org.scada_lts.mango.adapter.MangoEvent; +import org.scada_lts.mango.service.EventService; import org.scada_lts.mango.service.ViewService; import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.mvc.ParameterizableViewController; @@ -33,7 +35,6 @@ import com.serotonin.ShouldNeverHappenException; import com.serotonin.mango.Common; import com.serotonin.mango.db.dao.DataPointDao; -import com.serotonin.mango.db.dao.EventDao; import com.serotonin.mango.db.dao.UserDao; import com.serotonin.mango.view.View; import com.serotonin.mango.view.chart.ImageChartRenderer; @@ -116,9 +117,10 @@ protected ModelAndView handleRequestInternal(HttpServletRequest request, // Determine whether the link to edit the point should be displayed model.put("pointEditor", user.isAdmin()); + MangoEvent eventService = new EventService(); // Put the events in the model. model.put("events", - new EventDao().getEventsForDataPoint(id, user.getId())); + eventService.getEventsForDataPoint(id, user.getId())); // Put the default history table count into the model. Default to // 10. diff --git a/src/com/serotonin/mango/web/mvc/controller/EventsController.java b/src/com/serotonin/mango/web/mvc/controller/EventsController.java index a102248cec..7ec16a0fca 100644 --- a/src/com/serotonin/mango/web/mvc/controller/EventsController.java +++ b/src/com/serotonin/mango/web/mvc/controller/EventsController.java @@ -24,21 +24,24 @@ import javax.servlet.http.HttpServletRequest; +import org.scada_lts.mango.adapter.MangoEvent; +import org.scada_lts.mango.service.EventService; import org.springframework.validation.BindException; import com.serotonin.mango.Common; -import com.serotonin.mango.db.dao.EventDao; import com.serotonin.mango.rt.event.EventInstance; import com.serotonin.mango.web.comparators.EventInstanceComparator; import com.serotonin.web.util.PaginatedData; import com.serotonin.web.util.PagingDataForm; +@Deprecated public class EventsController { @SuppressWarnings("unchecked") protected PaginatedData getData(HttpServletRequest request, PagingDataForm paging, BindException errors) throws Exception { ResourceBundle bundle = Common.getBundle(request); - List data = new EventDao().getPendingEvents(Common.getUser(request).getId()); + MangoEvent eventService = new EventService(); + List data = eventService.getPendingEvents(Common.getUser(request).getId()); sortData(bundle, data, paging); return new PaginatedData(data, data.size()); } diff --git a/src/com/serotonin/mango/web/mvc/controller/PublisherEditController.java b/src/com/serotonin/mango/web/mvc/controller/PublisherEditController.java index c559f34ee2..db2aa86611 100644 --- a/src/com/serotonin/mango/web/mvc/controller/PublisherEditController.java +++ b/src/com/serotonin/mango/web/mvc/controller/PublisherEditController.java @@ -27,12 +27,13 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import org.scada_lts.mango.adapter.MangoEvent; +import org.scada_lts.mango.service.EventService; import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.mvc.ParameterizableViewController; import com.serotonin.ShouldNeverHappenException; import com.serotonin.mango.Common; -import com.serotonin.mango.db.dao.EventDao; import com.serotonin.mango.db.dao.PublisherDao; import com.serotonin.mango.rt.event.EventInstance; import com.serotonin.mango.vo.User; @@ -80,7 +81,8 @@ protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpSer Map model = new HashMap(); model.put("publisher", publisherVO); if (publisherVO.getId() != Common.NEW_ID) { - List events = new EventDao().getPendingEventsForPublisher(publisherVO.getId(), user.getId()); + MangoEvent eventService = new EventService(); + List events = eventService.getPendingEventsForPublisher(publisherVO.getId(), user.getId()); List beans = new ArrayList(); if (events != null) { ResourceBundle bundle = Common.getBundle(request); diff --git a/src/com/serotonin/mango/web/servlet/EventExportServlet.java b/src/com/serotonin/mango/web/servlet/EventExportServlet.java index 0f9117a931..67dc4905ad 100644 --- a/src/com/serotonin/mango/web/servlet/EventExportServlet.java +++ b/src/com/serotonin/mango/web/servlet/EventExportServlet.java @@ -9,11 +9,12 @@ import javax.servlet.http.HttpServletResponse; import com.serotonin.mango.Common; -import com.serotonin.mango.db.dao.EventDao; import com.serotonin.mango.rt.event.EventInstance; import com.serotonin.mango.vo.User; import com.serotonin.mango.vo.report.EventCsvStreamer; import com.serotonin.mango.web.dwr.beans.EventExportDefinition; +import org.scada_lts.mango.adapter.MangoEvent; +import org.scada_lts.mango.service.EventService; public class EventExportServlet extends HttpServlet { private static final long serialVersionUID = 1L; @@ -29,7 +30,8 @@ protected void doGet(HttpServletRequest request, HttpServletResponse response) t return; final ResourceBundle bundle = Common.getBundle(request); - List events = new EventDao().search(def.getEventId(), def.getEventSourceType(), def.getStatus(), + MangoEvent eventService = new EventService(); + List events = eventService.search(def.getEventId(), def.getEventSourceType(), def.getStatus(), def.getAlarmLevel(), def.getKeywords(), def.getDateFrom(), def.getDateTo(), user.getId(), bundle, 0, Integer.MAX_VALUE, null); diff --git a/src/org/scada_lts/cache/PendingEventsCache.java b/src/org/scada_lts/cache/PendingEventsCache.java index a56dbfe9c5..8582c53e19 100644 --- a/src/org/scada_lts/cache/PendingEventsCache.java +++ b/src/org/scada_lts/cache/PendingEventsCache.java @@ -25,13 +25,11 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.quartz.JobDetail; -import org.quartz.Scheduler; -import org.quartz.SchedulerException; -import org.quartz.SimpleTrigger; +import org.quartz.*; import org.quartz.impl.StdSchedulerFactory; import org.scada_lts.config.ScadaConfig; import org.scada_lts.mango.service.PendingEventService; +import org.scada_lts.mango.service.SystemSettingsService; import org.scada_lts.quartz.UpdatePendingEvents; import com.serotonin.mango.rt.event.EventInstance; @@ -49,6 +47,10 @@ public class PendingEventsCache { private int countBuffer; private Map> mapPendingEvents; private final PendingEventService eventService; + private final Scheduler scheduler; + private final SystemSettingsService systemSettingsService; + private final JobDetail job; + private final SimpleTrigger trigger; public static PendingEventsCache getInstance() throws SchedulerException, IOException { if (LOG.isTraceEnabled()) { @@ -113,6 +115,10 @@ private PendingEventsCache() throws SchedulerException, IOException { } eventService = new PendingEventService(); mapPendingEvents = eventService.getPendingEvents(); + scheduler = new StdSchedulerFactory().getScheduler(); + systemSettingsService = new SystemSettingsService(); + trigger = createTrigger(); + job = createJob(); cacheInitialize(); } @@ -120,10 +126,44 @@ private void cacheInitialize() throws SchedulerException, IOException { if (LOG.isTraceEnabled()) { LOG.trace("cacheInitialize"); } + scheduler.start(); + startUpdate(); + } + + public void startUpdate() { + try { + if(!isScheduled(scheduler, job.getName())) + scheduler.scheduleJob(job, trigger); + } catch (SchedulerException e) { + LOG.error(e.getMessage(), e); + } + } + + public void stopUpdate() { + try { + if(isScheduled(scheduler, job.getName())) + scheduler.deleteJob(job.getName(), job.getGroup()); + } catch (SchedulerException e) { + LOG.error(e.getMessage(), e); + } + } + + public void resetUpdate() { + boolean cacheEnable = systemSettingsService.getMiscSettings().isEventPendingCacheEnabled(); + if(cacheEnable) + startUpdate(); + else + stopUpdate(); + } + + private static JobDetail createJob() { JobDetail job = new JobDetail(); job.setName("UpdatePendingEvents"); job.setJobClass(UpdatePendingEvents.class); + return job; + } + private static SimpleTrigger createTrigger() throws IOException { SimpleTrigger trigger = new SimpleTrigger(); Date startTime = new Date(System.currentTimeMillis() + ScadaConfig.getInstance().getLong(ScadaConfig.START_UPDATE_PENDING_EVENTS, 10_000_000)); @@ -138,10 +178,15 @@ private void cacheInitialize() throws SchedulerException, IOException { } trigger.setRepeatInterval(interval); trigger.setName("Quartz - trigger-UpdatePendingEvents"); - - Scheduler scheduler = new StdSchedulerFactory().getScheduler(); - scheduler.start(); - scheduler.scheduleJob(job, trigger); + return trigger; } + private static boolean isScheduled(Scheduler scheduler, String jobName) throws SchedulerException { + for (String groupName : scheduler.getJobGroupNames()) { + Trigger[] triggers = scheduler.getTriggersOfJob(jobName, groupName); + if(triggers.length > 0) + return true; + } + return false; + } } diff --git a/src/org/scada_lts/dao/IPointEventDetectorDAO.java b/src/org/scada_lts/dao/IPointEventDetectorDAO.java index 925ecfb1bb..f0425dccb9 100644 --- a/src/org/scada_lts/dao/IPointEventDetectorDAO.java +++ b/src/org/scada_lts/dao/IPointEventDetectorDAO.java @@ -14,6 +14,6 @@ public interface IPointEventDetectorDAO { void delete(int dataPointId, PointEventDetectorVO pointEventDetector); void deleteWithId(String dataPointIds); PointEventDetectorVO getPointEventDetector(int pointEventDetectorId); - PointEventDetectorVO getPointEventDetector(String pointEventDetectorXid); + PointEventDetectorVO getPointEventDetector(String pointEventDetectorXid, int dataPointId); int getDataPointId(int pointEventDetectorId); } diff --git a/src/org/scada_lts/dao/PendingEventsDAO.java b/src/org/scada_lts/dao/PendingEventsDAO.java index 60ae2bc773..a23dfe6fab 100644 --- a/src/org/scada_lts/dao/PendingEventsDAO.java +++ b/src/org/scada_lts/dao/PendingEventsDAO.java @@ -87,18 +87,22 @@ public class PendingEventsDAO { + "ue.userId=? and " + "(e.ackTs is null or e.ackTs = 0) " + "order by e.activeTs desc " - + "LIMIT 100"; + + "LIMIT ? "; // @formatter:on - public List getPendingEvents(int userId, final Map> comments ) { + public List getPendingEvents(int userId, final Map> comments) { + return getPendingEvents(userId, comments, 100); + } + + public List getPendingEvents(int userId, final Map> comments, int limit) { if (LOG.isTraceEnabled()) { LOG.trace("SQL PendingEvents userId:"+userId); } try { @SuppressWarnings({ "unchecked", "rawtypes" }) - List listEvents = DAO.getInstance().getJdbcTemp().query(SQL_EVENTS,new Integer[]{userId}, + List listEvents = DAO.getInstance().getJdbcTemp().query(SQL_EVENTS,new Integer[]{userId, limit}, (rs, rownumber) -> mapToEvent(comments, rs)); return listEvents; diff --git a/src/org/scada_lts/dao/PointEventDetectorDAO.java b/src/org/scada_lts/dao/PointEventDetectorDAO.java index 5e537daae9..69cdf41ffd 100644 --- a/src/org/scada_lts/dao/PointEventDetectorDAO.java +++ b/src/org/scada_lts/dao/PointEventDetectorDAO.java @@ -424,22 +424,22 @@ public PointEventDetectorVO getPointEventDetector(int pointEventDetectorId) { } @Override - public PointEventDetectorVO getPointEventDetector(String pointEventDetectorXid) { + public PointEventDetectorVO getPointEventDetector(String pointEventDetectorXid, int dataPointId) { if (LOG.isTraceEnabled()) { - LOG.trace("getPointEventDetector(String pointEventDetectorXid) pointEventDetectorXid:" +pointEventDetectorXid); + LOG.trace("getPointEventDetector(String pointEventDetectorXid, int dataPointId) pointEventDetectorXid:" +pointEventDetectorXid + ", dataPointId:" + dataPointId); } - String templateSelectWhereIdOrderBy = POINT_EVENT_DETECTOR_SELECT + "where " + COLUMN_NAME_XID + "=? " - + "order by " + COLUMN_NAME_ID; + String templateSelectWhereIdOrderBy = POINT_EVENT_DETECTOR_SELECT + "where " + COLUMN_NAME_XID + "=? and " + COLUMN_NAME_DATA_POINT_ID + "=?" + + " order by " + COLUMN_NAME_ID; try { return DAO.getInstance().getJdbcTemp().queryForObject(templateSelectWhereIdOrderBy, - new Object[]{pointEventDetectorXid}, new PointEventDetectorRowMapper(null)); + new Object[]{pointEventDetectorXid, dataPointId}, new PointEventDetectorRowMapper(null)); } catch (EmptyResultDataAccessException ex) { return null; } catch (IncorrectResultSizeDataAccessException ex) { - LOG.warn("There is more than one detector with xid:" + pointEventDetectorXid + ", msg: " +ex.getMessage(), ex); + LOG.warn("There is more than one detector with xid:" + pointEventDetectorXid + ", dataPointId:" + dataPointId + ", msg: " +ex.getMessage(), ex); return new PointEventDetectorVO(Common.NEW_ID, null); } catch (Exception ex) { LOG.warn(ex.getMessage(), ex); diff --git a/src/org/scada_lts/dao/SystemSettingsDAO.java b/src/org/scada_lts/dao/SystemSettingsDAO.java index 80f3f8f429..a39f7e6046 100644 --- a/src/org/scada_lts/dao/SystemSettingsDAO.java +++ b/src/org/scada_lts/dao/SystemSettingsDAO.java @@ -142,6 +142,7 @@ public class SystemSettingsDAO { private static final String DELETE_POINT_VALUES = "delete from pointValues"; private static final String DELETE_MAINTENANCE_EVENTS = "delete from maintenanceEvents"; private static final String DELETE_MAILING_LISTS = "delete from mailingLists"; + @Deprecated(since = "2.7.5.4") private static final String DELETE_USERS = "delete from users"; private static final String DELETE_PUBLISHERS = "delete from publishers"; private static final String DELETE_DATA_POINT_USERS = "delete from dataPointUsers"; @@ -154,7 +155,9 @@ public class SystemSettingsDAO { public static final String VIEW_HIDE_SHORTCUT_DISABLE_FULL_SCREEN = "hideShortcutDisableFullScreen"; public static final String VIEW_FORCE_FULL_SCREEN_MODE = "viewForceFullScreenMode"; + public static final String EVENT_PENDING_LIMIT = "eventPendingLimit"; + public static final String EVENT_PENDING_CACHE_ENABLED = "eventPendingCacheEnabled"; // @formatter:off private static final String SELECT_SETTING_VALUE_WHERE = "" + "select " @@ -388,6 +391,8 @@ public String getDatabaseSchemaVersion(String key, String defaultValue) { DEFAULT_VALUES.put(EMAIL_TIMEOUT, String.valueOf(SystemSettingsUtils.getEmailTimeout())); DEFAULT_VALUES.put(VIEW_FORCE_FULL_SCREEN_MODE, SystemSettingsUtils.isForceFullScreenMode()); DEFAULT_VALUES.put(VIEW_HIDE_SHORTCUT_DISABLE_FULL_SCREEN, SystemSettingsUtils.isHideShortcutDisableFullScreen()); + DEFAULT_VALUES.put(EVENT_PENDING_LIMIT, SystemSettingsUtils.getEventPendingLimit()); + DEFAULT_VALUES.put(EVENT_PENDING_CACHE_ENABLED, SystemSettingsUtils.isEventPendingCacheEnabled()); } @Transactional(readOnly = false, propagation = Propagation.REQUIRES_NEW, isolation = Isolation.READ_COMMITTED, rollbackFor = SQLException.class) diff --git a/src/org/scada_lts/dao/cache/PointEventDetectorCache.java b/src/org/scada_lts/dao/cache/PointEventDetectorCache.java index f65c997a80..4b02b61bcf 100644 --- a/src/org/scada_lts/dao/cache/PointEventDetectorCache.java +++ b/src/org/scada_lts/dao/cache/PointEventDetectorCache.java @@ -53,8 +53,8 @@ public PointEventDetectorVO selectPointEventDetector(int pointEventDetectorId) { } @Override - public PointEventDetectorVO selectPointEventDetector(String pointEventDetectorXid) { - return pointEventDetectorDAO.getPointEventDetector(pointEventDetectorXid); + public PointEventDetectorVO selectPointEventDetector(String pointEventDetectorXid, int dataPointId) { + return pointEventDetectorDAO.getPointEventDetector(pointEventDetectorXid, dataPointId); } @Override diff --git a/src/org/scada_lts/dao/cache/PointEventDetectorCacheable.java b/src/org/scada_lts/dao/cache/PointEventDetectorCacheable.java index d856a81eb3..fb2e364b11 100644 --- a/src/org/scada_lts/dao/cache/PointEventDetectorCacheable.java +++ b/src/org/scada_lts/dao/cache/PointEventDetectorCacheable.java @@ -10,9 +10,11 @@ public interface PointEventDetectorCacheable { + String CACHE_ENABLED_KEY = "eventdetector.cache.enabled"; + @Caching(cacheable = { @Cacheable(cacheNames = "point_event_detector_list_by_data_point_id", key = "#dataPoint.id", - unless = "#result.isEmpty()", condition = "#dataPoint != null") + condition = "#dataPoint != null") }) List selectPointEventDetectors(DataPointVO dataPoint); @@ -22,10 +24,10 @@ public interface PointEventDetectorCacheable { PointEventDetectorVO selectPointEventDetector(int pointEventDetectorId); @Caching(cacheable = { - @Cacheable(cacheNames = "point_event_detector_by_xid", key = "#p0", unless = "#result == null || #result.id == -1", + @Cacheable(cacheNames = "point_event_detector_by_xid_and_data_point_id", key = "#p0 + '-' + #p1", unless = "#result == null || #result.id == -1", condition = "#p0 != null") }) - PointEventDetectorVO selectPointEventDetector(String pointEventDetectorXid); + PointEventDetectorVO selectPointEventDetector(String pointEventDetectorXid, int dataPointId); @Caching(cacheable = { @Cacheable(cacheNames = "data_point_id_by_point_event_detector_id", key = "#p0", unless = "#result == 0") @@ -36,7 +38,7 @@ public interface PointEventDetectorCacheable { @CacheEvict(cacheNames = "point_event_detector_list_by_data_point_id", key = "#p0"), @CacheEvict(cacheNames = "point_event_detector", key = "#pointEventDetector.id", condition = "#pointEventDetector != null"), - @CacheEvict(cacheNames = "point_event_detector_by_xid", key = "#pointEventDetector.xid", + @CacheEvict(cacheNames = "point_event_detector_by_xid_and_data_point_id", key = "#pointEventDetector.xid + '-' + #p0", condition = "#pointEventDetector != null"), @CacheEvict(cacheNames = "data_point_id_by_point_event_detector_id", key = "#pointEventDetector.id", condition = "#pointEventDetector != null") @@ -47,7 +49,7 @@ public interface PointEventDetectorCacheable { @CacheEvict(cacheNames = "point_event_detector_list_by_data_point_id", key = "#p0"), @CacheEvict(cacheNames = "point_event_detector", key = "#pointEventDetector.id", condition = "#pointEventDetector != null"), - @CacheEvict(cacheNames = "point_event_detector_by_xid", key = "#pointEventDetector.xid", + @CacheEvict(cacheNames = "point_event_detector_by_xid_and_data_point_id", key = "#pointEventDetector.xid + '-' + #p0", condition = "#pointEventDetector != null"), @CacheEvict(cacheNames = "data_point_id_by_point_event_detector_id", key = "#pointEventDetector.id", condition = "#pointEventDetector != null") @@ -58,7 +60,7 @@ public interface PointEventDetectorCacheable { @CacheEvict(cacheNames = "point_event_detector_list_by_data_point_id", key = "#p0"), @CacheEvict(cacheNames = "point_event_detector", key = "#pointEventDetector.id", condition = "#pointEventDetector != null"), - @CacheEvict(cacheNames = "point_event_detector_by_xid", key = "#pointEventDetector.xid", + @CacheEvict(cacheNames = "point_event_detector_by_xid_and_data_point_id", key = "#pointEventDetector.xid + '-' + #p0", condition = "#pointEventDetector != null"), @CacheEvict(cacheNames = "data_point_id_by_point_event_detector_id", key = "#pointEventDetector.id", condition = "#pointEventDetector != null") @@ -69,7 +71,7 @@ public interface PointEventDetectorCacheable { @CacheEvict(cacheNames = "point_event_detector_list_by_data_point_id", key = "#p0"), @CacheEvict(cacheNames = "point_event_detector", key = "#pointEventDetector.id", condition = "#pointEventDetector != null"), - @CacheEvict(cacheNames = "point_event_detector_by_xid", key = "#pointEventDetector.xid", + @CacheEvict(cacheNames = "point_event_detector_by_xid_and_data_point_id", key = "#pointEventDetector.xid + '-' + #p0", condition = "#pointEventDetector != null"), @CacheEvict(cacheNames = "data_point_id_by_point_event_detector_id", key = "#pointEventDetector.id", condition = "#pointEventDetector != null") @@ -79,7 +81,7 @@ public interface PointEventDetectorCacheable { @Caching(evict = { @CacheEvict(cacheNames = "point_event_detector_list_by_data_point_id", allEntries = true), @CacheEvict(cacheNames = "point_event_detector", allEntries = true), - @CacheEvict(cacheNames = "point_event_detector_by_xid", allEntries = true), + @CacheEvict(cacheNames = "point_event_detector_by_xid_and_data_point_id", allEntries = true), @CacheEvict(cacheNames = "data_point_id_by_point_event_detector_id", allEntries = true) }) default void deleteWithId(String dataPointIds) {} diff --git a/src/org/scada_lts/dao/cache/PointEventDetectorDaoWithCache.java b/src/org/scada_lts/dao/cache/PointEventDetectorDaoWithCache.java index e05b10ee7a..80ce7acb72 100644 --- a/src/org/scada_lts/dao/cache/PointEventDetectorDaoWithCache.java +++ b/src/org/scada_lts/dao/cache/PointEventDetectorDaoWithCache.java @@ -26,7 +26,7 @@ public List getPointEventDetectors(DataPointVO dataPoint) @Override public boolean isEventDetectorXidUnique(int dataPointId, String xid, int excludeId) { - PointEventDetectorVO pointEventDetectorVO = pointEventDetectorCache.selectPointEventDetector(xid); + PointEventDetectorVO pointEventDetectorVO = pointEventDetectorCache.selectPointEventDetector(xid, dataPointId); if(pointEventDetectorVO == null) return true; if(pointEventDetectorVO.getId() == Common.NEW_ID) @@ -65,8 +65,8 @@ public PointEventDetectorVO getPointEventDetector(int pointEventDetectorId) { } @Override - public PointEventDetectorVO getPointEventDetector(String pointEventDetectorXid) { - return pointEventDetectorCache.selectPointEventDetector(pointEventDetectorXid); + public PointEventDetectorVO getPointEventDetector(String pointEventDetectorXid, int dataPointId) { + return pointEventDetectorCache.selectPointEventDetector(pointEventDetectorXid, dataPointId); } @Override diff --git a/src/org/scada_lts/dao/event/EventDAO.java b/src/org/scada_lts/dao/event/EventDAO.java index 128e7b5df0..9e84998093 100644 --- a/src/org/scada_lts/dao/event/EventDAO.java +++ b/src/org/scada_lts/dao/event/EventDAO.java @@ -294,19 +294,25 @@ public class EventDAO implements GenericDaoCR { +"e."+COLUMN_NAME_TYPE_ID+"=? and " +"e."+COLUMN_NAME_TYPE_REF_1+"=? and " +"ue."+COLUMN_NAME_USER_ID+"=? and " - +"((e."+COLUMN_NAME_ACT_TS+" is null or e."+COLUMN_NAME_ACT_TS+"=0) or (e."+COLUMN_NAME_RTN_APPLICABLE+"=? and e."+COLUMN_NAME_RTN_TS+" is null and e."+COLUMN_NAME_ALARM_LEVEL+" > 0))" - +"order by e."+COLUMN_NAME_ACT_TS+ " desc"; + +"((e."+COLUMN_NAME_ACT_TS+" is null or e."+COLUMN_NAME_ACT_TS+"=0) or (e."+COLUMN_NAME_RTN_APPLICABLE+"=? and (e."+COLUMN_NAME_RTN_TS+" is null or e."+COLUMN_NAME_RTN_TS+"=0) and e."+COLUMN_NAME_ALARM_LEVEL+" > 0))" + +"order by e."+COLUMN_NAME_ACTIVE_TS+ " desc"; private static final String EVENT_FILTER_TYPE_USER = "" +"e."+COLUMN_NAME_TYPE_ID+"=? and " +"ue."+COLUMN_NAME_USER_ID+"=? and " - +"((e."+COLUMN_NAME_ACT_TS+" is null or e."+COLUMN_NAME_ACT_TS+"=0) or (e."+COLUMN_NAME_RTN_APPLICABLE+"=? and e."+COLUMN_NAME_RTN_TS+" is null and e."+COLUMN_NAME_ALARM_LEVEL+" > 0))" - +"order by e."+COLUMN_NAME_ACT_TS+ " desc"; + +"((e."+COLUMN_NAME_ACT_TS+" is null or e."+COLUMN_NAME_ACT_TS+"=0) or (e."+COLUMN_NAME_RTN_APPLICABLE+"=? and (e."+COLUMN_NAME_RTN_TS+" is null or e."+COLUMN_NAME_RTN_TS+"=0) and e."+COLUMN_NAME_ALARM_LEVEL+" > 0))" + +"order by e."+COLUMN_NAME_ACTIVE_TS+ " desc"; private static final String EVENT_FILTER_USER = "" +"ue."+COLUMN_NAME_USER_ID+"=? and " +"(e."+COLUMN_NAME_ACT_TS+" is null or e."+COLUMN_NAME_ACT_TS+"=0) " - +"order by e."+COLUMN_NAME_ACT_TS+ " desc"; + +"order by e."+COLUMN_NAME_ACTIVE_TS+ " desc"; + + private static final String EVENT_FILTER_USER_ALARM_LEVEL_MIN = "" + +"ue."+COLUMN_NAME_USER_ID+"=? and " + +"(e."+COLUMN_NAME_ACT_TS+" is null or e."+COLUMN_NAME_ACT_TS+"=0) and " + +"e."+COLUMN_NAME_ALARM_LEVEL+">=? " + +"order by e."+COLUMN_NAME_ACTIVE_TS+ " desc"; private static final String EVENT_COMMENT_SELECT = "" +"select " @@ -994,15 +1000,17 @@ public void ackAllPendingSelected(long actTS, long userId, int alternateAckSourc DAO.getInstance().getJdbcTemp().update( EVENT_ACT_IDS, new Object[] { actTS, userId, alternateAckSource, joiner.toString() } ); } - + @Deprecated public List getEventsForDataPoint(int dataPointId, int userId) { return (List) DAO.getInstance().getJdbcTemp().query(EVENT_SELECT_WITH_USER_DATA+" where "+ EVENT_FILTER_FOR_DATA_POINT, new Object[]{dataPointId, userId}, new UserEventRowMapper()); } - + + @Deprecated public List getPendingEvents(int typeId, int typeRef1, int userId) { return (List) DAO.getInstance().getJdbcTemp().query(EVENT_SELECT_WITH_USER_DATA+" where " + EVENT_FILTER_TYPE_REF_USER, new Object[]{typeId, typeRef1, userId, DAO.boolToChar(true)}, new UserEventRowMapper() ); } - + + @Deprecated public List getPendingEvents(int typeId, int userId) { return (List) DAO.getInstance().getJdbcTemp().query(EVENT_SELECT_WITH_USER_DATA+" where " + EVENT_FILTER_TYPE_USER, new Object[]{typeId, userId, DAO.boolToChar(true)}, new UserEventRowMapper() ); } @@ -1016,6 +1024,23 @@ public List getPendingEventsLimit(int userId, int limit) { } + public List getPendingEventsLimitAlarmLevelMin(int userId, int alarmLevelMin, int limit) { + return DAO.getInstance().getJdbcTemp().query(EVENT_SELECT_WITH_USER_DATA+" where " + EVENT_FILTER_USER_ALARM_LEVEL_MIN + LIMIT+" ? ", new Object[]{userId, alarmLevelMin, limit}, new UserEventRowMapper() ); + + } + + public List getEventsForDataPointLimit(int dataPointId, int userId, int limit) { + return DAO.getInstance().getJdbcTemp().query(EVENT_SELECT_WITH_USER_DATA+" where "+ EVENT_FILTER_FOR_DATA_POINT + LIMIT+" ? ", new Object[]{dataPointId, userId, limit}, new UserEventRowMapper()); + } + + public List getPendingEventsLimit(int typeId, int typeRef1, int userId, int limit) { + return DAO.getInstance().getJdbcTemp().query(EVENT_SELECT_WITH_USER_DATA+" where " + EVENT_FILTER_TYPE_REF_USER + LIMIT+" ? ", new Object[]{typeId, typeRef1, userId, DAO.boolToChar(true), limit}, new UserEventRowMapper() ); + } + + public List getPendingEventsLimit(int typeId, int userId, int limit) { + return DAO.getInstance().getJdbcTemp().query(EVENT_SELECT_WITH_USER_DATA+" where " + EVENT_FILTER_TYPE_USER + LIMIT+" ? ", new Object[]{typeId, userId, DAO.boolToChar(true), limit}, new UserEventRowMapper() ); + } + @Deprecated public void attachRelationalInfo(EventInstance event) { List lstUserComments = (List) DAO.getInstance().getJdbcTemp().query(EVENT_COMMENT_SELECT, new Object[] { event.getId() }, new UserCommentRowMapper() ); diff --git a/src/org/scada_lts/mango/adapter/MangoEvent.java b/src/org/scada_lts/mango/adapter/MangoEvent.java index 1098cf319d..2cf994a07e 100644 --- a/src/org/scada_lts/mango/adapter/MangoEvent.java +++ b/src/org/scada_lts/mango/adapter/MangoEvent.java @@ -129,4 +129,9 @@ public interface MangoEvent { String generateUniqueXid(); + boolean isXidUnique(String xid, int excludeId); + + List getPendingEventsAlarmLevelMin(int userId, int alarmLevelMin, int limit); + + List getPendingEventsAlarmLevelMin(int userId, int alarmLevelMin, int limit, boolean disabledCache); } diff --git a/src/org/scada_lts/mango/service/DataPointService.java b/src/org/scada_lts/mango/service/DataPointService.java index 1cba2fb22a..51eb9980d8 100644 --- a/src/org/scada_lts/mango/service/DataPointService.java +++ b/src/org/scada_lts/mango/service/DataPointService.java @@ -473,7 +473,7 @@ public String getDetectorXid(int pointEventDetectorId) { @Override public int getDetectorId(String pointEventDetectorXid, int dataPointId) { - PointEventDetectorVO pointEventDetectorVO = pointEventDetectorDAO.getPointEventDetector(pointEventDetectorXid); + PointEventDetectorVO pointEventDetectorVO = pointEventDetectorDAO.getPointEventDetector(pointEventDetectorXid, dataPointId); if(pointEventDetectorVO == null) return 0; return pointEventDetectorVO.getId(); diff --git a/src/org/scada_lts/mango/service/DataSourceService.java b/src/org/scada_lts/mango/service/DataSourceService.java index 8cdd54e07c..34c940dedc 100644 --- a/src/org/scada_lts/mango/service/DataSourceService.java +++ b/src/org/scada_lts/mango/service/DataSourceService.java @@ -227,14 +227,15 @@ public int copyDataSource(final int dataSourceId, final ResourceBundle bundle) { MqttPointLocatorVO pointLocator = dataPointCopy.getPointLocator(); pointLocator.setClientId(MqttUtils.generateUniqueClientId()); } + dataPointService.saveDataPoint(dataPointCopy); //Copy event detectors for (PointEventDetectorVO pointEventDetector: dataPointCopy.getEventDetectors()) { pointEventDetector.setId(Common.NEW_ID); + pointEventDetector.setXid(new DataPointService().generateEventDetectorUniqueXid(dataPointCopy.getId())); pointEventDetector.njbSetDataPoint(dataPointCopy); } dataPointService.saveDataPoint(dataPointCopy); - //Copy permissions dataPointService.copyPermissions(dataPoint.getId(), dataPointCopy.getId()); } diff --git a/src/org/scada_lts/mango/service/EventService.java b/src/org/scada_lts/mango/service/EventService.java index cc508e6ceb..4574814ee2 100644 --- a/src/org/scada_lts/mango/service/EventService.java +++ b/src/org/scada_lts/mango/service/EventService.java @@ -53,6 +53,7 @@ import java.sql.SQLException; import java.util.*; import java.util.concurrent.ConcurrentHashMap; +import java.util.stream.Collectors; /** * @author grzegorz bylica Abil'I.T. development team, sdt@abilit.eu @@ -61,16 +62,17 @@ public class EventService implements MangoEvent { private static final Log LOG = LogFactory.getLog(EventService.class); - private static final int MAX_PENDING_EVENTS = 100; private final EventDAO eventDAO; private final UserEventDAO userEventDAO; private final IUserCommentDAO userCommentDAO; + private final SystemSettingsService systemSettingsService; public EventService() { eventDAO = new EventDAO(); userEventDAO = new UserEventDAO(); userCommentDAO = ApplicationBeans.getUserCommentDaoBean(); + systemSettingsService = new SystemSettingsService(); } class UserPendingEventRetriever implements Runnable { @@ -171,10 +173,11 @@ public List getActiveEvents() { public List getPendingEvents(int typeId, int typeRef1, int userId) { List lst; + int limit = systemSettingsService.getMiscSettings().getEventPendingLimit(); if (typeRef1 == -1) { - lst = eventDAO.getPendingEvents(typeId, userId); + lst = eventDAO.getPendingEventsLimit(typeId, userId, limit); } else { - lst = eventDAO.getPendingEvents(typeId, typeRef1, userId); + lst = eventDAO.getPendingEventsLimit(typeId, typeRef1, userId, limit); } attachRelationInfo(lst); @@ -182,6 +185,7 @@ public List getPendingEvents(int typeId, int typeRef1, int userId } + @Deprecated(since = "2.7.5.4") @Override public List getPendingSimpleEvents(int typeId, int typeRef1, int userId) { @@ -194,10 +198,11 @@ public List getPendingSimpleEvents(int typeId, int typeRef1, int return lst; } - + @Override public List getEventsForDataPoint(int dataPointId, int userId) { - return eventDAO.getEventsForDataPoint(dataPointId, userId); + int limit = systemSettingsService.getMiscSettings().getEventPendingLimit(); + return eventDAO.getEventsForDataPointLimit(dataPointId, userId, limit); } @Override @@ -229,6 +234,7 @@ public List getPendingEventsForDataSource(int dataSourceId, int u return getPendingEvents(EventType.EventSources.DATA_SOURCE, dataSourceId, userId); } + @Deprecated @Override public List getPendingSimpleEventsForDataSource(int dataSourceId, int userId) { return getPendingSimpleEvents(EventType.EventSources.DATA_SOURCE, dataSourceId, userId); @@ -243,14 +249,35 @@ public List getPendingEventsForPublisher(int publisherId, int use @Override public List getPendingEvents(int userId) { + int limit = systemSettingsService.getMiscSettings().getEventPendingLimit(); + return getPendingEventsAlarmLevelMin(userId, -1, limit, false); + } + @Override + public List getPendingEventsAlarmLevelMin(int userId, int alarmLevelMin, int limit) { + return getPendingEventsAlarmLevelMin(userId, alarmLevelMin, limit, false); + } + + @Override + public List getPendingEventsAlarmLevelMin(int userId, int alarmLevelMin, int limit, boolean forceDisabledCache) { List results = null; try { - boolean cacheEnable = ScadaConfig.getInstance().getBoolean(ScadaConfig.ENABLE_CACHE, false); - if (cacheEnable) { - results = PendingEventsCache.getInstance().getPendingEvents(userId); + boolean cacheEnable = systemSettingsService.getMiscSettings().isEventPendingCacheEnabled(); + if (!forceDisabledCache && cacheEnable) { + PendingEventsCache.getInstance().startUpdate(); + results = PendingEventsCache.getInstance().getPendingEvents(userId).stream() + .sorted(Comparator.comparing(EventInstance::getActiveTimestamp)) + .filter(a -> alarmLevelMin < 0 || a.getAlarmLevel() >= alarmLevelMin) + .collect(Collectors.toList()); } else { - - results = eventDAO.getPendingEventsLimit(userId, MAX_PENDING_EVENTS); + if(!forceDisabledCache) + PendingEventsCache.getInstance().stopUpdate(); + int fromSystemSettingsLimit = systemSettingsService.getMiscSettings().getEventPendingLimit(); + int calcLimit = limit > -1 ? limit : fromSystemSettingsLimit; + if(alarmLevelMin > 0) { + results = eventDAO.getPendingEventsLimitAlarmLevelMin(userId, alarmLevelMin, calcLimit); + } else { + results = eventDAO.getPendingEventsLimit(userId, calcLimit); + } attachRelationalInfo(results); } } catch (SchedulerException | IOException e) { @@ -526,6 +553,11 @@ public String generateUniqueXid() { return DAO.getInstance().generateUniqueXid(EventHandlerVO.XID_PREFIX, "eventHandlers"); } + @Override + public boolean isXidUnique(String xid, int excludeId) { + return DAO.getInstance().isXidUnique(xid, excludeId, "eventHandlers"); + } + private void _ackEvent(int eventId, long time, int userId, int alternateAckSource, boolean signalAlarmLevelChange) { eventDAO.updateAck(time, userId, alternateAckSource, eventId); // true silenced diff --git a/src/org/scada_lts/mango/service/PendingEventService.java b/src/org/scada_lts/mango/service/PendingEventService.java index efc33c3f90..97bd1dbef0 100644 --- a/src/org/scada_lts/mango/service/PendingEventService.java +++ b/src/org/scada_lts/mango/service/PendingEventService.java @@ -42,20 +42,24 @@ public class PendingEventService { private final IUserDAO userDAO; + private final SystemSettingsService systemSettingsService; + public PendingEventService() { userCommentDAO = ApplicationBeans.getUserCommentDaoBean(); pendingEventsDAO = new PendingEventsDAO(); userDAO = ApplicationBeans.getUserDaoBean(); + systemSettingsService = new SystemSettingsService(); } public Map> getPendingEvents() { List users = userDAO.getAll(); Map> comments = getCacheUserComments(userCommentDAO.getEventComments()); + int limit = systemSettingsService.getMiscSettings().getEventPendingLimit(); Map> cacheEvents = new ConcurrentHashMap<>(); for (int userId: users) { - List events = new CopyOnWriteArrayList<>(pendingEventsDAO.getPendingEvents(userId, comments)); + List events = new CopyOnWriteArrayList<>(pendingEventsDAO.getPendingEvents(userId, comments, limit)); cacheEvents.put(userId, events); } return cacheEvents; diff --git a/src/org/scada_lts/mango/service/SystemSettingsService.java b/src/org/scada_lts/mango/service/SystemSettingsService.java index 3803f0a306..8bbfa106f0 100644 --- a/src/org/scada_lts/mango/service/SystemSettingsService.java +++ b/src/org/scada_lts/mango/service/SystemSettingsService.java @@ -4,7 +4,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.serotonin.mango.Common; import com.serotonin.mango.db.dao.DataPointDao; -import com.serotonin.mango.db.dao.EventDao; import com.serotonin.mango.rt.dataImage.DataPointSyncMode; import com.serotonin.mango.rt.event.type.AuditEventType; import com.serotonin.mango.rt.event.type.SystemEventType; @@ -18,6 +17,7 @@ import org.apache.commons.logging.LogFactory; import org.scada_lts.config.ScadaConfig; import org.scada_lts.dao.SystemSettingsDAO; +import org.scada_lts.mango.adapter.MangoEvent; import org.scada_lts.serorepl.utils.DirectoryInfo; import org.scada_lts.serorepl.utils.DirectoryUtils; import org.scada_lts.utils.SystemSettingsUtils; @@ -133,6 +133,8 @@ public JsonSettingsMisc getMiscSettings() { json.setDataPointRuntimeValueSynchronized(SystemSettingsDAO.getValue(SystemSettingsDAO.DATAPOINT_RUNTIME_VALUE_SYNCHRONIZED)); json.setHideShortcutDisableFullScreen(SystemSettingsDAO.getBooleanValue(SystemSettingsDAO.VIEW_HIDE_SHORTCUT_DISABLE_FULL_SCREEN, false)); json.setEnableFullScreen(SystemSettingsDAO.getBooleanValue(SystemSettingsDAO.VIEW_FORCE_FULL_SCREEN_MODE, false)); + json.setEventPendingLimit(SystemSettingsDAO.getIntValue(SystemSettingsDAO.EVENT_PENDING_LIMIT, 100)); + json.setEventPendingCacheEnabled(SystemSettingsDAO.getBooleanValue(SystemSettingsDAO.EVENT_PENDING_CACHE_ENABLED, false)); return json; } @@ -141,6 +143,8 @@ public void saveMiscSettings(JsonSettingsMisc json) { systemSettingsDAO.setValue(SystemSettingsDAO.DATAPOINT_RUNTIME_VALUE_SYNCHRONIZED, DataPointSyncMode.getName(json.getDataPointRuntimeValueSynchronized())); systemSettingsDAO.setBooleanValue(SystemSettingsDAO.VIEW_HIDE_SHORTCUT_DISABLE_FULL_SCREEN, json.isHideShortcutDisableFullScreen()); systemSettingsDAO.setBooleanValue(SystemSettingsDAO.VIEW_FORCE_FULL_SCREEN_MODE, json.isEnableFullScreen()); + systemSettingsDAO.setIntValue(SystemSettingsDAO.EVENT_PENDING_LIMIT, json.getEventPendingLimit()); + systemSettingsDAO.setBooleanValue(SystemSettingsDAO.EVENT_PENDING_CACHE_ENABLED, json.isEventPendingCacheEnabled()); } public SettingsDataRetention getDataRetentionSettings() { @@ -270,7 +274,9 @@ public Map getDatabaseSize() { data.put("historyCount", sum); data.put("topPoints", counts); - data.put("eventCount", new EventDao().getEventCount()); + + MangoEvent eventService = new EventService(); + data.put("eventCount", eventService.getEventCount()); return data; } diff --git a/src/org/scada_lts/quartz/UpdatePendingEvents.java b/src/org/scada_lts/quartz/UpdatePendingEvents.java index db90ef18ed..8eee55b408 100644 --- a/src/org/scada_lts/quartz/UpdatePendingEvents.java +++ b/src/org/scada_lts/quartz/UpdatePendingEvents.java @@ -48,6 +48,7 @@ public UpdatePendingEvents() { public void execute(JobExecutionContext arg0) throws JobExecutionException { LOG.trace("UpdatePendingEvents"); try { + PendingEventsCache.getInstance().resetUpdate(); PendingEventsCache.getInstance().setMapPendingEvents(pendingEventService.getPendingEvents()); PendingEventsCache.getInstance().resetCountBuffer(); } catch (SchedulerException | IOException e) { diff --git a/src/org/scada_lts/utils/SystemSettingsUtils.java b/src/org/scada_lts/utils/SystemSettingsUtils.java index ba4816a05a..cc0f80d285 100644 --- a/src/org/scada_lts/utils/SystemSettingsUtils.java +++ b/src/org/scada_lts/utils/SystemSettingsUtils.java @@ -34,6 +34,8 @@ private SystemSettingsUtils() {} public static final String VIEW_FORCE_FULL_SCREEN_MODE = "view.forceFullScreen"; public static final String VIEW_HIDE_SHORTCUT_DISABLE_FULL_SCREEN = "view.hideShortcutDisableFullScreen"; + public static final String EVENT_PENDING_LIMIT = "event.pending.limit"; + public static final String EVENT_PENDING_CACHE_ENABLED = "abilit.cacheEnable"; private static final org.apache.commons.logging.Log LOG = LogFactory.getLog(SystemSettingsUtils.class); public static DataPointSyncMode getDataPointSynchronizedMode() { @@ -202,4 +204,24 @@ public static boolean isForceFullScreenMode() { return false; } } + + public static int getEventPendingLimit() { + try { + String eventPendingLimit = ScadaConfig.getInstance().getConf().getProperty(EVENT_PENDING_LIMIT, "100"); + return Integer.parseInt(eventPendingLimit); + } catch (Exception e) { + LOG.error(e.getMessage()); + return 100; + } + } + + public static boolean isEventPendingCacheEnabled() { + try { + String eventPendingCache = ScadaConfig.getInstance().getConf().getProperty(EVENT_PENDING_CACHE_ENABLED, "false"); + return Boolean.parseBoolean(eventPendingCache); + } catch (Exception e) { + LOG.error(e.getMessage()); + return false; + } + } } diff --git a/src/org/scada_lts/web/beans/ApplicationBeans.java b/src/org/scada_lts/web/beans/ApplicationBeans.java index 587de26d85..c9de7e88a2 100644 --- a/src/org/scada_lts/web/beans/ApplicationBeans.java +++ b/src/org/scada_lts/web/beans/ApplicationBeans.java @@ -10,14 +10,9 @@ import com.serotonin.mango.vo.permission.DataPointAccess; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.scada_lts.config.ScadaConfig; import org.scada_lts.dao.*; -import org.scada_lts.dao.cache.HighestAlarmLevelCachable; -import org.scada_lts.dao.cache.UserCachable; -import org.scada_lts.dao.cache.UserCommentCachable; -import org.scada_lts.dao.cache.UsersProfileCacheable; +import org.scada_lts.dao.cache.*; import org.scada_lts.mango.service.UserCommentService; -import org.scada_lts.dao.cache.ViewCachable; import org.scada_lts.mango.service.UsersProfileService; import org.scada_lts.permissions.service.*; @@ -130,7 +125,7 @@ public static IViewDAO getViewDaoBean() { } public static IPointEventDetectorDAO getPointEventDetectorDaoBean() { - boolean viewCacheEnabled = Common.getEnvironmentProfile().getBoolean(ScadaConfig.ENABLE_CACHE, true); + boolean viewCacheEnabled = Common.getEnvironmentProfile().getBoolean(PointEventDetectorCacheable.CACHE_ENABLED_KEY, true); return viewCacheEnabled ? getBeanFromContext("pointEventDetectorDaoWithCache", IPointEventDetectorDAO.class) : getBeanFromContext("pointEventDetectorDAO", IPointEventDetectorDAO.class); diff --git a/src/org/scada_lts/web/mvc/api/SystemSettingsAPI.java b/src/org/scada_lts/web/mvc/api/SystemSettingsAPI.java index 9c6e55582c..edf8682488 100644 --- a/src/org/scada_lts/web/mvc/api/SystemSettingsAPI.java +++ b/src/org/scada_lts/web/mvc/api/SystemSettingsAPI.java @@ -267,6 +267,8 @@ public ResponseEntity saveMisc(HttpServletRequest request, @RequestBody try { User user = Common.getUser(request); if (user != null && user.isAdmin()) { + if(jsonSettingsMisc.getEventPendingLimit() < 0) + return new ResponseEntity<>(HttpStatus.BAD_REQUEST); systemSettingsService.saveMiscSettings(jsonSettingsMisc); return new ResponseEntity<>(SAVED_MSG, HttpStatus.OK); } else { diff --git a/src/org/scada_lts/web/mvc/api/json/JsonSettingsMisc.java b/src/org/scada_lts/web/mvc/api/json/JsonSettingsMisc.java index eeedd5acc3..536a9da249 100644 --- a/src/org/scada_lts/web/mvc/api/json/JsonSettingsMisc.java +++ b/src/org/scada_lts/web/mvc/api/json/JsonSettingsMisc.java @@ -8,15 +8,18 @@ public class JsonSettingsMisc implements Serializable { private String dataPointRuntimeValueSynchronized; public boolean enableFullScreen; public boolean hideShortcutDisableFullScreen; + public int eventPendingLimit; + public boolean eventPendingCacheEnabled; public JsonSettingsMisc() {} - public JsonSettingsMisc(int uiPerformance, String dataPointRuntimeValueSynchronized, - boolean enableFullScreen, boolean hideShortcutDisableFullScreen) { + public JsonSettingsMisc(int uiPerformance, String dataPointRuntimeValueSynchronized, boolean enableFullScreen, boolean hideShortcutDisableFullScreen, int eventPendingLimit, boolean eventPendingCacheEnabled) { this.uiPerformance = uiPerformance; this.dataPointRuntimeValueSynchronized = dataPointRuntimeValueSynchronized; this.enableFullScreen = enableFullScreen; this.hideShortcutDisableFullScreen = hideShortcutDisableFullScreen; + this.eventPendingLimit = eventPendingLimit; + this.eventPendingCacheEnabled = eventPendingCacheEnabled; } public int getUiPerformance() { @@ -50,4 +53,20 @@ public boolean isHideShortcutDisableFullScreen() { public void setHideShortcutDisableFullScreen(boolean hideShortcutDisableFullScreen) { this.hideShortcutDisableFullScreen = hideShortcutDisableFullScreen; } + + public int getEventPendingLimit() { + return eventPendingLimit; + } + + public void setEventPendingLimit(int eventPendingLimit) { + this.eventPendingLimit = eventPendingLimit; + } + + public boolean isEventPendingCacheEnabled() { + return eventPendingCacheEnabled; + } + + public void setEventPendingCacheEnabled(boolean eventPendingCacheEnabled) { + this.eventPendingCacheEnabled = eventPendingCacheEnabled; + } } diff --git a/test/br/org/scadabr/view/component/GenerateAlarmListComponentTest.java b/test/br/org/scadabr/view/component/GenerateAlarmListComponentTest.java index 3f1c63f633..0306b31aa8 100644 --- a/test/br/org/scadabr/view/component/GenerateAlarmListComponentTest.java +++ b/test/br/org/scadabr/view/component/GenerateAlarmListComponentTest.java @@ -1,7 +1,6 @@ package br.org.scadabr.view.component; import com.serotonin.mango.Common; -import com.serotonin.mango.db.dao.EventDao; import com.serotonin.mango.rt.event.EventInstance; import com.serotonin.mango.vo.User; import com.serotonin.mango.web.dwr.BaseDwr; @@ -30,8 +29,7 @@ @RunWith(PowerMockRunner.class) @PrepareForTest({BaseDwr.class, WebContextFactory.class, Common.class, - AlarmListComponent.class, LogFactory.class, EventService.class, - EventDao.class}) + AlarmListComponent.class, LogFactory.class, EventService.class}) public class GenerateAlarmListComponentTest { private final static String CONTENT_EXPECTED = "test"; diff --git a/test/com/serotonin/mango/web/dwr/MiscDwrDoLongPollAlarmsMultiThreadTest.java b/test/com/serotonin/mango/web/dwr/MiscDwrDoLongPollAlarmsMultiThreadTest.java index 0fdd4dc344..914007594f 100644 --- a/test/com/serotonin/mango/web/dwr/MiscDwrDoLongPollAlarmsMultiThreadTest.java +++ b/test/com/serotonin/mango/web/dwr/MiscDwrDoLongPollAlarmsMultiThreadTest.java @@ -1,9 +1,7 @@ package com.serotonin.mango.web.dwr; import com.serotonin.mango.Common; -import com.serotonin.mango.db.dao.EventDao; import com.serotonin.mango.rt.RuntimeManager; -import com.serotonin.mango.rt.dataImage.PointValueTime; import com.serotonin.mango.rt.event.EventInstance; import com.serotonin.mango.vo.User; import com.serotonin.mango.web.dwr.longPoll.LongPollRequest; @@ -13,11 +11,9 @@ import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.junit.runners.Parameterized; import org.powermock.core.classloader.annotations.PowerMockIgnore; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; -import org.powermock.modules.junit4.PowerMockRunnerDelegate; import org.scada_lts.dao.SystemSettingsDAO; import org.scada_lts.mango.service.EventService; import org.springframework.mock.web.MockHttpSession; @@ -30,7 +26,6 @@ import java.util.Arrays; import java.util.List; import java.util.Map; -import java.util.function.Supplier; import java.util.stream.Collectors; import static org.junit.Assert.assertEquals; @@ -40,7 +35,7 @@ @RunWith(PowerMockRunner.class) @PrepareForTest({WebContextFactory.class, Common.class, MiscDwr.class, SystemSettingsDAO.class, - ContentGenerator.class, EventDao.class}) + ContentGenerator.class}) @PowerMockIgnore({"com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*", "org.w3c.*", "com.sun.org.apache.xalan.*", "javax.activation.*", "javax.management.*"}) public class MiscDwrDoLongPollAlarmsMultiThreadTest { diff --git a/test/com/serotonin/mango/web/dwr/MiscDwrDoLongPollMultiThreadTest.java b/test/com/serotonin/mango/web/dwr/MiscDwrDoLongPollMultiThreadTest.java index 8a655bda81..e5fec158f0 100644 --- a/test/com/serotonin/mango/web/dwr/MiscDwrDoLongPollMultiThreadTest.java +++ b/test/com/serotonin/mango/web/dwr/MiscDwrDoLongPollMultiThreadTest.java @@ -2,7 +2,6 @@ import br.org.scadabr.vo.permission.ViewAccess; import com.serotonin.mango.Common; -import com.serotonin.mango.db.dao.EventDao; import com.serotonin.mango.rt.RuntimeManager; import com.serotonin.mango.rt.dataImage.DataPointRT; import com.serotonin.mango.rt.dataImage.PointValueCache; @@ -55,7 +54,7 @@ @RunWith(PowerMockRunner.class) @PowerMockRunnerDelegate(Parameterized.class) @PrepareForTest({WebContextFactory.class, Common.class, MiscDwr.class, SystemSettingsDAO.class, - ContentGenerator.class, DataPointRT.class, DataPointDetailsDwr.class, EventDao.class}) + ContentGenerator.class, DataPointRT.class, DataPointDetailsDwr.class}) @PowerMockIgnore({"com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*", "org.w3c.*", "com.sun.org.apache.xalan.*", "javax.activation.*", "javax.management.*"}) public class MiscDwrDoLongPollMultiThreadTest { diff --git a/test/org/scada_lts/dao/IsEventDetectorXidUniqueTest.java b/test/org/scada_lts/dao/IsEventDetectorXidUniqueTest.java index 548f7b61b5..2af2b03258 100644 --- a/test/org/scada_lts/dao/IsEventDetectorXidUniqueTest.java +++ b/test/org/scada_lts/dao/IsEventDetectorXidUniqueTest.java @@ -22,6 +22,7 @@ public static Object[][] primeNumbers() { new PointEventDetectorVO(1, "PED_123"), new PointEventDetectorVO(2, "PED_124"), new PointEventDetectorVO(3, "PED_125"), + 1, "PED_126", 0, true @@ -30,6 +31,7 @@ public static Object[][] primeNumbers() { new PointEventDetectorVO(1, "PED_123"), new PointEventDetectorVO(2, "PED_124"), new PointEventDetectorVO(3, "PED_125"), + 1, "PED_126", 0, true @@ -38,6 +40,7 @@ public static Object[][] primeNumbers() { new PointEventDetectorVO(1, "PED_123"), new PointEventDetectorVO(2, "PED_124"), new PointEventDetectorVO(3, "PED_125"), + 1, "PED_125", 0, false @@ -46,6 +49,7 @@ public static Object[][] primeNumbers() { new PointEventDetectorVO(1, "PED_123"), new PointEventDetectorVO(2, "PED_124"), new PointEventDetectorVO(3, "PED_125"), + 1, "PED_125", 0, false @@ -54,6 +58,7 @@ public static Object[][] primeNumbers() { new PointEventDetectorVO(1, "PED_123"), new PointEventDetectorVO(2, "PED_124"), new PointEventDetectorVO(3, "PED_125"), + 1, "PED_126", 1, true @@ -62,6 +67,7 @@ public static Object[][] primeNumbers() { new PointEventDetectorVO(1, "PED_123"), new PointEventDetectorVO(2, "PED_124"), new PointEventDetectorVO(3, "PED_125"), + 1, "PED_126", 1, true @@ -70,6 +76,7 @@ public static Object[][] primeNumbers() { new PointEventDetectorVO(1, "PED_123"), new PointEventDetectorVO(2, "PED_124"), new PointEventDetectorVO(3, "PED_125"), + 1, "PED_123", 1, true @@ -78,6 +85,7 @@ public static Object[][] primeNumbers() { new PointEventDetectorVO(1, "PED_123"), new PointEventDetectorVO(2, "PED_124"), new PointEventDetectorVO(3, "PED_125"), + 1, "PED_123", 1, true @@ -86,6 +94,7 @@ public static Object[][] primeNumbers() { new PointEventDetectorVO(1, "PED_123"), new PointEventDetectorVO(2, "PED_124"), new PointEventDetectorVO(3, "PED_125"), + 1, "PED_123", 2, false @@ -94,6 +103,7 @@ public static Object[][] primeNumbers() { new PointEventDetectorVO(1, "PED_123"), new PointEventDetectorVO(2, "PED_124"), new PointEventDetectorVO(3, "PED_125"), + 1, "PED_123", 2, false @@ -102,6 +112,7 @@ public static Object[][] primeNumbers() { new PointEventDetectorVO(1, null), new PointEventDetectorVO(2, null), new PointEventDetectorVO(3, null), + 1, "PED_126", 1, true @@ -110,6 +121,7 @@ public static Object[][] primeNumbers() { new PointEventDetectorVO(1, "PED_123"), new PointEventDetectorVO(2, null), new PointEventDetectorVO(3, null), + 1, "PED_123", 2, false @@ -121,15 +133,18 @@ public static Object[][] primeNumbers() { private final PointEventDetectorVO pointEventDetector1; private final PointEventDetectorVO pointEventDetector2; private final PointEventDetectorVO pointEventDetector3; + private final int dataPointId; private final String xid; private final int exclusiveId; private final boolean expected; public IsEventDetectorXidUniqueTest(PointEventDetectorVO pointEventDetector1, PointEventDetectorVO pointEventDetector2, - PointEventDetectorVO pointEventDetector3, String xid, int exclusiveId, boolean expected) { + PointEventDetectorVO pointEventDetector3, int dataPointId, + String xid, int exclusiveId, boolean expected) { this.pointEventDetector1 = pointEventDetector1; this.pointEventDetector2 = pointEventDetector2; this.pointEventDetector3 = pointEventDetector3; + this.dataPointId = dataPointId; this.xid = xid; this.exclusiveId = exclusiveId; this.expected = expected; @@ -143,16 +158,16 @@ public void config() { PointEventDetectorCache pointEventDetectorCache = new PointEventDetectorCache(pointEventDetectorDaoMock); subject = new PointEventDetectorDaoWithCache(pointEventDetectorCache); - when(pointEventDetectorDaoMock.getPointEventDetector(eq(pointEventDetector1.getXid()))).thenReturn(pointEventDetector1); - when(pointEventDetectorDaoMock.getPointEventDetector(eq(pointEventDetector2.getXid()))).thenReturn(pointEventDetector2); - when(pointEventDetectorDaoMock.getPointEventDetector(eq(pointEventDetector3.getXid()))).thenReturn(pointEventDetector3); + when(pointEventDetectorDaoMock.getPointEventDetector(eq(pointEventDetector1.getXid()), eq(dataPointId))).thenReturn(pointEventDetector1); + when(pointEventDetectorDaoMock.getPointEventDetector(eq(pointEventDetector2.getXid()), eq(dataPointId))).thenReturn(pointEventDetector2); + when(pointEventDetectorDaoMock.getPointEventDetector(eq(pointEventDetector3.getXid()), eq(dataPointId))).thenReturn(pointEventDetector3); } @Test public void when_isEventDetectorXidUnique() { //when - boolean result = subject.isEventDetectorXidUnique(-1, xid, exclusiveId); + boolean result = subject.isEventDetectorXidUnique(dataPointId, xid, exclusiveId); //then: assertEquals(expected, result); diff --git a/webapp-resources/ehcache.xml b/webapp-resources/ehcache.xml index 863d6d09ae..15a04f828a 100644 --- a/webapp-resources/ehcache.xml +++ b/webapp-resources/ehcache.xml @@ -165,6 +165,6 @@ - + diff --git a/webapp-resources/env.properties b/webapp-resources/env.properties index dbb38d95ba..f51dc522d5 100644 --- a/webapp-resources/env.properties +++ b/webapp-resources/env.properties @@ -57,7 +57,7 @@ abilit.disableDataSourcesOnServerStart=false abilit.api.replace.alert.onview=true -abilit.cacheEnable=true +abilit.cacheEnable=false abilit.START_UPDATE_UNSILENCED_ALARM_LEVEL=100000 abilit.START_UPDATE_EVENT_DETECTORS=100000 abilit.START_UPDATE_PENDING_EVENTS=100000 @@ -129,4 +129,6 @@ scadalts.security.js.access.granted.method.regexes=^.* scadalts.security.js.access.granted.class.regexes=java.lang.*;java.util.*;java.math.*;java.text.*;java.time.*;br.org.scadabr.*;cc.radiuino.scadabr.*;com.serotonin.*;org.scada_lts.* view.forceFullScreen=false -view.hideShortcutDisableFullScreen=false \ No newline at end of file +view.hideShortcutDisableFullScreen=false +eventdetector.cache.enabled=true +event.pending.limit=101 \ No newline at end of file diff --git a/webapp-resources/messages_de.properties b/webapp-resources/messages_de.properties index 1e3e07b722..ef9c64d5bd 100644 --- a/webapp-resources/messages_de.properties +++ b/webapp-resources/messages_de.properties @@ -3322,4 +3322,6 @@ user.view.enableFullScreen=Enable full screen mode user.view.hideShortcutDisableFullScreen=Hide shortcut to disable full screen user.view.forceAdminTitle=The function is enforced by the Admin validate.1to255=Must be between 1 and 255 inclusive -annotation.unknown=Unknown \ No newline at end of file +systemsettings.event.pendingLimit=Event Pending Limit +systemsettings.event.pendingCacheEnabled=Enabled Event Pending Cache +annotation.unknown=Unknown diff --git a/webapp-resources/messages_en.properties b/webapp-resources/messages_en.properties index 6cb53f3f0c..372f9d1950 100644 --- a/webapp-resources/messages_en.properties +++ b/webapp-resources/messages_en.properties @@ -3325,4 +3325,6 @@ user.view.enableFullScreen=Enable full screen mode user.view.hideShortcutDisableFullScreen=Hide shortcut to disable full screen user.view.forceAdminTitle=The function is enforced by the Admin validate.1to255=Must be between 1 and 255 inclusive -annotation.unknown=Unknown \ No newline at end of file +systemsettings.event.pendingLimit=Event Pending Limit +systemsettings.event.pendingCacheEnabled=Enabled Event Pending Cache +annotation.unknown=Unknown diff --git a/webapp-resources/messages_es.properties b/webapp-resources/messages_es.properties index c0c3f1908a..a58ebcf857 100644 --- a/webapp-resources/messages_es.properties +++ b/webapp-resources/messages_es.properties @@ -3365,4 +3365,6 @@ user.view.enableFullScreen=Enable full screen mode user.view.hideShortcutDisableFullScreen=Hide shortcut to disable full screen user.view.forceAdminTitle=The function is enforced by the Admin validate.1to255=Must be between 1 and 255 inclusive -annotation.unknown=Unknown \ No newline at end of file +systemsettings.event.pendingLimit=Event Pending Limit +systemsettings.event.pendingCacheEnabled=Enabled Event Pending Cache +annotation.unknown=Unknown diff --git a/webapp-resources/messages_fi.properties b/webapp-resources/messages_fi.properties index fd63b88708..2a4a842ea1 100644 --- a/webapp-resources/messages_fi.properties +++ b/webapp-resources/messages_fi.properties @@ -2485,8 +2485,8 @@ engUnit.86=imperial gallons per minute engUnit.87=liters per second engUnit.88=liters per minute engUnit.89=us gallons per minute -engUnit.90=degrees angular engUnit.91=degrees celsius per hour +engUnit.90=degrees angular engUnit.92=degrees celsius per minute engUnit.93=degrees fahrenheit per hour engUnit.94=degrees fahrenheit per minute @@ -3451,4 +3451,6 @@ user.view.enableFullScreen=Enable full screen mode user.view.hideShortcutDisableFullScreen=Hide shortcut to disable full screen user.view.forceAdminTitle=The function is enforced by the Admin validate.1to255=Must be between 1 and 255 inclusive -annotation.unknown=Unknown \ No newline at end of file +systemsettings.event.pendingLimit=Event Pending Limit +systemsettings.event.pendingCacheEnabled=Enabled Event Pending Cache +annotation.unknown=Unknown diff --git a/webapp-resources/messages_fr.properties b/webapp-resources/messages_fr.properties index d0229e3c3a..ab7e097ce5 100644 --- a/webapp-resources/messages_fr.properties +++ b/webapp-resources/messages_fr.properties @@ -3319,4 +3319,6 @@ user.view.enableFullScreen=Enable full screen mode user.view.hideShortcutDisableFullScreen=Hide shortcut to disable full screen user.view.forceAdminTitle=The function is enforced by the Admin validate.1to255=Must be between 1 and 255 inclusive -annotation.unknown=Unknown \ No newline at end of file +systemsettings.event.pendingLimit=Event Pending Limit +systemsettings.event.pendingCacheEnabled=Enabled Event Pending Cache +annotation.unknown=Unknown diff --git a/webapp-resources/messages_lu.properties b/webapp-resources/messages_lu.properties index 9b544e1c55..29c4774199 100644 --- a/webapp-resources/messages_lu.properties +++ b/webapp-resources/messages_lu.properties @@ -3338,4 +3338,6 @@ user.view.enableFullScreen=Enable full screen mode user.view.hideShortcutDisableFullScreen=Hide shortcut to disable full screen user.view.forceAdminTitle=The function is enforced by the Admin validate.1to255=Must be between 1 and 255 inclusive -annotation.unknown=Unknown \ No newline at end of file +systemsettings.event.pendingLimit=Event Pending Limit +systemsettings.event.pendingCacheEnabled=Enabled Event Pending Cache +annotation.unknown=Unknown diff --git a/webapp-resources/messages_nl.properties b/webapp-resources/messages_nl.properties index 7a2023c2d7..62876a0c63 100644 --- a/webapp-resources/messages_nl.properties +++ b/webapp-resources/messages_nl.properties @@ -3441,4 +3441,6 @@ user.view.enableFullScreen=Enable full screen mode user.view.hideShortcutDisableFullScreen=Hide shortcut to disable full screen user.view.forceAdminTitle=The function is enforced by the Admin validate.1to255=Must be between 1 and 255 inclusive -annotation.unknown=Unknown \ No newline at end of file +systemsettings.event.pendingLimit=Event Pending Limit +systemsettings.event.pendingCacheEnabled=Enabled Event Pending Cache +annotation.unknown=Unknown diff --git a/webapp-resources/messages_pl.properties b/webapp-resources/messages_pl.properties index 12663b4563..b5d43bd660 100644 --- a/webapp-resources/messages_pl.properties +++ b/webapp-resources/messages_pl.properties @@ -3463,4 +3463,6 @@ user.view.enableFullScreen=Enable full screen mode user.view.hideShortcutDisableFullScreen=Hide shortcut to disable full screen user.view.forceAdminTitle=The function is enforced by the Admin validate.1to255=Must be between 1 and 255 inclusive -annotation.unknown=Unknown \ No newline at end of file +systemsettings.event.pendingLimit=Event Pending Limit +systemsettings.event.pendingCacheEnabled=Enabled Event Pending Cache +annotation.unknown=Unknown diff --git a/webapp-resources/messages_pt.properties b/webapp-resources/messages_pt.properties index dd1fe685be..858b56157b 100644 --- a/webapp-resources/messages_pt.properties +++ b/webapp-resources/messages_pt.properties @@ -3477,4 +3477,6 @@ user.view.enableFullScreen=Enable full screen mode user.view.hideShortcutDisableFullScreen=Hide shortcut to disable full screen user.view.forceAdminTitle=The function is enforced by the Admin validate.1to255=Must be between 1 and 255 inclusive +systemsettings.event.pendingLimit=Event Pending Limit +systemsettings.event.pendingCacheEnabled=Enabled Event Pending Cache annotation.unknown=Unknown diff --git a/webapp-resources/messages_ru.properties b/webapp-resources/messages_ru.properties index 39758ea649..197fbc9534 100644 --- a/webapp-resources/messages_ru.properties +++ b/webapp-resources/messages_ru.properties @@ -3473,4 +3473,6 @@ user.view.enableFullScreen=Enable full screen mode user.view.hideShortcutDisableFullScreen=Hide shortcut to disable full screen user.view.forceAdminTitle=The function is enforced by the Admin validate.1to255=Must be between 1 and 255 inclusive -annotation.unknown=Unknown \ No newline at end of file +systemsettings.event.pendingLimit=Event Pending Limit +systemsettings.event.pendingCacheEnabled=Enabled Event Pending Cache +annotation.unknown=Unknown diff --git a/webapp-resources/messages_zh.properties b/webapp-resources/messages_zh.properties index 3b958b8b39..8ef6a11509 100644 --- a/webapp-resources/messages_zh.properties +++ b/webapp-resources/messages_zh.properties @@ -3426,4 +3426,6 @@ user.view.enableFullScreen=Enable full screen mode user.view.hideShortcutDisableFullScreen=Hide shortcut to disable full screen user.view.forceAdminTitle=The function is enforced by the Admin validate.1to255=Must be between 1 and 255 inclusive -annotation.unknown=Unknown \ No newline at end of file +systemsettings.event.pendingLimit=Event Pending Limit +systemsettings.event.pendingCacheEnabled=Enabled Event Pending Cache +annotation.unknown=Unknow