Class InMemoryAlertEntityDao

java.lang.Object
com.atlassian.diagnostics.internal.dao.InMemoryAlertEntityDao
All Implemented Interfaces:
AlertEntityDao

public class InMemoryAlertEntityDao extends Object implements AlertEntityDao
Simple implementation that's used for ref-app and validating the sanity of the DAO contract
  • Constructor Details

    • InMemoryAlertEntityDao

      public InMemoryAlertEntityDao()
  • Method Details

    • deleteAll

      public void deleteAll(@Nonnull AlertCriteria criteria)
      Description copied from interface: AlertEntityDao
      Deletes all alerts matching the supplied criteria.
      Specified by:
      deleteAll in interface AlertEntityDao
      Parameters:
      criteria - to use when choosing which alerts to delete
    • findAllComponentIds

      public Set<String> findAllComponentIds()
      Specified by:
      findAllComponentIds in interface AlertEntityDao
      Returns:
      all component IDs that any alert entity refers to
    • findAllIssueIds

      public Map<String,Severity> findAllIssueIds()
      Specified by:
      findAllIssueIds in interface AlertEntityDao
      Returns:
      all issue IDs that any alert entity refers to, with the corresponding severity
    • findAllNodeNames

      public Set<String> findAllNodeNames()
      Specified by:
      findAllNodeNames in interface AlertEntityDao
      Returns:
      all node names that any alert entity refers to
    • findAllPluginKeys

      public Set<String> findAllPluginKeys()
      Specified by:
      findAllPluginKeys in interface AlertEntityDao
      Returns:
      all plugin keys that any alert entity refers to (including DiagnosticsConstants.PLUGIN_NOT_DETECTED_KEY)
    • getById

      public AlertEntity getById(long id)
      Description copied from interface: AlertEntityDao
      Retrieves an alert entity by the specified ID
      Specified by:
      getById in interface AlertEntityDao
      Parameters:
      id - the alert ID
      Returns:
      the matching entity, or null if no matching entity was found
    • save

      @Nonnull public AlertEntity save(@Nonnull Alert alert)
      Description copied from interface: AlertEntityDao
      Stores 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:
      save in interface AlertEntityDao
      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: AlertEntityDao
      Streams all alerts matching the supplied criteria ordered by timestamp (descending), then ID (descending) until the callback signals that it's done or until no more matching alerts are found.

      The start offset on 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 start is specified on the page request.

      Specified by:
      streamAll in interface AlertEntityDao
      Parameters:
      criteria - request describing which alerts to retrieve
      callback - the callback to use when streaming matching alerts (including extras) from the data store
      pageRequest - request describing which page of results to return
    • streamByIds

      public void streamByIds(@Nonnull Collection<Long> ids, @Nonnull RowCallback<AlertEntity> callback)
      Description copied from interface: AlertEntityDao
      Streams all alerts matching the supplied IDs ordered by timestamp (descending), then ID (descending) until the callback signals that 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:
      streamByIds in interface AlertEntityDao
      Parameters:
      ids - the IDs of the alerts to retrieve
      callback - 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: AlertEntityDao
      Streams alert metrics for all alerts matching the supplied criteria ordered by timestamp (descending) until the callback signals that it's done or all available metrics have been provided.
      Specified by:
      streamMetrics in interface AlertEntityDao
      Parameters:
      criteria - the criteria to use when choosing which alerts to stream
      callback - 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: AlertEntityDao
      Streams minimal alerts matching the supplied criteria ordered by timestamp (descending), then ID (descending) until the callback signals that it's done or until no more matching alerts are found.

      The start offset on 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 start is specified on the page request.

      Specified by:
      streamMinimalAlerts in interface AlertEntityDao
      Parameters:
      criteria - request describing which alerts to retrieve
      callback - the callback to use when streaming matching alerts (including extras) from the data store
      pageRequest - request describing which page of results to return