org.openmrs.api.db.hibernate
Class ChainingInterceptor

java.lang.Object
  extended by org.openmrs.api.db.hibernate.ChainingInterceptor
All Implemented Interfaces:
org.hibernate.Interceptor

public class ChainingInterceptor
extends java.lang.Object
implements org.hibernate.Interceptor

Used by the HibernateSessionFactoryBean to keep track of multiple interceptors
Each of the methods in Interceptor are called for each interceptor that is added to this class

Since:
1.9

Field Summary
 java.util.Collection<org.hibernate.Interceptor> interceptors
           
 
Constructor Summary
ChainingInterceptor()
           
 
Method Summary
 void addInterceptor(org.hibernate.Interceptor interceptor)
          Adds the given interceptor to the list of interceptors to be applied to hibernate sessions.
 void afterTransactionBegin(org.hibernate.Transaction tx)
           
 void afterTransactionCompletion(org.hibernate.Transaction tx)
           
 void beforeTransactionCompletion(org.hibernate.Transaction tx)
           
 int[] findDirty(java.lang.Object entity, java.io.Serializable id, java.lang.Object[] currentState, java.lang.Object[] previousState, java.lang.String[] propertyNames, org.hibernate.type.Type[] types)
           
 java.lang.Object getEntity(java.lang.String entityName, java.io.Serializable id)
           
 java.lang.String getEntityName(java.lang.Object object)
           
 java.lang.Object instantiate(java.lang.String entityName, org.hibernate.EntityMode entityMode, java.io.Serializable id)
           
 java.lang.Boolean isTransient(java.lang.Object entity)
           
 void onCollectionRecreate(java.lang.Object collection, java.io.Serializable key)
           
 void onCollectionRemove(java.lang.Object collection, java.io.Serializable key)
           
 void onCollectionUpdate(java.lang.Object collection, java.io.Serializable key)
           
 void onDelete(java.lang.Object entity, java.io.Serializable id, java.lang.Object[] state, java.lang.String[] propertyNames, org.hibernate.type.Type[] types)
           
 boolean onFlushDirty(java.lang.Object entity, java.io.Serializable id, java.lang.Object[] currentState, java.lang.Object[] previousState, java.lang.String[] propertyNames, org.hibernate.type.Type[] types)
           
 boolean onLoad(java.lang.Object entity, java.io.Serializable id, java.lang.Object[] state, java.lang.String[] propertyNames, org.hibernate.type.Type[] types)
           
 java.lang.String onPrepareStatement(java.lang.String sql)
           
 boolean onSave(java.lang.Object entity, java.io.Serializable id, java.lang.Object[] state, java.lang.String[] propertyNames, org.hibernate.type.Type[] types)
           
 void postFlush(java.util.Iterator entities)
           
 void preFlush(java.util.Iterator entities)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

interceptors

public java.util.Collection<org.hibernate.Interceptor> interceptors
Constructor Detail

ChainingInterceptor

public ChainingInterceptor()
Method Detail

addInterceptor

public void addInterceptor(org.hibernate.Interceptor interceptor)
Adds the given interceptor to the list of interceptors to be applied to hibernate sessions. Interceptors are called in the added order, with core interceptors being called first

Parameters:
interceptor - the interceptor to add to the queue

onDelete

public void onDelete(java.lang.Object entity,
                     java.io.Serializable id,
                     java.lang.Object[] state,
                     java.lang.String[] propertyNames,
                     org.hibernate.type.Type[] types)
Specified by:
onDelete in interface org.hibernate.Interceptor

onFlushDirty

public boolean onFlushDirty(java.lang.Object entity,
                            java.io.Serializable id,
                            java.lang.Object[] currentState,
                            java.lang.Object[] previousState,
                            java.lang.String[] propertyNames,
                            org.hibernate.type.Type[] types)
Specified by:
onFlushDirty in interface org.hibernate.Interceptor

onLoad

public boolean onLoad(java.lang.Object entity,
                      java.io.Serializable id,
                      java.lang.Object[] state,
                      java.lang.String[] propertyNames,
                      org.hibernate.type.Type[] types)
Specified by:
onLoad in interface org.hibernate.Interceptor

onSave

public boolean onSave(java.lang.Object entity,
                      java.io.Serializable id,
                      java.lang.Object[] state,
                      java.lang.String[] propertyNames,
                      org.hibernate.type.Type[] types)
Specified by:
onSave in interface org.hibernate.Interceptor

postFlush

public void postFlush(java.util.Iterator entities)
Specified by:
postFlush in interface org.hibernate.Interceptor

preFlush

public void preFlush(java.util.Iterator entities)
Specified by:
preFlush in interface org.hibernate.Interceptor

isTransient

public java.lang.Boolean isTransient(java.lang.Object entity)
Specified by:
isTransient in interface org.hibernate.Interceptor

instantiate

public java.lang.Object instantiate(java.lang.String entityName,
                                    org.hibernate.EntityMode entityMode,
                                    java.io.Serializable id)
Specified by:
instantiate in interface org.hibernate.Interceptor

findDirty

public int[] findDirty(java.lang.Object entity,
                       java.io.Serializable id,
                       java.lang.Object[] currentState,
                       java.lang.Object[] previousState,
                       java.lang.String[] propertyNames,
                       org.hibernate.type.Type[] types)
Specified by:
findDirty in interface org.hibernate.Interceptor

getEntityName

public java.lang.String getEntityName(java.lang.Object object)
Specified by:
getEntityName in interface org.hibernate.Interceptor

getEntity

public java.lang.Object getEntity(java.lang.String entityName,
                                  java.io.Serializable id)
Specified by:
getEntity in interface org.hibernate.Interceptor

afterTransactionBegin

public void afterTransactionBegin(org.hibernate.Transaction tx)
Specified by:
afterTransactionBegin in interface org.hibernate.Interceptor

afterTransactionCompletion

public void afterTransactionCompletion(org.hibernate.Transaction tx)
Specified by:
afterTransactionCompletion in interface org.hibernate.Interceptor

beforeTransactionCompletion

public void beforeTransactionCompletion(org.hibernate.Transaction tx)
Specified by:
beforeTransactionCompletion in interface org.hibernate.Interceptor

onPrepareStatement

public java.lang.String onPrepareStatement(java.lang.String sql)
Specified by:
onPrepareStatement in interface org.hibernate.Interceptor

onCollectionRemove

public void onCollectionRemove(java.lang.Object collection,
                               java.io.Serializable key)
                        throws org.hibernate.CallbackException
Specified by:
onCollectionRemove in interface org.hibernate.Interceptor
Throws:
org.hibernate.CallbackException

onCollectionRecreate

public void onCollectionRecreate(java.lang.Object collection,
                                 java.io.Serializable key)
                          throws org.hibernate.CallbackException
Specified by:
onCollectionRecreate in interface org.hibernate.Interceptor
Throws:
org.hibernate.CallbackException

onCollectionUpdate

public void onCollectionUpdate(java.lang.Object collection,
                               java.io.Serializable key)
                        throws org.hibernate.CallbackException
Specified by:
onCollectionUpdate in interface org.hibernate.Interceptor
Throws:
org.hibernate.CallbackException

OpenMRS-1.7.x

Generated Apr 27 2012 10:06 PM. NOTE - these libraries are in active development and subject to change