Package com.atlassian.bamboo.persister
Class DefaultAuditLogService
java.lang.Object
com.atlassian.bamboo.persister.DefaultAuditLogService
- All Implemented Interfaces:
AuditLogService
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.atlassian.bamboo.persister.AuditLogService
AuditLogService.FieldChange -
Constructor Summary
ConstructorsConstructorDescriptionDefaultAuditLogService(AuditLogDao auditLogDao, BambooAuthenticationContext authenticationContext, AdministrationConfigurationAccessor administrationConfigurationAccessor, AdministrationConfigurationPersister administrationConfigurationPersister) -
Method Summary
Modifier and TypeMethodDescriptionlongcountAuditLogMessagesForEntity(@NotNull String entityId, @Nullable AuditLogEntityType entityType, long startDate, long endDate, @Nullable String searchTerm) Count audit log messages for entity in a given time period and with the requested searchTermlongcountAuditLogMessagesForEntity(@NotNull String entityId, AuditLogEntityType entityType, long startDate, long endDate) Count audit log messages for entity in a given time periodlongcountAuditLogMessagesForPlan(@NotNull ImmutablePlan plan) Count audit log messages for planlongcountAuditLogMessagesForPlan(@NotNull ImmutablePlan plan, long startDate, long endDate) Count audit log messages for plan in a given time periodlongcountAuditLogMessagesForPlan(@NotNull ImmutablePlan plan, long startDate, long endDate, @Nullable String searchTerm) Count audit log messages for plan in a given time period and with the requested searchTermlongCount global audit log messages.longcountGlobalAuditLogMessages(@Nullable String searchTerm) Count global audit log messages.voidDisables audit log during setup importgetAgentAuditLogsMessagesByAgentName(String agentName) Provide a list of audit log messages filter by Agent NamegetAgentAuditLogsMessagesByAgentName(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, @Nullable String searchTerm) Provide a paginated list of all audit log messages written against an entity between input dates and requested search term.getAuditLogMessagesForEntity(@NotNull String entityId, AuditLogEntityType entityType, long startDate, long endDate, int firstResult, int maxResults) Provide a paginated list of all audit log messages written against an entity between input dates.getAuditLogMessagesForPlan(@NotNull ImmutablePlan plan, long startDate, long endDate, int firstResult, int maxResults) Provide a paginated list of all audit log messages written against a plan between input dates.getAuditLogMessagesForPlan(@NotNull ImmutablePlan plan, long startDate, long endDate, int firstResult, int maxResults, @Nullable String searchTerm) Provide a paginated list of all audit log messages written against a plan between input dates and requested search term.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.booleanhasAuditLogMessagesForPlan(@NotNull ImmutablePlan plan, long startDate, long endDate) Determine whether any log messages have been recorded against the specified plan between the startDate and endDate (inclusive).booleanReturns whether logging is enabledbooleanvoidlog(@NotNull AuditLogEntry msg) Add a log to the audit log.voidlog(@NotNull Iterable<AuditLogService.FieldChange> changes, @Nullable AuditLogEntity entity) Add 'field change' messages to the system audit log.voidlog(@NotNull Iterable<AuditLogService.FieldChange> changes, @Nullable String entityId, @Nullable AuditLogEntityType entityType, @Nullable String childKey, @Nullable AuditLogEntity entity) voidAdd a message to the system audit log.voidlog(@NotNull String msg, @Nullable Key key, AuditLogEntityType entityType) Add a message to the plans audit log.voidlog(@NotNull String msg, @Nullable Key key, AuditLogEntityType entityType, @Nullable AuditLogEntity entity) Add a message to the entity's audit log.voidlog(@NotNull String fieldName, @Nullable String oldValue, @Nullable String newValue, @Nullable Key plan) Add 'field change' message to the system audit log.voidlog(@NotNull String fieldName, @Nullable String oldValue, @Nullable String newValue, @Nullable Key key, @Nullable AuditLogEntityType entityType, @Nullable AuditLogEntity entity) Add 'field change' message to the system audit log.voidlog(@NotNull Collection<AuditLogService.FieldChange> changes, @Nullable Key key) Add 'field change' messages to the system audit log.voidAdd a message to the system audit log.voidlog(@Nullable com.atlassian.user.User user, @NotNull String msg, @Nullable Key key, AuditLogEntityType entityType) Add a message to the entity's audit log.voidlog(@Nullable com.atlassian.user.User user, @NotNull String msg, @Nullable Key key, AuditLogEntityType entityType, @Nullable AuditLogEntity entity) Add a message to the plans audit log.voidlog(@Nullable String username, @NotNull String msg, @Nullable Key key, @Nullable AuditLogEntityType entityType, @Nullable AuditLogEntity field) voidlog(@Nullable String username, @NotNull String msg, @Nullable Key key, AuditLogEntityType entityType) voidSynch service state with stored configurationvoidDeletes all log messages in the databasevoidremoveAuditLogMessagesByTypeAndEntityId(@NotNull String entityId, @Nullable AuditLogEntityType entityType) voidremoveAuditLogMessagesForPlan(@NotNull ImmutablePlan plan) Deletes all log messages for a given planvoidDeletes all Global audit log messagesvoidsetEnabled(boolean enabled) sets whether logging is enabled or notvoidsetRssUpdatedLog(Boolean isRss) sets whether logging is for RSS update.
-
Constructor Details
-
DefaultAuditLogService
public DefaultAuditLogService(AuditLogDao auditLogDao, BambooAuthenticationContext authenticationContext, AdministrationConfigurationAccessor administrationConfigurationAccessor, AdministrationConfigurationPersister administrationConfigurationPersister)
-
-
Method Details
-
log
Description copied from interface:AuditLogServiceAdd a log to the audit log.- Specified by:
login interfaceAuditLogService- Parameters:
msg- (fully populated) to be logged
-
log
Description copied from interface:AuditLogServiceAdd a message to the system audit log. Message will be logged against the user that is currently set in the authentication context.- Specified by:
login interfaceAuditLogService- Parameters:
msg- the text of the message to add.
-
log
Description copied from interface:AuditLogServiceAdd a message to the system audit log. Message will be logged against the current logged in user (if available)- Specified by:
login interfaceAuditLogService- Parameters:
user- who caused the event being loggedmsg- the text of the message to add.
-
log
public void log(@NotNull @NotNull String msg, @Nullable @Nullable Key key, AuditLogEntityType entityType) Description copied from interface:AuditLogServiceAdd a message to the plans audit log. Message will be logged against the current logged in user (if available)- Specified by:
login interfaceAuditLogService- Parameters:
msg- to logkey- to log it against
-
log
public void log(@NotNull @NotNull String msg, @Nullable @Nullable Key key, AuditLogEntityType entityType, @Nullable @Nullable AuditLogEntity entity) Description copied from interface:AuditLogServiceAdd a message to the entity's audit log. Message will be logged against the current logged in user (if available)- Specified by:
login interfaceAuditLogService- Parameters:
msg- to logkey- to log it againstentity- job's task, chain' stage etc. to log against
-
log
public void log(@Nullable @Nullable com.atlassian.user.User user, @NotNull @NotNull String msg, @Nullable @Nullable Key key, AuditLogEntityType entityType) Description copied from interface:AuditLogServiceAdd a message to the entity's audit log. Message will be logged against provided user- Specified by:
login interfaceAuditLogService- Parameters:
user- who caused the event being loggedmsg- to be loggedkey- to log the message against.
-
log
public void log(@Nullable @Nullable com.atlassian.user.User user, @NotNull @NotNull String msg, @Nullable @Nullable Key key, AuditLogEntityType entityType, @Nullable @Nullable AuditLogEntity entity) Description copied from interface:AuditLogServiceAdd a message to the plans audit log. Message will be logged against provided user- Specified by:
login interfaceAuditLogService- Parameters:
user- who caused the event being loggedmsg- to be loggedkey- to log the message against.entity- header of job's task, chain' stage etc. to log against
-
log
public void log(@Nullable @Nullable String username, @NotNull @NotNull String msg, @Nullable @Nullable Key key, AuditLogEntityType entityType) -
log
public void log(@Nullable @Nullable String username, @NotNull @NotNull String msg, @Nullable @Nullable Key key, @Nullable @Nullable AuditLogEntityType entityType, @Nullable @Nullable AuditLogEntity field) -
getAuditLogMessagesForPlan
public List<AuditLogEntry> getAuditLogMessagesForPlan(@NotNull @NotNull ImmutablePlan plan, long startDate, long endDate, int firstResult, int maxResults) Description copied from interface:AuditLogServiceProvide a paginated list of all audit log messages written against a plan between input dates.- Specified by:
getAuditLogMessagesForPlanin interfaceAuditLogService- Parameters:
plan- to find audit messages forstartDate- 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 end- Returns:
- List of audit log entries for the given plan
-
getAuditLogMessagesForPlan
public List<AuditLogEntry> getAuditLogMessagesForPlan(@NotNull @NotNull ImmutablePlan plan, long startDate, long endDate, int firstResult, int maxResults, @Nullable @Nullable String searchTerm) Description copied from interface:AuditLogServiceProvide a paginated list of all audit log messages written against a plan between input dates and requested search term.- Specified by:
getAuditLogMessagesForPlanin interfaceAuditLogService- Parameters:
plan- to find audit messages forstartDate- 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 plan
-
getAuditLogMessagesForEntity
public List<AuditLogEntry> getAuditLogMessagesForEntity(@NotNull @NotNull String entityId, AuditLogEntityType entityType, long startDate, long endDate, int firstResult, int maxResults) Description copied from interface:AuditLogServiceProvide a paginated list of all audit log messages written against an entity between input dates.- Specified by:
getAuditLogMessagesForEntityin interfaceAuditLogService- 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 end- Returns:
- List of audit log entries for the given entity
-
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:AuditLogServiceProvide a paginated list of all audit log messages written against an entity between input dates and requested search term.- Specified by:
getAuditLogMessagesForEntityin interfaceAuditLogService- 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
-
hasAuditLogMessagesForPlan
public boolean hasAuditLogMessagesForPlan(@NotNull @NotNull ImmutablePlan plan, long startDate, long endDate) Description copied from interface:AuditLogServiceDetermine whether any log messages have been recorded against the specified plan between the startDate and endDate (inclusive). This is equivalent to but usually faster than checking the emptiness ofAuditLogService.getAuditLogMessagesForPlan(ImmutablePlan, long, long, int, int).- Specified by:
hasAuditLogMessagesForPlanin interfaceAuditLogServicestartDate- 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.
-
removeAuditLogMessagesForPlan
Description copied from interface:AuditLogServiceDeletes all log messages for a given plan- Specified by:
removeAuditLogMessagesForPlanin interfaceAuditLogService- Parameters:
plan- to delete messages for
-
removeAuditLogMessagesByTypeAndEntityId
public void removeAuditLogMessagesByTypeAndEntityId(@NotNull @NotNull String entityId, @Nullable @Nullable AuditLogEntityType entityType) - Specified by:
removeAuditLogMessagesByTypeAndEntityIdin interfaceAuditLogService
-
removeGlobalAuditLogMessages
public void removeGlobalAuditLogMessages()Description copied from interface:AuditLogServiceDeletes all Global audit log messages- Specified by:
removeGlobalAuditLogMessagesin interfaceAuditLogService
-
removeAllAuditLogMessages
public void removeAllAuditLogMessages()Description copied from interface:AuditLogServiceDeletes all log messages in the database- Specified by:
removeAllAuditLogMessagesin interfaceAuditLogService
-
getGlobalAuditLogMessages
Description copied from interface:AuditLogServiceProvide a page of a list of all audit log messages written against the system.- Specified by:
getGlobalAuditLogMessagesin interfaceAuditLogService- 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:AuditLogServiceProvide a page of a list of all audit log messages written against the system filtered by delivered searchTerm.- Specified by:
getGlobalAuditLogMessagesin interfaceAuditLogServicesearchTerm- 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:AuditLogServiceCount global audit log messages.- Specified by:
countGlobalAuditLogMessagesin interfaceAuditLogService- Returns:
- number of potential results
-
countGlobalAuditLogMessages
Description copied from interface:AuditLogServiceCount global audit log messages.- Specified by:
countGlobalAuditLogMessagesin interfaceAuditLogService- Parameters:
searchTerm- the phrase against which the results will be counted- Returns:
- number of potential results
-
countAuditLogMessagesForPlan
Description copied from interface:AuditLogServiceCount audit log messages for plan- Specified by:
countAuditLogMessagesForPlanin interfaceAuditLogService
-
countAuditLogMessagesForPlan
public long countAuditLogMessagesForPlan(@NotNull @NotNull ImmutablePlan plan, long startDate, long endDate) Description copied from interface:AuditLogServiceCount audit log messages for plan in a given time period- Specified by:
countAuditLogMessagesForPlanin interfaceAuditLogService
-
countAuditLogMessagesForPlan
public long countAuditLogMessagesForPlan(@NotNull @NotNull ImmutablePlan plan, long startDate, long endDate, @Nullable @Nullable String searchTerm) Description copied from interface:AuditLogServiceCount audit log messages for plan in a given time period and with the requested searchTerm- Specified by:
countAuditLogMessagesForPlanin interfaceAuditLogService
-
countAuditLogMessagesForEntity
public long countAuditLogMessagesForEntity(@NotNull @NotNull String entityId, AuditLogEntityType entityType, long startDate, long endDate) Description copied from interface:AuditLogServiceCount audit log messages for entity in a given time period- Specified by:
countAuditLogMessagesForEntityin interfaceAuditLogService
-
countAuditLogMessagesForEntity
public long countAuditLogMessagesForEntity(@NotNull @NotNull String entityId, @Nullable @Nullable AuditLogEntityType entityType, long startDate, long endDate, @Nullable @Nullable String searchTerm) Description copied from interface:AuditLogServiceCount audit log messages for entity in a given time period and with the requested searchTerm- Specified by:
countAuditLogMessagesForEntityin interfaceAuditLogService
-
log
public void log(@NotNull @NotNull Collection<AuditLogService.FieldChange> changes, @Nullable @Nullable Key key) Description copied from interface:AuditLogServiceAdd 'field change' messages to the system audit log. The messages will be logged against the user that is currently set in the authentication context. If key is not null the message will be logged against the given entity.- Specified by:
login interfaceAuditLogService
-
log
public void log(@NotNull @NotNull Iterable<AuditLogService.FieldChange> changes, @Nullable @Nullable String entityId, @Nullable @Nullable AuditLogEntityType entityType, @Nullable @Nullable String childKey, @Nullable @Nullable AuditLogEntity entity) - Specified by:
login interfaceAuditLogService
-
log
public void log(@NotNull @NotNull Iterable<AuditLogService.FieldChange> changes, @Nullable @Nullable AuditLogEntity entity) Description copied from interface:AuditLogServiceAdd 'field change' messages to the system audit log. The messages will be logged against the user that is currently set in the authentication context. The message will be logged with the given entity type.- Specified by:
login interfaceAuditLogService
-
log
public void log(@NotNull @NotNull String fieldName, @Nullable @Nullable String oldValue, @Nullable @Nullable String newValue, @Nullable @Nullable Key plan) Description copied from interface:AuditLogServiceAdd 'field change' message to the system audit log. The messages will be logged against the user that is currently set in the authentication context. If plan key is not null the message will be logged against the given plan.- Specified by:
login interfaceAuditLogService
-
log
public void log(@NotNull @NotNull String fieldName, @Nullable @Nullable String oldValue, @Nullable @Nullable String newValue, @Nullable @Nullable Key key, @Nullable @Nullable AuditLogEntityType entityType, @Nullable @Nullable AuditLogEntity entity) Description copied from interface:AuditLogServiceAdd 'field change' message to the system audit log. The messages will be logged against the user that is currently set in the authentication context. If plan key is not null the message will be logged against the given plan.- Specified by:
login interfaceAuditLogServiceentity- job's task or chain's stage affected by the change
-
isEnabled
public boolean isEnabled()Description copied from interface:AuditLogServiceReturns whether logging is enabled- Specified by:
isEnabledin interfaceAuditLogService
-
setEnabled
public void setEnabled(boolean enabled) Description copied from interface:AuditLogServicesets whether logging is enabled or not- Specified by:
setEnabledin interfaceAuditLogService
-
disableAuditLogForSetupImport
public void disableAuditLogForSetupImport()Description copied from interface:AuditLogServiceDisables audit log during setup import- Specified by:
disableAuditLogForSetupImportin interfaceAuditLogService
-
reloadConfiguration
public void reloadConfiguration()Description copied from interface:AuditLogServiceSynch service state with stored configuration- Specified by:
reloadConfigurationin interfaceAuditLogService
-
getAgentAuditLogsMessagesByAgentName
Description copied from interface:AuditLogServiceProvide a list of audit log messages filter by Agent Name- Specified by:
getAgentAuditLogsMessagesByAgentNamein interfaceAuditLogService- 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:AuditLogServiceProvide a list of audit log messages filter by Agent Name and the Search Term.- Specified by:
getAgentAuditLogsMessagesByAgentNamein interfaceAuditLogService- 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.
-
isRssUpdatedLog
public boolean isRssUpdatedLog()- Specified by:
isRssUpdatedLogin interfaceAuditLogService- Returns:
- whether logging is for RSS update.
-
setRssUpdatedLog
Description copied from interface:AuditLogServicesets whether logging is for RSS update.- Specified by:
setRssUpdatedLogin interfaceAuditLogService
-