Class DefaultItemSynchronizationService

java.lang.Object
de.hybris.platform.cmsfacades.synchronization.service.impl.DefaultItemSynchronizationService
All Implemented Interfaces:
ItemSynchronizationService

public class DefaultItemSynchronizationService extends Object implements ItemSynchronizationService
Default implementation of ItemSynchronizationService
  • Field Details

  • Constructor Details

    • DefaultItemSynchronizationService

      public DefaultItemSynchronizationService()
  • Method Details

    • getSynchronizationItemStatus

      public SynchronizationItemDetailsData getSynchronizationItemStatus(SyncRequestData syncRequestData, ItemModel item)
      Gets the synchronization item status for a given ItemModel 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 interface ItemSynchronizationService
      Parameters:
      syncRequestData - the synchronization request containing the source and target catalog versions
      item - the item model we are interested in getting the synchronization status
      Returns:
      an instance of SynchronizationItemDetailsData, never null.
      Throws:
      IllegalArgumentException - when any of the given parameters is null.
    • getSyncItemInfoFromCacheOrRetrieve

      protected List<SyncItemInfo> getSyncItemInfoFromCacheOrRetrieve(List<ItemModel> relatedItems, SyncItemJobModel syncItemJobModel)
      Returns the list of SyncItemInfo for the list of related items. It retrieves the values from cache if the cache is not empty.
      Parameters:
      relatedItems - the list of related items
      syncItemJobModel - the sync job
      Returns:
      the list of SyncItemInfo.
    • aggregatedStatusFromRelatedItems

      protected SyncItemStatus aggregatedStatusFromRelatedItems(List<SyncItemInfo> syncInfo)
      Calculate an aggregated SyncItemStatus from a given list of SyncItemInfo
      Parameters:
      syncInfo - the list of SyncItemInfo, including the root syncItemInfo
    • performItemSynchronization

      public void performItemSynchronization(SyncRequestData syncRequestData, List<ItemModel> items, SyncConfig config)
      performs the synchronization of a list of ItemModel 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 interface ItemSynchronizationService
      Parameters:
      syncRequestData - the synchronization request containing the source and target catalog versions
      items - the list of item models that we want to synchronize
      config - the synchronization configuration . See SyncConfig for more details.
    • getItemCollectorContext

      protected Map<String,Object> getItemCollectorContext(SyncItemJobModel syncItemJob)
      Gets the item collector configuration context. It sets CTX_LOCALES attribute as a collection of locales that are common for both source and target catalog versions. It also sets VISITORS_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 List<ItemModel> collectRelatedItems(ItemModel item, Map<String,Object> context)
      Retrieves the list of ItemModel 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 perspective
      context - the configuration context in which the item collector will be executed
      Returns:
    • getRelevantSyncItemJob

      protected SyncItemJobModel getRelevantSyncItemJob(SyncRequestData syncRequestData, ItemModel item)
      Will retrieve from the CatalogVersionModel of the ItemModel the SyncItemJobModel matching the request synchronization direction
      Parameters:
      syncRequestData - the requested direction for the synchronization from a catalog version perspective
      item - 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 of CatalogVersionModel (sees SynchronizationStatusService.getOutboundSynchronizations(ItemModel) and SynchronizationStatusService.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 perspective
      item - the catalog aware item for which a synchronization status is returned
      relatedItems - the collected related items to the main item
      syncInfo - the list of SyncItemInfo for the given relatedItems
      rootSyncInfo - the SyncItemInfo 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)
    • getSynchronizationCacheService

      public SynchronizationCacheService getSynchronizationCacheService()
    • setSynchronizationCacheService

      public void setSynchronizationCacheService(SynchronizationCacheService synchronizationCacheService)
    • getConfigurationService

      public ConfigurationService getConfigurationService()
    • setConfigurationService

      public void setConfigurationService(ConfigurationService configurationService)