Class DefaultSynchronizationFacade
java.lang.Object
de.hybris.platform.cmsfacades.synchronization.impl.DefaultSynchronizationFacade
- All Implemented Interfaces:
SynchronizationFacade
Default implementation of the synchronization facade.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateCatalogSynchronization(SyncRequestData syncJobRequest) Attempts to create a synchronization job.protected SyncItemCronJobModelCreates a newSyncItemCronJobModelfor the sameSyncItemJobModelprotected SyncItemJobModelcreateSyncJobModel(CatalogVersionModel source, CatalogVersionModel target) Create a sync jobprotected Optional<SyncItemJobModel>findLatestSyncItemJobModel(String catalogId, String sourceCatalogVersionName, String targetCatalogVersionName) Find the latest SyncItemJobModelprotected Optional<SyncItemJobModel>findLatestSyncItemJobModelByTarget(List<SyncItemJobModel> incomingSynchronizations, Map<PK, CronJobModel> latestCronJobs) Retrieves the synchronization item that triggered the last successful cron job (SUCCESSFUL and FINISHED).protected Optional<CronJobModel>findTheCronJob(String catalogId, String sourceCatalogVersionName, String targetCatalogVersionName) Find a cron job based a catalog and version.protected Optional<CronJobModel>findTheCronJob(Optional<SyncItemJobModel> syncItemJobModel) Return the latest cron job of a syncItemJobModelprotected org.springframework.validation.Validatorprotected org.springframework.validation.Validatorprotected CatalogVersionServiceprotected CronJobServiceprotected Optional<CronJobStatus>getCronJobStatus(Optional<CronJobModel> cronJobModel) Get a cron job statusprotected FacadeValidationServiceprotected List<SyncItemJobModel>getIncomingSynchronizations(String catalogId, String targetCatalogVersionName) Finds the list of synchronizations targeting the provided catalog version.protected Optional<CronJobModel>getLastSuccessfulCronJob(SyncItemJobModel syncItemJobModel) Retrieves the last successful (SUCCESSFUL and FINISHED) cron job of the provided synchronization item.getLastSynchronizationByCatalogTarget(SyncRequestData syncJobRequest) Get the status of the last synchronization job bySyncRequestData.protected ModelServicegetSynchronizationByCatalogSourceTarget(SyncRequestData syncJobRequest) Get a synchronization status bySyncRequestData.protected Map<PK,CronJobModel> getSynchronizationsLastSuccessfulCronJob(List<SyncItemJobModel> synchronizations) Retrieves the last successful cron job of each of the provided synchronization items.protected Populator<Optional<SyncItemJobModel>,SyncJobData> protected Converter<Optional<CronJobModel>,SyncJobData> protected org.springframework.validation.Validatorprotected UserServicevoidsetBasicSyncJobRequestCompositeValidator(org.springframework.validation.Validator basicSyncJobRequestCompositeValidator) voidsetCatalogSynchronizationCompositeValidator(org.springframework.validation.Validator catalogSynchronizationCompositeValidator) voidsetCatalogVersionService(CatalogVersionService catalogVersionService) voidsetCronJobService(CronJobService cronJobService) voidsetFacadeValidationService(FacadeValidationService facadeValidationService) voidsetModelService(ModelService modelService) voidsetSyncItemJobToSyncJobDataPopulator(Populator<Optional<SyncItemJobModel>, SyncJobData> syncItemJobToSyncJobDataPopulator) voidsetSyncJobConverter(Converter<Optional<CronJobModel>, SyncJobData> syncJobConverter) voidsetSyncJobRequestCompositeValidator(org.springframework.validation.Validator syncJobRequestCompositeValidator) voidsetUserService(UserService userService) protected voidvalidateIfJobIsRunning(Optional<CronJobStatus> cronJobStatus) Check if the a cron job is running
-
Constructor Details
-
DefaultSynchronizationFacade
public DefaultSynchronizationFacade()
-
-
Method Details
-
getSynchronizationByCatalogSourceTarget
public SyncJobData getSynchronizationByCatalogSourceTarget(SyncRequestData syncJobRequest) throws ValidationException Description copied from interface:SynchronizationFacadeGet a synchronization status bySyncRequestData.- Specified by:
getSynchronizationByCatalogSourceTargetin interfaceSynchronizationFacade- Parameters:
syncJobRequest- the synchronization request data- Returns:
- the
SyncJobData - Throws:
ValidationException- if there any validation errors.
-
getLastSynchronizationByCatalogTarget
public SyncJobData getLastSynchronizationByCatalogTarget(SyncRequestData syncJobRequest) throws ValidationException Description copied from interface:SynchronizationFacadeGet the status of the last synchronization job bySyncRequestData. Information is retrieved based on the catalog version target.- Specified by:
getLastSynchronizationByCatalogTargetin interfaceSynchronizationFacade- Parameters:
syncJobRequest- the synchronization request data- Returns:
- the
SyncJobData - Throws:
ValidationException- if there are any validation errors
-
getIncomingSynchronizations
protected List<SyncItemJobModel> getIncomingSynchronizations(String catalogId, String targetCatalogVersionName) Finds the list of synchronizations targeting the provided catalog version.- Parameters:
catalogId- a catalog idtargetCatalogVersionName- the target catalog version- Returns:
- List
List of SyncItemJobModel
-
getSynchronizationsLastSuccessfulCronJob
protected Map<PK,CronJobModel> getSynchronizationsLastSuccessfulCronJob(List<SyncItemJobModel> synchronizations) Retrieves the last successful cron job of each of the provided synchronization items.- Parameters:
synchronizations- A list of synchronization items- Returns:
- Map<PK, CronJobModel> A map. It contains the last successful cron job of each synchronization item. It's indexed by the PK of the synchronization item.
-
getLastSuccessfulCronJob
Retrieves the last successful (SUCCESSFUL and FINISHED) cron job of the provided synchronization item.- Parameters:
syncItemJobModel- A synchronization item- Returns:
- Optional
The last successful cron job.
-
findLatestSyncItemJobModelByTarget
protected Optional<SyncItemJobModel> findLatestSyncItemJobModelByTarget(List<SyncItemJobModel> incomingSynchronizations, Map<PK, CronJobModel> latestCronJobs) Retrieves the synchronization item that triggered the last successful cron job (SUCCESSFUL and FINISHED).- Parameters:
incomingSynchronizations- A list of synchronization itemslatestCronJobs- A map of the latest synchronization cron jobs. Its indexed by synchronization items PKs.- Returns:
- Optional
The synchronization item
-
createCatalogSynchronization
Description copied from interface:SynchronizationFacadeAttempts to create a synchronization job. It may not succeed due to internal constraints, and in this case it will throw an exception.- Specified by:
createCatalogSynchronizationin interfaceSynchronizationFacade- Parameters:
syncJobRequest- the synchronization request data- Returns:
- the synchronization job status
-
validateIfJobIsRunning
Check if the a cron job is running- Parameters:
cronJobStatus- anOptionalofCronJobStatus
-
createSyncJobModel
protected SyncItemJobModel createSyncJobModel(CatalogVersionModel source, CatalogVersionModel target) Create a sync job- Parameters:
source- the catalog source versiontarget- the catalog target version.- Returns:
- a
SyncItemJobModel
-
findLatestSyncItemJobModel
protected Optional<SyncItemJobModel> findLatestSyncItemJobModel(String catalogId, String sourceCatalogVersionName, String targetCatalogVersionName) Find the latest SyncItemJobModel- Parameters:
catalogId-sourceCatalogVersionName-targetCatalogVersionName-- Returns:
- Optional
-
findTheCronJob
protected Optional<CronJobModel> findTheCronJob(String catalogId, String sourceCatalogVersionName, String targetCatalogVersionName) Find a cron job based a catalog and version.- Parameters:
catalogId- a catalog idsourceCatalogVersionName- the source catalog versiontargetCatalogVersionName- the target catalog version- Returns:
- Optional
a OptionalofCronJobModel
-
findTheCronJob
Return the latest cron job of a syncItemJobModel- Parameters:
syncItemJobModel- anOptionalofSyncItemJobModel- Returns:
- a
OptionalofCronJobModel
-
getCronJobStatus
Get a cron job status- Parameters:
cronJobModel-OptionalofCronJobModel- Returns:
OptionalofCronJobStatus
-
createSyncCronJob
Creates a newSyncItemCronJobModelfor the sameSyncItemJobModel- Parameters:
job- the SyncItemJobModel that will hold the new instance of the cron Job- Returns:
- a new SyncItemCronJobModel
-
getCatalogVersionService
-
setCatalogVersionService
-
getSyncJobConverter
-
setSyncJobConverter
-
getFacadeValidationService
-
setFacadeValidationService
-
getModelService
-
setModelService
-
getCatalogSynchronizationCompositeValidator
protected org.springframework.validation.Validator getCatalogSynchronizationCompositeValidator() -
setCatalogSynchronizationCompositeValidator
public void setCatalogSynchronizationCompositeValidator(org.springframework.validation.Validator catalogSynchronizationCompositeValidator) -
getSyncJobRequestCompositeValidator
protected org.springframework.validation.Validator getSyncJobRequestCompositeValidator() -
setSyncJobRequestCompositeValidator
public void setSyncJobRequestCompositeValidator(org.springframework.validation.Validator syncJobRequestCompositeValidator) -
getBasicSyncJobRequestCompositeValidator
protected org.springframework.validation.Validator getBasicSyncJobRequestCompositeValidator() -
setBasicSyncJobRequestCompositeValidator
public void setBasicSyncJobRequestCompositeValidator(org.springframework.validation.Validator basicSyncJobRequestCompositeValidator) -
getCronJobService
-
setCronJobService
-
getSyncItemJobToSyncJobDataPopulator
-
setSyncItemJobToSyncJobDataPopulator
public void setSyncItemJobToSyncJobDataPopulator(Populator<Optional<SyncItemJobModel>, SyncJobData> syncItemJobToSyncJobDataPopulator) -
getUserService
-
setUserService
-