Class DefaultOutboundSyncService
- java.lang.Object
-
- de.hybris.platform.outboundsync.activator.impl.DefaultOutboundSyncService
-
- All Implemented Interfaces:
OutboundSyncService
public class DefaultOutboundSyncService extends java.lang.Object implements OutboundSyncService
Default implementation ofOutboundSyncServicethat usesOutboundServiceFacadefor sending changes to the destinations.
-
-
Field Summary
Fields Modifier and Type Field Description protected EventServiceeventServiceprotected ItemModelSearchServiceitemModelSearchServiceprotected OutboundItemConsumeroutboundItemConsumer
-
Constructor Summary
Constructors Constructor Description DefaultOutboundSyncService()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected voidconsumeChanges(OutboundItemDTOGroup outboundItemDTOGroup)protected ItemModelfindItemByPk(PK pk)protected java.util.Optional<CronJobModel>getCronJob(PK cronJobPk)Gets theCronJobModelfrom the databaseprotected ItemModelSearchServicegetItemModelSearchService()protected ModelServicegetModelService()Deprecated, for removal: This API element is subject to removal in a future version.This method will be removed without alternativeOutboundItemConsumergetOutboundItemConsumer()protected OutboundItemFactorygetOutboundItemFactory()OutboundServiceFacadegetOutboundServiceFacade()protected SyncRetryServicegetSyncRetryService()protected voidhandleError(OutboundItemDTOGroup outboundItemDTOGroup)protected voidhandleResponse(org.springframework.http.ResponseEntity<java.util.Map> responseEntity, OutboundItemDTOGroup outboundItemDTOGroup)protected voidhandleSuccessfulSync(OutboundItemDTOGroup outboundItemDTOGroup)protected voidpublishSuccessfulCompletedEvent(PK cronJobPk, int changeItemCount)Publish theCompletedOutboundSyncEventwith success set to true when the synchronization is doneprotected voidpublishSystemErrorEvent(PK cronJobPk, int changeItemCount)Publish thenSystemErrorOutboundSyncEventif a system error occursprotected voidpublishUnSuccessfulCompletedEvent(PK cronJobPk, int changeItemCount)Publish theCompletedOutboundSyncEventwith success set to false when the synchronization is donevoidsetEventService(EventService eventService)voidsetItemModelSearchService(ItemModelSearchService itemModelSearchService)voidsetModelService(ModelService modelService)Deprecated, for removal: This API element is subject to removal in a future version.voidsetOutboundItemConsumer(OutboundItemConsumer outboundItemConsumer)voidsetOutboundItemFactory(OutboundItemFactory factory)voidsetOutboundServiceFacade(OutboundServiceFacade outboundServiceFacade)voidsetSyncRetryService(SyncRetryService syncRetryService)voidsync(java.util.Collection<OutboundItemDTO> outboundItemDTOs)Consumes a DTO with the item changed information and handles the message based on the change type.protected voidsyncInternal(PK cronJobPk, int changeItemCount, de.hybris.platform.outboundsync.activator.impl.BaseOutboundSyncService.Synchronizer synchronizer)This method checks the cronjob is in the appropriate state before calling theBaseOutboundSyncService.Synchronizer.
-
-
-
Field Detail
-
itemModelSearchService
protected ItemModelSearchService itemModelSearchService
-
eventService
protected EventService eventService
-
outboundItemConsumer
protected OutboundItemConsumer outboundItemConsumer
-
-
Method Detail
-
sync
public void sync(java.util.Collection<OutboundItemDTO> outboundItemDTOs)
Description copied from interface:OutboundSyncServiceConsumes a DTO with the item changed information and handles the message based on the change type.- Specified by:
syncin interfaceOutboundSyncService- Parameters:
outboundItemDTOs- A collection of DTOs with the information about the changes in the item.
-
handleError
protected void handleError(OutboundItemDTOGroup outboundItemDTOGroup)
-
handleResponse
protected void handleResponse(org.springframework.http.ResponseEntity<java.util.Map> responseEntity, OutboundItemDTOGroup outboundItemDTOGroup)
-
getCronJob
protected java.util.Optional<CronJobModel> getCronJob(PK cronJobPk)
Gets theCronJobModelfrom the database- Parameters:
cronJobPk- PK of the cronjob being executed- Returns:
- The cronjob wrapped in an
Optionalif found, otherwise anOptional.empty()
-
handleSuccessfulSync
protected void handleSuccessfulSync(OutboundItemDTOGroup outboundItemDTOGroup)
-
consumeChanges
protected void consumeChanges(OutboundItemDTOGroup outboundItemDTOGroup)
-
getModelService
@Deprecated(since="2105", forRemoval=true) protected ModelService getModelService()Deprecated, for removal: This API element is subject to removal in a future version.This method will be removed without alternative
-
setModelService
@Deprecated(since="2105", forRemoval=true) public void setModelService(ModelService modelService)Deprecated, for removal: This API element is subject to removal in a future version.
-
getOutboundItemFactory
protected OutboundItemFactory getOutboundItemFactory()
-
setOutboundItemFactory
public void setOutboundItemFactory(OutboundItemFactory factory)
-
getOutboundServiceFacade
public OutboundServiceFacade getOutboundServiceFacade()
-
setOutboundServiceFacade
public void setOutboundServiceFacade(OutboundServiceFacade outboundServiceFacade)
-
getOutboundItemConsumer
public OutboundItemConsumer getOutboundItemConsumer()
-
setOutboundItemConsumer
public void setOutboundItemConsumer(OutboundItemConsumer outboundItemConsumer)
-
getSyncRetryService
protected SyncRetryService getSyncRetryService()
-
setSyncRetryService
public void setSyncRetryService(SyncRetryService syncRetryService)
-
setEventService
public void setEventService(EventService eventService)
-
getItemModelSearchService
protected ItemModelSearchService getItemModelSearchService()
-
setItemModelSearchService
public void setItemModelSearchService(ItemModelSearchService itemModelSearchService)
-
syncInternal
protected void syncInternal(PK cronJobPk, int changeItemCount, de.hybris.platform.outboundsync.activator.impl.BaseOutboundSyncService.Synchronizer synchronizer)
This method checks the cronjob is in the appropriate state before calling theBaseOutboundSyncService.Synchronizer.Here are the rules:
- If the job is aborting, an abort event is published. No synchronization will occur.
- If the job is in system error state, an system error event is published. No synchronization will occur.
- If the job is not aborted and not in system error state, synchronization will occur.
- Parameters:
cronJobPk- PK of the cronjob being executedchangeItemCount- The number of changed items detectedsynchronizer- Synchronizer to execute when the cronjob is in the appropriate state
-
publishSystemErrorEvent
protected void publishSystemErrorEvent(PK cronJobPk, int changeItemCount)
Publish thenSystemErrorOutboundSyncEventif a system error occurs- Parameters:
cronJobPk- PK of the cronjob being executedchangeItemCount- The number of changed items detected
-
publishSuccessfulCompletedEvent
protected void publishSuccessfulCompletedEvent(PK cronJobPk, int changeItemCount)
Publish theCompletedOutboundSyncEventwith success set to true when the synchronization is done- Parameters:
cronJobPk- PK of the cronjob being executedchangeItemCount- The number of changed items detected
-
publishUnSuccessfulCompletedEvent
protected void publishUnSuccessfulCompletedEvent(PK cronJobPk, int changeItemCount)
Publish theCompletedOutboundSyncEventwith success set to false when the synchronization is done- Parameters:
cronJobPk- PK of the cronjob being executedchangeItemCount- The number of changed items detected
-
-