public class DefaultAuditLogService extends Object implements AuditLogService
AuditLogService.FieldChange
Constructor and Description |
---|
DefaultAuditLogService(AuditLogDao auditLogDao,
BambooAuthenticationContext authenticationContext,
AdministrationConfigurationAccessor administrationConfigurationAccessor,
AdministrationConfigurationPersister administrationConfigurationPersister) |
Modifier and Type | Method and Description |
---|---|
long |
countAuditLogMessagesForEntity(String entityId,
AuditLogEntityType entityType,
long startDate,
long endDate) |
long |
countAuditLogMessagesForPlan(ImmutablePlan plan)
Count audit log messages for plan
|
long |
countAuditLogMessagesForPlan(ImmutablePlan plan,
long startDate,
long endDate)
Count audit log messages for plan in a given time period
|
long |
countGlobalAuditLogMessages()
Count global audit log messages.
|
List<AuditLogEntry> |
getAgentAuditLogsMessagesByAgentName(String agentName)
Provide a list of audit log messages filter by Agent Name
|
List<AuditLogEntry> |
getAuditLogMessagesForEntity(String entityId,
AuditLogEntityType entityType,
long startDate,
long endDate,
int firstResult,
int maxResults) |
List<AuditLogEntry> |
getAuditLogMessagesForPlan(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.
|
List<AuditLogEntry> |
getGlobalAuditLogMessages()
Provide a list of all audit log messages written against the system.
|
List<AuditLogEntry> |
getGlobalAuditLogMessages(int firstResult,
int maxResults)
Provide a page of a list of all audit log messages written against the system.
|
boolean |
hasAuditLogMessagesForPlan(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 |
isEnabled()
Returns whether logging is enabled
|
void |
log(AuditLogEntry msg)
Add a log to the audit log.
|
void |
log(Collection<AuditLogService.FieldChange> changes,
Key key)
Add 'field change' messages to the system audit log.
|
void |
log(Iterable<AuditLogService.FieldChange> changes,
AuditLogEntity entity)
Add 'field change' messages to the system audit log.
|
void |
log(Iterable<AuditLogService.FieldChange> changes,
String entityId,
AuditLogEntityType entityType,
String childKey,
AuditLogEntity entity) |
void |
log(String msg)
Add a message to the system audit log.
|
void |
log(String msg,
Key key,
AuditLogEntityType entityType)
Add a message to the plans audit log.
|
void |
log(String msg,
Key key,
AuditLogEntityType entityType,
AuditLogEntity entity)
Add a message to the entity's audit log.
|
void |
log(String username,
String msg,
Key key,
AuditLogEntityType entityType) |
void |
log(String username,
String msg,
Key key,
AuditLogEntityType entityType,
AuditLogEntity field) |
void |
log(String fieldName,
String oldValue,
String newValue,
Key plan)
Add 'field change' message to the system audit log.
|
void |
log(String fieldName,
String oldValue,
String newValue,
Key key,
AuditLogEntityType entityType,
AuditLogEntity entity)
Add 'field change' message to the system audit log.
|
void |
log(com.atlassian.user.User user,
String msg)
Add a message to the system audit log.
|
void |
log(com.atlassian.user.User user,
String msg,
Key key,
AuditLogEntityType entityType)
Add a message to the entity's audit log.
|
void |
log(com.atlassian.user.User user,
String msg,
Key key,
AuditLogEntityType entityType,
AuditLogEntity entity)
Add a message to the plans audit log.
|
void |
removeAllAuditLogMessages()
Deletes all log messages in the database
|
void |
removeAuditLogMessagesByTypeAndEntityId(String entityId,
AuditLogEntityType entityType) |
void |
removeAuditLogMessagesForPlan(ImmutablePlan plan)
Deletes all log messages for a given plan
|
void |
removeGlobalAuditLogMessages()
Deletes all Global audit log messages
|
void |
setEnabled(boolean enabled)
sets whether logging is enabled or not
|
public DefaultAuditLogService(AuditLogDao auditLogDao, BambooAuthenticationContext authenticationContext, AdministrationConfigurationAccessor administrationConfigurationAccessor, AdministrationConfigurationPersister administrationConfigurationPersister)
public void log(@NotNull AuditLogEntry msg)
AuditLogService
log
in interface AuditLogService
msg
- (fully populated) to be loggedpublic void log(@NotNull String msg)
AuditLogService
log
in interface AuditLogService
msg
- the text of the message to add.public void log(@Nullable com.atlassian.user.User user, @NotNull String msg)
AuditLogService
log
in interface AuditLogService
user
- who caused the event being loggedmsg
- the text of the message to add.public void log(@NotNull String msg, @Nullable Key key, AuditLogEntityType entityType)
AuditLogService
log
in interface AuditLogService
msg
- to logkey
- to log it againstpublic void log(@NotNull String msg, @Nullable Key key, AuditLogEntityType entityType, @Nullable AuditLogEntity entity)
AuditLogService
log
in interface AuditLogService
msg
- to logkey
- to log it againstentity
- job's task, chain' stage etc. to log againstpublic void log(@Nullable com.atlassian.user.User user, @NotNull String msg, @Nullable Key key, AuditLogEntityType entityType)
AuditLogService
log
in interface AuditLogService
user
- who caused the event being loggedmsg
- to be loggedkey
- to log the message against.public void log(@Nullable com.atlassian.user.User user, @NotNull String msg, @Nullable Key key, AuditLogEntityType entityType, @Nullable AuditLogEntity entity)
AuditLogService
log
in interface AuditLogService
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 againstpublic void log(@Nullable String username, @NotNull String msg, @Nullable Key key, AuditLogEntityType entityType)
public void log(@Nullable String username, @NotNull String msg, @Nullable Key key, @Nullable AuditLogEntityType entityType, @Nullable AuditLogEntity field)
public List<AuditLogEntry> getAuditLogMessagesForPlan(@NotNull ImmutablePlan plan, long startDate, long endDate, int firstResult, int maxResults)
AuditLogService
getAuditLogMessagesForPlan
in interface AuditLogService
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 endpublic List<AuditLogEntry> getAuditLogMessagesForEntity(@NotNull String entityId, AuditLogEntityType entityType, long startDate, long endDate, int firstResult, int maxResults)
getAuditLogMessagesForEntity
in interface AuditLogService
public boolean hasAuditLogMessagesForPlan(@NotNull ImmutablePlan plan, long startDate, long endDate)
AuditLogService
AuditLogService.getAuditLogMessagesForPlan(ImmutablePlan, long, long, int, int)
.hasAuditLogMessagesForPlan
in interface AuditLogService
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.public void removeAuditLogMessagesForPlan(@NotNull ImmutablePlan plan)
AuditLogService
removeAuditLogMessagesForPlan
in interface AuditLogService
plan
- to delete messages forpublic void removeAuditLogMessagesByTypeAndEntityId(@NotNull String entityId, @Nullable AuditLogEntityType entityType)
removeAuditLogMessagesByTypeAndEntityId
in interface AuditLogService
public void removeGlobalAuditLogMessages()
AuditLogService
removeGlobalAuditLogMessages
in interface AuditLogService
public void removeAllAuditLogMessages()
AuditLogService
removeAllAuditLogMessages
in interface AuditLogService
public List<AuditLogEntry> getGlobalAuditLogMessages()
AuditLogService
getGlobalAuditLogMessages
in interface AuditLogService
public List<AuditLogEntry> getGlobalAuditLogMessages(int firstResult, int maxResults)
AuditLogService
getGlobalAuditLogMessages
in interface AuditLogService
public long countGlobalAuditLogMessages()
AuditLogService
countGlobalAuditLogMessages
in interface AuditLogService
public long countAuditLogMessagesForPlan(@NotNull ImmutablePlan plan)
AuditLogService
countAuditLogMessagesForPlan
in interface AuditLogService
public long countAuditLogMessagesForPlan(@NotNull ImmutablePlan plan, long startDate, long endDate)
AuditLogService
countAuditLogMessagesForPlan
in interface AuditLogService
public long countAuditLogMessagesForEntity(@NotNull String entityId, AuditLogEntityType entityType, long startDate, long endDate)
countAuditLogMessagesForEntity
in interface AuditLogService
public void log(@NotNull Collection<AuditLogService.FieldChange> changes, @Nullable Key key)
AuditLogService
log
in interface AuditLogService
public void log(@NotNull Iterable<AuditLogService.FieldChange> changes, @Nullable String entityId, @Nullable AuditLogEntityType entityType, @Nullable String childKey, @Nullable AuditLogEntity entity)
log
in interface AuditLogService
public void log(@NotNull Iterable<AuditLogService.FieldChange> changes, @Nullable AuditLogEntity entity)
AuditLogService
log
in interface AuditLogService
public void log(@NotNull String fieldName, @Nullable String oldValue, @Nullable String newValue, @Nullable Key plan)
AuditLogService
log
in interface AuditLogService
public void log(@NotNull String fieldName, @Nullable String oldValue, @Nullable String newValue, @Nullable Key key, @Nullable AuditLogEntityType entityType, @Nullable AuditLogEntity entity)
AuditLogService
log
in interface AuditLogService
entity
- job's task or chain's stage affected by the changepublic boolean isEnabled()
AuditLogService
isEnabled
in interface AuditLogService
public void setEnabled(boolean enabled)
AuditLogService
setEnabled
in interface AuditLogService
public List<AuditLogEntry> getAgentAuditLogsMessagesByAgentName(String agentName)
AuditLogService
getAgentAuditLogsMessagesByAgentName
in interface AuditLogService
agentName
- the name of the agentCopyright © 2020 Atlassian Software Systems Pty Ltd. All rights reserved.