Class DefaultC4CAggregatingCollector
java.lang.Object
de.hybris.platform.c4ccustomer.deltadetection.impl.DefaultC4CAggregatingCollector
- All Implemented Interfaces:
de.hybris.deltadetection.ChangesCollector,C4CAggregatingCollector
Collector that grabs changes of
CustomerModel models and fetches related AddressModel and vice versa.
So, as a result there is a set of changed customers with all addresses belonging to each. 'Changed' here stands for
'something has changed in customer fields or any of the addresses related'.
Deleted customers are skipped, because C4C does not implement customer removal yet.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final StringSelect customer by PK.protected static final StringSelect addresses what belong to given customer.protected static final StringSelect customer model that owns given address.protected static final StringName of primary key param in all queries.protected static final StringSelect version marker. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancollect(de.hybris.deltadetection.ItemChangeDTO itemChangeDTO) protected voidcollectAddressesOf(de.hybris.deltadetection.ItemChangeDTO customer) Fetches addresses owned by the customer.protected voidfetchAllDependenciesOf(de.hybris.deltadetection.ItemChangeDTO itemChangeDTO) For customer pulls in all dependent addresses.voidfinish()This implementation does not finalizes the subsequent collectors.protected Stringprotected ChangeTypegetChangeTypeOf(Long pk, String streamId) protected CustomerModelgetCustomer(long customerPk) Looks for a customer based on its PK.protected Stringprotected ItemVersionMarkerModelgetVersionMarkerForItem(Long pk, String streamId) voidsetAddressCollector(C4CBatchingCollector addressCollector) voidvoidsetChangeDetectionService(de.hybris.deltadetection.ChangeDetectionService changeDetectionService) voidsetCustomerCollector(C4CBatchingCollector customerCollector) voidvoidsetFlexibleSearchService(de.hybris.platform.servicelayer.search.FlexibleSearchService flexibleSearchService) voidsetTypeService(de.hybris.platform.servicelayer.type.TypeService typeService)
-
Field Details
-
PRIMARY_KEY_PARAM_NAME
Name of primary key param in all queries.- See Also:
-
OWNING_CUSTOMER_QUERY
Select customer model that owns given address.- See Also:
-
CUSTOMERS_ADDRESSES_QUERY
Select addresses what belong to given customer.- See Also:
-
CUSTOMER_QUERY
Select customer by PK.- See Also:
-
VERSION_MARKER_QUERY
Select version marker.- See Also:
-
-
Constructor Details
-
DefaultC4CAggregatingCollector
public DefaultC4CAggregatingCollector()
-
-
Method Details
-
collect
public boolean collect(de.hybris.deltadetection.ItemChangeDTO itemChangeDTO) - Specified by:
collectin interfacede.hybris.deltadetection.ChangesCollector
-
finish
public void finish()This implementation does not finalizes the subsequent collectors. It has to be done manually outside of the class scope.The only reason is the collector is used multiple times (for customers and for addresses), so finalizing batching collectors in between would produce smaller chunks.
- Specified by:
finishin interfacede.hybris.deltadetection.ChangesCollector
-
setCustomerConfigurationId
- Specified by:
setCustomerConfigurationIdin interfaceC4CAggregatingCollector- Parameters:
id- stream configuration id for customers.
-
setAddressConfigurationId
- Specified by:
setAddressConfigurationIdin interfaceC4CAggregatingCollector- Parameters:
id- stream configuration id for addresses.
-
setFlexibleSearchService
public void setFlexibleSearchService(de.hybris.platform.servicelayer.search.FlexibleSearchService flexibleSearchService) -
setChangeDetectionService
public void setChangeDetectionService(de.hybris.deltadetection.ChangeDetectionService changeDetectionService) -
setTypeService
public void setTypeService(de.hybris.platform.servicelayer.type.TypeService typeService) -
fetchAllDependenciesOf
protected void fetchAllDependenciesOf(@Nonnull de.hybris.deltadetection.ItemChangeDTO itemChangeDTO) For customer pulls in all dependent addresses. For address fetches it's owner customer and all the addresses of the customer.- Parameters:
itemChangeDTO- changed item
-
collectAddressesOf
protected void collectAddressesOf(de.hybris.deltadetection.ItemChangeDTO customer) Fetches addresses owned by the customer.- Parameters:
customer- change of aCustomerModel
-
getChangeTypeOf
-
getVersionMarkerForItem
-
getCustomer
protected CustomerModel getCustomer(long customerPk) throws de.hybris.platform.servicelayer.exceptions.ModelNotFoundException Looks for a customer based on its PK.- Parameters:
customerPk- primary key of customer model- Throws:
de.hybris.platform.servicelayer.exceptions.ModelNotFoundException- if the customer does not exist
-
getCustomerConfigurationId
- Returns:
- customer configuration id.
-
getAddressConfigurationId
- Returns:
- address configuration id.
-
getCustomerCollector
-
setCustomerCollector
- Specified by:
setCustomerCollectorin interfaceC4CAggregatingCollector- Parameters:
customerCollector- Collector that will take care of customers.
-
getAddressCollector
-
setAddressCollector
- Specified by:
setAddressCollectorin interfaceC4CAggregatingCollector- Parameters:
addressCollector- Collector that will take care of addresses.
-