public class AuditDSGenerator implements DynamicDSGenerator
DynamicDSGenerator
which generates an audit
DataSource
based on a DataSource
which has auditing enabled.
An audit DataSource
is a DataSource
which basically
inherits from the original DataSource
and adds some additional
metadata which allows storing the timestamp, revision,
user and operation type in addition to record field values
on each add, update and remove operations.
In order to enable audit for a DataSource
you have to specify the
audit=true property.
There are additional properties which can be specified in order to control how the new fields are named:
DataSource
. Default
value is audit_[OriginalDSID].
In addition to this, setting audit=false property on a field will
disable tracking on that field. In effect, the field won't be stored in the
audit DataSource
Modifier and Type | Method and Description |
---|---|
void |
addMapping(java.lang.String auditDSID,
java.lang.String dsID)
Add a mapping between an audit
DataSource and audited DataSource |
static java.lang.String |
getAuditDSConstructor(DataSource ds)
Get the serverConstructor configured for the given
DataSource |
static java.lang.String |
getAuditRevisionFieldName(DataSource ds)
Get the revision field name configured for the given
DataSource |
static java.lang.String |
getAuditSchemaName(DataSource ds)
Get the schema configured for the given
DataSource |
static java.lang.String |
getAuditTimestampFieldName(DataSource ds)
Get the timestamp field name configured for the given
DataSource |
static java.lang.String |
getAuditTypeFieldName(DataSource ds)
Get the type field name configured for the given
DataSource |
static java.lang.String |
getAuditUserFieldName(DataSource ds)
Get the user field name configured for the given
DataSource |
boolean |
hasMappingFor(java.lang.String auditDSID)
Returns true if the specified audit
DataSource is already mapped inside
the AuditDSGenerator |
getDataSource
public static java.lang.String getAuditRevisionFieldName(DataSource ds)
DataSource
ds
- the audit DataSource
for which we want to retrieve the revision field name.DataSource
passed as parameter.public static java.lang.String getAuditTimestampFieldName(DataSource ds)
DataSource
ds
- the audit DataSource
for which we want to retrieve the timestamp field name.DataSource
passed as parameter.public static java.lang.String getAuditUserFieldName(DataSource ds)
DataSource
ds
- the audit DataSource
for which we want to retrieve the user field name.DataSource
passed as parameter.public static java.lang.String getAuditTypeFieldName(DataSource ds)
DataSource
ds
- the audit DataSource
for which we want to retrieve the type field name.DataSource
passed as parameter.public static java.lang.String getAuditSchemaName(DataSource ds)
DataSource
ds
- the audit DataSource
for which we want to retrieve schema name.DataSource
passed as parameter.public static java.lang.String getAuditDSConstructor(DataSource ds)
DataSource
ds
- the audit DataSource
for which we want to retrieve the serverConstructor.DataSource
passed as parameter.public void addMapping(java.lang.String auditDSID, java.lang.String dsID)
DataSource
and audited DataSource
auditDSID
- the audit DataSource
to be generateddsID
- the audited DataSource
for which we need to generate the audit DataSourcepublic boolean hasMappingFor(java.lang.String auditDSID)
DataSource
is already mapped inside
the AuditDSGenerator
auditDSID
- auditDSID the audit DataSource
to be generatedDataSource
is already mapped by the AuditDSGenerator