Class DefaultItemSynchronizationService
- java.lang.Object
-
- de.hybris.platform.cmsfacades.synchronization.service.impl.DefaultItemSynchronizationService
-
- All Implemented Interfaces:
ItemSynchronizationService
public class DefaultItemSynchronizationService extends java.lang.Object implements ItemSynchronizationService
Default implementation ofItemSynchronizationService
-
-
Constructor Summary
Constructors Constructor Description DefaultItemSynchronizationService()
-
Method Summary
-
-
-
Method Detail
-
getSynchronizationItemStatus
public SynchronizationItemDetailsData getSynchronizationItemStatus(SyncRequestData syncRequestData, ItemModel item)
Gets the synchronization item status for a givenItemModel
taking 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:
getSynchronizationItemStatus
in 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:
java.lang.IllegalArgumentException
- when any of the given parameters isnull
.
-
aggregatedStatusFromRelatedItems
protected SyncItemStatus aggregatedStatusFromRelatedItems(java.util.List<SyncItemInfo> syncInfo)
Calculate an aggregatedSyncItemStatus
from a given list ofSyncItemInfo
- Parameters:
syncInfo
- the list ofSyncItemInfo
, including the root syncItemInfo
-
performItemSynchronization
public void performItemSynchronization(SyncRequestData syncRequestData, java.util.List<ItemModel> items, SyncConfig config)
performs the synchronization of a list ofItemModel
taking 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:
performItemSynchronization
in 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 . SeeSyncConfig
for more details.
-
getItemCollectorContext
protected java.util.Map<java.lang.String,java.lang.Object> getItemCollectorContext(SyncItemJobModel syncItemJob)
Gets the item collector configuration context. It setsCTX_LOCALES
attribute as a collection of locales that are common for both source and target catalog versions. It also setsVISITORS_CTX_TARGET_CATALOG_VERSION
attribute 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
protected java.util.List<ItemModel> collectRelatedItems(ItemModel item, java.util.Map<java.lang.String,java.lang.Object> context)
Retrieves the list ofItemModel
related 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
protected SyncItemJobModel getRelevantSyncItemJob(SyncRequestData syncRequestData, ItemModel item)
Will retrieve from theCatalogVersionModel
of theItemModel
theSyncItemJobModel
matching 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
protected boolean isOutboundSynchronization(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. 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:
java.lang.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, java.util.List<ItemModel> relatedItems, java.util.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 ofSyncItemInfo
for the given relatedItemsrootSyncInfo
- theSyncItemInfo
of the main item- Returns:
- SynchronizationItemDetailsData
-
setModelService
public void setModelService(ModelService modelService)
-
getModelService
protected ModelService getModelService()
-
setCatalogVersionService
public void setCatalogVersionService(CatalogVersionService catalogVersionService)
-
getCatalogVersionService
protected CatalogVersionService getCatalogVersionService()
-
setRelatedItemsCollector
public void setRelatedItemsCollector(RelatedItemsCollector relatedItemsCollector)
-
getRelatedItemsCollector
protected RelatedItemsCollector getRelatedItemsCollector()
-
setPlatformSynchronizationStatusService
public void setPlatformSynchronizationStatusService(SynchronizationStatusService platformSynchronizationStatusService)
-
getPlatformSynchronizationStatusService
protected SynchronizationStatusService getPlatformSynchronizationStatusService()
-
setCatalogSynchronizationService
public void setCatalogSynchronizationService(CatalogSynchronizationService catalogSynchronizationService)
-
getCatalogSynchronizationService
protected CatalogSynchronizationService getCatalogSynchronizationService()
-
setCatalogTypeService
public void setCatalogTypeService(CatalogTypeService catalogTypeService)
-
getCatalogTypeService
protected CatalogTypeService getCatalogTypeService()
-
setSearchRestrictionService
public void setSearchRestrictionService(SearchRestrictionService searchRestrictionService)
-
getSearchRestrictionService
protected SearchRestrictionService getSearchRestrictionService()
-
setSessionService
public void setSessionService(SessionService sessionService)
-
getSessionService
public SessionService getSessionService()
-
getCommonI18NService
protected CommonI18NService getCommonI18NService()
-
setCommonI18NService
public void setCommonI18NService(CommonI18NService commonI18NService)
-
getSessionSearchRestrictionsDisabler
protected SessionSearchRestrictionsDisabler getSessionSearchRestrictionsDisabler()
-
setSessionSearchRestrictionsDisabler
public void setSessionSearchRestrictionsDisabler(SessionSearchRestrictionsDisabler sessionSearchRestrictionsDisabler)
-
-