Wired up RM node-based audit results

- Fixed up some file formatting
 - Added List-based audit results for RM


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@16146 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2009-09-08 15:08:02 +00:00
parent efb73c6e4c
commit d2be2015e4
8 changed files with 96 additions and 13 deletions

View File

@@ -121,5 +121,24 @@ public interface AuditComponent
*/
void auditQuery(
AuditQueryCallback callback,
String applicationName, String user, Long from, Long to, int maxResults);
String applicationName, String user, Long from, Long to,
int maxResults);
/**
* Get the audit entries that match the given criteria.
*
* @param callback the callback that will handle results
* @param applicationName if not <tt>null</tt>, find entries logged against this application
* @param user if not <tt>null</tt>, find entries logged against this user
* @param from the start search time (<tt>null</tt> to start at the beginning)
* @param to the end search time (<tt>null</tt> for no limit)
* @param searchKey the audit key path that must exist (<tt>null</tt> to ignore)
* @param searchString an audit value string that must exist (<tt>null</tt> to ignore)
* @param maxResults the maximum number of results to retrieve (zero or negative to ignore)
*/
void auditQuery(
AuditQueryCallback callback,
String applicationName, String user, Long from, Long to,
String searchKey, String searchString,
int maxResults);
}

View File

@@ -966,4 +966,28 @@ public class AuditComponentImpl implements AuditComponent
auditDAO.findAuditEntries(callback, applicationName, user, from, to, maxResults);
}
/**
* {@inheritDoc}
*/
public void auditQuery(
AuditQueryCallback callback,
String applicationName,
String user,
Long from,
Long to,
String searchKey, String searchString,
int maxResults)
{
ParameterCheck.mandatory("callback", callback);
// Shortcuts
if (from != null && to != null && from.compareTo(to) > 0)
{
// Time range can't yield results
return;
}
auditDAO.findAuditEntries(callback, applicationName, user, from, to, searchKey, searchString, maxResults);
}
}

View File

@@ -130,16 +130,32 @@ public class AuditServiceImpl implements AuditService
/**
* {@inheritDoc}
* @see AuditComponent#auditQuery(AuditQueryCallback, String, String, Long, Long, int)
* @since 3.2
*/
public void auditQuery(
AuditQueryCallback callback,
String applicationName, String user, Long from, Long to, int maxResults)
String applicationName, String user, Long from, Long to,
int maxResults)
{
ParameterCheck.mandatory("callback", callback);
auditComponent.auditQuery(callback, applicationName, user, from, to, maxResults);
}
/**
* {@inheritDoc}
* @since 3.2
*/
public void auditQuery(
AuditQueryCallback callback,
String applicationName, String user, Long from, Long to,
String searchKey, String searchString,
int maxResults)
{
ParameterCheck.mandatory("callback", callback);
auditComponent.auditQuery(callback, applicationName, user, from, to, searchKey, searchString, maxResults);
}
}

View File

@@ -694,7 +694,8 @@ public class HibernateAuditDAO extends HibernateDaoSupport implements AuditDAO,
*/
public void findAuditEntries(
AuditQueryCallback callback,
String applicationName, String user, Long from, Long to, int maxResults)
String applicationName, String user, Long from, Long to,
int maxResults)
{
throw new UnsupportedOperationException();
}
@@ -707,8 +708,9 @@ public class HibernateAuditDAO extends HibernateDaoSupport implements AuditDAO,
*/
public void findAuditEntries(
AuditQueryCallback callback,
String applicationName, String user, Long from, Long to, int maxResults,
String searchKey, String searchString)
String applicationName, String user, Long from, Long to,
String searchKey, String searchString,
int maxResults)
{
throw new UnsupportedOperationException();
}

View File

@@ -343,7 +343,8 @@ public abstract class AbstractAuditDAOImpl implements AuditDAO
public void findAuditEntries(
AuditQueryCallback callback,
String applicationName, String user, Long from, Long to, int maxResults)
String applicationName, String user, Long from, Long to,
int maxResults)
{
AuditQueryRowHandler rowHandler = new AuditQueryRowHandler(callback);
findAuditEntries(rowHandler, applicationName, user, from, to, maxResults, null, null);
@@ -351,8 +352,9 @@ public abstract class AbstractAuditDAOImpl implements AuditDAO
public void findAuditEntries(
AuditQueryCallback callback,
String applicationName, String user, Long from, Long to, int maxResults,
String searchKey, String searchString)
String applicationName, String user, Long from, Long to,
String searchKey, String searchString,
int maxResults)
{
AuditQueryRowHandler rowHandler = new AuditQueryRowHandler(callback);
findAuditEntries(rowHandler, applicationName, user, from, to, maxResults, searchKey, searchString);

View File

@@ -101,6 +101,7 @@ public interface AuditDAO
void findAuditEntries(
AuditQueryCallback callback,
String applicationName, String user, Long from, Long to, int maxResults,
String searchKey, String searchString);
String applicationName, String user, Long from, Long to,
String searchKey, String searchString,
int maxResults);
}

View File

@@ -196,7 +196,7 @@ public class AuditDAOTest extends TestCase
{
public Void execute() throws Throwable
{
auditDAO.findAuditEntries(callback, null, null, null, null, -1, "/a/b/c", null);
auditDAO.findAuditEntries(callback, null, null, null, null, "/a/b/c", null, -1);
return null;
}
};

View File

@@ -143,5 +143,24 @@ public interface AuditService
*/
void auditQuery(
AuditQueryCallback callback,
String applicationName, String user, Long from, Long to, int maxResults);
String applicationName, String user, Long from, Long to,
int maxResults);
/**
* Get the audit entries that match the given criteria.
*
* @param callback the callback that will handle results
* @param applicationName if not <tt>null</tt>, find entries logged against this application
* @param user if not <tt>null</tt>, find entries logged against this user
* @param from the start search time (<tt>null</tt> to start at the beginning)
* @param to the end search time (<tt>null</tt> for no limit)
* @param searchKey the audit key path that must exist (<tt>null</tt> to ignore)
* @param searchString an audit value string that must exist (<tt>null</tt> to ignore)
* @param maxResults the maximum number of results to retrieve (zero or negative to ignore)
*/
void auditQuery(
AuditQueryCallback callback,
String applicationName, String user, Long from, Long to,
String searchKey, String searchString,
int maxResults);
}