Package com.atlassian.bamboo.persister
Interface AuditLogService
- All Known Implementing Classes:
DefaultAuditLogService
public interface AuditLogService
Service allowing you to register audit messages against the system or against plans. Audit messages allow you to
track changes to configuration.
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic interface
Simple interface that provides information about a changed field. -
Method Summary
Modifier and TypeMethodDescriptionlong
countAuditLogMessagesForEntity
(@NotNull String entityId, @Nullable AuditLogEntityType entityType, long startDate, long endDate) Count audit log messages for entity in a given time periodlong
countAuditLogMessagesForEntity
(@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 searchTermlong
countAuditLogMessagesForPlan
(@NotNull ImmutablePlan plan) Count audit log messages for planlong
countAuditLogMessagesForPlan
(@NotNull ImmutablePlan plan, long startDate, long endDate) Count audit log messages for plan in a given time periodlong
countAuditLogMessagesForPlan
(@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 searchTermlong
Count global audit log messages.long
countGlobalAuditLogMessages
(@Nullable String searchTerm) Count global audit log messages.getAgentAuditLogsMessagesByAgentName
(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) Provide a paginated list of all audit log messages written against an entity between input dates.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
(@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.boolean
hasAuditLogMessagesForPlan
(@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).boolean
Returns whether logging is enabledboolean
void
log
(@NotNull AuditLogEntry msg) Add a log to the audit log.void
log
(@NotNull Iterable<AuditLogService.FieldChange> changes, @Nullable AuditLogEntity entity) Add 'field change' messages to the system audit log.void
log
(@NotNull Iterable<AuditLogService.FieldChange> changes, @Nullable String entityId, AuditLogEntityType entityType, @Nullable String childKey, @Nullable AuditLogEntity entity) void
Add a message to the system audit log.void
log
(@NotNull String s, @Nullable Key key, @Nullable AuditLogEntityType entityType, @Nullable AuditLogEntity entity) Add a message to the entity's audit log.void
log
(@NotNull String msg, @Nullable Key key, AuditLogEntityType entityType) Add a message to the plans audit log.void
log
(@NotNull String fieldName, @Nullable String oldValue, @Nullable String newValue, @Nullable Key plan) Add 'field change' message to the system audit log.void
log
(@NotNull String fieldName, @Nullable String oldValue, @Nullable String newValue, @Nullable Key key, AuditLogEntityType entityType, @Nullable AuditLogEntity entity) Add 'field change' message to the system audit log.void
log
(@NotNull Collection<AuditLogService.FieldChange> changes, @Nullable Key key) Add 'field change' messages to the system audit log.void
Add a message to the system audit log.void
log
(@Nullable com.atlassian.user.User user, @NotNull String msg, @Nullable Key key, @Nullable AuditLogEntityType entityType) Add a message to the entity's audit log.void
log
(@Nullable com.atlassian.user.User user, @NotNull String msg, @Nullable Key key, @Nullable AuditLogEntityType entityType, @Nullable AuditLogEntity entity) Add a message to the plans audit log.void
Deletes all log messages in the databasevoid
removeAuditLogMessagesByTypeAndEntityId
(@NotNull String entityId, @Nullable AuditLogEntityType entityType) void
removeAuditLogMessagesForPlan
(@NotNull ImmutablePlan plan) Deletes all log messages for a given planvoid
Deletes all Global audit log messagesvoid
setEnabled
(boolean enabled) sets whether logging is enabled or notvoid
setRssUpdatedLog
(Boolean isRss) sets whether logging is for RSS update.
-
Method Details
-
log
Add a log to the audit log.- Parameters:
msg
- (fully populated) to be logged
-
log
Add a message to the system audit log. Message will be logged against the user that is currently set in the authentication context.- Parameters:
msg
- the text of the message to add.
-
log
void log(@NotNull @NotNull Collection<AuditLogService.FieldChange> changes, @Nullable @Nullable Key key) Add '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. -
log
void log(@NotNull @NotNull Iterable<AuditLogService.FieldChange> changes, @Nullable @Nullable String entityId, AuditLogEntityType entityType, @Nullable @Nullable String childKey, @Nullable @Nullable AuditLogEntity entity) -
log
void log(@NotNull @NotNull Iterable<AuditLogService.FieldChange> changes, @Nullable @Nullable AuditLogEntity entity) Add '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. -
log
void log(@NotNull @NotNull String fieldName, @Nullable @Nullable String oldValue, @Nullable @Nullable String newValue, @Nullable @Nullable Key plan) Add '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. -
log
void log(@NotNull @NotNull String fieldName, @Nullable @Nullable String oldValue, @Nullable @Nullable String newValue, @Nullable @Nullable Key key, AuditLogEntityType entityType, @Nullable @Nullable AuditLogEntity entity) Add '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.- Parameters:
entity
- job's task or chain's stage affected by the change
-
log
Add a message to the system audit log. Message will be logged against the current logged in user (if available)- Parameters:
user
- who caused the event being loggedmsg
- the text of the message to add.
-
log
Add a message to the plans audit log. Message will be logged against the current logged in user (if available)- Parameters:
msg
- to logkey
- to log it against
-
log
void log(@NotNull @NotNull String s, @Nullable @Nullable Key key, @Nullable @Nullable AuditLogEntityType entityType, @Nullable @Nullable AuditLogEntity entity) Add a message to the entity's audit log. Message will be logged against the current logged in user (if available)- Parameters:
s
- to logkey
- to log it againstentity
- job's task, chain' stage etc. to log against
-
log
void log(@Nullable @Nullable com.atlassian.user.User user, @NotNull @NotNull String msg, @Nullable @Nullable Key key, @Nullable @Nullable AuditLogEntityType entityType) Add a message to the entity's audit log. Message will be logged against provided user- Parameters:
user
- who caused the event being loggedmsg
- to be loggedkey
- to log the message against.
-
log
void log(@Nullable @Nullable com.atlassian.user.User user, @NotNull @NotNull String msg, @Nullable @Nullable Key key, @Nullable @Nullable AuditLogEntityType entityType, @Nullable @Nullable AuditLogEntity entity) Add a message to the plans audit log. Message will be logged against provided user- 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
-
getAuditLogMessagesForPlan
List<AuditLogEntry> getAuditLogMessagesForPlan(@NotNull @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.- 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
@ExperimentalApi List<AuditLogEntry> getAuditLogMessagesForPlan(@NotNull @NotNull ImmutablePlan plan, long startDate, long endDate, int firstResult, int maxResults, @Nullable @Nullable String searchTerm) Provide a paginated list of all audit log messages written against a plan between input dates and requested search term.- 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
- Since:
- 9.1
-
getAgentAuditLogsMessagesByAgentName
Provide a list of audit log messages filter by Agent Name- Parameters:
agentName
- the name of the agent- Returns:
- List of audit log entries for the given Agent Name
-
getAgentAuditLogsMessagesByAgentName
@ExperimentalApi List<AuditLogEntry> getAgentAuditLogsMessagesByAgentName(String agentName, @Nullable @Nullable String searchTerm) Provide a list of audit log messages filter by Agent Name and the Search Term.- 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.
- Since:
- 9.1
-
getGlobalAuditLogMessages
Provide a page of a list of all audit log messages written against the system.- Returns:
- a list of audit log entries for the system
-
getGlobalAuditLogMessages
@ExperimentalApi List<AuditLogEntry> getGlobalAuditLogMessages(int firstResult, int maxResults, @Nullable @Nullable String searchTerm) Provide a page of a list of all audit log messages written against the system filtered by delivered searchTerm.- Parameters:
firstResult
-maxResults
-searchTerm
- the phrase against which the search will be made- Returns:
- a list of audit log entries for the system
- Since:
- 9.1
-
countGlobalAuditLogMessages
long countGlobalAuditLogMessages()Count global audit log messages.- Returns:
- number of potential results
-
countGlobalAuditLogMessages
Count global audit log messages.- Parameters:
searchTerm
- the phrase against which the results will be counted- Returns:
- number of potential results
- Since:
- 9.1
-
countAuditLogMessagesForPlan
Count audit log messages for plan -
countAuditLogMessagesForPlan
long countAuditLogMessagesForPlan(@NotNull @NotNull ImmutablePlan plan, long startDate, long endDate) Count audit log messages for plan in a given time period -
countAuditLogMessagesForPlan
@ExperimentalApi long countAuditLogMessagesForPlan(@NotNull @NotNull ImmutablePlan plan, long startDate, long endDate, @Nullable @Nullable String searchTerm) Count audit log messages for plan in a given time period and with the requested searchTerm- Since:
- 9.1
-
countAuditLogMessagesForEntity
long countAuditLogMessagesForEntity(@NotNull @NotNull String entityId, @Nullable @Nullable AuditLogEntityType entityType, long startDate, long endDate) Count audit log messages for entity in a given time period -
countAuditLogMessagesForEntity
@ExperimentalApi long countAuditLogMessagesForEntity(@NotNull @NotNull String entityId, @Nullable @Nullable AuditLogEntityType entityType, long startDate, long endDate, @Nullable @Nullable String searchTerm) Count audit log messages for entity in a given time period and with the requested searchTerm- Since:
- 9.1
-
removeGlobalAuditLogMessages
void removeGlobalAuditLogMessages()Deletes all Global audit log messages -
hasAuditLogMessagesForPlan
boolean hasAuditLogMessagesForPlan(@NotNull @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). This is equivalent to but usually faster than checking the emptiness ofgetAuditLogMessagesForPlan(ImmutablePlan, long, long, int, int)
.- Parameters:
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.
-
removeAuditLogMessagesForPlan
Deletes all log messages for a given plan- Parameters:
plan
- to delete messages for
-
removeAuditLogMessagesByTypeAndEntityId
void removeAuditLogMessagesByTypeAndEntityId(@NotNull @NotNull String entityId, @Nullable @Nullable AuditLogEntityType entityType) -
removeAllAuditLogMessages
void removeAllAuditLogMessages()Deletes all log messages in the database -
isEnabled
boolean isEnabled()Returns whether logging is enabled -
setEnabled
void setEnabled(boolean enabled) sets whether logging is enabled or not -
getAuditLogMessagesForEntity
@ExperimentalApi List<AuditLogEntry> getAuditLogMessagesForEntity(@NotNull @NotNull String entityId, @Nullable @Nullable AuditLogEntityType entityType, long startDate, long endDate, int firstResult, int maxResults, @Nullable @Nullable String searchTerm) Provide a paginated list of all audit log messages written against an entity between input dates and requested search term.- 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
- Since:
- 9.1
-
getAuditLogMessagesForEntity
List<AuditLogEntry> getAuditLogMessagesForEntity(@NotNull @NotNull String entityId, @Nullable @Nullable 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.- 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
-
isRssUpdatedLog
boolean isRssUpdatedLog()- Returns:
- whether logging is for RSS update.
-
setRssUpdatedLog
sets whether logging is for RSS update.
-