mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
DOD Recert: Simple support for event and property filtering on audit
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/DEV/DODRECERT@51108 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -210,7 +210,7 @@ subprojects {
|
|||||||
copy {
|
copy {
|
||||||
from "${configModuleDir}"
|
from "${configModuleDir}"
|
||||||
include "${moduleProperties}"
|
include "${moduleProperties}"
|
||||||
include "${fileMapping}"
|
include "${fileMapping}"
|
||||||
into assembleDir
|
into assembleDir
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -222,7 +222,8 @@ subprojects {
|
|||||||
copy {
|
copy {
|
||||||
from configDir
|
from configDir
|
||||||
exclude "**/${moduleProperties}"
|
exclude "**/${moduleProperties}"
|
||||||
exclude "**/${fileMapping}"
|
exclude "**/${fileMapping}"
|
||||||
|
exclude "**/dev-context.xml"
|
||||||
into "${assembleDir}/config"
|
into "${assembleDir}/config"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -768,7 +768,7 @@ public class RecordsManagementAuditServiceImpl
|
|||||||
* @param reportFormat Format to write the audit trail in, ignored if writer is <code>null</code>
|
* @param reportFormat Format to write the audit trail in, ignored if writer is <code>null</code>
|
||||||
*/
|
*/
|
||||||
private void getAuditTrailImpl(
|
private void getAuditTrailImpl(
|
||||||
RecordsManagementAuditQueryParameters params,
|
final RecordsManagementAuditQueryParameters params,
|
||||||
final List<RecordsManagementAuditEntry> results,
|
final List<RecordsManagementAuditEntry> results,
|
||||||
final Writer writer,
|
final Writer writer,
|
||||||
final ReportFormat reportFormat)
|
final ReportFormat reportFormat)
|
||||||
@@ -811,6 +811,7 @@ public class RecordsManagementAuditServiceImpl
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Date timestamp = new Date(time);
|
Date timestamp = new Date(time);
|
||||||
String eventName = null;
|
String eventName = null;
|
||||||
String fullName = null;
|
String fullName = null;
|
||||||
@@ -872,6 +873,22 @@ public class RecordsManagementAuditServiceImpl
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// filter out events if set
|
||||||
|
if (params.getEvent() != null &&
|
||||||
|
params.getEvent().endsWith(eventName) == false)
|
||||||
|
{
|
||||||
|
// skip it
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (params.getProperty() != null &&
|
||||||
|
getChangedProperties(beforeProperties, afterProperties).contains(params.getProperty()) == false)
|
||||||
|
{
|
||||||
|
// skip it
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: Refactor this to use the builder pattern
|
// TODO: Refactor this to use the builder pattern
|
||||||
RecordsManagementAuditEntry entry = new RecordsManagementAuditEntry(
|
RecordsManagementAuditEntry entry = new RecordsManagementAuditEntry(
|
||||||
timestamp,
|
timestamp,
|
||||||
@@ -904,6 +921,32 @@ public class RecordsManagementAuditServiceImpl
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private List<QName> getChangedProperties(Map<QName, Serializable> beforeProperties, Map<QName, Serializable> afterProperties)
|
||||||
|
{
|
||||||
|
List<QName> changedProperties = new ArrayList<QName>(21);
|
||||||
|
|
||||||
|
if (beforeProperties != null && afterProperties != null)
|
||||||
|
{
|
||||||
|
// add all the properties present before the audited action
|
||||||
|
for (QName valuePropName : beforeProperties.keySet())
|
||||||
|
{
|
||||||
|
changedProperties.add(valuePropName);
|
||||||
|
}
|
||||||
|
|
||||||
|
// add all the properties present after the audited action that
|
||||||
|
// have not already been added
|
||||||
|
for (QName valuePropName : afterProperties.keySet())
|
||||||
|
{
|
||||||
|
if (!beforeProperties.containsKey(valuePropName))
|
||||||
|
{
|
||||||
|
changedProperties.add(valuePropName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return changedProperties;
|
||||||
|
}
|
||||||
|
|
||||||
private void writeEntryToFile(RecordsManagementAuditEntry entry)
|
private void writeEntryToFile(RecordsManagementAuditEntry entry)
|
||||||
{
|
{
|
||||||
if (writer == null)
|
if (writer == null)
|
||||||
@@ -947,8 +990,6 @@ public class RecordsManagementAuditServiceImpl
|
|||||||
Long fromTime = (params.getDateFrom() == null ? null : new Long(params.getDateFrom().getTime()));
|
Long fromTime = (params.getDateFrom() == null ? null : new Long(params.getDateFrom().getTime()));
|
||||||
Long toTime = (params.getDateTo() == null ? null : new Long(params.getDateTo().getTime()));
|
Long toTime = (params.getDateTo() == null ? null : new Long(params.getDateTo().getTime()));
|
||||||
NodeRef nodeRef = params.getNodeRef();
|
NodeRef nodeRef = params.getNodeRef();
|
||||||
String eventName = params.getEvent();
|
|
||||||
QName propertyQName = params.getProperty();
|
|
||||||
int maxEntries = params.getMaxEntries();
|
int maxEntries = params.getMaxEntries();
|
||||||
boolean forward = maxEntries > 0 ? false : true; // Reverse order if the results are limited
|
boolean forward = maxEntries > 0 ? false : true; // Reverse order if the results are limited
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user