ACSCE-5X practice question 12 of 15

Select two ways to audit Alfresco Content Services events in an Alfresco Content Services extension? (Choose two.)

Full set: 87 questions
Answer options
A: Mark a method in the extension with an @Auditable annotation. Correct answer
B: Open a connection to the database and write the audit information to the audit tables.
C: Inject AuditComponent into the extension and call recordAuditValues.
D: Use the Alfresco REST API to record an audit event.
E: Call the Java Audit Service. Correct answer
Correct Answer:
A. Mark a method in the extension with an @Auditable annotation.; E. Call the Java Audit Service.
Explanation

Alfresco Content Services provides two primary, officially supported methods for an extension to generate audit events.
1. Declarative Auditing (@Auditable): An extension can use the @Auditable annotation on a service method. The Alfresco framework intercepts the method call and automatically generates an audit entry based on the annotation's configuration. This is the simplest way to audit method executions.
2. Programmatic Auditing (AuditService): For more complex scenarios requiring custom data or conditional auditing, an extension can inject the AuditService bean. By calling the recordAuditValues method on this service, the developer can programmatically create a detailed audit entry at any point in their code.

Why Incorrect

B. Open a connection to the database and write the audit information to the audit tables. This is incorrect because directly manipulating the database bypasses the Alfresco service layer, transaction control, and caching, leading to data inconsistency and potential corruption.
C. Inject AuditComponent into the extension and call recordAuditValues. While AuditComponent is the implementation of AuditService, best practice is to code against the public interface (AuditService). This option describes the same programmatic method as option E, making E the more appropriate answer.
D. Use the Alfresco REST API to record an audit event. This is incorrect. The standard Alfresco v1 REST API provides endpoints for retrieving and purging audit data but does not include an endpoint for creating new audit entries.

References

1. Official Alfresco Documentation (ACS 5.2): Auditing Concepts. This document explicitly describes the two main approaches.

For @Auditable (Option A): "The @Auditable annotation can be used to audit method calls declaratively. This is the simplest way to audit a method call and requires no code other than the annotation itself."

For AuditService (Option E): "For more complex auditing, the AuditService can be used directly. This allows for more control over the data that is audited and also allows for auditing to be conditional."

Source: Alfresco Content Services 5.2 Documentation, "Auditing concepts". (docs.alfresco.com/5.2/concepts/audit-concepts.html)

2. Official Alfresco Documentation (ACS 5.2): AuditService JavaDoc. The JavaDoc for the AuditService interface confirms it is the public API for auditing functions, including recordAuditValues.

Source: Alfresco Content Services 5.2 JavaDoc, org.alfresco.service.cmr.audit.AuditService.

3. Official Alfresco Documentation (ACS 5.2): Audit REST API. The API reference for auditing shows only GET and DELETE endpoints for retrieving and managing audit entries, confirming the absence of a POST endpoint for creation.

Source: Alfresco Content Services 5.2 Documentation, "Audit REST API". (docs.alfresco.com/5.2/references/RESTful-Audit.html)

Scroll to Top