Taylor

Taylor Audit

From Taylor

Taylor Audit is a reusable component for tracking changes to entities.

Contents

Model

The model defines the entities that store the audit data.

Listeners

The audit listeners hook into hibernate and audit all inserts, updates, and deletes.

Place the following in your persistence.xml file to turn on auditing.

	<!-- Audit Listeners -->
	<property name="hibernate.ejb.event.post-insert" value="net.taylor.audit.AuditListener"/>
	<property name="hibernate.ejb.event.post-update" value="net.taylor.audit.AuditListener"/>
	<property name="hibernate.ejb.event.post-delete" value="net.taylor.audit.AuditListener"/>
	<property name="hibernate.ejb.event.pre-collection-update" value="net.taylor.audit.AuditListener"/>
	<property name="hibernate.ejb.event.pre-collection-remove" value="net.taylor.audit.AuditListener"/>
	<property name="hibernate.ejb.event.post-collection-recreate" value="net.taylor.audit.AuditListener"/>

By Pass

Add the @BypassAudit annotation to any entities that you do not wish to audit.

JMS Topic

Audit messages are placed on a jms topic to minimize performance impacts and share the events with multiple listeners.

The AuditMDB persists the audit data.

	<mbean code="org.jboss.jms.server.destination.TopicService"
		name="jboss.messaging.destination:service=Topic,name=net.taylor.AuditTopic"
		xmbean-dd="xmdesc/Topic-xmbean.xml">
		<depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
		<depends>jboss.messaging:service=PostOffice</depends>
		<attribute name="RedeliveryDelay">10000</attribute>
	</mbean>

Presentation

  • Maintenance screens
    • View all audit events
  • Change History
    • Each entity View/Edit facelet has a link to this dialog to view audit events for the specific entity instance
  • Associations
    • The @NaturalId annotation is relied on to display the proper fields for associations

Related

  • Envers?