Access tracking (until v4.9.1)

Since v5.0 AccessTracking is not included in the distribution. You can use the new AccessTracker of OpenXava or Hibernate Envers, create your own listener or get AccessTracking from an older distribution.
Until OpenXava 4.9.1 the AccessTracking project was included in distribution by default. This project defines an entity listener that allows you to track all access to the data in your application. Actually, this project allows your application to comply the Spanish Data Protection Law (Ley de Protección de Datos) including high level security data. Although it's generic enough to be useful in a broad variety of scenarios.

Applying the listener

When you apply this listener to your entity, then the code of AccessTrackingListener is executed each time a object is created, loaded, modified or removed. AccessTrackingListener writes a record into a database table with information about the access.
In order to apply this listener you only need to write this in your entity code:
public class Warehouse {
In this simply way, only one line, all accesses to Warehouse entities will be record in a database table.

Setup AccessTracking

If you want to use the AccessTracking in your project you have to follow the next setup steps:
  • Add AccessTracking as referenced project: Inside Eclipse click right button on your project and go to Properties > Java Build Path > Projects.
  • Create the table in your database to store the tracking of accesses. You can find the CREATE TABLE in AccessTracking/data/access-tracking-db.script file.
  • Inside the AccessTracking project you need to select a configuration (editing build.xml) and regenerate hibernate code (using the ant target generateHibernate) for AccessTracking project.
Also you need to modify the target deployWar of your build.xml in this way:
<target name="deployWar">
    <ant antfile="../AccessTracking/build.xml" target="createTracker"/>
Now you only have to deploy the war for your project.
All access are recorded in a table with the name TRACKING.ACCESS. If you want you can deploy the module web or the portlet of AccessTracking project in order to have a web application to browse the accesses.
For more details you can have a look at the OpenXavaTest project.