com.jalios.jcms.db
Class JcmsHibernateEventListener

java.lang.Object
  extended by com.jalios.jcms.db.JcmsHibernateEventListener
All Implemented Interfaces:
DBConstants, Serializable, org.hibernate.event.PostDeleteEventListener, org.hibernate.event.PostInsertEventListener, org.hibernate.event.PostUpdateEventListener, org.hibernate.event.PreUpdateEventListener

public class JcmsHibernateEventListener
extends Object
implements org.hibernate.event.PreUpdateEventListener, org.hibernate.event.PostInsertEventListener, org.hibernate.event.PostUpdateEventListener, org.hibernate.event.PostDeleteEventListener, DBConstants

This class is a singleton that dispatches Hibernate events to JCMS DBListeners

Since:
jcms-6.0.0
Author:
Olivier Dedieu
See Also:
Serialized Form

Field Summary
static String REVISION
           
 
Fields inherited from interface com.jalios.jcms.db.DBConstants
ALL_CATEGORIES_SET_FIELD, AUTH_GRP_SET_FIELD, AUTH_MBR_SET_FIELD, AUTHOR_ID_FIELD, CATEGORIES_SET_FIELD, CDATE_FIELD, CHANNEL_JCMSDB_PROP, DBDATA_URID, HAS_NO_READ_RIGHTS, HIBERNATE_MAPPING_ADATE, HIBERNATE_MAPPING_AUTHOR, HIBERNATE_MAPPING_CDATE, HIBERNATE_MAPPING_EDATE, HIBERNATE_MAPPING_MDATE, HIBERNATE_MAPPING_PDATE, HIBERNATE_MAPPING_PSTATUS, HIBERNATE_MAPPING_TITLE, HIBERNATE_MAPPING_WORKFLOW_ID, HIBERNATE_MAPPING_WORKSPACE_ID, MDATE_FIELD, PSTATUS_FIELD, ROW_ID_FIELD, SCROLL_FETCH_SIZE, WORKFLOW_ID_FIELD, WORKSPACE_ID_FIELD
 
Method Summary
 void addListener(DBListener listener)
          Adds a DBListener for all the classes.
 void addListener(DBListener listener, Class clazz)
          Adds a DBListener for the given class.
 Map<Class,Set<DBListener>> getDBListenerClassMap()
          Returns an unmodifiable view of the Map of class / listener.
 Set<DBListener> getDBListenerSet()
          Returns an unmodifiable view of the listener set.
static JcmsHibernateEventListener getInstance()
          Returns the singleton.
 boolean isClassListen(Class clazz)
          Returns true if the given class is explicitly listen by a DBListener.
 void onPostDelete(org.hibernate.event.PostDeleteEvent event)
           
 void onPostDelete(org.hibernate.event.PostDeleteEvent event, boolean firstTime)
           
 void onPostInsert(org.hibernate.event.PostInsertEvent event)
           
 void onPostInsert(org.hibernate.event.PostInsertEvent event, boolean firstTime)
           
 void onPostUpdate(org.hibernate.event.PostUpdateEvent event)
           
 void onPostUpdate(org.hibernate.event.PostUpdateEvent event, boolean firstTime)
           
 boolean onPreUpdate(org.hibernate.event.PreUpdateEvent event)
           
 boolean onPreUpdateInternal(org.hibernate.event.PreUpdateEvent event)
           
 void removeListener(DBListener listener)
          Removes a DBListener for all the classes.
 void removeListener(DBListener listener, Class clazz)
          Removes a DBListener for the given class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

REVISION

public static final String REVISION
See Also:
Constant Field Values
Method Detail

getInstance

public static JcmsHibernateEventListener getInstance()
Returns the singleton.

Returns:
the singleton.
Since:
jcms-6.0.0

addListener

public void addListener(DBListener listener)
Adds a DBListener for all the classes.

Parameters:
listener - the listener
Since:
jcms-6.0.0

addListener

public void addListener(DBListener listener,
                        Class clazz)
Adds a DBListener for the given class.

Parameters:
listener - the listener
clazz - the class
Since:
jcms-6.0.0

removeListener

public void removeListener(DBListener listener)
Removes a DBListener for all the classes.

Parameters:
listener - the listener
Since:
jcms-6.0.0

removeListener

public void removeListener(DBListener listener,
                           Class clazz)
Removes a DBListener for the given class.

Parameters:
listener - the listener
clazz - the class
Since:
jcms-6.0.0

getDBListenerSet

public Set<DBListener> getDBListenerSet()
Returns an unmodifiable view of the listener set.

Returns:
an unmodifiable view of the listener set.
Since:
jcms-6.1.0

getDBListenerClassMap

public Map<Class,Set<DBListener>> getDBListenerClassMap()
Returns an unmodifiable view of the Map of class / listener.

Returns:
an unmodifiable view of the Map of class / listener.
Since:
jcms-6.1.0

isClassListen

public boolean isClassListen(Class clazz)
Returns true if the given class is explicitly listen by a DBListener.

Parameters:
clazz - the class.
Returns:
true if the given class is explicitly listen by a DBListener.
Since:
jcms-6.1.0

onPostInsert

public void onPostInsert(org.hibernate.event.PostInsertEvent event)
Specified by:
onPostInsert in interface org.hibernate.event.PostInsertEventListener

onPostInsert

public void onPostInsert(org.hibernate.event.PostInsertEvent event,
                         boolean firstTime)

onPreUpdate

public boolean onPreUpdate(org.hibernate.event.PreUpdateEvent event)
Specified by:
onPreUpdate in interface org.hibernate.event.PreUpdateEventListener

onPreUpdateInternal

public boolean onPreUpdateInternal(org.hibernate.event.PreUpdateEvent event)

onPostUpdate

public void onPostUpdate(org.hibernate.event.PostUpdateEvent event)
Specified by:
onPostUpdate in interface org.hibernate.event.PostUpdateEventListener

onPostUpdate

public void onPostUpdate(org.hibernate.event.PostUpdateEvent event,
                         boolean firstTime)

onPostDelete

public void onPostDelete(org.hibernate.event.PostDeleteEvent event)
Specified by:
onPostDelete in interface org.hibernate.event.PostDeleteEventListener

onPostDelete

public void onPostDelete(org.hibernate.event.PostDeleteEvent event,
                         boolean firstTime)


Copyright © 2001-2010 Jalios SA. All Rights Reserved.