Class DefaultAuditLogService

java.lang.Object
com.atlassian.bamboo.persister.DefaultAuditLogService
All Implemented Interfaces:
AuditLogService

public class DefaultAuditLogService extends Object implements AuditLogService
  • Constructor Details

  • Method Details

    • log

      public void log(@NotNull @NotNull AuditLogEntry msg)
      Description copied from interface: AuditLogService
      Add a log to the audit log.
      Specified by:
      log in interface AuditLogService
      Parameters:
      msg - (fully populated) to be logged
    • log

      public void log(@NotNull @NotNull String msg)
      Description copied from interface: AuditLogService
      Add a message to the system audit log. Message will be logged against the user that is currently set in the authentication context.
      Specified by:
      log in interface AuditLogService
      Parameters:
      msg - the text of the message to add.
    • log

      public void log(@Nullable @Nullable com.atlassian.user.User user, @NotNull @NotNull String msg)
      Description copied from interface: AuditLogService
      Add a message to the system audit log. Message will be logged against the current logged in user (if available)
      Specified by:
      log in interface AuditLogService
      Parameters:
      user - who caused the event being logged
      msg - 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: AuditLogService
      Add a message to the plans audit log. Message will be logged against the current logged in user (if available)
      Specified by:
      log in interface AuditLogService
      Parameters:
      msg - to log
      key - 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: AuditLogService
      Add a message to the entity's audit log. Message will be logged against the current logged in user (if available)
      Specified by:
      log in interface AuditLogService
      Parameters:
      msg - to log
      key - to log it against
      entity - 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: AuditLogService
      Add a message to the entity's audit log. Message will be logged against provided user
      Specified by:
      log in interface AuditLogService
      Parameters:
      user - who caused the event being logged
      msg - to be logged
      key - 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: AuditLogService
      Add a message to the plans audit log. Message will be logged against provided user
      Specified by:
      log in interface AuditLogService
      Parameters:
      user - who caused the event being logged
      msg - to be logged
      key - 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: AuditLogService
      Provide a paginated list of all audit log messages written against a plan between input dates.
      Specified by:
      getAuditLogMessagesForPlan in interface AuditLogService
      Parameters:
      plan - to find audit messages for
      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.
      firstResult - if specified marks a first item to be returned, passing 0 or negative number will effect with returning elements from the beginning
      maxResults - 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: AuditLogService
      Provide a paginated list of all audit log messages written against a plan between input dates and requested search term.
      Specified by:
      getAuditLogMessagesForPlan in interface AuditLogService
      Parameters:
      plan - to find audit messages for
      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.
      firstResult - if specified marks a first item to be returned, passing 0 or negative number will effect with returning elements from the beginning
      maxResults - 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
      searchTerm - 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: AuditLogService
      Provide a paginated list of all audit log messages written against an entity between input dates.
      Specified by:
      getAuditLogMessagesForEntity in interface AuditLogService
      Parameters:
      entityId - to find audit messages for
      entityType - type of entity associated with the entityId
      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.
      firstResult - if specified marks a first item to be returned, passing 0 or negative number will effect with returning elements from the beginning
      maxResults - 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: AuditLogService
      Provide a paginated list of all audit log messages written against an entity between input dates and requested search term.
      Specified by:
      getAuditLogMessagesForEntity in interface AuditLogService
      Parameters:
      entityId - to find audit messages for
      entityType - type of entity associated with the entityId
      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.
      firstResult - if specified marks a first item to be returned, passing 0 or negative number will effect with returning elements from the beginning
      maxResults - 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
      searchTerm - 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: AuditLogService
      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 of AuditLogService.getAuditLogMessagesForPlan(ImmutablePlan, long, long, int, int).
      Specified by:
      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.
    • removeAuditLogMessagesForPlan

      public void removeAuditLogMessagesForPlan(@NotNull @NotNull ImmutablePlan plan)
      Description copied from interface: AuditLogService
      Deletes all log messages for a given plan
      Specified by:
      removeAuditLogMessagesForPlan in interface AuditLogService
      Parameters:
      plan - to delete messages for
    • removeAuditLogMessagesByTypeAndEntityId

      public void removeAuditLogMessagesByTypeAndEntityId(@NotNull @NotNull String entityId, @Nullable @Nullable AuditLogEntityType entityType)
      Specified by:
      removeAuditLogMessagesByTypeAndEntityId in interface AuditLogService
    • removeGlobalAuditLogMessages

      public void removeGlobalAuditLogMessages()
      Description copied from interface: AuditLogService
      Deletes all Global audit log messages
      Specified by:
      removeGlobalAuditLogMessages in interface AuditLogService
    • removeAllAuditLogMessages

      public void removeAllAuditLogMessages()
      Description copied from interface: AuditLogService
      Deletes all log messages in the database
      Specified by:
      removeAllAuditLogMessages in interface AuditLogService
    • getGlobalAuditLogMessages

      public List<AuditLogEntry> getGlobalAuditLogMessages(int firstResult, int maxResults)
      Description copied from interface: AuditLogService
      Provide a page of a list of all audit log messages written against the system.
      Specified by:
      getGlobalAuditLogMessages in interface AuditLogService
      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: AuditLogService
      Provide a page of a list of all audit log messages written against the system filtered by delivered searchTerm.
      Specified by:
      getGlobalAuditLogMessages in interface AuditLogService
      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: AuditLogService
      Count global audit log messages.
      Specified by:
      countGlobalAuditLogMessages in interface AuditLogService
      Returns:
      number of potential results
    • countGlobalAuditLogMessages

      public long countGlobalAuditLogMessages(@Nullable @Nullable String searchTerm)
      Description copied from interface: AuditLogService
      Count global audit log messages.
      Specified by:
      countGlobalAuditLogMessages in interface AuditLogService
      Parameters:
      searchTerm - the phrase against which the results will be counted
      Returns:
      number of potential results
    • countAuditLogMessagesForPlan

      public long countAuditLogMessagesForPlan(@NotNull @NotNull ImmutablePlan plan)
      Description copied from interface: AuditLogService
      Count audit log messages for plan
      Specified by:
      countAuditLogMessagesForPlan in interface AuditLogService
    • countAuditLogMessagesForPlan

      public long countAuditLogMessagesForPlan(@NotNull @NotNull ImmutablePlan plan, long startDate, long endDate)
      Description copied from interface: AuditLogService
      Count audit log messages for plan in a given time period
      Specified by:
      countAuditLogMessagesForPlan in interface AuditLogService
    • countAuditLogMessagesForPlan

      public long countAuditLogMessagesForPlan(@NotNull @NotNull ImmutablePlan plan, long startDate, long endDate, @Nullable @Nullable String searchTerm)
      Description copied from interface: AuditLogService
      Count audit log messages for plan in a given time period and with the requested searchTerm
      Specified by:
      countAuditLogMessagesForPlan in interface AuditLogService
    • countAuditLogMessagesForEntity

      public long countAuditLogMessagesForEntity(@NotNull @NotNull String entityId, AuditLogEntityType entityType, long startDate, long endDate)
      Description copied from interface: AuditLogService
      Count audit log messages for entity in a given time period
      Specified by:
      countAuditLogMessagesForEntity in interface AuditLogService
    • countAuditLogMessagesForEntity

      public long countAuditLogMessagesForEntity(@NotNull @NotNull String entityId, @Nullable @Nullable AuditLogEntityType entityType, long startDate, long endDate, @Nullable @Nullable String searchTerm)
      Description copied from interface: AuditLogService
      Count audit log messages for entity in a given time period and with the requested searchTerm
      Specified by:
      countAuditLogMessagesForEntity in interface AuditLogService
    • log

      public void log(@NotNull @NotNull Collection<AuditLogService.FieldChange> changes, @Nullable @Nullable Key key)
      Description copied from interface: AuditLogService
      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.
      Specified by:
      log in interface AuditLogService
    • 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:
      log in interface AuditLogService
    • log

      public void log(@NotNull @NotNull Iterable<AuditLogService.FieldChange> changes, @Nullable @Nullable AuditLogEntity entity)
      Description copied from interface: AuditLogService
      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.
      Specified by:
      log in interface AuditLogService
    • log

      public void log(@NotNull @NotNull String fieldName, @Nullable @Nullable String oldValue, @Nullable @Nullable String newValue, @Nullable @Nullable Key plan)
      Description copied from interface: AuditLogService
      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.
      Specified by:
      log in interface AuditLogService
    • 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: AuditLogService
      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.
      Specified by:
      log in interface AuditLogService
      entity - job's task or chain's stage affected by the change
    • isEnabled

      public boolean isEnabled()
      Description copied from interface: AuditLogService
      Returns whether logging is enabled
      Specified by:
      isEnabled in interface AuditLogService
    • setEnabled

      public void setEnabled(boolean enabled)
      Description copied from interface: AuditLogService
      sets whether logging is enabled or not
      Specified by:
      setEnabled in interface AuditLogService
    • getAgentAuditLogsMessagesByAgentName

      public List<AuditLogEntry> getAgentAuditLogsMessagesByAgentName(String agentName)
      Description copied from interface: AuditLogService
      Provide a list of audit log messages filter by Agent Name
      Specified by:
      getAgentAuditLogsMessagesByAgentName in interface AuditLogService
      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: AuditLogService
      Provide a list of audit log messages filter by Agent Name and the Search Term.
      Specified by:
      getAgentAuditLogsMessagesByAgentName in interface AuditLogService
      Parameters:
      agentName - the name of the agent
      searchTerm - 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:
      isRssUpdatedLog in interface AuditLogService
      Returns:
      whether logging is for RSS update.
    • setRssUpdatedLog

      public void setRssUpdatedLog(Boolean isRss)
      Description copied from interface: AuditLogService
      sets whether logging is for RSS update.
      Specified by:
      setRssUpdatedLog in interface AuditLogService