Interface SynchronizationFacade

All Known Implementing Classes:
DefaultSynchronizationFacade

public interface SynchronizationFacade
Facade which allows to perform synchronization related operations.
  • Method Details

    • performSynchronization

      Optional<String> performSynchronization(SyncTask syncTask)
      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

      List<SyncItemJobModel> getInboundSynchronizations(CatalogVersionModel catalogVersion)
      Gets inbound sync jobs for given catalog version.
      Parameters:
      catalogVersion - - catalog version for which outbound synchronizations will be returned. To obtain catalog version please use getSyncCatalogVersion(Collection)
      Returns:
      list of sync jobs
    • getOutboundSynchronizations

      List<SyncItemJobModel> getOutboundSynchronizations(CatalogVersionModel catalogVersion)
      Gets outbound sync jobs for given catalog version.
      Parameters:
      catalogVersion - - catalog version for which outbound synchronizations will be returned. To obtain catalog version please use getSyncCatalogVersion(Collection)
      Returns:
      list of sync jobs
    • getSyncCatalogVersion

      Optional<CatalogVersionModel> getSyncCatalogVersion(Collection<ItemModel> items)
      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 all ItemModels are sync according to source and target from SyncItemJobModel.
      Parameters:
      itemModels - defines items for which sync status is checked
      jobModel - defines sync item job model from which source and target is taken to perform status check
      ctxMap - defines additional context
      Returns:
      true if all itemModels are in sync
    • isInSync

      Optional<Boolean> isInSync(ItemModel itemModel, Map<String,Object> ctxMap)
      Checks ItemModel's status in all available synchronizations.
      Parameters:
      itemModel - defines item for which sync status is checked
      ctxMap - 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

      default boolean isApplicableForItems(SyncItemJobModel jobModel, Collection<ItemModel> items)
      Checks if SyncItemJobModel is applicable for ItemModels
      Parameters:
      jobModel - define sync job which will be checked if is applicable for items
      items - 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)
      Checks ItemModel's status in all available synchronizations.
      Parameters:
      itemModel - defines item for which sync status is checked
      status - defines target status for partial sync info PartialSyncInfo
      ctxMap - defines additional context
      Returns:
      partial sync information if item is catalog version aware.
    • findSyncCounterpart

      Optional<ItemModel> findSyncCounterpart(ItemModel item, SyncItemJobModel syncItemJob)
      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

      List<CatalogVersionModel> getItemsCatalogVersions(List<? extends ItemModel> items)
      Extracts from given list items which are CatalogVersion
      Parameters:
      items - list of items
      Returns:
      list of catalog version items
    • getCatalogVersionAwareItems

      List<ItemModel> getCatalogVersionAwareItems(List<? extends ItemModel> items)
      Parameters:
      items - list of items
      Returns:
      list of catalog version aware items
    • isSyncInProgress

      boolean isSyncInProgress(ItemModel item)
      Tells if given item is being synchronized.
      Parameters:
      item - item to check
      Returns:
      true if item is being synchronized.
    • reRunCronJob

      void reRunCronJob(CatalogVersionSyncCronJobModel cronJob)
      Runs given sync cron job again omitting items already processed in the previous run.
      Parameters:
      cronJob - sync cron job to rerun.
    • canSync

      boolean canSync(SyncItemJobModel sync)
      Tells whether current user can perform given sync.
      Parameters:
      sync - synchronization job.
      Returns:
      true if user can synchronize.