Class DefaultItemSynchronizationFacade
- java.lang.Object
-
- de.hybris.platform.cmsfacades.synchronization.impl.DefaultItemSynchronizationFacade
-
- All Implemented Interfaces:
ItemSynchronizationFacade
public class DefaultItemSynchronizationFacade extends java.lang.Object implements ItemSynchronizationFacade
Default implementation of theItemSynchronizationFacadefacade. Its main purpose is to coordinate the recursive calls for theItemSynchronizationServicerespecting themaxDepthattribute (either given in the method or using the default value). It makes usage of theItemCollectorRegistryandItemCollectorclasses to identify item models that are directly referenced or that are shared by a given item model.
-
-
Constructor Summary
Constructors Constructor Description DefaultItemSynchronizationFacade()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.util.List<SyncItemStatusData>collectItemsAndGetSynchronizationItemStatus(SyncRequestData syncRequestData, ItemModel item, SyncItemStatusConfig config, java.lang.Integer level, ItemCollectorRegistry collectorRegistry)Collects the items that also requires information about the synchronization status details and make more calls togetSynchronizationItemStatus(SyncRequestData, ItemModel, SyncItemStatusConfig, Integer)from individual items that were collected.protected java.util.List<SyncItemStatusData>findUnavailableDependencies(SyncRequestData syncRequestData, ItemModel item, java.lang.Integer level)Find all dependent items which have never been synchronized to the target catalog.protected ItemCollectorRegistrygetBasicItemCollectorRegistry()protected org.springframework.validation.ValidatorgetCatalogSynchronizationCompositeValidator()protected org.springframework.validation.ValidatorgetCmsItemSynchronizationValidator()protected ItemCollectorRegistrygetDependentItemCollectorRegistry()protected FacadeValidationServicegetFacadeValidationService()protected java.util.concurrent.ForkJoinPoolgetForkJoinPool()Get the fork/join pool for the current node initialized with the runtime number of available processors.protected ItemModelgetItem(ItemSynchronizationData itemSynchronizationData)Will convert a itemId/itemType pair to a ofItemModelprotected ItemSynchronizationServicegetItemSynchronizationService()protected java.util.List<ItemModel>getListOfItems(SynchronizationData synchronizationData)Will convert a list of itemId/itemType pairs to a list ofItemModelprotected ItemCollectorRegistrygetSharedItemCollectorRegistry()protected SyncConfiggetSyncConfig()SyncItemStatusDatagetSynchronizationItemStatus(SyncRequestData syncRequestData, ItemSynchronizationData itemSynchronizationData)Retrieves the synchronization status for a givenItemModel.SyncItemStatusDatagetSynchronizationItemStatus(SyncRequestData syncRequestData, ItemSynchronizationData itemSynchronizationData, SyncItemStatusConfig config)Retrieves the synchronization status for a givenItemModel.protected SyncItemStatusDatagetSynchronizationItemStatus(SyncRequestData syncRequestData, ItemModel item, SyncItemStatusConfig config, java.lang.Integer level)Gets the synchronization status by callingItemSynchronizationService.getSynchronizationItemStatus(SyncRequestData, ItemModel).protected SyncItemStatusConfiggetSyncItemStatusConfig()protected Converter<SynchronizationItemDetailsData,SyncItemStatusData>getSyncItemStatusConverter()protected UniqueItemIdentifierServicegetUniqueItemIdentifierService()voidperformItemSynchronization(SyncRequestData syncRequestData, SynchronizationData synchronizationData)Performs the synchronization for a list ofItemModel.voidperformItemSynchronization(SyncRequestData syncRequestData, SynchronizationData synchronizationData, SyncConfig config)Performs the synchronization for a list ofItemModel.voidsetBasicItemCollectorRegistry(ItemCollectorRegistry basicItemCollectorRegistry)voidsetCatalogSynchronizationCompositeValidator(org.springframework.validation.Validator catalogSynchronizationCompositeValidator)voidsetCmsItemSynchronizationValidator(org.springframework.validation.Validator cmsItemSynchronizationValidator)voidsetDependentItemCollectorRegistry(ItemCollectorRegistry dependentItemCollectorRegistry)voidsetFacadeValidationService(FacadeValidationService facadeValidationService)voidsetItemSynchronizationService(ItemSynchronizationService itemSynchronizationService)voidsetSharedItemCollectorRegistry(ItemCollectorRegistry sharedItemCollectorRegistry)voidsetSyncConfig(SyncConfig syncConfig)voidsetSyncItemStatusConfig(SyncItemStatusConfig syncItemStatusConfig)voidsetSyncItemStatusConverter(Converter<SynchronizationItemDetailsData,SyncItemStatusData> syncItemStatusConverter)voidsetUniqueItemIdentifierService(UniqueItemIdentifierService uniqueItemIdentifierService)
-
-
-
Method Detail
-
getSynchronizationItemStatus
public SyncItemStatusData getSynchronizationItemStatus(SyncRequestData syncRequestData, ItemSynchronizationData itemSynchronizationData)
Description copied from interface:ItemSynchronizationFacadeRetrieves the synchronization status for a givenItemModel. In the method signature the client needs to provide theSyncRequestDatawhich contains the source and target catalog versions. The implementation should provide a default maximum depth property to prevent the mechanism to crawl too many items.- Specified by:
getSynchronizationItemStatusin interfaceItemSynchronizationFacade- Parameters:
syncRequestData- the synchronization request containing the source and target catalog versionsitemSynchronizationData- the pair of identifier/type to retrieve theItemModelof which we want to get the synchronization status- Returns:
- the synchronization status details for a given
ItemModel.
-
getSynchronizationItemStatus
public SyncItemStatusData getSynchronizationItemStatus(SyncRequestData syncRequestData, ItemSynchronizationData itemSynchronizationData, SyncItemStatusConfig config)
Description copied from interface:ItemSynchronizationFacadeRetrieves the synchronization status for a givenItemModel. In the method signature the client needs to provide theSyncRequestDatawhich contains the source and target catalog versions. This method lets the client decide what is the maximum depth level to navigate on the item's dependencies.- Specified by:
getSynchronizationItemStatusin interfaceItemSynchronizationFacade- Parameters:
syncRequestData- the synchronization request containing the source and target catalog versionsitemSynchronizationData- the pair of identifier/type to retrieve theItemModelof which we want to get the synchronization statusconfig- the get status configuration. SeeSyncItemStatusConfigfor more details.- Returns:
- the synchronization status details for a given
ItemModel.
-
performItemSynchronization
public void performItemSynchronization(SyncRequestData syncRequestData, SynchronizationData synchronizationData)
Description copied from interface:ItemSynchronizationFacadePerforms the synchronization for a list ofItemModel. In the method signature the client needs to provide theSyncRequestDatawhich contains the source and target catalog versions.- Specified by:
performItemSynchronizationin interfaceItemSynchronizationFacade- Parameters:
syncRequestData- the synchronization request containing the source and target catalog versionssynchronizationData- contains the list ofItemSynchronizationDatapairs of itemId/itemType that we want to synchronize
-
performItemSynchronization
public void performItemSynchronization(SyncRequestData syncRequestData, SynchronizationData synchronizationData, SyncConfig config)
Description copied from interface:ItemSynchronizationFacadePerforms the synchronization for a list ofItemModel. In the method signature the client needs to provide theSyncRequestDatawhich contains the source and target catalog versions.- Specified by:
performItemSynchronizationin interfaceItemSynchronizationFacade- Parameters:
syncRequestData- the synchronization request containing the source and target catalog versionssynchronizationData- contains the list of pairs ofItemSynchronizationDataitemId/itemType that we want to synchronizeconfig- the synchronization configuration . SeeSyncConfigfor more details.
-
getListOfItems
protected java.util.List<ItemModel> getListOfItems(SynchronizationData synchronizationData)
Will convert a list of itemId/itemType pairs to a list ofItemModel- Parameters:
synchronizationData- the list ofItemSynchronizationDatacandidates on which to perform synchronization- Returns:
- the list of
ItemModelto be synchronized
-
getItem
protected ItemModel getItem(ItemSynchronizationData itemSynchronizationData)
Will convert a itemId/itemType pair to a ofItemModel- Parameters:
itemSynchronizationData- theItemSynchronizationDatacandidate on which to perform synchronization- Returns:
- the
ItemModelto be synchronized
-
getSynchronizationItemStatus
protected SyncItemStatusData getSynchronizationItemStatus(SyncRequestData syncRequestData, ItemModel item, SyncItemStatusConfig config, java.lang.Integer level)
Gets the synchronization status by callingItemSynchronizationService.getSynchronizationItemStatus(SyncRequestData, ItemModel). It also converts the result into an instance ofSyncItemStatusDatathat will be then post populated by recursive calls to this method.- Parameters:
syncRequestData- the synchronization request data containing the source and target catalog versions.item- the item model currently being inspectedconfig- the configuration for getting the synchronization statuslevel- the current level on the data structure.- Returns:
- the
SyncItemStatusDatainformation about a given item model and all related items collected during execution.
-
findUnavailableDependencies
protected java.util.List<SyncItemStatusData> findUnavailableDependencies(SyncRequestData syncRequestData, ItemModel item, java.lang.Integer level)
Find all dependent items which have never been synchronized to the target catalog.- Parameters:
syncRequestData- the synchronization request data containing the source and target catalog versions.item- the item model currently being inspectedlevel- the current level on the data structure- Returns:
- a list of
SyncItemStatusDatafor never-synchronized dependent items
-
collectItemsAndGetSynchronizationItemStatus
protected java.util.List<SyncItemStatusData> collectItemsAndGetSynchronizationItemStatus(SyncRequestData syncRequestData, ItemModel item, SyncItemStatusConfig config, java.lang.Integer level, ItemCollectorRegistry collectorRegistry)
Collects the items that also requires information about the synchronization status details and make more calls togetSynchronizationItemStatus(SyncRequestData, ItemModel, SyncItemStatusConfig, Integer)from individual items that were collected.- Parameters:
syncRequestData- the synchronization request data containing the source and target catalog versions.item- the item model currently being inspectedconfig- the configuration for getting the synchronization statuslevel- the current level on the data structure.collectorRegistry- the collector registry to get an instance ofItemCollector- Returns:
- a list of
SyncItemStatusDatabeans collected and converted recursively.
-
getForkJoinPool
protected java.util.concurrent.ForkJoinPool getForkJoinPool()
Get the fork/join pool for the current node initialized with the runtime number of available processors.- Returns:
- the fork/join pool
-
getBasicItemCollectorRegistry
protected ItemCollectorRegistry getBasicItemCollectorRegistry()
-
setBasicItemCollectorRegistry
public void setBasicItemCollectorRegistry(ItemCollectorRegistry basicItemCollectorRegistry)
-
getSharedItemCollectorRegistry
protected ItemCollectorRegistry getSharedItemCollectorRegistry()
-
setSharedItemCollectorRegistry
public void setSharedItemCollectorRegistry(ItemCollectorRegistry sharedItemCollectorRegistry)
-
getDependentItemCollectorRegistry
protected ItemCollectorRegistry getDependentItemCollectorRegistry()
-
setDependentItemCollectorRegistry
public void setDependentItemCollectorRegistry(ItemCollectorRegistry dependentItemCollectorRegistry)
-
setItemSynchronizationService
public void setItemSynchronizationService(ItemSynchronizationService itemSynchronizationService)
-
getItemSynchronizationService
protected ItemSynchronizationService getItemSynchronizationService()
-
getSyncItemStatusConverter
protected Converter<SynchronizationItemDetailsData,SyncItemStatusData> getSyncItemStatusConverter()
-
setSyncItemStatusConverter
public void setSyncItemStatusConverter(Converter<SynchronizationItemDetailsData,SyncItemStatusData> syncItemStatusConverter)
-
getSyncItemStatusConfig
protected SyncItemStatusConfig getSyncItemStatusConfig()
-
setSyncItemStatusConfig
public void setSyncItemStatusConfig(SyncItemStatusConfig syncItemStatusConfig)
-
setSyncConfig
public void setSyncConfig(SyncConfig syncConfig)
-
getSyncConfig
protected SyncConfig getSyncConfig()
-
setUniqueItemIdentifierService
public void setUniqueItemIdentifierService(UniqueItemIdentifierService uniqueItemIdentifierService)
-
getUniqueItemIdentifierService
protected UniqueItemIdentifierService getUniqueItemIdentifierService()
-
getCatalogSynchronizationCompositeValidator
protected org.springframework.validation.Validator getCatalogSynchronizationCompositeValidator()
-
setCatalogSynchronizationCompositeValidator
public void setCatalogSynchronizationCompositeValidator(org.springframework.validation.Validator catalogSynchronizationCompositeValidator)
-
getFacadeValidationService
protected FacadeValidationService getFacadeValidationService()
-
setFacadeValidationService
public void setFacadeValidationService(FacadeValidationService facadeValidationService)
-
getCmsItemSynchronizationValidator
protected org.springframework.validation.Validator getCmsItemSynchronizationValidator()
-
setCmsItemSynchronizationValidator
public void setCmsItemSynchronizationValidator(org.springframework.validation.Validator cmsItemSynchronizationValidator)
-
-