Audit

Complete

OpenVPMS has a simple but incomplete audit facility that needs to be explicitly enabled - see below.

Some records (eg invoices) record the 'author' - ie the name of the user who created them. However, this is not universal - for example no author is recorded on the customer record.

 

Audit Service
The audit service is very limited. It has never been developed beyond prototype phase. As such, it doesn't audit all of the operations performed on the database nor does it log the user that performed the operation.  It works by intercepting calls to the archetype service but it does not intercept the method where multiple objects are saved at once.

This method is used in many places, including:

* editing
* lookup merging
* customer merging
* invoice/credit reversals
* document generation
* customer balance updates
* till clearing

If you want to try it out, you need to edit applicationContext.xml located in <TOMCAT_HOME>/webapps/openvpms/WEB-INF/ and uncomment auditDao, auditService, autoProxyCreator, and auditServiceAdvisor so that things look as follows:
 

     <bean id="auditDao"
          class="org.openvpms.component.business.dao.hibernate.im.audit.AuditDAOHibernate">
        <property name="sessionFactory" ref="sessionFactory"/>
    </bean>

    <bean id="auditService"
          class="org.openvpms.component.business.service.audit.AuditService">
        <constructor-arg ref="auditDao"/>
    </bean>

    <bean id="autoProxyCreator"
          class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator">
        <property name="beanNames">
            <list>
                <value>archetypeService</value>
            </list>
        </property>
        <property name="interceptorNames">
            <list>
                <value>auditServiceAdvisor</value>
            </list>
        </property>
    </bean>

    <bean id="auditServiceAdvisor"
          class="org.springframework.aop.support.RegexpMethodPointcutAdvisor">
        <property name="advice" ref="auditService"/>
        <property name="patterns">
            <list>
                <value>.*ArchetypeService\.save</value>
                <value>.*ArchetypeService\.remove</value>
            </list>
        </property>
    </bean>