Package com.atlassian.bamboo.persister
Class AuditLogHibernateDao
java.lang.Object
org.springframework.dao.support.DaoSupport
org.springframework.orm.hibernate5.support.HibernateDaoSupport
com.atlassian.bamboo.persistence3.BambooHibernateObjectDao<AuditLogEntry>
com.atlassian.bamboo.persister.AuditLogHibernateDao
- All Implemented Interfaces:
BambooObjectDao<AuditLogEntry>,AuditLogDao,org.springframework.beans.factory.InitializingBean
public class AuditLogHibernateDao
extends BambooHibernateObjectDao<AuditLogEntry>
implements AuditLogDao
-
Field Summary
Fields inherited from class org.springframework.dao.support.DaoSupport
logger -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlongcountAuditLogMessagesForEntity(@NotNull String entityId, @Nullable AuditLogEntityType entityType, long startDate, long endDate, @Nullable String searchTerm) Retrieve the number of audit log messages recorded against the specified entity between the startDate and endDate (inclusive).longcountAuditLogMessagesForEntity(@NotNull String entityId, AuditLogEntityType entityType, long startDate, long endDate) Retrieve the number of audit log messages recorded against the specified entity between the startDate and endDate (inclusive).longCount global audit log messages.longcountGlobalAuditLogMessages(@Nullable String searchTerm) Count global audit log messages.voidDelete all audit logsvoiddeleteAuditLogMessagesByTypeAndEntityId(String entityId, AuditLogEntityType entityType) @NotNull Collection<? extends AuditLogEntry> findAll()getAgentAuditLogsMessagesByAgentName(@NotNull String agentName) Provide a list of audit log messages filter by Agent Name.getAgentAuditLogsMessagesByAgentName(String agentName, @Nullable String searchTerm) Provide a list of audit log messages filter by Agent Name and the Search Term.getAuditLogMessagesForEntity(@NotNull String entityId, @Nullable AuditLogEntityType entityType, long startDate, long endDate, int firstResult, int maxResults) getAuditLogMessagesForEntity(@NotNull String entityId, @Nullable AuditLogEntityType entityType, long startDate, long endDate, int firstResult, int maxResults, @Nullable String searchTerm) Provide a paginated list of all audit log messages written against an entity between input dates and requested search term.getAuditLogMessagesForPlan(ImmutablePlan plan, long startDate, long endDate, int firstResult, int maxResults) Deprecated.used only in testsProvide a list of all audit log messages written against the system.getGlobalAuditLogMessages(int firstResult, int maxResults) Provide a page of a list of all audit log messages written against the system.getGlobalAuditLogMessages(int firstResult, int maxResults, @Nullable String searchTerm) Provide a page of a list of all audit log messages written against the system filtered by delivered searchTerm.longscrollAuditLogsForExport(Consumer<AuditLogEntry> consumer) Scroll through all AuditLogEntry records and pass them to consumerMethods inherited from class com.atlassian.bamboo.persistence3.BambooHibernateObjectDao
convertSearchTermToLikeExpression, countAll, countWithRestriction, delete, deleteAll, executeCountQuery, findAll, findAll, findById, merge, save, saveAllMethods inherited from class org.springframework.orm.hibernate5.support.HibernateDaoSupport
checkDaoConfig, createHibernateTemplate, currentSession, getHibernateTemplate, getSessionFactory, setHibernateTemplate, setSessionFactoryMethods inherited from class org.springframework.dao.support.DaoSupport
afterPropertiesSet, initDao
-
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:
getAuditLogMessagesForEntityin interfaceAuditLogDao
-
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:AuditLogDaoProvide a paginated list of all audit log messages written against an entity between input dates and requested search term.- Specified by:
getAuditLogMessagesForEntityin interfaceAuditLogDao- Parameters:
entityId- to find audit messages forentityType- type of entity associated with the entityIdstartDate- 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 beginningmaxResults- if specified marks a total number of items to be returned, passing 0 or negative number will effect with returning all elements until the endsearchTerm- 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:AuditLogDaoRetrieve 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 ofAuditLogDao.getAuditLogMessagesForPlan(ImmutablePlan, long, long, int, int).- Specified by:
countAuditLogMessagesForEntityin interfaceAuditLogDao- Parameters:
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:AuditLogDaoRetrieve 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 ofAuditLogDao.getAuditLogMessagesForPlan(ImmutablePlan, long, long, int, int).- Specified by:
countAuditLogMessagesForEntityin interfaceAuditLogDao- Parameters:
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
Description copied from interface:AuditLogDaoProvide a list of all audit log messages written against the system.- Specified by:
getGlobalAuditLogMessagesin interfaceAuditLogDao- Returns:
- a list of audit log entries for the system
-
getGlobalAuditLogMessages
Description copied from interface:AuditLogDaoProvide a page of a list of all audit log messages written against the system.- Specified by:
getGlobalAuditLogMessagesin interfaceAuditLogDao- 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:AuditLogDaoProvide a page of a list of all audit log messages written against the system filtered by delivered searchTerm.- Specified by:
getGlobalAuditLogMessagesin interfaceAuditLogDao- Parameters:
firstResult-maxResults-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:AuditLogDaoCount global audit log messages.- Specified by:
countGlobalAuditLogMessagesin interfaceAuditLogDao- Returns:
- number of potential results
-
countGlobalAuditLogMessages
Description copied from interface:AuditLogDaoCount global audit log messages.- Specified by:
countGlobalAuditLogMessagesin interfaceAuditLogDao- Parameters:
searchTerm- the phrase against which the results will be counted- Returns:
- number of potential results
-
getAgentAuditLogsMessagesByAgentName
Description copied from interface:AuditLogDaoProvide a list of audit log messages filter by Agent Name.- Specified by:
getAgentAuditLogsMessagesByAgentNamein interfaceAuditLogDao- 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:AuditLogDaoProvide a list of audit log messages filter by Agent Name and the Search Term.- Specified by:
getAgentAuditLogsMessagesByAgentNamein interfaceAuditLogDao- Parameters:
agentName- the name of the agentsearchTerm- 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:
getAuditLogMessagesForPlanin interfaceAuditLogDao
-
deleteAllAuditLogMessages
public void deleteAllAuditLogMessages()Description copied from interface:AuditLogDaoDelete all audit logs- Specified by:
deleteAllAuditLogMessagesin interfaceAuditLogDao
-
deleteAuditLogMessagesByTypeAndEntityId
- Specified by:
deleteAuditLogMessagesByTypeAndEntityIdin interfaceAuditLogDao
-
findAll
- Specified by:
findAllin interfaceAuditLogDao
-
scrollAuditLogsForExport
Description copied from interface:AuditLogDaoScroll through all AuditLogEntry records and pass them to consumer- Specified by:
scrollAuditLogsForExportin interfaceAuditLogDao
-