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_MATCH
Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
-
Constructor Summary
ConstructorDescriptionNotificationStateInitializingDomainMapperMember
(com.broadleafcommerce.common.extension.TypeFactory typeFactory) -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract boolean
Whether or notNotificationState
initialization should occur formessageType()
during CREATE flows.protected abstract boolean
Whether or notNotificationState
initialization should occur formessageType()
during DELETE flows.protected abstract boolean
Whether or notNotificationState
initialization should occur formessageType()
during UPDATE and REPLACE flows.<D> D
deleteMap
(D entity, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) <D> D
fromBusinessDomain
(Object projection, D entity, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) int
getOrder()
protected abstract boolean
isQualified
(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 String
The type of message for which aNotificationState
should 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, wait
Methods inherited from interface com.broadleafcommerce.common.extension.data.DataRoutePartitionAware
getDataRoutePartition
Methods inherited from interface com.broadleafcommerce.data.tracking.core.mapping.DomainMapper
getBusinessDomainType
Methods 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:
fromBusinessDomain
in 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:
modifyMap
in interfacecom.broadleafcommerce.data.tracking.core.mapping.DomainMapper
-
deleteMap
public <D> D deleteMap(D entity, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) - Specified by:
deleteMap
in interfacecom.broadleafcommerce.data.tracking.core.mapping.DomainMapper
-
getOrder
public int getOrder()- Specified by:
getOrder
in interfacecom.broadleafcommerce.data.tracking.core.mapping.DomainMapperMember
- Specified by:
getOrder
in 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 aNotificationState
should be initialized. Related directly toNotificationState.getName()
.- Returns:
- The type of message for which a
NotificationState
should be initialized
-
applyOnCreate
protected abstract boolean applyOnCreate()Whether or notNotificationState
initialization should occur formessageType()
during CREATE flows.- Returns:
- Whether or not
NotificationState
initialization should occur
-
applyOnUpdate
protected abstract boolean applyOnUpdate()Whether or notNotificationState
initialization should occur formessageType()
during UPDATE and REPLACE flows.- Returns:
- Whether or not
NotificationState
initialization should occur
-
applyOnDelete
protected abstract boolean applyOnDelete()Whether or notNotificationState
initialization should occur formessageType()
during DELETE flows.- Returns:
- Whether or not
NotificationState
initialization should occur
-