Class DefaultDeleteOutboundSyncService
- java.lang.Object
-
- de.hybris.platform.outboundsync.activator.impl.DefaultDeleteOutboundSyncService
-
- All Implemented Interfaces:
DeleteOutboundSyncService
public class DefaultDeleteOutboundSyncService extends java.lang.Object implements DeleteOutboundSyncService
Default implementation of theDeleteOutboundSyncService
-
-
Field Summary
Fields Modifier and Type Field Description protected EventServiceeventServiceprotected ItemModelSearchServiceitemModelSearchServiceprotected OutboundItemConsumeroutboundItemConsumer
-
Constructor Summary
Constructors Constructor Description DefaultDeleteOutboundSyncService(@NotNull DeleteRequestSender deleteRequestSender, @NotNull ItemModelSearchService itemModelSearchService, @NotNull EventService eventService, @NotNull OutboundItemConsumer outboundItemConsumer)Instantiates the delete sync service
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.util.Optional<CronJobModel>getCronJob(PK cronJobPk)Gets theCronJobModelfrom the databaseprotected 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 donevoidsync(OutboundItemDTO deletedItem)Synchronize the item deletionprotected 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
-
-
Constructor Detail
-
DefaultDeleteOutboundSyncService
public DefaultDeleteOutboundSyncService(@NotNull @NotNull DeleteRequestSender deleteRequestSender, @NotNull @NotNull ItemModelSearchService itemModelSearchService, @NotNull @NotNull EventService eventService, @NotNull @NotNull OutboundItemConsumer outboundItemConsumer)Instantiates the delete sync service- Parameters:
deleteRequestSender- Sender that sends the delete requestitemModelSearchService- Finder that retrieves an item modeleventService- Service to send events to update cronjob statusoutboundItemConsumer- Consumer that consumes the delta detect change
-
-
Method Detail
-
sync
public void sync(OutboundItemDTO deletedItem)
Description copied from interface:DeleteOutboundSyncServiceSynchronize the item deletion- Specified by:
syncin interfaceDeleteOutboundSyncService- Parameters:
deletedItem- Contains the data about the deleted item
-
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
-
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()
-
-