Interface SynchronizationFacade
- All Known Implementing Classes:
DefaultSynchronizationFacade
public interface SynchronizationFacade
Facade which allows to perform synchronization related operations.
-
Method Summary
Modifier and TypeMethodDescriptionbooleancanSync(SyncItemJobModel sync) Tells whether current user can perform given sync.findSyncCounterpart(ItemModel item, SyncItemJobModel syncItemJob) Finds a counterpart of given item in respective catalog version defined by the syncItemJob.getCatalogVersionAwareItems(List<? extends ItemModel> items) Extract catalog version aware itemsCatalogTypeService.isCatalogVersionAwareModel(ItemModel)getInboundSynchronizations(CatalogVersionModel catalogVersion) Gets inbound sync jobs for given catalog version.getItemsCatalogVersions(List<? extends ItemModel> items) Extracts from given list items which are CatalogVersiongetOutboundSynchronizations(CatalogVersionModel catalogVersion) Gets outbound sync jobs for given catalog version.getPartialSyncStatusInfo(ItemModel itemModel, SyncItemStatus status, Map<String, Object> ctxMap) ChecksItemModel's status in all available synchronizations.getSyncCatalogVersion(Collection<ItemModel> items) Returns catalog version for given items if they are from the same catalog version or are CatalogVersion itself.default booleanisApplicableForItems(SyncItemJobModel jobModel, Collection<ItemModel> items) Checks ifSyncItemJobModelis applicable forItemModelsChecksItemModel's status in all available synchronizations.Checks if allItemModels are sync according to source and target fromSyncItemJobModel.booleanisSyncInProgress(ItemModel item) Tells if given item is being synchronized.default booleanisSyncInProgressByDirectSearch(ItemModel itemModel) Tells if given item is being synchronized by direct flexible searchperformSynchronization(SyncTask syncTask) Performs synchronization based on given sync task.voidRuns given sync cron job again omitting items already processed in the previous run.
-
Method Details
-
performSynchronization
Performs synchronization based on given sync task.- Parameters:
syncTask- - defines sync jobs and items to sync.- Returns:
- executed sync cron job code
CronJobModel.getCode()if sync has been started.
-
getInboundSynchronizations
Gets inbound sync jobs for given catalog version.- Parameters:
catalogVersion- - catalog version for which outbound synchronizations will be returned. To obtain catalog version please usegetSyncCatalogVersion(Collection)- Returns:
- list of sync jobs
-
getOutboundSynchronizations
Gets outbound sync jobs for given catalog version.- Parameters:
catalogVersion- - catalog version for which outbound synchronizations will be returned. To obtain catalog version please usegetSyncCatalogVersion(Collection)- Returns:
- list of sync jobs
-
getSyncCatalogVersion
Returns catalog version for given items if they are from the same catalog version or are CatalogVersion itself.- Parameters:
items- items for which catalog version will be extracted.- Returns:
- catalog version for given items.
-
isInSync
Optional<Boolean> isInSync(List<ItemModel> itemModels, SyncItemJobModel jobModel, Map<String, Object> ctxMap) Checks if allItemModels are sync according to source and target fromSyncItemJobModel.- Parameters:
itemModels- defines items for which sync status is checkedjobModel- defines sync item job model from which source and target is taken to perform status checkctxMap- defines additional context- Returns:
- true if all itemModels are in sync
-
isInSync
ChecksItemModel's status in all available synchronizations.- Parameters:
itemModel- defines item for which sync status is checkedctxMap- defines additional context- Returns:
- true if all itemModel are in sync, Optional.empty if sync status is not available e.g. item is not catalog version aware
-
isApplicableForItems
Checks ifSyncItemJobModelis applicable forItemModels- Parameters:
jobModel- define sync job which will be checked if is applicable for itemsitems- defines items for which sync job is checked- Returns:
- true if sync job is applicable for items, false if it is not applicable
-
getPartialSyncStatusInfo
Optional<PartialSyncInfo> getPartialSyncStatusInfo(ItemModel itemModel, SyncItemStatus status, Map<String, Object> ctxMap) ChecksItemModel's status in all available synchronizations.- Parameters:
itemModel- defines item for which sync status is checkedstatus- defines target status for partial sync infoPartialSyncInfoctxMap- defines additional context- Returns:
- partial sync information if item is catalog version aware.
-
findSyncCounterpart
Finds a counterpart of given item in respective catalog version defined by the syncItemJob.- Parameters:
item- item of which counterpart will be found.syncItemJob- synchronization job which defines source and target catalog version.- Returns:
- counterpart item if found.
-
getItemsCatalogVersions
Extracts from given list items which are CatalogVersion- Parameters:
items- list of items- Returns:
- list of catalog version items
-
getCatalogVersionAwareItems
Extract catalog version aware itemsCatalogTypeService.isCatalogVersionAwareModel(ItemModel)- Parameters:
items- list of items- Returns:
- list of catalog version aware items
-
isSyncInProgress
Tells if given item is being synchronized.- Parameters:
item- item to check- Returns:
- true if item is being synchronized.
-
isSyncInProgressByDirectSearch
Tells if given item is being synchronized by direct flexible search- Parameters:
itemModel- itemModel to check- Returns:
- true if item is being synchronized.
-
reRunCronJob
Runs given sync cron job again omitting items already processed in the previous run.- Parameters:
cronJob- sync cron job to rerun.
-
canSync
Tells whether current user can perform given sync.- Parameters:
sync- synchronization job.- Returns:
- true if user can synchronize.
-