public class ChangeSummaryMessageFactory extends Object implements com.broadleafcommerce.common.messaging.notification.MessageFactory<ChangeEvent>
ChangeEvent
messages based on an entity instance.Modifier and Type | Field and Description |
---|---|
static String |
CREATE_SANDBOX_IF_NOT_EXISTS |
static String |
IS_PROMOTE |
static String |
IS_REMOVE_TEMP_OVERRIDE |
static String |
IS_TEMP_SANDBOX |
Constructor and Description |
---|
ChangeSummaryMessageFactory(DomainMapperManager mapper,
com.broadleafcommerce.common.extension.TypeFactory typeFactory,
SingleIndexRequestMessageFactory singleIndexRequestMessageFactory,
TrackableBehaviorUtil behaviorUtil) |
Modifier and Type | Method and Description |
---|---|
protected void |
buildIndexableInformation(Object entity,
Trackable domain,
ChangeEvent changeEvent)
Assign
ChangeEvent.getIndexableTargetId() and ChangeEvent.getIndexableType() ,
if single index request messaging is supported for the entity and state. |
org.springframework.messaging.Message<ChangeEvent> |
createMessage(Object entity) |
org.springframework.messaging.Message<ChangeEvent> |
createMessage(Object entity,
Map<String,Object> attributes) |
protected List<ContextRequestHydrator> |
getContextRequestHydrators() |
protected com.broadleafcommerce.common.extension.data.DataRouteReference |
getReference() |
protected VendorVisibilityManager |
getVendorVisibilityManager() |
void |
setContextRequestHydratorProvider(org.springframework.beans.factory.ObjectProvider<ContextRequestHydrator> contextRequestHydratorProvider)
If vendor processing is enabled, a
ContextInfo matching each entity's tracking will
need to be supplied to the methods of getVendorVisibilityManager() to ensure any
fetches are correctly narrowed to the same context. |
void |
setReference(com.broadleafcommerce.common.extension.data.DataRouteReference reference) |
protected void |
setVendorRefIfApplicable(Trackable entity,
ChangeEvent changeEvent)
If vendor processing is enabled, this will determine the vendor the
entity is
associated to, and set that information on the ChangeEvent.getVendorRef() . |
void |
setVendorVisibilityManagerProvider(org.springframework.beans.factory.ObjectProvider<VendorVisibilityManager> vendorVisibilityManagerProvider)
If vendor processing is enabled, this bean will be injected and used to determine which
vendor a changed entity is associated to.
|
public static final String IS_PROMOTE
public static final String CREATE_SANDBOX_IF_NOT_EXISTS
public static final String IS_TEMP_SANDBOX
public static final String IS_REMOVE_TEMP_OVERRIDE
public ChangeSummaryMessageFactory(DomainMapperManager mapper, com.broadleafcommerce.common.extension.TypeFactory typeFactory, SingleIndexRequestMessageFactory singleIndexRequestMessageFactory, TrackableBehaviorUtil behaviorUtil)
@Nullable protected VendorVisibilityManager getVendorVisibilityManager()
protected List<ContextRequestHydrator> getContextRequestHydrators()
public org.springframework.messaging.Message<ChangeEvent> createMessage(Object entity, Map<String,Object> attributes)
createMessage
in interface com.broadleafcommerce.common.messaging.notification.MessageFactory<ChangeEvent>
public org.springframework.messaging.Message<ChangeEvent> createMessage(Object entity)
createMessage
in interface com.broadleafcommerce.common.messaging.notification.MessageFactory<ChangeEvent>
protected void buildIndexableInformation(Object entity, Trackable domain, ChangeEvent changeEvent)
ChangeEvent.getIndexableTargetId()
and ChangeEvent.getIndexableType()
,
if single index request messaging is supported for the entity and state. See
SingleIndexRequestMessageFactory.isSupported(Object)
.entity
- The raw entity instancedomain
- The Trackable version of the entity instancechangeEvent
- The ChangeEvent being emitted as a result of persistence of the entityprotected void setVendorRefIfApplicable(Trackable entity, ChangeEvent changeEvent)
entity
is
associated to, and set that information on the ChangeEvent.getVendorRef()
.entity
- the entity whose vendor association should be determinedchangeEvent
- the change event being emitted as a result of persistence of this entity@Autowired public void setVendorVisibilityManagerProvider(org.springframework.beans.factory.ObjectProvider<VendorVisibilityManager> vendorVisibilityManagerProvider)
We leverage ObjectProvider
here since we want both optional and lazy
injection. This is because ChangeSummaryMessageFactory
may indirectly be a dependency
of service components injected by VendorVisibilityManager
and we want to avoid
circular dependencies.
@Autowired public void setContextRequestHydratorProvider(org.springframework.beans.factory.ObjectProvider<ContextRequestHydrator> contextRequestHydratorProvider)
ContextInfo
matching each entity's tracking will
need to be supplied to the methods of getVendorVisibilityManager()
to ensure any
fetches are correctly narrowed to the same context. This will require the
ContextRequest
to be hydrated, and thus hydrators need to be injected.
If vendor processing is disabled, the hydrators are not necessary.
We leverage ObjectProvider
here since we want both optional and lazy
injection. This is because ChangeSummaryMessageFactory
may indirectly be a dependency
of service components injected by ContextRequestHydrator
implementations and we want
to avoid circular dependencies.
@Autowired public void setReference(@Nullable com.broadleafcommerce.common.extension.data.DataRouteReference reference)
@Nullable protected com.broadleafcommerce.common.extension.data.DataRouteReference getReference()
Copyright © 2021. All rights reserved.