Class AuditLogHibernateDao

java.lang.Object
org.springframework.dao.support.DaoSupport
org.springframework.orm.hibernate5.support.HibernateDaoSupport
All Implemented Interfaces:
BambooObjectDao<AuditLogEntry>, AuditLogDao, org.springframework.beans.factory.InitializingBean

public class AuditLogHibernateDao extends BambooHibernateObjectDao<AuditLogEntry> implements AuditLogDao
  • Constructor Details

    • AuditLogHibernateDao

      public AuditLogHibernateDao()
  • Method Details

    • getAuditLogMessagesForEntity

      public List<AuditLogEntry> getAuditLogMessagesForEntity(@NotNull @NotNull String entityId, @Nullable @Nullable AuditLogEntityType entityType, long startDate, long endDate, int firstResult, int maxResults)
      Specified by:
      getAuditLogMessagesForEntity in interface AuditLogDao
    • getAuditLogMessagesForEntity

      public List<AuditLogEntry> getAuditLogMessagesForEntity(@NotNull @NotNull String entityId, @Nullable @Nullable AuditLogEntityType entityType, long startDate, long endDate, int firstResult, int maxResults, @Nullable @Nullable String searchTerm)
      Description copied from interface: AuditLogDao
      Provide a paginated list of all audit log messages written against an entity between input dates and requested search term.
      Specified by:
      getAuditLogMessagesForEntity in interface AuditLogDao
      Parameters:
      entityId - to find audit messages for
      entityType - type of entity associated with the entityId
      startDate - if specified, messages before this date will be excluded. Represented as milliseconds after January 1, 1970 00:00:00 GMT. Passing 0 or a negative number will not set a start range.
      endDate - if specified, messages after this date will be excluded. Represented as milliseconds after January 1, 1970 00:00:00 GMT. Passing 0 or a negative number will not set an end range.
      firstResult - if specified marks a first item to be returned, passing 0 or negative number will effect with returning elements from the beginning
      maxResults - if specified marks a total number of items to be returned, passing 0 or negative number will effect with returning all elements until the end
      searchTerm - value against which the results are filtered out
      Returns:
      List of audit log entries for the given entity
    • countAuditLogMessagesForEntity

      public long countAuditLogMessagesForEntity(@NotNull @NotNull String entityId, AuditLogEntityType entityType, long startDate, long endDate)
      Description copied from interface: AuditLogDao
      Retrieve the number of audit log messages recorded against the specified entity between the startDate and endDate (inclusive). This is equivalent to but usually faster than checking the size of AuditLogDao.getAuditLogMessagesForPlan(ImmutablePlan, long, long, int, int).
      Specified by:
      countAuditLogMessagesForEntity in interface AuditLogDao
      startDate - only messages at or after this time will be retrieved. Represented as milliseconds after January 1, 1970 00:00:00 GMT. Passing 0 or a negative number will not set a start range.
      endDate - only messages at or before this time will be retrieved. Represented as milliseconds after January 1, 1970 00:00:00 GMT. Passing 0 or a negative number will not set an end range.
      Returns:
      the number of audit messages found. Always 0 or more.
    • countAuditLogMessagesForEntity

      public long countAuditLogMessagesForEntity(@NotNull @NotNull String entityId, @Nullable @Nullable AuditLogEntityType entityType, long startDate, long endDate, @Nullable @Nullable String searchTerm)
      Description copied from interface: AuditLogDao
      Retrieve the number of audit log messages recorded against the specified entity between the startDate and endDate (inclusive). This is equivalent to but usually faster than checking the size of AuditLogDao.getAuditLogMessagesForPlan(ImmutablePlan, long, long, int, int).
      Specified by:
      countAuditLogMessagesForEntity in interface AuditLogDao
      startDate - only messages at or after this time will be retrieved. Represented as milliseconds after January 1, 1970 00:00:00 GMT. Passing 0 or a negative number will not set a start range.
      endDate - only messages at or before this time will be retrieved. Represented as milliseconds after January 1, 1970 00:00:00 GMT. Passing 0 or a negative number will not set an end range.
      searchTerm - value against which the results are filtered out
      Returns:
      the number of audit messages found. Always 0 or more.
    • getGlobalAuditLogMessages

      public List<AuditLogEntry> getGlobalAuditLogMessages()
      Description copied from interface: AuditLogDao
      Provide a list of all audit log messages written against the system.
      Specified by:
      getGlobalAuditLogMessages in interface AuditLogDao
      Returns:
      a list of audit log entries for the system
    • getGlobalAuditLogMessages

      public List<AuditLogEntry> getGlobalAuditLogMessages(int firstResult, int maxResults)
      Description copied from interface: AuditLogDao
      Provide a page of a list of all audit log messages written against the system.
      Specified by:
      getGlobalAuditLogMessages in interface AuditLogDao
      Returns:
      a list of audit log entries for the system
    • getGlobalAuditLogMessages

      public List<AuditLogEntry> getGlobalAuditLogMessages(int firstResult, int maxResults, @Nullable @Nullable String searchTerm)
      Description copied from interface: AuditLogDao
      Provide a page of a list of all audit log messages written against the system filtered by delivered searchTerm.
      Specified by:
      getGlobalAuditLogMessages in interface AuditLogDao
      searchTerm - the phrase against which the search will be made
      Returns:
      a list of audit log entries for the system
    • countGlobalAuditLogMessages

      public long countGlobalAuditLogMessages()
      Description copied from interface: AuditLogDao
      Count global audit log messages.
      Specified by:
      countGlobalAuditLogMessages in interface AuditLogDao
      Returns:
      number of potential results
    • countGlobalAuditLogMessages

      public long countGlobalAuditLogMessages(@Nullable @Nullable String searchTerm)
      Description copied from interface: AuditLogDao
      Count global audit log messages.
      Specified by:
      countGlobalAuditLogMessages in interface AuditLogDao
      Parameters:
      searchTerm - the phrase against which the results will be counted
      Returns:
      number of potential results
    • getAgentAuditLogsMessagesByAgentName

      public List<AuditLogEntry> getAgentAuditLogsMessagesByAgentName(@NotNull @NotNull String agentName)
      Description copied from interface: AuditLogDao
      Provide a list of audit log messages filter by Agent Name.
      Specified by:
      getAgentAuditLogsMessagesByAgentName in interface AuditLogDao
      Parameters:
      agentName - the name of the agent
      Returns:
      List of audit log entries for the given Agent Name.
    • getAgentAuditLogsMessagesByAgentName

      public List<AuditLogEntry> getAgentAuditLogsMessagesByAgentName(String agentName, @Nullable @Nullable String searchTerm)
      Description copied from interface: AuditLogDao
      Provide a list of audit log messages filter by Agent Name and the Search Term.
      Specified by:
      getAgentAuditLogsMessagesByAgentName in interface AuditLogDao
      Parameters:
      agentName - the name of the agent
      searchTerm - the value searched in the Agent related audit log
      Returns:
      List of audit log entries for the given Agent Name and Search Term.
    • getAuditLogMessagesForPlan

      @Deprecated public List<AuditLogEntry> getAuditLogMessagesForPlan(ImmutablePlan plan, long startDate, long endDate, int firstResult, int maxResults)
      Deprecated.
      used only in tests
      Specified by:
      getAuditLogMessagesForPlan in interface AuditLogDao
    • deleteAllAuditLogMessages

      public void deleteAllAuditLogMessages()
      Description copied from interface: AuditLogDao
      Delete all audit logs
      Specified by:
      deleteAllAuditLogMessages in interface AuditLogDao
    • deleteAuditLogMessagesByTypeAndEntityId

      public void deleteAuditLogMessagesByTypeAndEntityId(String entityId, AuditLogEntityType entityType)
      Specified by:
      deleteAuditLogMessagesByTypeAndEntityId in interface AuditLogDao
    • findAll

      @NotNull public @NotNull Collection<? extends AuditLogEntry> findAll()
      Specified by:
      findAll in interface AuditLogDao
    • scrollAuditLogsForExport

      public long scrollAuditLogsForExport(Consumer<AuditLogEntry> consumer)
      Description copied from interface: AuditLogDao
      Scroll through all AuditLogEntry records and pass them to consumer
      Specified by:
      scrollAuditLogsForExport in interface AuditLogDao