Riding the enterprise horse

Posts tagged "audit"

The Correspondence Management solution allows a number of actions, such as Create, Edit/Update, Revert, etc., over assets within the solution. Here is an approach to maintain an audit trail for each such action performed on an asset.

Overview

The overall approach used here is to register an AuditHandler that is registered against each action, such that it is invoked (from within the infrastructure) when the corresponding actions are performed over an asset. The handler can then have any custom implementation for managing the audit log, varying from as simple as a message in a log file to more complex management such as a database tuple.

Implementation

Here are the specific steps you need to take to enable the above.

Create an AuditHandler class, that implements the com.adobe.livecycle.content.repository.action.ActionHandler interface, in the CorrespondenceManagementSolutionTemplate/Services project. You are then required to implement the preProcess() and postProcess() methods which are called before and after an action in performed respectively. One may choose to perform the audit logging in any one (or maybe both) of these methods. Here’s how your AuditHandler skeleton would look like:

Update the com.adobe.icc.bootstrap.AssetDefinitionDeployer class, under CorrespondenceManagementSolutionTemplate\Services\src\com\adobe\icc\bootstrap, to add a private member variable repositoryService of type com.adobe.livecycle.content.repository.RepositoryService:

@Autowired
private RepositoryService repositoryService;

Register your handler for the necessary actions. To do so, add the following code to the afterPropertiesSet()method:

List<ActionHandler> handlers = new ArrayList<ActionHandler>();
handlers = new ArrayList<ActionHandler>();
handlers.add(new AuditHandler());
// registering the handler against the CREATE action of a Text asset.
repositoryService.addActionHandlers(ActionHandlerService.APP_ROOT_GLOBAL, TextModule.class.getName(), ActionType.CREATE, handlers);
// registering the handler against the EDIT/UPDATE action of a Text asset.
repositoryService.addActionHandlers(ActionHandlerService.APP_ROOT_GLOBAL, TextModule.class.getName(), ActionType.UPDATE, handlers);
// register for other actions, as applicable