Class ChangeSummaryMessageFactory
- java.lang.Object
-
- com.broadleafcommerce.data.tracking.core.messaging.ChangeSummaryMessageFactory
-
- All Implemented Interfaces:
com.broadleafcommerce.common.messaging.notification.MessageFactory<ChangeEvent>
public class ChangeSummaryMessageFactory extends Object implements com.broadleafcommerce.common.messaging.notification.MessageFactory<ChangeEvent>
Creates newChangeEventmessages based on an entity instance.- Author:
- Jeff Fischer
-
-
Field Summary
Fields Modifier and Type Field Description static StringCREATE_SANDBOX_IF_NOT_EXISTSstatic StringIS_PROMOTEstatic StringIS_REMOVE_TEMP_OVERRIDEstatic StringIS_TEMP_SANDBOX
-
Constructor Summary
Constructors Constructor Description ChangeSummaryMessageFactory(DomainMapperManager mapper, com.broadleafcommerce.common.extension.TypeFactory typeFactory, SingleIndexRequestMessageFactory singleIndexRequestMessageFactory, TrackableBehaviorUtil behaviorUtil)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidbuildIndexableInformation(Object entity, Trackable domain, ChangeEvent changeEvent)AssignChangeEvent.getIndexableTargetId()andChangeEvent.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.DataRouteReferencegetReference()protected VendorVisibilityManagergetVendorVisibilityManager()voidsetContextRequestHydratorProvider(org.springframework.beans.factory.ObjectProvider<ContextRequestHydrator> contextRequestHydratorProvider)If vendor processing is enabled, aContextInfomatching each entity's tracking will need to be supplied to the methods ofgetVendorVisibilityManager()to ensure any fetches are correctly narrowed to the same context.voidsetReference(com.broadleafcommerce.common.extension.data.DataRouteReference reference)protected voidsetVendorRefIfApplicable(Trackable entity, ChangeEvent changeEvent)If vendor processing is enabled, this will determine the vendor theentityis associated to, and set that information on theChangeEvent.getVendorRef().voidsetVendorVisibilityManagerProvider(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.
-
-
-
Field Detail
-
IS_PROMOTE
public static final String IS_PROMOTE
- See Also:
- Constant Field Values
-
CREATE_SANDBOX_IF_NOT_EXISTS
public static final String CREATE_SANDBOX_IF_NOT_EXISTS
- See Also:
- Constant Field Values
-
IS_TEMP_SANDBOX
public static final String IS_TEMP_SANDBOX
- See Also:
- Constant Field Values
-
IS_REMOVE_TEMP_OVERRIDE
public static final String IS_REMOVE_TEMP_OVERRIDE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ChangeSummaryMessageFactory
public ChangeSummaryMessageFactory(DomainMapperManager mapper, com.broadleafcommerce.common.extension.TypeFactory typeFactory, SingleIndexRequestMessageFactory singleIndexRequestMessageFactory, TrackableBehaviorUtil behaviorUtil)
-
-
Method Detail
-
getVendorVisibilityManager
@Nullable protected VendorVisibilityManager getVendorVisibilityManager()
-
getContextRequestHydrators
protected List<ContextRequestHydrator> getContextRequestHydrators()
-
createMessage
public org.springframework.messaging.Message<ChangeEvent> createMessage(Object entity, Map<String,Object> attributes)
- Specified by:
createMessagein interfacecom.broadleafcommerce.common.messaging.notification.MessageFactory<ChangeEvent>
-
createMessage
public org.springframework.messaging.Message<ChangeEvent> createMessage(Object entity)
- Specified by:
createMessagein interfacecom.broadleafcommerce.common.messaging.notification.MessageFactory<ChangeEvent>
-
buildIndexableInformation
protected void buildIndexableInformation(Object entity, Trackable domain, ChangeEvent changeEvent)
AssignChangeEvent.getIndexableTargetId()andChangeEvent.getIndexableType(), if single index request messaging is supported for the entity and state. SeeSingleIndexRequestMessageFactory.isSupported(Object).- Parameters:
entity- The raw entity instancedomain- The Trackable version of the entity instancechangeEvent- The ChangeEvent being emitted as a result of persistence of the entity
-
setVendorRefIfApplicable
protected void setVendorRefIfApplicable(Trackable entity, ChangeEvent changeEvent)
If vendor processing is enabled, this will determine the vendor theentityis associated to, and set that information on theChangeEvent.getVendorRef().- Parameters:
entity- the entity whose vendor association should be determinedchangeEvent- the change event being emitted as a result of persistence of this entity
-
setVendorVisibilityManagerProvider
@Autowired public 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.We leverage
ObjectProviderhere since we want both optional and lazy injection. This is becauseChangeSummaryMessageFactorymay indirectly be a dependency of service components injected byVendorVisibilityManagerand we want to avoid circular dependencies.
-
setContextRequestHydratorProvider
@Autowired public void setContextRequestHydratorProvider(org.springframework.beans.factory.ObjectProvider<ContextRequestHydrator> contextRequestHydratorProvider)
If vendor processing is enabled, aContextInfomatching each entity's tracking will need to be supplied to the methods ofgetVendorVisibilityManager()to ensure any fetches are correctly narrowed to the same context. This will require theContextRequestto be hydrated, and thus hydrators need to be injected.If vendor processing is disabled, the hydrators are not necessary.
We leverage
ObjectProviderhere since we want both optional and lazy injection. This is becauseChangeSummaryMessageFactorymay indirectly be a dependency of service components injected byContextRequestHydratorimplementations and we want to avoid circular dependencies.
-
setReference
@Autowired public void setReference(@Nullable com.broadleafcommerce.common.extension.data.DataRouteReference reference)
-
getReference
@Nullable protected com.broadleafcommerce.common.extension.data.DataRouteReference getReference()
-
-