Package org.openremote.manager.alarm
Class AlarmService
java.lang.Object
org.apache.camel.builder.BuilderSupport
org.apache.camel.builder.RouteBuilder
org.openremote.manager.alarm.AlarmService
- All Implemented Interfaces:
org.apache.camel.builder.ModelRoutesBuilder,org.apache.camel.CamelContextAware,org.apache.camel.Ordered,org.apache.camel.RoutesBuilder,org.apache.camel.spi.HasCamelContext,org.apache.camel.spi.ResourceAware,org.openremote.model.ContainerService
public class AlarmService
extends org.apache.camel.builder.RouteBuilder
implements org.openremote.model.ContainerService
A service for managing
SentAlarms. It also provides functionality for managing links between SentAlarms
and Assets using AlarmAssetLinks.-
Field Summary
FieldsFields inherited from class org.apache.camel.builder.RouteBuilder
logFields inherited from interface org.openremote.model.ContainerService
DEFAULT_PRIORITY, HIGH_PRIORITY, LOW_PRIORITY, MED_PRIORITYFields inherited from interface org.apache.camel.Ordered
HIGHEST, LOWEST -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidorg.openremote.model.alarm.SentAlarmRetrieves the details of an existing alarm if the given user has access to the alarm realm.getAlarmRealms(List<org.openremote.model.alarm.SentAlarm> alarms) Returns a set of all realms of the given alarms.List<org.openremote.model.alarm.SentAlarm> getAlarms(String realm, org.openremote.model.alarm.Alarm.Status status, String assetId, String assigneeId) Retrieves all existing alarms in a realm.List<org.openremote.model.alarm.SentAlarm> Retrieves the details of existing alarms if the given user has access to the alarm realms.List<org.openremote.model.alarm.AlarmAssetLink> getAssetLinks(Long alarmId, String realm) Returns the assets linked to an alarm if the given user has access to the alarm realm.intvoidinit(org.openremote.model.Container container) voidlinkAssets(List<String> assetIds, String realm, Long alarmId) Links multiple assets to an existing alarm.voidlinkAssets(List<org.openremote.model.alarm.AlarmAssetLink> links) Links multiple assets to existing alarms if the given user has access to the alarm realms.voidremoveAlarm(org.openremote.model.alarm.SentAlarm alarm) Removes an existing alarm if the given user has access to the alarm realm.voidremoveAlarms(List<org.openremote.model.alarm.SentAlarm> alarms, List<Long> alarmIds) Removes existing alarms if the given user has access to the alarm realms.org.openremote.model.alarm.SentAlarmSends an alarm if the given user has access to the alarm realm.protected voidsendAssigneeNotification(org.openremote.model.alarm.SentAlarm alarm, Set<String> excludeUserIds) Sends e-mail and push notifications for an alarm to the alarm assignee.voidstart(org.openremote.model.Container container) voidstop(org.openremote.model.Container container) voidupdateAlarm(org.openremote.model.alarm.SentAlarm oldAlarm, org.openremote.model.alarm.SentAlarm newAlarm) Updates an existing alarm if the given user has access to the alarm realm.protected voidvalidateAlarmId(Long alarmId) Throws anIllegalArgumentExceptionifalarmIdis null or negative.protected voidvalidateAlarmIds(Collection<Long> alarmIds) Throws anIllegalArgumentExceptionif the givenalarmIdsare null, empty or negative.protected voidvalidateAssetIds(Collection<String> assetIds) Throws anIllegalArgumentExceptionif the givenassetIdsare null or empty.Methods inherited from class org.apache.camel.builder.RouteBuilder
addLifecycleInterceptor, addRoutes, addRoutesToCamelContext, addTemplatedRoutesToCamelContext, bindToRegistry, bindToRegistry, checkInitialized, configuration, configureRest, configureRests, configureRoute, configureRouteConfiguration, configureRoutes, configureRouteTemplate, configureTemplatedRoute, customize, customize, dataFormat, errorHandler, errorHandler, expression, from, from, from, fromF, fromV, fromV, getBeans, getOrder, getResource, getRestCollection, getRestConfiguration, getRests, getRouteCollection, getRoutes, getRouteTemplateCollection, getTemplatedRouteCollection, initializeCamelContext, intercept, interceptFrom, interceptFrom, interceptSendToEndpoint, loadRoutesBuilder, loadRoutesBuilder, onCompletion, onException, onException, populateBeans, populateOrUpdateRoutes, populateRests, populateRoutes, populateRouteTemplates, populateTemplatedRoutes, populateTransformers, populateValidators, prepareModel, property, propertyInject, removeLifecycleInterceptor, rest, rest, restConfiguration, routeTemplate, setErrorHandlerFactory, setResource, setRestCollection, setRouteTemplateCollection, setTemplatedRouteCollection, templatedRoute, tokenizer, toString, transformer, updateRoutesToCamelContext, validatorMethods inherited from class org.apache.camel.builder.BuilderSupport
body, bodyAs, constant, constant, constant, createErrorHandlerBuilder, csimple, csimple, datasonnet, datasonnet, datasonnet, deadLetterChannel, deadLetterChannel, defaultErrorHandler, endpoint, endpoint, exceptionMessage, exchangeProperty, expression, getCamelContext, getContext, getErrorHandlerFactory, hasErrorHandlerFactory, header, java, java, joor, joor, jq, jq, jsonpath, jsonpath, jtaTransactionErrorHandler, jtaTransactionErrorHandler, jtaTransactionErrorHandler, method, method, method, method, noErrorHandler, regexReplaceAll, regexReplaceAll, setCamelContext, simple, simple, simpleF, simpleF, springTransactionErrorHandler, springTransactionErrorHandler, springTransactionErrorHandler, systemProperty, systemProperty, variable, xpath, xpath, xpath, xpath
-
Field Details
-
LOG
-
-
Constructor Details
-
AlarmService
public AlarmService()
-
-
Method Details
-
getPriority
public int getPriority()- Specified by:
getPriorityin interfaceorg.openremote.model.ContainerService
-
init
- Specified by:
initin interfaceorg.openremote.model.ContainerService- Throws:
Exception
-
start
- Specified by:
startin interfaceorg.openremote.model.ContainerService- Throws:
Exception
-
stop
- Specified by:
stopin interfaceorg.openremote.model.ContainerService- Throws:
Exception
-
configure
- Specified by:
configurein classorg.apache.camel.builder.RouteBuilder- Throws:
Exception
-
getAlarmRealms
Returns a set of all realms of the given alarms. -
validateAlarmId
Throws anIllegalArgumentExceptionifalarmIdis null or negative. -
validateAlarmIds
Throws anIllegalArgumentExceptionif the givenalarmIdsare null, empty or negative. -
validateAssetIds
Throws anIllegalArgumentExceptionif the givenassetIdsare null or empty. -
sendAlarm
public org.openremote.model.alarm.SentAlarm sendAlarm(org.openremote.model.alarm.Alarm alarm, List<String> assetIds) Sends an alarm if the given user has access to the alarm realm. -
sendAssigneeNotification
protected void sendAssigneeNotification(org.openremote.model.alarm.SentAlarm alarm, Set<String> excludeUserIds) Sends e-mail and push notifications for an alarm to the alarm assignee. If an assignee is not set all users having theConstants.READ_ADMIN_ROLEorConstants.WRITE_ALARMS_ROLEare notified.- Parameters:
alarm- the alarm to send e-mail and push notifications forexcludeUserIds- users matching these user IDs will are excluded from the notifications
-
updateAlarm
public void updateAlarm(org.openremote.model.alarm.SentAlarm oldAlarm, org.openremote.model.alarm.SentAlarm newAlarm) Updates an existing alarm if the given user has access to the alarm realm. -
linkAssets
Links multiple assets to an existing alarm. -
linkAssets
Links multiple assets to existing alarms if the given user has access to the alarm realms. -
getAssetLinks
public List<org.openremote.model.alarm.AlarmAssetLink> getAssetLinks(Long alarmId, String realm) throws IllegalArgumentException Returns the assets linked to an alarm if the given user has access to the alarm realm.- Throws:
IllegalArgumentException
-
getAlarm
Retrieves the details of an existing alarm if the given user has access to the alarm realm.- Throws:
IllegalArgumentException
-
getAlarms
public List<org.openremote.model.alarm.SentAlarm> getAlarms(List<Long> alarmIds) throws IllegalArgumentException Retrieves the details of existing alarms if the given user has access to the alarm realms.- Throws:
IllegalArgumentException
-
getAlarms
public List<org.openremote.model.alarm.SentAlarm> getAlarms(String realm, org.openremote.model.alarm.Alarm.Status status, String assetId, String assigneeId) throws IllegalArgumentException Retrieves all existing alarms in a realm. Thestatus,assetIdandassigneeIdparameters are optional and if non-null are used for filtering the alarms.- Throws:
IllegalArgumentException
-
removeAlarm
public void removeAlarm(org.openremote.model.alarm.SentAlarm alarm) Removes an existing alarm if the given user has access to the alarm realm. -
removeAlarms
public void removeAlarms(List<org.openremote.model.alarm.SentAlarm> alarms, List<Long> alarmIds) throws IllegalArgumentException Removes existing alarms if the given user has access to the alarm realms.- Throws:
IllegalArgumentException
-