mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Audit enhancements
- Added marker data extractor to record the presence of a key in the audit data - AuditMethodInterceptor applies a marker key in the case of success (failure already has a key) git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@16519 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -86,6 +86,9 @@
|
|||||||
<bean name="auditModel.extractor.simpleValue" class="org.alfresco.repo.audit.extractor.SimpleValueDataExtractor">
|
<bean name="auditModel.extractor.simpleValue" class="org.alfresco.repo.audit.extractor.SimpleValueDataExtractor">
|
||||||
<property name="registry" ref="auditModel.extractorRegistry" />
|
<property name="registry" ref="auditModel.extractorRegistry" />
|
||||||
</bean>
|
</bean>
|
||||||
|
<bean name="auditModel.extractor.nullValue" class="org.alfresco.repo.audit.extractor.NullValueDataExtractor">
|
||||||
|
<property name="registry" ref="auditModel.extractorRegistry" />
|
||||||
|
</bean>
|
||||||
<bean name="auditModel.extractor.nodeName" class="org.alfresco.repo.audit.extractor.NodeNameDataExtractor">
|
<bean name="auditModel.extractor.nodeName" class="org.alfresco.repo.audit.extractor.NodeNameDataExtractor">
|
||||||
<property name="registry" ref="auditModel.extractorRegistry" />
|
<property name="registry" ref="auditModel.extractorRegistry" />
|
||||||
<property name="nodeService" ref="nodeService" />
|
<property name="nodeService" ref="nodeService" />
|
||||||
|
@@ -71,6 +71,7 @@ import org.apache.commons.logging.LogFactory;
|
|||||||
* ...
|
* ...
|
||||||
* /result=<value>
|
* /result=<value>
|
||||||
* /error=<value>
|
* /error=<value>
|
||||||
|
* /no-error=<null>
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
* Applications can remap the paths onto their configurations as appropriate.
|
* Applications can remap the paths onto their configurations as appropriate.
|
||||||
@@ -87,6 +88,7 @@ public class AuditMethodInterceptor implements MethodInterceptor
|
|||||||
public static final String AUDIT_SNIPPET_ARGS = "/args";
|
public static final String AUDIT_SNIPPET_ARGS = "/args";
|
||||||
public static final String AUDIT_SNIPPET_RESULT = "/result";
|
public static final String AUDIT_SNIPPET_RESULT = "/result";
|
||||||
public static final String AUDIT_SNIPPET_ERROR = "/error";
|
public static final String AUDIT_SNIPPET_ERROR = "/error";
|
||||||
|
public static final String AUDIT_SNIPPET_NO_ERROR = "/no-error";
|
||||||
|
|
||||||
private static final Log logger = LogFactory.getLog(AuditMethodInterceptor.class);
|
private static final Log logger = LogFactory.getLog(AuditMethodInterceptor.class);
|
||||||
|
|
||||||
@@ -417,6 +419,8 @@ public class AuditMethodInterceptor implements MethodInterceptor
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
// Add the "no error" indicator
|
||||||
|
auditData.put(AUDIT_SNIPPET_NO_ERROR, null);
|
||||||
// The current transaction will be fine
|
// The current transaction will be fine
|
||||||
auditedData = auditComponent.recordAuditValues(rootPath, auditData);
|
auditedData = auditComponent.recordAuditValues(rootPath, auditData);
|
||||||
}
|
}
|
||||||
|
@@ -52,7 +52,7 @@ public interface DataExtractor
|
|||||||
* Convert an value passed into the audit components into a value to be recorded.
|
* Convert an value passed into the audit components into a value to be recorded.
|
||||||
*
|
*
|
||||||
* @param value the source data
|
* @param value the source data
|
||||||
* @return the extracted data or <tt>null</tt> if the value is not relevant
|
* @return the extracted data including <tt>null</tt>
|
||||||
* @throws Throwable All errors will be handled by the calling framework
|
* @throws Throwable All errors will be handled by the calling framework
|
||||||
*/
|
*/
|
||||||
public Serializable extractData(Serializable value) throws Throwable;
|
public Serializable extractData(Serializable value) throws Throwable;
|
||||||
|
@@ -0,0 +1,54 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2005-2009 Alfresco Software Limited.
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
|
* As a special exception to the terms and conditions of version 2.0 of
|
||||||
|
* the GPL, you may redistribute this Program in connection with Free/Libre
|
||||||
|
* and Open Source Software ("FLOSS") applications as described in Alfresco's
|
||||||
|
* FLOSS exception. You should have recieved a copy of the text describing
|
||||||
|
* the FLOSS exception, and it is also available here:
|
||||||
|
* http://www.alfresco.com/legal/licensing
|
||||||
|
*/
|
||||||
|
package org.alfresco.repo.audit.extractor;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An extractor that merely records a null value. This enables configuration such
|
||||||
|
* that the <i>presence</i> of a data path can be recorded when the actual value
|
||||||
|
* is of no interest.
|
||||||
|
*
|
||||||
|
* @author Derek Hulley
|
||||||
|
* @since 3.2
|
||||||
|
*/
|
||||||
|
public class NullValueDataExtractor extends AbstractDataExtractor
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @return Returns <tt>true</tt> always
|
||||||
|
*/
|
||||||
|
public boolean isSupported(Serializable data)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Returns <tt>null</tt> always
|
||||||
|
*/
|
||||||
|
public Serializable extractData(Serializable in) throws Throwable
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user