Class DefaultCatalogSynchronizationService
java.lang.Object
de.hybris.platform.catalog.synchronization.DefaultCatalogSynchronizationService
- All Implemented Interfaces:
CatalogSynchronizationService
public class DefaultCatalogSynchronizationService
extends Object
implements CatalogSynchronizationService
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddScheduleFromConfig(SyncItemCronJobModel cronJob, SyncConfig config) booleancanSynchronize(SyncItemJobModel syncJob, PrincipalModel principal) Returns true if the principal has sync permissions to synchronize between catalog versions from given sync job.protected SyncConfigcloneSyncConfig(SyncConfig givenSyncConfig) protected SyncItemCronJobModelprotected CatalogVersionSyncJobModelcreateSyncJob(CatalogVersionModel source, CatalogVersionModel target) protected CatalogVersionSyncJobModelcreateSyncJob(CatalogVersionModel source, CatalogVersionModel target, int numberOfThreads) getApplicableItems(List<ItemModel> inputItems, SyncItemJobModel syncItemJob) Filters given items returning only the ones being applicable to the given sync job.protected IntegergetSynchronizationSourceFor(SyncItemJobModel theSyncJob, ItemModel targetItem) Returns the counterpart for thetargetitem against given sync jobtheSyncJob.getSynchronizationSourceTimestampFor(SyncItemJobModel theSyncJob, ItemModel source) Returns the existingItemSyncTimestampModelfor thesourceitem in the scope of the given sync job.getSynchronizationTargetFor(SyncItemJobModel theSyncJob, ItemModel sourceItem) Returns the counterpart for thesourceitem against given sync jobtheSyncJob.getSynchronizationTargetTimestampFor(SyncItemJobModel theSyncJob, ItemModel target) Returns the existingItemSyncTimestampModelfor the target item in the scope of the given sync job.getSyncJob(CatalogVersionModel source, CatalogVersionModel target, String qualifier) Returns the publication rule (asSyncItemJobModelitem) between a specified source catalog version and target catalog version.booleanisInProgress(SyncItemJobModel theSyncJob) Checks whether the givengivenSyncJobis currently in progress.lookupCurrentSynchronizations(SyncItemJobModel theSyncJob) Returns the current executions for the giventheSyncJob.performSynchronization(List<ItemModel> givenItems, SyncItemJobModel syncItemJob, SyncConfig syncConfig) Performs the synchronization for given items.performSynchronization(List<ItemModel> givenItems, List<SyncItemJobModel> syncItemJobs, SyncConfig syncConfig) Performs the synchronization for given items against given sync jobs.protected SyncConfigscheduleItemsWithConfig(SyncConfig syncConfig, SyncItemJobModel syncJob, List<ItemModel> applicableItems) voidsetCatalogTypeService(CatalogTypeService catalogTypeService) voidsetCatalogVersionService(CatalogVersionService catalogVersionService) voidsetCronJobService(CronJobService cronJobService) voidsetFlexibleSearchService(FlexibleSearchService flexibleSearchService) voidsetItemSyncTimestampDao(ItemSyncTimestampDao itemSyncTimestampDao) voidsetModelService(ModelService modelService) voidsetSyncJobApplicableTypesStrategy(SyncJobApplicableTypesStrategy syncJobApplicableTypesStrategy) voidsetUserService(UserService userService) synchronize(SyncItemJobModel syncJob, SyncConfig syncConfig) Starts synchronization for an existingSyncItemJobModel.voidsynchronizeFully(CatalogVersionModel source, CatalogVersionModel target) For the given catalog version pair a newCatalogVersionSyncJobModelis being created configured to sync all default catalog item types.voidsynchronizeFully(CatalogVersionModel source, CatalogVersionModel target, int numberOfThreads) For the given catalog version pair a newCatalogVersionSyncJobModelis being created configured to sync all default catalog item types.voidsynchronizeFullyInBackground(CatalogVersionModel source, CatalogVersionModel target) For the given catalog version pair a newCatalogVersionSyncJobModelis being created configured to sync all default catalog item types.
-
Constructor Details
-
DefaultCatalogSynchronizationService
public DefaultCatalogSynchronizationService()
-
-
Method Details
-
synchronizeFully
Description copied from interface:CatalogSynchronizationServiceFor the given catalog version pair a newCatalogVersionSyncJobModelis being created configured to sync all default catalog item types. The actual sync process is backed by a also newCatalogVersionSyncCronJobModelwhich is performed synchronously.- Specified by:
synchronizeFullyin interfaceCatalogSynchronizationService
-
synchronizeFully
public void synchronizeFully(CatalogVersionModel source, CatalogVersionModel target, int numberOfThreads) Description copied from interface:CatalogSynchronizationServiceFor the given catalog version pair a newCatalogVersionSyncJobModelis being created configured to sync all default catalog item types. The actual sync process is backed by a also newCatalogVersionSyncCronJobModelwhich is started synchronously.- Specified by:
synchronizeFullyin interfaceCatalogSynchronizationServicenumberOfThreads- specifies the number of sync workers to be used - overrides the number configured incatalog.sync.workers
-
synchronizeFullyInBackground
Description copied from interface:CatalogSynchronizationServiceFor the given catalog version pair a newCatalogVersionSyncJobModelis being created configured to sync all default catalog item types. The actual sync process is backed by a also newCatalogVersionSyncCronJobModelwhich is started asynchronously.- Specified by:
synchronizeFullyInBackgroundin interfaceCatalogSynchronizationService
-
synchronize
Description copied from interface:CatalogSynchronizationServiceStarts synchronization for an existingSyncItemJobModel. The configuration parameter allows to configure/override a number of synchronization job settings.The returned
SyncResultgives both access to the execution result or, in case the process was started asynchronously, to observe the running process- Specified by:
synchronizein interfaceCatalogSynchronizationService
-
performSynchronization
public List<SyncResult> performSynchronization(List<ItemModel> givenItems, List<SyncItemJobModel> syncItemJobs, SyncConfig syncConfig) Description copied from interface:CatalogSynchronizationServicePerforms the synchronization for given items against given sync jobs.Note that for each job the list of items is being filtered to schedule only the ones which are actually applicable (being compatible with the job's root type collection).
For influencing the sync behavior a sync config object can be passed, e.g. for controlling the level of multi-threading.
- Specified by:
performSynchronizationin interfaceCatalogSynchronizationService
-
scheduleItemsWithConfig
protected SyncConfig scheduleItemsWithConfig(SyncConfig syncConfig, SyncItemJobModel syncJob, List<ItemModel> applicableItems) -
getSyncJob
public SyncItemJobModel getSyncJob(CatalogVersionModel source, CatalogVersionModel target, String qualifier) Description copied from interface:CatalogSynchronizationServiceReturns the publication rule (asSyncItemJobModelitem) between a specified source catalog version and target catalog version.- Specified by:
getSyncJobin interfaceCatalogSynchronizationService
-
performSynchronization
public SyncResult performSynchronization(List<ItemModel> givenItems, SyncItemJobModel syncItemJob, SyncConfig syncConfig) Description copied from interface:CatalogSynchronizationServicePerforms the synchronization for given items.Note that the list of items is being filtered to schedule only the ones which are actually applicable (being compatible with the job's root type collection).
For influencing the sync behavior a sync config object can be passed, e.g. for controlling the level of multi-threading.
- Specified by:
performSynchronizationin interfaceCatalogSynchronizationService
-
getApplicableItems
Description copied from interface:CatalogSynchronizationServiceFilters given items returning only the ones being applicable to the given sync job. Being applicable means whether or not an item is compatible to the job's root type collection and whether it belongs to the specified catalog version.- Specified by:
getApplicableItemsin interfaceCatalogSynchronizationService
-
isInProgress
Description copied from interface:CatalogSynchronizationServiceChecks whether the givengivenSyncJobis currently in progress.- Specified by:
isInProgressin interfaceCatalogSynchronizationService
-
lookupCurrentSynchronizations
Description copied from interface:CatalogSynchronizationServiceReturns the current executions for the giventheSyncJob.- Specified by:
lookupCurrentSynchronizationsin interfaceCatalogSynchronizationService
-
getSynchronizationSourceTimestampFor
public ItemSyncTimestampModel getSynchronizationSourceTimestampFor(SyncItemJobModel theSyncJob, ItemModel source) Description copied from interface:CatalogSynchronizationServiceReturns the existingItemSyncTimestampModelfor thesourceitem in the scope of the given sync job. In case of the item never been synchronized before NULL is returned.- Specified by:
getSynchronizationSourceTimestampForin interfaceCatalogSynchronizationService
-
getSynchronizationTargetTimestampFor
public ItemSyncTimestampModel getSynchronizationTargetTimestampFor(SyncItemJobModel theSyncJob, ItemModel target) Description copied from interface:CatalogSynchronizationServiceReturns the existingItemSyncTimestampModelfor the target item in the scope of the given sync job. In case of the original source item being deleted this methods will return NULL.- Specified by:
getSynchronizationTargetTimestampForin interfaceCatalogSynchronizationService
-
getSynchronizationSourceFor
Description copied from interface:CatalogSynchronizationServiceReturns the counterpart for thetargetitem against given sync jobtheSyncJob.- Specified by:
getSynchronizationSourceForin interfaceCatalogSynchronizationService
-
getSynchronizationTargetFor
Description copied from interface:CatalogSynchronizationServiceReturns the counterpart for thesourceitem against given sync jobtheSyncJob.- Specified by:
getSynchronizationTargetForin interfaceCatalogSynchronizationService
-
canSynchronize
Returns true if the principal has sync permissions to synchronize between catalog versions from given sync job. Returns true if the principal has sync permissions by checking sync job has syncPrincipalsOnly set to true and given principal is part of sync job's syncPrincipals list or by checking write permissions on target catalog.- Specified by:
canSynchronizein interfaceCatalogSynchronizationService- Parameters:
syncJob- the sync jobprincipal- the principal- Returns:
- a boolean
-
addScheduleFromConfig
-
createSyncJob
protected CatalogVersionSyncJobModel createSyncJob(CatalogVersionModel source, CatalogVersionModel target) -
createSyncJob
protected CatalogVersionSyncJobModel createSyncJob(CatalogVersionModel source, CatalogVersionModel target, int numberOfThreads) -
createSyncCronJob
-
cloneSyncConfig
-
getMaxThreads
-
setCronJobService
-
setModelService
-
setItemSyncTimestampDao
-
setSyncJobApplicableTypesStrategy
public void setSyncJobApplicableTypesStrategy(SyncJobApplicableTypesStrategy syncJobApplicableTypesStrategy) -
setCatalogTypeService
-
setFlexibleSearchService
-
setCatalogVersionService
-
setUserService
-