Class DefaultItemSynchronizationService

    • Constructor Detail

      • DefaultItemSynchronizationService

        public DefaultItemSynchronizationService()
    • Method Detail

      • 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:
        java.lang.IllegalArgumentException - when any of the given parameters is null.
      • performItemSynchronization

        public void performItemSynchronization​(SyncRequestData syncRequestData,
                                               java.util.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 java.util.Map<java.lang.String,​java.lang.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 java.util.List<ItemModel> collectRelatedItems​(ItemModel item,
                                                                java.util.Map<java.lang.String,​java.lang.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:
        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 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)
      • setRelatedItemsCollector

        public void setRelatedItemsCollector​(RelatedItemsCollector relatedItemsCollector)
      • setPlatformSynchronizationStatusService

        public void setPlatformSynchronizationStatusService​(SynchronizationStatusService platformSynchronizationStatusService)
      • setCatalogSynchronizationService

        public void setCatalogSynchronizationService​(CatalogSynchronizationService catalogSynchronizationService)
      • setCatalogTypeService

        public void setCatalogTypeService​(CatalogTypeService catalogTypeService)
      • setSearchRestrictionService

        public void setSearchRestrictionService​(SearchRestrictionService searchRestrictionService)
      • setSessionService

        public void setSessionService​(SessionService sessionService)
      • setCommonI18NService

        public void setCommonI18NService​(CommonI18NService commonI18NService)