diff --git a/config/alfresco/audit-services-context.xml b/config/alfresco/audit-services-context.xml index 3e3c81e7fc..47e819db31 100644 --- a/config/alfresco/audit-services-context.xml +++ b/config/alfresco/audit-services-context.xml @@ -86,6 +86,9 @@ + + + diff --git a/source/java/org/alfresco/repo/audit/AuditMethodInterceptor.java b/source/java/org/alfresco/repo/audit/AuditMethodInterceptor.java index 6b1d3e8ee6..82a087ec6a 100644 --- a/source/java/org/alfresco/repo/audit/AuditMethodInterceptor.java +++ b/source/java/org/alfresco/repo/audit/AuditMethodInterceptor.java @@ -71,6 +71,7 @@ import org.apache.commons.logging.LogFactory; * ... * /result=<value> * /error=<value> + * /no-error=<null> * * * 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_RESULT = "/result"; 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); @@ -417,6 +419,8 @@ public class AuditMethodInterceptor implements MethodInterceptor } else { + // Add the "no error" indicator + auditData.put(AUDIT_SNIPPET_NO_ERROR, null); // The current transaction will be fine auditedData = auditComponent.recordAuditValues(rootPath, auditData); } diff --git a/source/java/org/alfresco/repo/audit/extractor/DataExtractor.java b/source/java/org/alfresco/repo/audit/extractor/DataExtractor.java index cd58a8653b..fa06b4b121 100644 --- a/source/java/org/alfresco/repo/audit/extractor/DataExtractor.java +++ b/source/java/org/alfresco/repo/audit/extractor/DataExtractor.java @@ -52,7 +52,7 @@ public interface DataExtractor * Convert an value passed into the audit components into a value to be recorded. * * @param value the source data - * @return the extracted data or null if the value is not relevant + * @return the extracted data including null * @throws Throwable All errors will be handled by the calling framework */ public Serializable extractData(Serializable value) throws Throwable; diff --git a/source/java/org/alfresco/repo/audit/extractor/NullValueDataExtractor.java b/source/java/org/alfresco/repo/audit/extractor/NullValueDataExtractor.java new file mode 100644 index 0000000000..47684a072d --- /dev/null +++ b/source/java/org/alfresco/repo/audit/extractor/NullValueDataExtractor.java @@ -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 presence 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 true always + */ + public boolean isSupported(Serializable data) + { + return true; + } + + /** + * @return Returns null always + */ + public Serializable extractData(Serializable in) throws Throwable + { + return null; + } +}