Merged 5.2.N-AUDIT-API (5.2.2) to 5.2.N (5.2.2)

137949 anechifor: REPO-2555 validate auditAppId


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.2.N/root@137979 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Jan Vonka
2017-07-12 12:11:51 +00:00
parent 03ec9fbbcf
commit 0e86382a6b
2 changed files with 18 additions and 7 deletions

View File

@@ -182,6 +182,8 @@ public class AuditImpl implements Audit
public CollectionWithPagingInfo<AuditEntry> listAuditEntries(String auditAppId, Parameters parameters)
{
checkEnabled();
validateAuditAppId(auditAppId);
// adding orderBy property
Pair<String, Boolean> sortProp = getAuditEntrySortProp(parameters);
@@ -228,6 +230,18 @@ public class AuditImpl implements Audit
}
private void validateAuditAppId(String auditAppId)
{
AuditService.AuditApplication auditApplication = findAuditAppById(auditAppId);
// Check if id is valid
if (auditApplication == null)
{
throw new EntityNotFoundException(auditAppId);
}
}
/**
*
* @param parameters
@@ -417,13 +431,7 @@ public class AuditImpl implements Audit
{
checkEnabled();
AuditService.AuditApplication auditApplication = findAuditAppById(auditAppId);
// Check if id is valid
if (auditApplication == null)
{
throw new EntityNotFoundException(auditAppId);
}
validateAuditAppId(auditAppId);
// Enable/Disable audit application
if (auditApp.getIsEnabled() && !auditApplication.isEnabled())