Interface AlarmHistoryRepository
-
- All Known Implementing Classes:
ElasticAlarmHistoryRepository
public interface AlarmHistoryRepository
Provides methods for querying the alarm history.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.util.List<AlarmState>
getActiveAlarmsAt(long time)
Retrieves the last known state of alarms which were active (and not yet deleted) at the given time.java.util.List<AlarmState>
getActiveAlarmsNow()
Retrieves the last known state of alarms which are currently active (and not yet deleted).java.util.Optional<AlarmState>
getAlarmWithDbIdAt(long id, long time)
Retrieves the last known state of the alarm with the given database id, at or before the given time.java.util.Optional<AlarmState>
getAlarmWithReductionKeyIdAt(java.lang.String reductionKey, long time)
Similar togetAlarmWithDbIdAt(long, long)
, except the lookup is performed using the reduction key.java.util.List<AlarmState>
getLastStateOfAllAlarms(long start, long end)
Retrieves the last known state of all alarms which were recorded in the given time period.long
getNumActiveAlarmsAt(long time)
Retrieves the number of alarms which were active at the given time.long
getNumActiveAlarmsNow()
Retrieves the number of alarms which are currently active.java.util.List<AlarmState>
getStatesForAlarmWithDbId(long id)
Retrieves all the known states for the alarm with the given database id.java.util.List<AlarmState>
getStatesForAlarmWithReductionKey(java.lang.String reductionKey)
Retrieves all the known states for the alarm with the given database reduction key.
-
-
-
Method Detail
-
getAlarmWithDbIdAt
java.util.Optional<AlarmState> getAlarmWithDbIdAt(long id, long time)
Retrieves the last known state of the alarm with the given database id, at or before the given time. If the alarm was deleted at (or before) this time, the returned document will only include minimal information. To retrieve the complete state prior to the delete you can perform another call to this this function with a time less thanAlarmState.getDeletedTime()
.- Parameters:
id
- database id of the alarm to querytime
- timestamps in milliseconds- Returns:
- the last known state of the alarm, or an empty
Optional
if none was found
-
getAlarmWithReductionKeyIdAt
java.util.Optional<AlarmState> getAlarmWithReductionKeyIdAt(java.lang.String reductionKey, long time)
Similar togetAlarmWithDbIdAt(long, long)
, except the lookup is performed using the reduction key.- Parameters:
reductionKey
- reduction key of the alarm to querytime
- timestamps in milliseconds- Returns:
- the last known state of the alarm, or an empty
Optional
if none was found
-
getStatesForAlarmWithDbId
java.util.List<AlarmState> getStatesForAlarmWithDbId(long id)
Retrieves all the known states for the alarm with the given database id.- Parameters:
id
- database id of the alarm to query- Returns:
- all the known states for the alarm, or an empty list if none were found
-
getStatesForAlarmWithReductionKey
java.util.List<AlarmState> getStatesForAlarmWithReductionKey(java.lang.String reductionKey)
Retrieves all the known states for the alarm with the given database reduction key.- Parameters:
reductionKey
- reduction key of the alarm to query- Returns:
- all the known states for the alarm, or an empty list if none were found
-
getActiveAlarmsAt
java.util.List<AlarmState> getActiveAlarmsAt(long time)
Retrieves the last known state of alarms which were active (and not yet deleted) at the given time.- Parameters:
time
- timestamp in milliseconds- Returns:
- list of alarms
-
getLastStateOfAllAlarms
java.util.List<AlarmState> getLastStateOfAllAlarms(long start, long end)
Retrieves the last known state of all alarms which were recorded in the given time period.- Parameters:
start
- timestamp in milliseconds (inclusive)end
- timestamp in milliseconds (inclusive)- Returns:
- list of alarms
-
getNumActiveAlarmsAt
long getNumActiveAlarmsAt(long time)
Retrieves the number of alarms which were active at the given time.- Parameters:
time
- timestamp in milliseconds- Returns:
- number of active alarms
-
getActiveAlarmsNow
java.util.List<AlarmState> getActiveAlarmsNow()
Retrieves the last known state of alarms which are currently active (and not yet deleted).- Returns:
- list of alarms
-
getNumActiveAlarmsNow
long getNumActiveAlarmsNow()
Retrieves the number of alarms which are currently active.- Returns:
- number of active alarms
-
-