Class NotificationStateInitializingDomainMapperMember
java.lang.Object
com.broadleafcommerce.data.tracking.jpa.messaging.NotificationStateInitializingDomainMapperMember
- All Implemented Interfaces:
com.broadleafcommerce.common.extension.data.DataRoutePartitionAware,com.broadleafcommerce.data.tracking.core.mapping.DomainMapper,com.broadleafcommerce.data.tracking.core.mapping.DomainMapperMember,org.springframework.core.Ordered
public abstract class NotificationStateInitializingDomainMapperMember
extends Object
implements com.broadleafcommerce.data.tracking.core.mapping.DomainMapperMember
Responsible for initializing the state of a
NotificationStateAware implementing entity.
Since the NotificationStates for such an entity are updated via DML during message processing,
there is an expectation that an appropriately initialized notification state for a given message
type already exists. The targeted DomainMapperMember bean should setup an initial notification
state in the entity's associated collection during a CREATE flow in the mapping pipeline. For
convenience, implementations may derive from
NotificationStateInitializingDomainMapperMember. Subclasses should be aware of the route
on which the mapper member will be active and return the
DataRoutePartitionAware.getDataRoutePartition() value appropriately. Note, returning
DataRoutePartitionAware.ALL_MATCH indicates the initializer bean will execute during the
mapping pipeline for all routes, which may not be appropriate, or may be overkill.
Note, initialization of NotificationState is never required when using
DetachedDurableMessageSender.-
Field Summary
Fields inherited from interface com.broadleafcommerce.common.extension.data.DataRoutePartitionAware
ALL_MATCHFields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE -
Constructor Summary
ConstructorsConstructorDescriptionNotificationStateInitializingDomainMapperMember(com.broadleafcommerce.common.extension.TypeFactory typeFactory) -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract booleanWhether or notNotificationStateinitialization should occur formessageType()during CREATE flows.protected abstract booleanWhether or notNotificationStateinitialization should occur formessageType()during DELETE flows.protected abstract booleanWhether or notNotificationStateinitialization should occur formessageType()during UPDATE and REPLACE flows.<D> DdeleteMap(D entity, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) <D> DfromBusinessDomain(Object projection, D entity, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) intgetOrder()protected abstract booleanisQualified(Object entity, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Whether or not this mapper member should run given the type of entity in play.protected abstract StringThe type of message for which aNotificationStateshould be initialized.<D,P> D modifyMap(D entity, P projection, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo, boolean allowNull) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.broadleafcommerce.common.extension.data.DataRoutePartitionAware
getDataRoutePartitionMethods inherited from interface com.broadleafcommerce.data.tracking.core.mapping.DomainMapper
getBusinessDomainTypeMethods inherited from interface com.broadleafcommerce.data.tracking.core.mapping.DomainMapperMember
fromRepositoryDomain
-
Constructor Details
-
NotificationStateInitializingDomainMapperMember
public NotificationStateInitializingDomainMapperMember(com.broadleafcommerce.common.extension.TypeFactory typeFactory)
-
-
Method Details
-
fromBusinessDomain
public <D> D fromBusinessDomain(Object projection, D entity, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) - Specified by:
fromBusinessDomainin interfacecom.broadleafcommerce.data.tracking.core.mapping.DomainMapperMember
-
modifyMap
public <D,P> D modifyMap(D entity, P projection, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo, boolean allowNull) - Specified by:
modifyMapin interfacecom.broadleafcommerce.data.tracking.core.mapping.DomainMapper
-
deleteMap
public <D> D deleteMap(D entity, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) - Specified by:
deleteMapin interfacecom.broadleafcommerce.data.tracking.core.mapping.DomainMapper
-
getOrder
public int getOrder()- Specified by:
getOrderin interfacecom.broadleafcommerce.data.tracking.core.mapping.DomainMapperMember- Specified by:
getOrderin interfaceorg.springframework.core.Ordered
-
isQualified
protected abstract boolean isQualified(Object entity, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Whether or not this mapper member should run given the type of entity in play.- Parameters:
entity- The repository version of the entitycontextInfo- Contextual information related to tenant and other concerns- Returns:
- Whether or not this mapper member should run
-
messageType
The type of message for which aNotificationStateshould be initialized. Related directly toNotificationState.getName().- Returns:
- The type of message for which a
NotificationStateshould be initialized
-
applyOnCreate
protected abstract boolean applyOnCreate()Whether or notNotificationStateinitialization should occur formessageType()during CREATE flows.- Returns:
- Whether or not
NotificationStateinitialization should occur
-
applyOnUpdate
protected abstract boolean applyOnUpdate()Whether or notNotificationStateinitialization should occur formessageType()during UPDATE and REPLACE flows.- Returns:
- Whether or not
NotificationStateinitialization should occur
-
applyOnDelete
protected abstract boolean applyOnDelete()Whether or notNotificationStateinitialization should occur formessageType()during DELETE flows.- Returns:
- Whether or not
NotificationStateinitialization should occur
-