diff --git a/source/java/org/alfresco/repo/audit/AuditComponent.java b/source/java/org/alfresco/repo/audit/AuditComponent.java
index 3df7d94480..0a269b4f22 100644
--- a/source/java/org/alfresco/repo/audit/AuditComponent.java
+++ b/source/java/org/alfresco/repo/audit/AuditComponent.java
@@ -28,6 +28,7 @@ import java.io.Serializable;
import java.util.List;
import java.util.Map;
+import org.alfresco.repo.audit.model.AuditApplication;
import org.alfresco.repo.audit.model._3.AuditPath;
import org.alfresco.service.cmr.audit.AuditInfo;
import org.alfresco.service.cmr.repository.NodeRef;
@@ -87,32 +88,38 @@ public interface AuditComponent
* the same root path.
*
* The name of the application controls part of the audit model will be used. The root path must
- * start with the matching key attribute that was declared for the matching
- * Application element in the audit configuration.
+ * start with the path separator '/' ({@link AuditApplication#AUDIT_PATH_SEPARATOR}) and the matching
+ * key attribute that was declared for the Application element in the audit configuration.
*
* This is a read-write method. Client code must wrap calls in the appropriate transactional wrappers.
*
* @param applicationName the name of the application to log against
- * @param rootPath a base path of {@link AuditPath} key entries concatenated with . (period)
- * @return Returns the unique session
+ * @param rootPath a base path of {@link AuditPath} key entries concatenated with
+ * {@link AuditApplication#AUDIT_PATH_SEPARATOR}.
+ * @return Returns the unique session or null if no session was created
* @throws IllegalStateException if there is not a writable transaction present
*/
AuditSession startAuditSession(String applicationName, String rootPath);
/**
- * {@inheritDoc #startAuditSession(String, String)}
+ * {@inheritDoc AuditComponent#startAuditSession(String, String)}
+ * @param applicationName the name of the application to log against
+ * @param rootPath a base path of {@link AuditPath} key entries concatenated with the path separator
+ * '/' ({@link AuditApplication#AUDIT_PATH_SEPARATOR})
* @param values values to associate with the session. These values will override or
* complement generated session-specific values
+ * @param rootPath a base path of {@link AuditPath} key entries concatenated with
+ * {@link AuditApplication#AUDIT_PATH_SEPARATOR}.
* @throws IllegalStateException if there is not a writable transaction present
*/
AuditSession startAuditSession(String applicationName, String rootPath, Map values);
/**
- * Record a set of values against the given session. The map is a path (starting with '/') relative
- * to the root path given when {@link #startAuditSession(String, String) starting the session}. All
- * resulting path values (session root path + map entry paths) must have data recorder entries and
- * be enabled for data to be recorded.
+ * Record a set of values against the given session. The map is a path - starting with '/'
+ * ({@link AuditApplication#AUDIT_PATH_SEPARATOR}), relative to the root path given when
+ * {@link #startAuditSession(String, String) starting the session}. All resulting path values
+ * (session root path + map entry paths) must have data recorder entries and be enabled for data to be recorded.
*
* The return values reflect what was actually persisted and is controlled by the data extractors
* defined in the audit configuration.
diff --git a/source/java/org/alfresco/repo/audit/AuditComponentTest.java b/source/java/org/alfresco/repo/audit/AuditComponentTest.java
index 61cb7845cd..7b78b2fa5b 100644
--- a/source/java/org/alfresco/repo/audit/AuditComponentTest.java
+++ b/source/java/org/alfresco/repo/audit/AuditComponentTest.java
@@ -60,6 +60,7 @@ import org.springframework.util.ResourceUtils;
public class AuditComponentTest extends TestCase
{
private static final String APPLICATION_TEST = "Alfresco Test";
+ private static final String APPLICATION_ACTIONS_TEST = "Actions Test";
private static ApplicationContext ctx = ApplicationContextHelper.getApplicationContext();
@@ -206,8 +207,8 @@ public class AuditComponentTest extends TestCase
{
public Map execute() throws Throwable
{
- String actionPath = AuditApplication.buildPath("test/actions", action);
- AuditSession session = auditComponent.startAuditSession(APPLICATION_TEST, actionPath);
+ String actionPath = AuditApplication.buildPath("actions-test/actions", action);
+ AuditSession session = auditComponent.startAuditSession(APPLICATION_ACTIONS_TEST, actionPath);
return auditComponent.audit(session, adjustedValues);
}
@@ -215,6 +216,9 @@ public class AuditComponentTest extends TestCase
return transactionService.getRetryingTransactionHelper().doInTransaction(auditCallback);
}
+ /**
+ * Utility method to compare a 'results' map with a map of expected values
+ */
private void checkAuditMaps(Map result, Map expected)
{
Map copyResult = new HashMap(result);
@@ -275,10 +279,10 @@ public class AuditComponentTest extends TestCase
Map result = auditTestAction("action-01", nodeRef, parameters);
Map expected = new HashMap();
- expected.put("/test/actions/action-01/context-node/noderef", nodeRef);
- expected.put("/test/actions/action-01/params/A/value", valueA);
- expected.put("/test/actions/action-01/params/B/value", valueB);
- expected.put("/test/actions/action-01/params/C/value", valueC);
+ expected.put("/actions-test/actions/action-01/context-node/noderef", nodeRef);
+ expected.put("/actions-test/actions/action-01/params/A/value", valueA);
+ expected.put("/actions-test/actions/action-01/params/B/value", valueB);
+ expected.put("/actions-test/actions/action-01/params/C/value", valueC);
// Check
checkAuditMaps(result, expected);
diff --git a/source/java/org/alfresco/service/cmr/audit/AuditService.java b/source/java/org/alfresco/service/cmr/audit/AuditService.java
index 56fc536085..b94704815b 100644
--- a/source/java/org/alfresco/service/cmr/audit/AuditService.java
+++ b/source/java/org/alfresco/service/cmr/audit/AuditService.java
@@ -26,7 +26,6 @@ package org.alfresco.service.cmr.audit;
import java.util.List;
-import org.alfresco.repo.audit.AuditState;
import org.alfresco.service.NotAuditable;
import org.alfresco.service.PublicService;
import org.alfresco.service.cmr.repository.NodeRef;
@@ -43,7 +42,6 @@ import org.alfresco.service.cmr.repository.NodeRef;
@PublicService
public interface AuditService
{
-
/**
* Add an application audit entry.
*
diff --git a/source/test-resources/alfresco/audit/alfresco-audit-test.xml b/source/test-resources/alfresco/audit/alfresco-audit-test.xml
index adcfd95cc7..36f6a62bbd 100644
--- a/source/test-resources/alfresco/audit/alfresco-audit-test.xml
+++ b/source/test-resources/alfresco/audit/alfresco-audit-test.xml
@@ -64,6 +64,10 @@
+
+
+
+