Class DefaultItemSynchronizationService
java.lang.Object
de.hybris.platform.cmsfacades.synchronization.service.impl.DefaultItemSynchronizationService
- All Implemented Interfaces:
ItemSynchronizationService
Default implementation of
ItemSynchronizationService-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected SyncItemStatusaggregatedStatusFromRelatedItems(List<SyncItemInfo> syncInfo) Calculate an aggregatedSyncItemStatusfrom a given list ofSyncItemInfoprotected SynchronizationItemDetailsDatabuildData(SyncRequestData syncRequestData, ItemModel item, List<ItemModel> relatedItems, List<SyncItemInfo> syncInfo, SyncItemInfo rootSyncInfo) collectRelatedItems(ItemModel item, Map<String, Object> context) Retrieves the list ofItemModelrelated to an item of which we want to get the synchronization statusprotected CatalogSynchronizationServiceprotected CatalogTypeServiceprotected CatalogVersionServiceprotected CommonI18NServicegetItemCollectorContext(SyncItemJobModel syncItemJob) Gets the item collector configuration context.protected ModelServiceprotected SynchronizationStatusServiceprotected RelatedItemsCollectorprotected SyncItemJobModelgetRelevantSyncItemJob(SyncRequestData syncRequestData, ItemModel item) Will retrieve from theCatalogVersionModelof theItemModeltheSyncItemJobModelmatching the request synchronization directionprotected SearchRestrictionServiceprotected SessionSearchRestrictionsDisablergetSynchronizationItemStatus(SyncRequestData syncRequestData, ItemModel item) Gets the synchronization item status for a givenItemModeltaking in consideration the source and target catalog versions.protected List<SyncItemInfo>getSyncItemInfoFromCacheOrRetrieve(List<ItemModel> relatedItems, SyncItemJobModel syncItemJobModel) Returns the list ofSyncItemInfofor the list of related items.protected booleanisOutboundSynchronization(SyncRequestData syncRequestData, ItemModel item) Determines whether the requested synchronisation status is outbound or inbound based on the active flag ofCatalogVersionModel(seesSynchronizationStatusService.getOutboundSynchronizations(ItemModel)andSynchronizationStatusService.getInboundSynchronizations(ItemModel)) An outbound synchronization is from a non active source version to an active target version.voidperformItemSynchronization(SyncRequestData syncRequestData, List<ItemModel> items, SyncConfig config) performs the synchronization of a list ofItemModeltaking in consideration the source and target catalog versions.voidsetCatalogSynchronizationService(CatalogSynchronizationService catalogSynchronizationService) voidsetCatalogTypeService(CatalogTypeService catalogTypeService) voidsetCatalogVersionService(CatalogVersionService catalogVersionService) voidsetCommonI18NService(CommonI18NService commonI18NService) voidsetConfigurationService(ConfigurationService configurationService) voidsetModelService(ModelService modelService) voidsetPlatformSynchronizationStatusService(SynchronizationStatusService platformSynchronizationStatusService) voidsetRelatedItemsCollector(RelatedItemsCollector relatedItemsCollector) voidsetSearchRestrictionService(SearchRestrictionService searchRestrictionService) voidsetSessionSearchRestrictionsDisabler(SessionSearchRestrictionsDisabler sessionSearchRestrictionsDisabler) voidsetSessionService(SessionService sessionService) voidsetSynchronizationCacheService(SynchronizationCacheService synchronizationCacheService)
-
Field Details
-
SYNCHRONIZATION_MAX_RECURSION_DEPTH
- See Also:
-
-
Constructor Details
-
DefaultItemSynchronizationService
public DefaultItemSynchronizationService()
-
-
Method Details
-
getSynchronizationItemStatus
public SynchronizationItemDetailsData getSynchronizationItemStatus(SyncRequestData syncRequestData, ItemModel item) Gets the synchronization item status for a givenItemModeltaking in consideration the source and target catalog versions. Implementations should be able to provide details of the synchronization status of related items as well.- Specified by:
getSynchronizationItemStatusin interfaceItemSynchronizationService- Parameters:
syncRequestData- the synchronization request containing the source and target catalog versionsitem- the item model we are interested in getting the synchronization status- Returns:
- an instance of
SynchronizationItemDetailsData, nevernull. - Throws:
IllegalArgumentException- when any of the given parameters isnull.
-
getSyncItemInfoFromCacheOrRetrieve
protected List<SyncItemInfo> getSyncItemInfoFromCacheOrRetrieve(List<ItemModel> relatedItems, SyncItemJobModel syncItemJobModel) Returns the list ofSyncItemInfofor the list of related items. It retrieves the values from cache if the cache is not empty.- Parameters:
relatedItems- the list of related itemssyncItemJobModel- the sync job- Returns:
- the list of
SyncItemInfo.
-
aggregatedStatusFromRelatedItems
Calculate an aggregatedSyncItemStatusfrom a given list ofSyncItemInfo- Parameters:
syncInfo- the list ofSyncItemInfo, including the root syncItemInfo
-
performItemSynchronization
public void performItemSynchronization(SyncRequestData syncRequestData, List<ItemModel> items, SyncConfig config) performs the synchronization of a list ofItemModeltaking in consideration the source and target catalog versions. Implementations should be able to provide details of the synchronization status of related items as well.- Specified by:
performItemSynchronizationin interfaceItemSynchronizationService- Parameters:
syncRequestData- the synchronization request containing the source and target catalog versionsitems- the list of item models that we want to synchronizeconfig- the synchronization configuration . SeeSyncConfigfor more details.
-
getItemCollectorContext
Gets the item collector configuration context. It setsCTX_LOCALESattribute as a collection of locales that are common for both source and target catalog versions. It also setsVISITORS_CTX_TARGET_CATALOG_VERSIONattribute as a target catalog version that is used in synchronization process.- Parameters:
syncItemJob- the sync item job being investigated.- Returns:
- the collector configuration context
-
collectRelatedItems
Retrieves the list ofItemModelrelated to an item of which we want to get the synchronization status- Parameters:
item- the item of which we want to retrieve the related items from a synchronization perspectivecontext- the configuration context in which the item collector will be executed- Returns:
-
getRelevantSyncItemJob
Will retrieve from theCatalogVersionModelof theItemModeltheSyncItemJobModelmatching the request synchronization direction- Parameters:
syncRequestData- the requested direction for the synchronization from a catalog version perspectiveitem- the catalog aware item from which a catalog version is extracted- Returns:
-
isOutboundSynchronization
Determines whether the requested synchronisation status is outbound or inbound based on the active flag ofCatalogVersionModel(seesSynchronizationStatusService.getOutboundSynchronizations(ItemModel)andSynchronizationStatusService.getInboundSynchronizations(ItemModel)) An outbound synchronization is from a non active source version to an active target version. An inbound synchronization is from an active source version to a non active target version.- Parameters:
syncRequestData- the requested direction for the synchronization from a catalog version perspective- Returns:
- boolean stating whether the synchronization is outbound
- Throws:
IllegalArgumentException- if the direction could not be determined because of both catalog versions being active or inactive
-
buildData
protected SynchronizationItemDetailsData buildData(SyncRequestData syncRequestData, ItemModel item, List<ItemModel> relatedItems, List<SyncItemInfo> syncInfo, SyncItemInfo rootSyncInfo) - Parameters:
syncRequestData- the requested direction for the synchronization from a catalog version perspectiveitem- the catalog aware item for which a synchronization status is returnedrelatedItems- the collected related items to the main itemsyncInfo- the list ofSyncItemInfofor the given relatedItemsrootSyncInfo- theSyncItemInfoof the main item- Returns:
- SynchronizationItemDetailsData
-
setModelService
-
getModelService
-
setCatalogVersionService
-
getCatalogVersionService
-
setRelatedItemsCollector
-
getRelatedItemsCollector
-
setPlatformSynchronizationStatusService
public void setPlatformSynchronizationStatusService(SynchronizationStatusService platformSynchronizationStatusService) -
getPlatformSynchronizationStatusService
-
setCatalogSynchronizationService
public void setCatalogSynchronizationService(CatalogSynchronizationService catalogSynchronizationService) -
getCatalogSynchronizationService
-
setCatalogTypeService
-
getCatalogTypeService
-
setSearchRestrictionService
-
getSearchRestrictionService
-
setSessionService
-
getSessionService
-
getCommonI18NService
-
setCommonI18NService
-
getSessionSearchRestrictionsDisabler
-
setSessionSearchRestrictionsDisabler
public void setSessionSearchRestrictionsDisabler(SessionSearchRestrictionsDisabler sessionSearchRestrictionsDisabler) -
getSynchronizationCacheService
-
setSynchronizationCacheService
-
getConfigurationService
-
setConfigurationService
-