Package com.inesm.KeyManager.services
Class LoggerService
java.lang.Object
com.inesm.KeyManager.services.LoggerService
Provides methods to log operations.
-
Method Summary
Modifier and TypeMethodDescriptionFetches all logs from the database that match the filter.longInits a log instance of an operation.voidUpdates a log instance regarding a the outcome of the operation, and the received parameters.
-
Method Details
-
initLog
Inits a log instance of an operation. Will save in the log fields the current username, roleName, operationName, resourceType and the current timestamp.After the log instance is initialized it will be necessary to call
updateLog(long, Resource, boolean, String)in order to properly update the log instance, regarding the outcome of the operation.- Parameters:
user- the user performing the operation, if null the log will use 'undefined' to reference the user performing the operationoperationID- the operationID of the operation being logged- Returns:
- the logID of the created log or -1 if an error occurred
-
updateLog
Updates a log instance regarding a the outcome of the operation, and the received parameters.- Parameters:
logID- the logID of the log being updateddata- the input data of the operation, can be nullerror- the flag indicating if the operation terminated successfullyinfo- the message to display as the cause of the operation interruption (or more information on the conclusion status), can be null
-
getLogs
Fetches all logs from the database that match the filter.All the fields except the timestamps are checked for equality, the timestamp is used with timestampEnd to define a time interval.
If some of the log fields are not set, they will not be considered for filtering. Ultimately, an "empty" (not null) log object will provide all the logs inside the database.
- Parameters:
filter- the object containing the values of the filter, not null- Returns:
- a list containing all the logs that matched the filter, not null, maybe empty
-