Interface PersistenceManagerEventHandler

All Superinterfaces:
org.springframework.core.Ordered
All Known Implementing Classes:
ArchiveStatusPersistenceEventHandler, PersistenceManagerEventHandlerAdapter

public interface PersistenceManagerEventHandler extends org.springframework.core.Ordered
Interface for handling various lifecycle event for the PersistenceManager. These events occur as part of the standard admin persistence lifecycle for entities.

PersistenceManagerEventHandler instances are generally registered via the following approach in application context xml

<bean class="org.broadleafcommerce.common.extensibility.context.merge.LateStageMergeBeanPostProcessor"> <property name="collectionRef" value="blSandBoxPersistenceManagerEventHandlers"/> <property name="targetRef" value="blPersistenceManagerEventHandlers"/> </bean> <bean id="blSandBoxPersistenceManagerEventHandlers" class="org.springframework.beans.factory.config.ListFactoryBean"> <property name="sourceList"> <list> <ref bean="blSandBoxPersistenceManagerEventHandler"/> </list> </property> </bean>

Author:
Jeff Fischer
  • Method Details

    • preInspect

      PersistenceManagerEventHandlerResponse preInspect(PersistenceManager persistenceManager, PersistencePackage persistencePackage) throws org.broadleafcommerce.common.exception.ServiceException
      Called prior to inspection for the entity described by persistencePackage
      Parameters:
      persistenceManager - the PersistenceManager instance making the call
      persistencePackage - the descriptive information for the call
      Returns:
      the response containing any changes, status or additional data
      Throws:
      org.broadleafcommerce.common.exception.ServiceException
    • postInspect

      PersistenceManagerEventHandlerResponse postInspect(PersistenceManager persistenceManager, DynamicResultSet resultSet, PersistencePackage persistencePackage) throws org.broadleafcommerce.common.exception.ServiceException
      Called after the inspection for the entity described by persistencePackage
      Parameters:
      persistenceManager - the PersistenceManager instance making the call
      resultSet - the inspection result data
      persistencePackage - the descriptive information for the call
      Returns:
      the response containing any changes, status or additional data
      Throws:
      org.broadleafcommerce.common.exception.ServiceException
    • preFetch

      PersistenceManagerEventHandlerResponse preFetch(PersistenceManager persistenceManager, PersistencePackage persistencePackage, CriteriaTransferObject cto) throws org.broadleafcommerce.common.exception.ServiceException
      Called prior to a fetch, which is a request for one or more persisted entities
      Parameters:
      persistenceManager - the PersistenceManager instance making the call
      persistencePackage - the descriptive information for the call
      cto - the criteria describing the parameters of the fetch - converted into the where clause for the select query
      Returns:
      the response containing any changes, status or additional data
      Throws:
      org.broadleafcommerce.common.exception.ServiceException
    • postFetch

      PersistenceManagerEventHandlerResponse postFetch(PersistenceManager persistenceManager, DynamicResultSet resultSet, PersistencePackage persistencePackage, CriteriaTransferObject cto) throws org.broadleafcommerce.common.exception.ServiceException
      Called after the fetch, which is a request for one or more persisted entities
      Parameters:
      persistenceManager - the PersistenceManager instance making the call
      resultSet - the fetch result data
      persistencePackage - the descriptive information for the call
      cto - the criteria describing the parameters of the fetch - converted into the where clause for the select query
      Returns:
      the response containing any changes, status or additional data
      Throws:
      org.broadleafcommerce.common.exception.ServiceException
    • preAdd

      PersistenceManagerEventHandlerResponse preAdd(PersistenceManager persistenceManager, PersistencePackage persistencePackage) throws org.broadleafcommerce.common.exception.ServiceException
      Called prior to an add
      Parameters:
      persistenceManager - the PersistenceManager instance making the call
      persistencePackage - the descriptive information for the call
      Returns:
      the response containing any changes, status or additional data
      Throws:
      org.broadleafcommerce.common.exception.ServiceException
    • postAdd

      PersistenceManagerEventHandlerResponse postAdd(PersistenceManager persistenceManager, Entity entity, PersistencePackage persistencePackage) throws org.broadleafcommerce.common.exception.ServiceException
      Called after an add
      Parameters:
      persistenceManager - the PersistenceManager instance making the call
      entity - the result of the add
      persistencePackage - the descriptive information for the call
      Returns:
      the response containing any changes, status or additional data
      Throws:
      org.broadleafcommerce.common.exception.ServiceException
    • preUpdate

      PersistenceManagerEventHandlerResponse preUpdate(PersistenceManager persistenceManager, PersistencePackage persistencePackage) throws org.broadleafcommerce.common.exception.ServiceException
      Called prior to an update
      Parameters:
      persistenceManager - the PersistenceManager instance making the call
      persistencePackage - the descriptive information for the call
      Returns:
      the response containing any changes, status or additional data
      Throws:
      org.broadleafcommerce.common.exception.ServiceException
    • postUpdate

      PersistenceManagerEventHandlerResponse postUpdate(PersistenceManager persistenceManager, Entity entity, PersistencePackage persistencePackage) throws org.broadleafcommerce.common.exception.ServiceException
      Called after an update
      Parameters:
      persistenceManager - the PersistenceManager instance making the call
      entity - the result of the update
      persistencePackage - the descriptive information for the call
      Returns:
      the response containing any changes, status or additional data
      Throws:
      org.broadleafcommerce.common.exception.ServiceException
    • preRemove

      PersistenceManagerEventHandlerResponse preRemove(PersistenceManager persistenceManager, PersistencePackage persistencePackage) throws org.broadleafcommerce.common.exception.ServiceException
      Called prior to a remove
      Parameters:
      persistenceManager - the PersistenceManager instance making the call
      persistencePackage - the descriptive information for the call
      Returns:
      the response containing any changes, status or additional data
      Throws:
      org.broadleafcommerce.common.exception.ServiceException
    • postRemove

      PersistenceManagerEventHandlerResponse postRemove(PersistenceManager persistenceManager, PersistencePackage persistencePackage) throws org.broadleafcommerce.common.exception.ServiceException
      Called after a remove
      Parameters:
      persistenceManager - the PersistenceManager instance making the call
      persistencePackage - the descriptive information for the call
      Returns:
      the response containing any changes, status or additional data
      Throws:
      org.broadleafcommerce.common.exception.ServiceException
    • processValidationError

      PersistenceManagerEventHandlerResponse processValidationError(PersistenceManager persistenceManager, Entity entity, PersistencePackage persistencePackage) throws org.broadleafcommerce.common.exception.ServiceException
      Called after a validation error. Validations occur on adds, updates and removes. The validation confirms the persistence request is correct and does not have any errors. This event handling hook provides an opportunity to impact and/or modify the results of validation errors. Errors are generally reviewed in this method by looking at Entity.getPropertyValidationErrors()
      Parameters:
      persistenceManager - the PersistenceManager instance making the call
      entity - the results of the persistence request
      persistencePackage - the descriptive information for the call
      Returns:
      the response containing any changes, status or additional data
      Throws:
      org.broadleafcommerce.common.exception.ServiceException