Package fr.becpg.repo.audit.service.impl
Class BeCPGAuditServiceImpl
java.lang.Object
fr.becpg.repo.audit.service.impl.BeCPGAuditServiceImpl
- All Implemented Interfaces:
AuditScopeListener,BeCPGAuditService
@Service("beCPGAuditService")
public class BeCPGAuditServiceImpl
extends Object
implements BeCPGAuditService, AuditScopeListener
BeCPGAuditServiceImpl class.
- Version:
- $Id: $Id
- Author:
- matthieu
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate AuditPlugin[]private DatabaseAuditServiceprivate static final StringConstantNOT_DATABASE_PLUGIN="Audit plugin for type '%s' is not a dat"{trunked}private ThreadLocal<AuditScope> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcompleteAuditEntry(AuditType auditType, String filterKey, String filterValue) Complete the entry left open by an operation recorded on start, the one matching the given filter.voiddeleteAuditEntries(AuditType type, Long fromId, Long toId) deleteAuditEntries.private intfilterRank(List<String> hierarchy, String filterKey) private DatabaseAuditPlugingetDatabasePlugin(AuditType type) getDatabasePlugin.private AuditPlugingetPlugin.List<org.json.JSONObject> listAuditEntries(AuditType type, AuditQuery auditQuery) listAuditEntries.listAuditPage(AuditType type, AuditQuery auditQuery) listAuditPage.voidonClose(AuditScope auditScope) onClose.voidonStart(AuditScope auditScope) onStart.private AuditQueryprioritizeFilters(DatabaseAuditPlugin plugin, AuditQuery auditQuery) A copy of the query whose filters are ordered on the filter hierarchy of the plugin, so that the database reads with the most selective one and the other ones are applied in memory.startAudit(AuditType auditType) startAudit.startAudit(AuditType auditType, Class<?> auditClass, String scopeName) startAudit.
-
Field Details
-
NOT_DATABASE_PLUGIN
ConstantNOT_DATABASE_PLUGIN="Audit plugin for type '%s' is not a dat"{trunked}- See Also:
-
auditPlugins
-
databaseAuditService
-
threadLocalScope
-
-
Constructor Details
-
BeCPGAuditServiceImpl
public BeCPGAuditServiceImpl()
-
-
Method Details
-
startAudit
startAudit.
- Specified by:
startAuditin interfaceBeCPGAuditService- Parameters:
auditType- aAuditTypeobject- Returns:
- a
AuditScopeobject
-
startAudit
startAudit.
- Specified by:
startAuditin interfaceBeCPGAuditService- Parameters:
auditType- aAuditTypeobjectauditClass- aClassobjectscopeName- aStringobject- Returns:
- a
AuditScopeobject
-
listAuditEntries
listAuditEntries.
The filters but the most selective one are applied in memory, on the entries the database returns within the query size: with several filters, the list may hold less entries than the matching ones.BeCPGAuditService.listAuditPage(AuditType, AuditQuery)reads them all, page by page. The filters are first ordered on the filter hierarchy of the plugin.- Specified by:
listAuditEntriesin interfaceBeCPGAuditService- Parameters:
type- aAuditTypeobjectauditQuery- aAuditQueryobject- Returns:
- a
Listobject
-
listAuditPage
listAuditPage.
Read one page of audit entries by keyset paging, so that the database only ever walks through a bounded window of entry identifiers. The filters are first ordered on the filter hierarchy of the plugin.- Specified by:
listAuditPagein interfaceBeCPGAuditService- Parameters:
type- aAuditTypeobjectauditQuery- aAuditQueryobject- Returns:
- a
AuditPageobject
-
prioritizeFilters
A copy of the query whose filters are ordered on the filter hierarchy of the plugin, so that the database reads with the most selective one and the other ones are applied in memory. The identifier matches a single entry: it comes first, unless the plugin places it in its hierarchy. The filters on a key missing from the hierarchy keep their order, after the other ones.- Parameters:
plugin- aDatabaseAuditPluginobjectauditQuery- aAuditQueryobject- Returns:
- a
AuditQueryobject - Throws:
BeCPGAuditException- if a filter has a wrong syntax
-
filterRank
-
getDatabasePlugin
getDatabasePlugin.
- Parameters:
type- aAuditTypeobject- Returns:
- a
DatabaseAuditPluginobject - Throws:
BeCPGAuditException- if the plugin of the type does not record in the database
-
completeAuditEntry
Complete the entry left open by an operation recorded on start, the one matching the given filter.- Specified by:
completeAuditEntryin interfaceBeCPGAuditService- Parameters:
auditType- aAuditTypeobjectfilterKey- the audit key correlating the entry to the completed operationfilterValue- the value of that key
-
deleteAuditEntries
deleteAuditEntries.
- Specified by:
deleteAuditEntriesin interfaceBeCPGAuditService- Parameters:
type- aAuditTypeobjectfromId- aLongobjecttoId- aLongobject
-
getPlugin
getPlugin.
- Parameters:
type- aAuditTypeobject- Returns:
- a
AuditPluginobject
-
onStart
onStart.
- Specified by:
onStartin interfaceAuditScopeListener- Parameters:
auditScope- aAuditScopeobject
-
onClose
onClose.
- Specified by:
onClosein interfaceAuditScopeListener- Parameters:
auditScope- aAuditScopeobject
-