mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
ALF-4106: Added entry deletion count return value for clear()
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@22109 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -78,10 +78,11 @@ public interface AuditComponent
|
||||
* @param applicationName the name of the application being logged to
|
||||
* @param fromTime the start time of entries to remove (inclusive and optional)
|
||||
* @param toTime the end time of entries to remove (exclusive and optional)
|
||||
* @return Returns the number of entries deleted
|
||||
*
|
||||
* @since 3.2
|
||||
*/
|
||||
void deleteAuditEntries(String applicationName, Long fromTime, Long toTime);
|
||||
int deleteAuditEntries(String applicationName, Long fromTime, Long toTime);
|
||||
|
||||
/**
|
||||
* Check if an audit path is enabled. The path will be disabled if it or any higher
|
||||
|
@@ -113,7 +113,7 @@ public class AuditComponentImpl implements AuditComponent
|
||||
* {@inheritDoc}
|
||||
* @since 3.2
|
||||
*/
|
||||
public void deleteAuditEntries(String applicationName, Long fromTime, Long toTime)
|
||||
public int deleteAuditEntries(String applicationName, Long fromTime, Long toTime)
|
||||
{
|
||||
ParameterCheck.mandatory("applicationName", applicationName);
|
||||
AlfrescoTransactionSupport.checkTransactionReadState(true);
|
||||
@@ -125,17 +125,20 @@ public class AuditComponentImpl implements AuditComponent
|
||||
{
|
||||
logger.debug("No audit application named '" + applicationName + "' has been registered.");
|
||||
}
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
Long applicationId = application.getApplicationId();
|
||||
|
||||
auditDAO.deleteAuditEntries(applicationId, fromTime, toTime);
|
||||
int deleted = auditDAO.deleteAuditEntries(applicationId, fromTime, toTime);
|
||||
// Done
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("Delete audit entries for " + applicationName + " (" + fromTime + " to " + toTime);
|
||||
logger.debug(
|
||||
"Delete audit " + deleted + " entries for " + applicationName +
|
||||
" (" + fromTime + " to " + toTime);
|
||||
}
|
||||
return deleted;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -115,10 +115,10 @@ public class AuditServiceImpl implements AuditService
|
||||
* {@inheritDoc}
|
||||
* @since 3.2
|
||||
*/
|
||||
public void clearAudit(String applicationName)
|
||||
public int clearAudit(String applicationName)
|
||||
{
|
||||
Long now = Long.valueOf(System.currentTimeMillis());
|
||||
auditComponent.deleteAuditEntries(applicationName, null, now);
|
||||
return auditComponent.deleteAuditEntries(applicationName, null, now);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -126,10 +126,10 @@ public class AuditServiceImpl implements AuditService
|
||||
* @since 3.4
|
||||
*/
|
||||
@Override
|
||||
public void clearAudit(String applicationName, Long fromTime, Long toTime)
|
||||
public int clearAudit(String applicationName, Long fromTime, Long toTime)
|
||||
{
|
||||
toTime = (toTime == null) ? Long.valueOf(System.currentTimeMillis()) : toTime;
|
||||
auditComponent.deleteAuditEntries(applicationName, fromTime, toTime);
|
||||
return auditComponent.deleteAuditEntries(applicationName, fromTime, toTime);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user