Class AuditServiceImpl
java.lang.Object
com.atlassian.crowd.manager.audit.AuditServiceImpl
- All Implemented Interfaces:
AuditService
,InternalAuditService
-
Constructor Summary
ConstructorDescriptionAuditServiceImpl
(AuditDao auditDao, PropertyManager propertyManager, Clock clock, AuditLogChangesetPopulator auditLogChangesetPopulator, AuditLogProperties auditLogSystemProperties, AuditLogEnabledChecker auditLogEnabledChecker) -
Method Summary
Modifier and TypeMethodDescriptionlong
Returns current auditing configurationboolean
int
removeEntriesOlderThan
(Instant threshold) Removes entries created before the given instantint
Removes stale entries basing on current configurationvoid
saveAudit
(AuditLogChangeset changeset) Persists an audit log changeset.void
saveAudits
(Collection<AuditLogChangeset> changesets) Persists the given audit log changesets.void
saveConfiguration
(AuditLogConfiguration auditLogConfiguration) Sets the new configuration for auditing<RESULT> List<RESULT>
searchAuditLog
(AuditLogQuery<RESULT> query) Queries the audit log.boolean
Allows the caller to determine whether it should attempt to generate audit events.
-
Constructor Details
-
AuditServiceImpl
public AuditServiceImpl(AuditDao auditDao, PropertyManager propertyManager, Clock clock, AuditLogChangesetPopulator auditLogChangesetPopulator, AuditLogProperties auditLogSystemProperties, AuditLogEnabledChecker auditLogEnabledChecker)
-
-
Method Details
-
saveAudit
Description copied from interface:AuditService
Persists an audit log changeset. The timestamp will be set to the current time. Will not do anything when audit log is disabled.- Specified by:
saveAudit
in interfaceAuditService
- Parameters:
changeset
- the changeset that will be persisted
-
saveAudits
Description copied from interface:InternalAuditService
Persists the given audit log changesets. Their timestamps will be set to the current time. Will not do anything when audit log is disabled.- Specified by:
saveAudits
in interfaceInternalAuditService
- Parameters:
changesets
- the changesets that will be persisted
-
searchAuditLog
Description copied from interface:AuditService
Queries the audit log. Returns aList
ofAuditLogChangeset
s, which match the criteria specified in the query. The results will be sorted by the timestamp, descending.- Specified by:
searchAuditLog
in interfaceAuditService
- Parameters:
query
- the search query- Returns:
- List of AuditLogEntry matching the query
-
isEnabled
public boolean isEnabled()- Specified by:
isEnabled
in interfaceAuditService
- Returns:
- true if the audit log is enabled, false otherwise. A disabled audit log will not persist any new entries.
-
removeStaleEntries
@Transactional public int removeStaleEntries()Description copied from interface:InternalAuditService
Removes stale entries basing on current configuration- Specified by:
removeStaleEntries
in interfaceInternalAuditService
- Returns:
- number of removed entries
-
removeEntriesOlderThan
Description copied from interface:InternalAuditService
Removes entries created before the given instant- Specified by:
removeEntriesOlderThan
in interfaceInternalAuditService
- Returns:
- number of removed entries
-
getAuditLogSize
@Transactional public long getAuditLogSize()- Specified by:
getAuditLogSize
in interfaceInternalAuditService
- Returns:
- the amount of changesets in the audit log
-
saveConfiguration
Description copied from interface:AuditService
Sets the new configuration for auditing- Specified by:
saveConfiguration
in interfaceAuditService
- Parameters:
auditLogConfiguration
- new configuration
-
getConfiguration
Description copied from interface:AuditService
Returns current auditing configuration- Specified by:
getConfiguration
in interfaceAuditService
- Returns:
- current configuration
-
shouldAuditEvent
public boolean shouldAuditEvent()Description copied from interface:AuditService
Allows the caller to determine whether it should attempt to generate audit events. Auditing might be disabled globally, or it might be disabled during specific operations or states (for example during synchronizations).- Specified by:
shouldAuditEvent
in interfaceAuditService
- Returns:
- true if calling saveAudit() will persist the event, false otherwise
-