Added source-target mappings for Audit data

- Audit entry creation API no longer requires an application name
 - Inbound data is remapped according to the mappings in the audit XML files


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@16327 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2009-09-16 19:02:40 +00:00
parent a2970e7c49
commit c0d49f6284
14 changed files with 588 additions and 165 deletions

View File

@@ -174,6 +174,7 @@ public class AuditApplication
*/
public void checkPath(String path)
{
checkPathFormat(path);
if (path == null || path.length() == 0)
{
generateException(path, "Empty or null audit path");
@@ -192,6 +193,26 @@ public class AuditApplication
}
}
/**
* Helper method to check that a path is correct for this application instance
*
* @param path the path in format <b>/app-key/x/y/z</b>
* @throws AuditModelException if the path is invalid
*
* @see #AUDIT_PATH_REGEX
*/
public static void checkPathFormat(String path)
{
if (path == null || path.length() == 0)
{
throw new AuditModelException("Empty or null audit path");
}
else if (!path.matches(AUDIT_PATH_REGEX))
{
throw new AuditModelException("An audit must match regular expression: " + AUDIT_PATH_REGEX);
}
}
/**
* Compile a path or part of a path into a single string which always starts with the
* {@link #AUDIT_PATH_SEPARATOR}. This can be a relative path so need not always start with
@@ -237,6 +258,33 @@ public class AuditApplication
return path;
}
/**
* @param path the audit path for form <b>/abc/def</b>
* @return the root key of form <b>abc</b>
*
* @see #AUDIT_ROOT_KEY_REGEX
*/
public static String getRootKey(String path)
{
if (!path.startsWith(AUDIT_PATH_SEPARATOR))
{
throw new AuditModelException(
"The path must start with the path separator '" + AUDIT_PATH_SEPARATOR + "'");
}
String rootPath;
int index = path.indexOf(AUDIT_PATH_SEPARATOR, 1);
if (index > 0)
{
rootPath = path.substring(1, index);
}
else
{
rootPath = path.substring(1);
}
// Done
return rootPath;
}
/**
* Get all data extractors applicable to a given path and scope.
*