Class InMemoryAlertEntityDao
java.lang.Object
com.atlassian.diagnostics.internal.dao.InMemoryAlertEntityDao
- All Implemented Interfaces:
AlertEntityDao
Simple implementation that's used for ref-app and validating the sanity of the DAO contract
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddeleteAll(AlertCriteria criteria) getById(long id) Retrieves an alert entity by the specified IDStores an alert.voidstreamAll(AlertCriteria criteria, RowCallback<AlertEntity> callback, PageRequest pageRequest) voidstreamByIds(Collection<Long> ids, RowCallback<AlertEntity> callback) voidstreamMetrics(AlertCriteria criteria, RowCallback<AlertMetric> callback, PageRequest pageRequest) Streamsalert metricsfor allalertsmatching the suppliedcriteriaordered by timestamp (descending) until the callbacksignalsthat it's done or all available metrics have been provided.voidstreamMinimalAlerts(AlertCriteria criteria, RowCallback<MinimalAlertEntity> callback, PageRequest pageRequest) Streamsminimal alertsmatching the suppliedcriteriaordered by timestamp (descending), then ID (descending) until the callbacksignalsthat it's done or until no more matching alerts are found.
-
Constructor Details
-
InMemoryAlertEntityDao
public InMemoryAlertEntityDao()
-
-
Method Details
-
deleteAll
Description copied from interface:AlertEntityDao- Specified by:
deleteAllin interfaceAlertEntityDao- Parameters:
criteria- to use when choosing which alerts to delete
-
findAllComponentIds
- Specified by:
findAllComponentIdsin interfaceAlertEntityDao- Returns:
- all component IDs that any alert entity refers to
-
findAllIssueIds
- Specified by:
findAllIssueIdsin interfaceAlertEntityDao- Returns:
- all issue IDs that any alert entity refers to, with the corresponding severity
-
findAllNodeNames
- Specified by:
findAllNodeNamesin interfaceAlertEntityDao- Returns:
- all node names that any alert entity refers to
-
findAllPluginKeys
- Specified by:
findAllPluginKeysin interfaceAlertEntityDao- Returns:
- all plugin keys that any alert entity refers to (including
DiagnosticsConstants.PLUGIN_NOT_DETECTED_KEY)
-
getById
Description copied from interface:AlertEntityDaoRetrieves an alert entity by the specified ID- Specified by:
getByIdin interfaceAlertEntityDao- Parameters:
id- the alert ID- Returns:
- the matching entity, or
nullif no matching entity was found
-
save
Description copied from interface:AlertEntityDaoStores an alert. This should only be used to store newly-created alerts. Supplying an already stored alert will yield undefined results but most likely will result in persisting a duplicate.- Specified by:
savein interfaceAlertEntityDao- Parameters:
alert- the alert to store- Returns:
- the persisted alert entity
-
streamAll
public void streamAll(@Nonnull AlertCriteria criteria, @Nonnull RowCallback<AlertEntity> callback, @Nonnull PageRequest pageRequest) Description copied from interface:AlertEntityDaoStreams allalertsmatching the suppliedcriteriaordered by timestamp (descending), then ID (descending) until the callbacksignalsthat it's done or until no more matching alerts are found.The
start offseton the page request refers to the row at which the requested page starts.For pagination purposes, implementations must attempt to retrieve one extra item following the page of data if an
startis specified on the page request.- Specified by:
streamAllin interfaceAlertEntityDao- Parameters:
criteria- request describing which alerts to retrievecallback- the callback to use when streaming matching alerts (including extras) from the data storepageRequest- request describing which page of results to return
-
streamByIds
Description copied from interface:AlertEntityDaoStreams allalertsmatching the supplied IDs ordered by timestamp (descending), then ID (descending) until the callbacksignalsthat it's done or until no more matching alerts are found.If a requested ID is not found, no error should be returned.
- Specified by:
streamByIdsin interfaceAlertEntityDao- Parameters:
ids- the IDs of thealertsto retrievecallback- the callback to use when streaming matching alerts from the data store
-
streamMetrics
public void streamMetrics(@Nonnull AlertCriteria criteria, @Nonnull RowCallback<AlertMetric> callback, @Nonnull PageRequest pageRequest) Description copied from interface:AlertEntityDaoStreamsalert metricsfor allalertsmatching the suppliedcriteriaordered by timestamp (descending) until the callbacksignalsthat it's done or all available metrics have been provided.- Specified by:
streamMetricsin interfaceAlertEntityDao- Parameters:
criteria- the criteria to use when choosing which alerts to streamcallback- the callback to use when streaming matching alerts from the data store
-
streamMinimalAlerts
public void streamMinimalAlerts(@Nonnull AlertCriteria criteria, @Nonnull RowCallback<MinimalAlertEntity> callback, @Nonnull PageRequest pageRequest) Description copied from interface:AlertEntityDaoStreamsminimal alertsmatching the suppliedcriteriaordered by timestamp (descending), then ID (descending) until the callbacksignalsthat it's done or until no more matching alerts are found.The
start offseton the page request refers to the row at which the requested page starts.For pagination purposes, implementations must attempt to retrieve one extra item following the page of data if an
startis specified on the page request.- Specified by:
streamMinimalAlertsin interfaceAlertEntityDao- Parameters:
criteria- request describing which alerts to retrievecallback- the callback to use when streaming matching alerts (including extras) from the data storepageRequest- request describing which page of results to return
-