public class DefaultC4CAggregatingCollector extends java.lang.Object implements C4CAggregatingCollector
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.
| Modifier and Type | Field and Description |
|---|---|
protected static java.lang.String |
CUSTOMER_QUERY
Select customer by PK.
|
protected static java.lang.String |
CUSTOMERS_ADDRESSES_QUERY
Select addresses what belong to given customer.
|
protected static java.lang.String |
OWNING_CUSTOMER_QUERY
Select customer model that owns given address.
|
protected static java.lang.String |
PRIMARY_KEY_PARAM_NAME
Name of primary key param in all queries.
|
protected static java.lang.String |
VERSION_MARKER_QUERY
Select version marker.
|
| Constructor and Description |
|---|
DefaultC4CAggregatingCollector() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
collect(ItemChangeDTO itemChangeDTO)
Collects the given change in a specified way.
|
protected void |
collectAddressesOf(ItemChangeDTO customer)
Fetches addresses owned by the customer.
|
protected void |
fetchAllDependenciesOf(ItemChangeDTO itemChangeDTO)
For customer pulls in all dependent addresses.
|
void |
finish()
This implementation does not finalizes the subsequent collectors.
|
C4CBatchingCollector |
getAddressCollector() |
protected java.lang.String |
getAddressConfigurationId() |
protected ChangeType |
getChangeTypeOf(java.lang.Long pk,
java.lang.String streamId) |
protected CustomerModel |
getCustomer(long customerPk)
Looks for a customer based on its PK.
|
C4CBatchingCollector |
getCustomerCollector() |
protected java.lang.String |
getCustomerConfigurationId() |
protected ItemVersionMarkerModel |
getVersionMarkerForItem(java.lang.Long pk,
java.lang.String streamId) |
void |
setAddressCollector(C4CBatchingCollector addressCollector) |
void |
setAddressConfigurationId(java.lang.String id) |
void |
setChangeDetectionService(ChangeDetectionService changeDetectionService) |
void |
setCustomerCollector(C4CBatchingCollector customerCollector) |
void |
setCustomerConfigurationId(java.lang.String id) |
void |
setFlexibleSearchService(FlexibleSearchService flexibleSearchService) |
void |
setTypeService(TypeService typeService) |
protected static final java.lang.String PRIMARY_KEY_PARAM_NAME
protected static final java.lang.String OWNING_CUSTOMER_QUERY
protected static final java.lang.String CUSTOMERS_ADDRESSES_QUERY
protected static final java.lang.String CUSTOMER_QUERY
protected static final java.lang.String VERSION_MARKER_QUERY
public boolean collect(ItemChangeDTO itemChangeDTO)
ChangesCollectorcollect in interface ChangesCollectoritemChangeDTO - change to be collectedtrue, if the collecting process should continue, false otherwisepublic void finish()
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.
finish in interface ChangesCollectorpublic void setCustomerConfigurationId(java.lang.String id)
setCustomerConfigurationId in interface C4CAggregatingCollectorid - stream configuration id for customers.public void setAddressConfigurationId(java.lang.String id)
setAddressConfigurationId in interface C4CAggregatingCollectorid - stream configuration id for addresses.public void setFlexibleSearchService(FlexibleSearchService flexibleSearchService)
public void setChangeDetectionService(ChangeDetectionService changeDetectionService)
public void setTypeService(TypeService typeService)
protected void fetchAllDependenciesOf(ItemChangeDTO itemChangeDTO)
itemChangeDTO - changed itemprotected void collectAddressesOf(ItemChangeDTO customer)
customer - change of a CustomerModelprotected ChangeType getChangeTypeOf(java.lang.Long pk, java.lang.String streamId)
protected ItemVersionMarkerModel getVersionMarkerForItem(java.lang.Long pk, java.lang.String streamId)
protected CustomerModel getCustomer(long customerPk) throws ModelNotFoundException
customerPk - primary key of customer modelModelNotFoundException - if the customer does not existprotected java.lang.String getCustomerConfigurationId()
protected java.lang.String getAddressConfigurationId()
public C4CBatchingCollector getCustomerCollector()
public void setCustomerCollector(C4CBatchingCollector customerCollector)
setCustomerCollector in interface C4CAggregatingCollectorcustomerCollector - Collector that will take care of customers.public C4CBatchingCollector getAddressCollector()
public void setAddressCollector(C4CBatchingCollector addressCollector)
setAddressCollector in interface C4CAggregatingCollectoraddressCollector - Collector that will take care of addresses.Copyright © 2018 SAP SE. All Rights Reserved.