Package cz.metacentrum.perun.core.impl
Class AuditMessagesManagerImpl
java.lang.Object
cz.metacentrum.perun.core.impl.AuditMessagesManagerImpl
- All Implemented Interfaces:
AuditMessagesManagerImplApi
Implementation of AuditMessagesManagerImplApi with methods used to read stored auditer messages.
- Author:
- Pavel Zlámal
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
checkAuditerConsumerExists
(PerunSession session, String consumerName) Returns TRUE if auditer consumer with specified name exist.void
createAuditerConsumer
(PerunSession perunSession, String consumerName) Creates new auditer consumer with last processed id which equals current auditer log max id.Get all registered auditer consumers as map name(String)=lastProcessedId(Integer).int
getAuditerMessagesCount
(PerunSession perunSession) Get count of all messages in auditLOG.int
getLastMessageId
(PerunSession perunSession) Get ID of last (newest) message in audit log (max_id).getMessages
(PerunSession perunSession, int count) Returns exact number of newest audit messages defined by 'count' param (disregarding message IDs).getMessagesByCount
(PerunSession perunSession, int count) 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.getMessagesByIdAndCount
(PerunSession perunSession, int id, int count) Returns "count" number of messages that are more or equal than the given ID (ascending order), i.e.getMessagesPage
(PerunSession perunSession, MessagesPageQuery query) Returns page of audit messages.pollConsumerEvents
(PerunSession perunSession, String consumerName, int lastProcessedId) Returns list of AuditEvents from audit log with IDs > lastProcessedId for registered auditer consumer.pollConsumerMessages
(PerunSession perunSession, String consumerName) Returns list of AuditMessages from audit log with IDs > lastProcessedId for registered auditer consumer.pollConsumerMessages
(PerunSession perunSession, String consumerName, int lastProcessedId) Returns list of AuditMessages from audit log with IDs > lastProcessedId for registered auditer consumer.void
setLastProcessedId
(PerunSession perunSession, String consumerName, int lastProcessedId) Set ID of last processed message for specified consumer.
-
Constructor Details
-
AuditMessagesManagerImpl
-
-
Method Details
-
checkAuditerConsumerExists
Description copied from interface:AuditMessagesManagerImplApi
Returns TRUE if auditer consumer with specified name exist.- Specified by:
checkAuditerConsumerExists
in interfaceAuditMessagesManagerImplApi
- Parameters:
session
- PerunSessionconsumerName
- Name of consumer to check- Returns:
- TRUE if consumer exists by name / FALSE otherwise
-
createAuditerConsumer
Description copied from interface:AuditMessagesManagerImplApi
Creates new auditer consumer with last processed id which equals current auditer log max id.- Specified by:
createAuditerConsumer
in interfaceAuditMessagesManagerImplApi
- Parameters:
perunSession
- perun sessionconsumerName
- new name for consumer
-
getAllAuditerConsumers
Description copied from interface:AuditMessagesManagerImplApi
Get all registered auditer consumers as map name(String)=lastProcessedId(Integer).- Specified by:
getAllAuditerConsumers
in interfaceAuditMessagesManagerImplApi
- Parameters:
sess
- perun session- Returns:
- Mapping of auditer consumer names to their last processed ID.
-
getAuditerMessagesCount
Description copied from interface:AuditMessagesManagerImplApi
Get count of all messages in auditLOG.- Specified by:
getAuditerMessagesCount
in interfaceAuditMessagesManagerImplApi
- Parameters:
perunSession
- perun session- Returns:
- Count of all messages in audit log
-
getLastMessageId
Description copied from interface:AuditMessagesManagerImplApi
Get ID of last (newest) message in audit log (max_id).- Specified by:
getLastMessageId
in interfaceAuditMessagesManagerImplApi
- Parameters:
perunSession
- perun session- Returns:
- ID of last (newest) message.
-
getMessages
Description copied from interface:AuditMessagesManagerImplApi
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 interfaceAuditMessagesManagerImplApi
- Parameters:
perunSession
- perun sessioncount
- Count of returned messages.- Returns:
- List of audit messages
-
getMessagesByCount
Description copied from interface:AuditMessagesManagerImplApi
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 interfaceAuditMessagesManagerImplApi
- Parameters:
perunSession
- perun sessioncount
- Number of IDs to subtract from max(ID)- Returns:
- List of audit messages
-
getMessagesByIdAndCount
Description copied from interface:AuditMessagesManagerImplApi
Returns "count" number of messages that are more or equal than the given ID (ascending order), i.e. the method returns newer messages by provided ID.- Specified by:
getMessagesByIdAndCount
in interfaceAuditMessagesManagerImplApi
- Parameters:
perunSession
- perun sessionid
- starting id from which the messages will be takencount
- Number of messages that will be returned- Returns:
- List of audit messages
-
getMessagesPage
Description copied from interface:AuditMessagesManagerImplApi
Returns page of audit messages. Query parameter specifies offset and page size and allows filtering by name of event. Total count is only estimated.- Specified by:
getMessagesPage
in interfaceAuditMessagesManagerImplApi
- Parameters:
perunSession
- perun session- Returns:
- Page of audit messages
-
pollConsumerEvents
public List<AuditEvent> pollConsumerEvents(PerunSession perunSession, String consumerName, int lastProcessedId) Description copied from interface:AuditMessagesManagerImplApi
Returns list of AuditEvents from audit log with IDs > lastProcessedId for registered auditer consumer. Number of returned events for one call is limited (by default 10 000). You might need to fetch additional events by repeating this call.- Specified by:
pollConsumerEvents
in interfaceAuditMessagesManagerImplApi
- Parameters:
perunSession
- perun sessionconsumerName
- consumer to get messages forlastProcessedId
- id of the last message- Returns:
- List of audit messages
-
pollConsumerMessages
Description copied from interface:AuditMessagesManagerImplApi
Returns list of AuditMessages from audit log with IDs > lastProcessedId for registered auditer consumer. Number of returned messages for one call is limited (by default 10 000). You might need to fetch additional messages by repeating this call.- Specified by:
pollConsumerMessages
in interfaceAuditMessagesManagerImplApi
- Parameters:
perunSession
- perun sessionconsumerName
- 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:AuditMessagesManagerImplApi
Returns list of AuditMessages from audit log with IDs > lastProcessedId for registered auditer consumer. Number of returned messages for one call is limited (by default 10 000). You might need to fetch additional messages by repeating this call.- Specified by:
pollConsumerMessages
in interfaceAuditMessagesManagerImplApi
- Parameters:
perunSession
- perun sessionconsumerName
- consumer to get messages forlastProcessedId
- id of the last message- Returns:
- List of audit messages
-
setLastProcessedId
Description copied from interface:AuditMessagesManagerImplApi
Set ID of last processed message for specified consumer.- Specified by:
setLastProcessedId
in interfaceAuditMessagesManagerImplApi
- Parameters:
perunSession
- perun sessionconsumerName
- name of consumerlastProcessedId
- id of last processed message in consumer
-