Package com.jalios.jcms.db
Class JcmsHibernateEventListener
- java.lang.Object
-
- com.jalios.jcms.db.JcmsHibernateEventListener
-
- All Implemented Interfaces:
DBConstants
,java.io.Serializable
,org.hibernate.event.PostDeleteEventListener
,org.hibernate.event.PostInsertEventListener
,org.hibernate.event.PostUpdateEventListener
,org.hibernate.event.PreUpdateEventListener
public class JcmsHibernateEventListener extends java.lang.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
-
Fields inherited from interface com.jalios.jcms.db.DBConstants
ALL_CATEGORIES_SET_FIELD, ATTACH_WS_SET_FIELD, AUTH_GRP_SET_FIELD, AUTH_MBR_SET_FIELD, AUTHOR_ID_FIELD, CATEGORIES_SET_FIELD, CDATE_FIELD, CHANNEL_JCMSDB_PROP, CLASSIFICATION_LEVEL_FIELD, DBDATA_URID, EXTENDED_READ_RIGHTS, HAS_ATTACH_WS_FIELD, HAS_NO_READ_RIGHTS, HIBERNATE_MAPPING_ADATE, HIBERNATE_MAPPING_AUTHOR, HIBERNATE_MAPPING_CDATE, HIBERNATE_MAPPING_EDATE, HIBERNATE_MAPPING_HAS_ATTACH_WS, HIBERNATE_MAPPING_HASNOREADRIGHTS, HIBERNATE_MAPPING_MAININSTANCE_ID, HIBERNATE_MAPPING_MAJORVERSION, HIBERNATE_MAPPING_MDATE, HIBERNATE_MAPPING_MERGE_DATE, HIBERNATE_MAPPING_MERGE_ID, HIBERNATE_MAPPING_MINORVERSION, HIBERNATE_MAPPING_OPAUTHOR, HIBERNATE_MAPPING_PDATE, HIBERNATE_MAPPING_PSTATUS, HIBERNATE_MAPPING_READ_ACK, HIBERNATE_MAPPING_READERCOUNT, HIBERNATE_MAPPING_RESTRICTIVE_UPDATE_RIGHTS, HIBERNATE_MAPPING_TITLE, HIBERNATE_MAPPING_TRACKED, HIBERNATE_MAPPING_UDATE, HIBERNATE_MAPPING_VOTECOUNT, HIBERNATE_MAPPING_VOTESCORE, HIBERNATE_MAPPING_WORKFLOW_ID, HIBERNATE_MAPPING_WORKSPACE_ID, MAX_HIBERNATE_MAPPING_PUBLICATION, MDATE_FIELD, OPAUTHOR_ID_FIELD, PSTATUS_FIELD, ROW_ID_FIELD, SCROLL_FETCH_SIZE, WORKFLOW_ID_FIELD, WORKSPACE_ID_FIELD
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addListener(DBListener listener)
Adds a DBListener for all the classes.void
addListener(DBListener listener, java.lang.Class<?> clazz)
Adds a DBListener for the given class.java.util.Map<java.lang.Class<?>,java.util.Set<DBListener>>
getDBListenerClassMap()
Returns an unmodifiable view of the Map of class / listener.java.util.Set<DBListener>
getDBListenerSet()
Returns an unmodifiable view of the listener set.static JcmsHibernateEventListener
getInstance()
Returns the singleton.boolean
isClassListen(java.lang.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, java.lang.Class<?> clazz)
Removes a DBListener for the given class.
-
-
-
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, java.lang.Class<?> clazz)
Adds a DBListener for the given class.- Parameters:
listener
- the listenerclazz
- 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, java.lang.Class<?> clazz)
Removes a DBListener for the given class.- Parameters:
listener
- the listenerclazz
- the class- Since:
- jcms-6.0.0
-
getDBListenerSet
public java.util.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 java.util.Map<java.lang.Class<?>,java.util.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(java.lang.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 interfaceorg.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 interfaceorg.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 interfaceorg.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 interfaceorg.hibernate.event.PostDeleteEventListener
-
onPostDelete
public void onPostDelete(org.hibernate.event.PostDeleteEvent event, boolean firstTime)
-
-