Class AuditMessagesManagerBlImpl

java.lang.Object
cz.metacentrum.perun.core.blImpl.AuditMessagesManagerBlImpl
All Implemented Interfaces:
AuditMessagesManagerBl

public class AuditMessagesManagerBlImpl extends Object implements AuditMessagesManagerBl
AuditMessagesManager manages audit messages (logs). Implementation of Business Logic.
Author:
Michal Stava
  • Constructor Details

  • Method Details

    • setAuditer

      public void setAuditer(Auditer auditer)
    • getAuditer

      public Auditer getAuditer()
    • getPerunBl

      public PerunBl getPerunBl()
    • setPerunBl

      public void setPerunBl(PerunBl perunBl)
    • getAuditMessagesManagerImpl

      public AuditMessagesManagerImplApi getAuditMessagesManagerImpl()
    • getMessages

      public List<AuditMessage> getMessages(PerunSession perunSession, int count)
      Description copied from interface: AuditMessagesManagerBl
      Returns exact number of newest audit messages defined by 'count' param (disregarding message IDs). If there is less messages present, then all of them are returned.
      Specified by:
      getMessages in interface AuditMessagesManagerBl
      Parameters:
      perunSession - perun session
      count - Count of returned messages.
      Returns:
      List of audit messages
    • getMessagesByCount

      public List<AuditMessage> getMessagesByCount(PerunSession perunSession, int count)
      Description copied from interface: AuditMessagesManagerBl
      Returns all messages with IDs within the range from max(ID) to (max(ID)-count), where number of returned messages is equal or less than 'count' param, because some IDs could be skipped in the sequence.
      Specified by:
      getMessagesByCount in interface AuditMessagesManagerBl
      Parameters:
      perunSession - perun session
      count - Number of IDs to subtract from max(ID)
      Returns:
      List of audit messages
    • getMessagesPage

      public Paginated<AuditMessage> getMessagesPage(PerunSession perunSession, MessagesPageQuery query)
      Description copied from interface: AuditMessagesManagerBl
      Returns page of audit messages. Query parameter specifies offset and page size.
      Specified by:
      getMessagesPage in interface AuditMessagesManagerBl
      Parameters:
      perunSession - perun session
      Returns:
      Page of audit messages
    • pollConsumerMessages

      public List<AuditMessage> pollConsumerMessages(PerunSession perunSession, String consumerName)
      Description copied from interface: AuditMessagesManagerBl
      Returns list of AuditMessages from audit log with IDs > lastProcessedId for registered auditer consumer.
      Specified by:
      pollConsumerMessages in interface AuditMessagesManagerBl
      Parameters:
      perunSession - perun session
      consumerName - consumer to get messages for
      Returns:
      List of audit messages
    • pollConsumerMessages

      public List<AuditMessage> pollConsumerMessages(PerunSession perunSession, String consumerName, int lastProcessedId)
      Description copied from interface: AuditMessagesManagerBl
      Returns list of AuditMessages from audit log with IDs > lastProcessedId for registered auditer consumer.
      Specified by:
      pollConsumerMessages in interface AuditMessagesManagerBl
      Parameters:
      perunSession - perun session
      consumerName - consumer to get messages for
      lastProcessedId - id of the last message
      Returns:
      List of audit messages
    • pollConsumerEvents

      public List<AuditEvent> pollConsumerEvents(PerunSession perunSession, String consumerName)
      Description copied from interface: AuditMessagesManagerBl
      Returns list of AuditEvents from audit log with IDs > lastProcessedId for registered auditer consumer.
      Specified by:
      pollConsumerEvents in interface AuditMessagesManagerBl
      Parameters:
      perunSession - perun session
      consumerName - consumer to get messages for
      Returns:
      List of audit messages
    • pollConsumerEvents

      public List<AuditEvent> pollConsumerEvents(PerunSession perunSession, String consumerName, int lastProcessedId)
      Description copied from interface: AuditMessagesManagerBl
      Returns list of AuditEvents from audit log with IDs > lastProcessedId for registered auditer consumer.
      Specified by:
      pollConsumerEvents in interface AuditMessagesManagerBl
      Parameters:
      perunSession - perun session
      consumerName - consumer to get messages for
      lastProcessedId - id of the last message
      Returns:
      List of audit messages
    • createAuditerConsumer

      public void createAuditerConsumer(PerunSession perunSession, String consumerName)
      Description copied from interface: AuditMessagesManagerBl
      Creates new auditer consumer with last processed id which equals current auditer log max id.
      Specified by:
      createAuditerConsumer in interface AuditMessagesManagerBl
      Parameters:
      perunSession - perun session
      consumerName - new name for consumer
    • log

      public void log(PerunSession perunSession, String message)
      Description copied from interface: AuditMessagesManagerBl
      Log arbitrary audit message.
      Specified by:
      log in interface AuditMessagesManagerBl
      Parameters:
      perunSession - perun session
      message - message to be logged
    • getAllAuditerConsumers

      public Map<String,Integer> getAllAuditerConsumers(PerunSession perunSession)
      Description copied from interface: AuditMessagesManagerBl
      Get all registered auditer consumers as map name(String)=lastProcessedId(Integer).
      Specified by:
      getAllAuditerConsumers in interface AuditMessagesManagerBl
      Parameters:
      perunSession - perun session
      Returns:
      Mapping of auditer consumer names to their last processed ID.
    • getLastMessageId

      public int getLastMessageId(PerunSession perunSession)
      Description copied from interface: AuditMessagesManagerBl
      Get ID of last (newest) message in audit log (max_id).
      Specified by:
      getLastMessageId in interface AuditMessagesManagerBl
      Parameters:
      perunSession - perun session
      Returns:
      ID of last (newest) message.
    • setLastProcessedId

      public void setLastProcessedId(PerunSession perunSession, String consumerName, int lastProcessedId)
      Description copied from interface: AuditMessagesManagerBl
      Set ID of last processed message for specified consumer.
      Specified by:
      setLastProcessedId in interface AuditMessagesManagerBl
      Parameters:
      perunSession - perun session
      consumerName - name of consumer
      lastProcessedId - id of last processed message in consumer
    • getAuditerMessagesCount

      public int getAuditerMessagesCount(PerunSession perunSession)
      Description copied from interface: AuditMessagesManagerBl
      Get count of all messages in audit log.
      Specified by:
      getAuditerMessagesCount in interface AuditMessagesManagerBl
      Parameters:
      perunSession - perun session
      Returns:
      Count of all messages in audit log