gov.nih.nci.caarray.util
Class CaArrayAuditLogInterceptor

java.lang.Object
  extended by org.hibernate.EmptyInterceptor
      extended by com.fiveamsolutions.nci.commons.audit.AuditLogInterceptor
          extended by gov.nih.nci.caarray.util.CaArrayAuditLogInterceptor
All Implemented Interfaces:
java.io.Serializable, org.hibernate.Interceptor

public class CaArrayAuditLogInterceptor
extends com.fiveamsolutions.nci.commons.audit.AuditLogInterceptor

Interceptor that adds audit log records for audits. The username that identifies the actor of the change request is determined with UsernameHolder. Don't forget to define a sequence "AUDIT_ID_SEQ", if your database supports it.

See Also:
This class was copied and modified from AuditLogInterceptor in nci-commons v1.2.24. This should be removed and integrated back into nci-commons when caArray updates to the newest version. Tracked in JIRA ticket ARRAY-2496., Serialized Form

Field Summary
static java.lang.String SEQUENCE_NAME
          Name of the database sequence defined for audit transaction id.
 
Fields inherited from class org.hibernate.EmptyInterceptor
INSTANCE
 
Constructor Summary
CaArrayAuditLogInterceptor()
          default ctor.
CaArrayAuditLogInterceptor(com.fiveamsolutions.nci.commons.util.HibernateHelper helper)
           
 
Method Summary
 void afterTransactionCompletion(org.hibernate.Transaction arg0)
          
 com.fiveamsolutions.nci.commons.util.HibernateHelper getHibernateHelper()
           
 com.fiveamsolutions.nci.commons.audit.DefaultProcessor getProcessor()
           
 void onCollectionUpdate(java.lang.Object collection, java.io.Serializable key)
          
 void onDelete(java.lang.Object obj, java.io.Serializable id, java.lang.Object[] newValues, java.lang.String[] properties, org.hibernate.type.Type[] types)
          
 boolean onFlushDirty(java.lang.Object obj, java.io.Serializable id, java.lang.Object[] newValues, java.lang.Object[] oldValues, java.lang.String[] properties, org.hibernate.type.Type[] types)
          
 boolean onSave(java.lang.Object obj, java.io.Serializable id, java.lang.Object[] newValues, java.lang.String[] properties, org.hibernate.type.Type[] types)
          
 void postFlush(java.util.Iterator arg0)
          
 void setHibernateHelper(com.fiveamsolutions.nci.commons.util.HibernateHelper hibernateHelper)
           
 void setProcessor(com.fiveamsolutions.nci.commons.audit.DefaultProcessor processor)
           
 
Methods inherited from class org.hibernate.EmptyInterceptor
afterTransactionBegin, beforeTransactionCompletion, findDirty, getEntity, getEntityName, instantiate, isTransient, onCollectionRecreate, onCollectionRemove, onLoad, onPrepareStatement, preFlush
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SEQUENCE_NAME

public static final java.lang.String SEQUENCE_NAME
Name of the database sequence defined for audit transaction id.

See Also:
Constant Field Values
Constructor Detail

CaArrayAuditLogInterceptor

public CaArrayAuditLogInterceptor(com.fiveamsolutions.nci.commons.util.HibernateHelper helper)
Parameters:
helper - the helper used for persistence operations.

CaArrayAuditLogInterceptor

public CaArrayAuditLogInterceptor()
default ctor.

Method Detail

getHibernateHelper

public com.fiveamsolutions.nci.commons.util.HibernateHelper getHibernateHelper()
Overrides:
getHibernateHelper in class com.fiveamsolutions.nci.commons.audit.AuditLogInterceptor
Returns:
the helper used for persistence operations.

setHibernateHelper

public void setHibernateHelper(com.fiveamsolutions.nci.commons.util.HibernateHelper hibernateHelper)
Overrides:
setHibernateHelper in class com.fiveamsolutions.nci.commons.audit.AuditLogInterceptor
Parameters:
hibernateHelper - the helper to use for persistence operations.

setProcessor

public void setProcessor(com.fiveamsolutions.nci.commons.audit.DefaultProcessor processor)
Overrides:
setProcessor in class com.fiveamsolutions.nci.commons.audit.AuditLogInterceptor
Parameters:
processor - replace the default selector.

getProcessor

public com.fiveamsolutions.nci.commons.audit.DefaultProcessor getProcessor()
Overrides:
getProcessor in class com.fiveamsolutions.nci.commons.audit.AuditLogInterceptor
Returns:
the current processor.

onFlushDirty

public boolean onFlushDirty(java.lang.Object obj,
                            java.io.Serializable id,
                            java.lang.Object[] newValues,
                            java.lang.Object[] oldValues,
                            java.lang.String[] properties,
                            org.hibernate.type.Type[] types)

Specified by:
onFlushDirty in interface org.hibernate.Interceptor
Overrides:
onFlushDirty in class com.fiveamsolutions.nci.commons.audit.AuditLogInterceptor

onSave

public boolean onSave(java.lang.Object obj,
                      java.io.Serializable id,
                      java.lang.Object[] newValues,
                      java.lang.String[] properties,
                      org.hibernate.type.Type[] types)

Specified by:
onSave in interface org.hibernate.Interceptor
Overrides:
onSave in class com.fiveamsolutions.nci.commons.audit.AuditLogInterceptor

onDelete

public void onDelete(java.lang.Object obj,
                     java.io.Serializable id,
                     java.lang.Object[] newValues,
                     java.lang.String[] properties,
                     org.hibernate.type.Type[] types)

Specified by:
onDelete in interface org.hibernate.Interceptor
Overrides:
onDelete in class com.fiveamsolutions.nci.commons.audit.AuditLogInterceptor

onCollectionUpdate

public void onCollectionUpdate(java.lang.Object collection,
                               java.io.Serializable key)

Specified by:
onCollectionUpdate in interface org.hibernate.Interceptor
Overrides:
onCollectionUpdate in class com.fiveamsolutions.nci.commons.audit.AuditLogInterceptor

postFlush

public void postFlush(java.util.Iterator arg0)

Specified by:
postFlush in interface org.hibernate.Interceptor
Overrides:
postFlush in class com.fiveamsolutions.nci.commons.audit.AuditLogInterceptor

afterTransactionCompletion

public void afterTransactionCompletion(org.hibernate.Transaction arg0)

Specified by:
afterTransactionCompletion in interface org.hibernate.Interceptor
Overrides:
afterTransactionCompletion in class com.fiveamsolutions.nci.commons.audit.AuditLogInterceptor