mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Example of how to get last audit entry ID for a given app name
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@17773 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -491,7 +491,7 @@ public class AuditComponentTest extends TestCase
|
|||||||
if (logger.isDebugEnabled())
|
if (logger.isDebugEnabled())
|
||||||
{
|
{
|
||||||
logger.debug(
|
logger.debug(
|
||||||
"Audit Entry: " + applicationName + ", " + user + ", " + new Date(time) + "\n" +
|
"Audit Entry " + entryId + ": " + applicationName + ", " + user + ", " + new Date(time) + "\n" +
|
||||||
" Data: " + values);
|
" Data: " + values);
|
||||||
}
|
}
|
||||||
sb.append("Row: ")
|
sb.append("Row: ")
|
||||||
@@ -569,4 +569,37 @@ public class AuditComponentTest extends TestCase
|
|||||||
logger.debug(sb.toString());
|
logger.debug(sb.toString());
|
||||||
assertFalse("Did not get any audit results after failed login", results.isEmpty());
|
assertFalse("Did not get any audit results after failed login", results.isEmpty());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testAuditQuery_MaxId() throws Exception
|
||||||
|
{
|
||||||
|
AuditQueryCallback auditQueryCallback = new AuditQueryCallback()
|
||||||
|
{
|
||||||
|
public boolean handleAuditEntry(
|
||||||
|
Long entryId,
|
||||||
|
String applicationName,
|
||||||
|
String user,
|
||||||
|
long time,
|
||||||
|
Map<String, Serializable> values)
|
||||||
|
{
|
||||||
|
if (logger.isDebugEnabled())
|
||||||
|
{
|
||||||
|
logger.debug(
|
||||||
|
"Audit Entry " + entryId + ": " + applicationName + ", " + user + ", " + new Date(time) + "\n" +
|
||||||
|
" Data: " + values);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean handleAuditEntryError(Long entryId, String errorMsg, Throwable error)
|
||||||
|
{
|
||||||
|
throw new AlfrescoRuntimeException(errorMsg, error);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
AuditQueryParameters params = new AuditQueryParameters();
|
||||||
|
params.setApplicationName(APPLICATION_API_TEST);
|
||||||
|
params.setForward(false);
|
||||||
|
params.setToId(Long.MAX_VALUE);
|
||||||
|
auditService.auditQuery(auditQueryCallback, params, 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user