Class AuditService
java.lang.Object
de.bytestore.hostinger.internal.service.AuditService
AuditService provides functionalities for auditing application activities,
managing error notifications, and maintaining log records.
It includes features for adding stack traces, purging old logs, sending error
notifications via email, and converting logs to localized strings.
This class leverages dependency injection for its collaborative services.
-
Constructor Summary
ConstructorsConstructorDescriptionAuditService(io.jmix.core.Messages messages, io.jmix.core.security.CurrentAuthentication currentAuthentication) -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a stacktrace related to the given key and associated objects for tracking or debugging purposes.static StringobjectToString(Object... objectsIO) Converts the given objects into their JSON string representation.voidpurgeOldLogs(Integer maxAge) Purges old log entries from the database that are older than or equal to the specified maximum age.stringToObject(String jsonString) Converts a JSON string into an object of the specified type.toLocalisedString(AuditLog guardianLog) Converts the given AuditLog object into a localized string representation by extracting its key and formatting it using a message provider.
-
Constructor Details
-
AuditService
public AuditService(io.jmix.core.Messages messages, io.jmix.core.security.CurrentAuthentication currentAuthentication)
-
-
Method Details
-
addEntry
Adds a stacktrace related to the given key and associated objects for tracking or debugging purposes.- Parameters:
keyIO- the identifier or key associated with the stacktraceobjectsIO- the objects or context information related to the stacktrace
-
purgeOldLogs
Purges old log entries from the database that are older than or equal to the specified maximum age. This method retrieves the log entries meeting the criteria and removes them.- Parameters:
maxAge- The maximum age (in days) for the log entries to retain. Entries older than or equal to this value will be deleted.
-
toLocalisedString
Converts the given AuditLog object into a localized string representation by extracting its key and formatting it using a message provider.- Parameters:
guardianLog- the AuditLog object containing the key and value to be localized.- Returns:
- the localized string representation formatted based on the extracted key and value.
-
objectToString
Converts the given objects into their JSON string representation.- Parameters:
objectsIO- The objects to be converted to a JSON string.- Returns:
- The JSON string representation of the provided objects.
-
stringToObject
Converts a JSON string into an object of the specified type.- Parameters:
jsonString- the JSON string to be deserialized- Returns:
- the deserialized object of the specified
-