Class BasicDBListener

java.lang.Object
com.jalios.jcms.db.BasicDBListener
All Implemented Interfaces:
DBConstants, DBListener, PluginComponent
Direct Known Subclasses:
AlertListener, BasicDBListenerStoreListener, CacheDBListener, DBContentListener, DBEventLogManager, MediaProgressionManager, MemberPreferenceListener, PublicationFollowerListener, ReaderTrackerManager, StrongLockManager, VoteListener, VoteManager, WorkspaceDBMemberListener

public class BasicDBListener extends Object implements DBListener, DBConstants, PluginComponent
This class is a default implementation of DBListener.
Since:
jcms-6.0.0
Author:
Olivier Dedieu
  • Constructor Details

    • BasicDBListener

      public BasicDBListener()
  • Method Details

    • init

      public boolean init(Plugin plugin)
      Description copied from interface: PluginComponent
      Initialize the component with the given plugin configuration
      Specified by:
      init in interface PluginComponent
      Parameters:
      plugin - the calling plugin
      Returns:
      true if the component has been correctly initialized.
      Since:
      jcms-6.0.0
      See Also:
    • onPostInsert

      public void onPostInsert(DBData data, org.hibernate.event.PostInsertEvent event, boolean firstTime)
      Description copied from interface: DBListener
      This method is called after a DBData has been created.
      Specified by:
      onPostInsert in interface DBListener
      Parameters:
      data - the data.
      event - the event.
      firstTime - true on the JSync replica on which the operation took place and false on the other replicas.
      Since:
      jcms-6.0.0
      See Also:
    • onPreUpdate

      public void onPreUpdate(DBData data, org.hibernate.event.PreUpdateEvent event)
      Description copied from interface: DBListener
      This method is called before a DBData is updated.
      Specified by:
      onPreUpdate in interface DBListener
      Parameters:
      data - the data.
      event - the event.
      Since:
      jcms-6.0.0
      See Also:
    • onPostUpdate

      public void onPostUpdate(DBData data, org.hibernate.event.PostUpdateEvent event, boolean firstTime)
      Description copied from interface: DBListener
      This method is called after a DBData has been updated.
      Specified by:
      onPostUpdate in interface DBListener
      Parameters:
      data - the data.
      event - the event.
      firstTime - true on the JSync replica on which the operation took place and false on the other replicas.
      Since:
      jcms-6.0.0
      See Also:
    • onPostDelete

      public void onPostDelete(DBData data, org.hibernate.event.PostDeleteEvent event, boolean firstTime)
      Description copied from interface: DBListener
      This method is called after a DBData has been deleted.
      Specified by:
      onPostDelete in interface DBListener
      Parameters:
      data - the deleted DBData. WARNING! In a JSync Cluster, when firstTime is false, this data will be null. In this case, to get information about this deleted data, you must use the event and in particular event.getId(), which returns the JPlatform ID of the data, and event.getDeletedState() which returns the attributes of the data.
      event - the event
      firstTime - true on the JSync replica on which the operation took place and false on the other replicas.
      Since:
      jcms-6.0.0
      See Also:
    • hasNoChange

      public boolean hasNoChange(org.hibernate.event.PreUpdateEvent event)
    • hasNoChange

      public boolean hasNoChange(org.hibernate.event.PostUpdateEvent event)
    • getCdateFromState

      public Date getCdateFromState(Object[] state)
      Returns the cdate from the given hibernate state.
      Parameters:
      state - the state
      Returns:
      the cdate from the given hibernate state.
      Since:
      jcms-6.0.0
    • getMdateFromState

      public Date getMdateFromState(Object[] state)
      Returns the mdate from the given hibernate state.
      Parameters:
      state - the state
      Returns:
      the mdate from the given hibernate state.
      Since:
      jcms-6.0.0
    • getAuthorIdFromState

      public String getAuthorIdFromState(Object[] state)
      Returns the authorId from the given hibernate state.
      Parameters:
      state - the state
      Returns:
      the authorId from the given hibernate state.
      Since:
      jcms-6.0.0
    • getPstatusFromState

      public int getPstatusFromState(Object[] state)
      Returns the pstatus from the given hibernate state.
      Parameters:
      state - the state
      Returns:
      the pstatus from the given hibernate state.
      Since:
      jcms-6.0.0
    • getPdateFromState

      public Date getPdateFromState(Object[] state)
      Returns the pdate from the given hibernate state.
      Parameters:
      state - the state
      Returns:
      the pdate from the given hibernate state.
      Since:
      jcms-6.0.0
    • getEdateFromState

      public Date getEdateFromState(Object[] state)
      Returns the edate from the given hibernate state.
      Parameters:
      state - the state
      Returns:
      the edate from the given hibernate state.
      Since:
      jcms-6.0.0
    • getAdateFromState

      public Date getAdateFromState(Object[] state)
      Returns the adate from the given hibernate state.
      Parameters:
      state - the state
      Returns:
      the adate from the given hibernate state.
      Since:
      jcms-6.0.0
    • getPrePstatus

      public int getPrePstatus(org.hibernate.event.PreUpdateEvent event)
      Returns the pstatus from the given PreUpdateEvent.
      Parameters:
      event - the event
      Returns:
      the pstatus from the given PreUpdateEvent.
      Since:
      jcms-6.0.0
    • getPrePstatus

      public int getPrePstatus(org.hibernate.event.PostUpdateEvent event)
      Returns the pstatus from the given PostUpdateEvent.
      Parameters:
      event - the event
      Returns:
      the pstatus from the given PostUpdateEvent.
      Since:
      jcms-6.0.0
    • getDateFromState

      public Date getDateFromState(Object[] state, int index)
      Returns the given date from the given hibernate state.
      Parameters:
      state - the state
      index - the index of the date field in the state
      Returns:
      the given date from the given hibernate state.
      Since:
      jcms-8.0.2