mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
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:
@@ -54,6 +54,9 @@ public class AuditApplicationsAuditEntriesRelation implements RelationshipResour
|
||||
ParameterCheck.mandatory("audit", this.audit);
|
||||
}
|
||||
|
||||
/**
|
||||
* If auditAppId does not exist, EntityNotFoundException (status 404).
|
||||
*/
|
||||
@WebApiDescription(title = "Returns audit entries for audit app id")
|
||||
@Override
|
||||
public CollectionWithPagingInfo<AuditEntry> readAll(String auditAppId, Parameters parameters)
|
||||
|
@@ -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())
|
||||
|
Reference in New Issue
Block a user