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
-
Field Summary
Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
-
Method Summary
Modifier and TypeMethodDescriptionpostAdd
(PersistenceManager persistenceManager, Entity entity, PersistencePackage persistencePackage) Called after an addpostFetch
(PersistenceManager persistenceManager, DynamicResultSet resultSet, PersistencePackage persistencePackage, CriteriaTransferObject cto) Called after the fetch, which is a request for one or more persisted entitiespostInspect
(PersistenceManager persistenceManager, DynamicResultSet resultSet, PersistencePackage persistencePackage) Called after the inspection for the entity described by persistencePackagepostRemove
(PersistenceManager persistenceManager, PersistencePackage persistencePackage) Called after a removepostUpdate
(PersistenceManager persistenceManager, Entity entity, PersistencePackage persistencePackage) Called after an updatepreAdd
(PersistenceManager persistenceManager, PersistencePackage persistencePackage) Called prior to an addpreFetch
(PersistenceManager persistenceManager, PersistencePackage persistencePackage, CriteriaTransferObject cto) Called prior to a fetch, which is a request for one or more persisted entitiespreInspect
(PersistenceManager persistenceManager, PersistencePackage persistencePackage) Called prior to inspection for the entity described by persistencePackagepreRemove
(PersistenceManager persistenceManager, PersistencePackage persistencePackage) Called prior to a removepreUpdate
(PersistenceManager persistenceManager, PersistencePackage persistencePackage) Called prior to an updateprocessValidationError
(PersistenceManager persistenceManager, Entity entity, PersistencePackage persistencePackage) Called after a validation error.Methods inherited from interface org.springframework.core.Ordered
getOrder
-
Method Details
-
preInspect
PersistenceManagerEventHandlerResponse preInspect(PersistenceManager persistenceManager, PersistencePackage persistencePackage) throws ServiceException Called prior to inspection for the entity described by persistencePackage- Parameters:
persistenceManager
- the PersistenceManager instance making the callpersistencePackage
- the descriptive information for the call- Returns:
- the response containing any changes, status or additional data
- Throws:
ServiceException
-
postInspect
PersistenceManagerEventHandlerResponse postInspect(PersistenceManager persistenceManager, DynamicResultSet resultSet, PersistencePackage persistencePackage) throws ServiceException Called after the inspection for the entity described by persistencePackage- Parameters:
persistenceManager
- the PersistenceManager instance making the callresultSet
- the inspection result datapersistencePackage
- the descriptive information for the call- Returns:
- the response containing any changes, status or additional data
- Throws:
ServiceException
-
preFetch
PersistenceManagerEventHandlerResponse preFetch(PersistenceManager persistenceManager, PersistencePackage persistencePackage, CriteriaTransferObject cto) throws ServiceException Called prior to a fetch, which is a request for one or more persisted entities- Parameters:
persistenceManager
- the PersistenceManager instance making the callpersistencePackage
- the descriptive information for the callcto
- 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:
ServiceException
-
postFetch
PersistenceManagerEventHandlerResponse postFetch(PersistenceManager persistenceManager, DynamicResultSet resultSet, PersistencePackage persistencePackage, CriteriaTransferObject cto) throws ServiceException Called after the fetch, which is a request for one or more persisted entities- Parameters:
persistenceManager
- the PersistenceManager instance making the callresultSet
- the fetch result datapersistencePackage
- the descriptive information for the callcto
- 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:
ServiceException
-
preAdd
PersistenceManagerEventHandlerResponse preAdd(PersistenceManager persistenceManager, PersistencePackage persistencePackage) throws ServiceException Called prior to an add- Parameters:
persistenceManager
- the PersistenceManager instance making the callpersistencePackage
- the descriptive information for the call- Returns:
- the response containing any changes, status or additional data
- Throws:
ServiceException
-
postAdd
PersistenceManagerEventHandlerResponse postAdd(PersistenceManager persistenceManager, Entity entity, PersistencePackage persistencePackage) throws ServiceException Called after an add- Parameters:
persistenceManager
- the PersistenceManager instance making the callentity
- the result of the addpersistencePackage
- the descriptive information for the call- Returns:
- the response containing any changes, status or additional data
- Throws:
ServiceException
-
preUpdate
PersistenceManagerEventHandlerResponse preUpdate(PersistenceManager persistenceManager, PersistencePackage persistencePackage) throws ServiceException Called prior to an update- Parameters:
persistenceManager
- the PersistenceManager instance making the callpersistencePackage
- the descriptive information for the call- Returns:
- the response containing any changes, status or additional data
- Throws:
ServiceException
-
postUpdate
PersistenceManagerEventHandlerResponse postUpdate(PersistenceManager persistenceManager, Entity entity, PersistencePackage persistencePackage) throws ServiceException Called after an update- Parameters:
persistenceManager
- the PersistenceManager instance making the callentity
- the result of the updatepersistencePackage
- the descriptive information for the call- Returns:
- the response containing any changes, status or additional data
- Throws:
ServiceException
-
preRemove
PersistenceManagerEventHandlerResponse preRemove(PersistenceManager persistenceManager, PersistencePackage persistencePackage) throws ServiceException Called prior to a remove- Parameters:
persistenceManager
- the PersistenceManager instance making the callpersistencePackage
- the descriptive information for the call- Returns:
- the response containing any changes, status or additional data
- Throws:
ServiceException
-
postRemove
PersistenceManagerEventHandlerResponse postRemove(PersistenceManager persistenceManager, PersistencePackage persistencePackage) throws ServiceException Called after a remove- Parameters:
persistenceManager
- the PersistenceManager instance making the callpersistencePackage
- the descriptive information for the call- Returns:
- the response containing any changes, status or additional data
- Throws:
ServiceException
-
processValidationError
PersistenceManagerEventHandlerResponse processValidationError(PersistenceManager persistenceManager, Entity entity, PersistencePackage persistencePackage) throws 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 atEntity.getPropertyValidationErrors()
- Parameters:
persistenceManager
- the PersistenceManager instance making the callentity
- the results of the persistence requestpersistencePackage
- the descriptive information for the call- Returns:
- the response containing any changes, status or additional data
- Throws:
ServiceException
-