Class DefaultDeleteOutboundSyncService

    • 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 request
        itemModelSearchService - Finder that retrieves an item model
        eventService - Service to send events to update cronjob status
        outboundItemConsumer - Consumer that consumes the delta detect change
    • Method Detail

      • 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 the BaseOutboundSyncService.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 executed
        changeItemCount - The number of changed items detected
        synchronizer - Synchronizer to execute when the cronjob is in the appropriate state
      • publishSystemErrorEvent

        protected void publishSystemErrorEvent​(PK cronJobPk,
                                               int changeItemCount)
        Publish then SystemErrorOutboundSyncEvent if a system error occurs
        Parameters:
        cronJobPk - PK of the cronjob being executed
        changeItemCount - The number of changed items detected
      • publishSuccessfulCompletedEvent

        protected void publishSuccessfulCompletedEvent​(PK cronJobPk,
                                                       int changeItemCount)
        Publish the CompletedOutboundSyncEvent with success set to true when the synchronization is done
        Parameters:
        cronJobPk - PK of the cronjob being executed
        changeItemCount - The number of changed items detected
      • publishUnSuccessfulCompletedEvent

        protected void publishUnSuccessfulCompletedEvent​(PK cronJobPk,
                                                         int changeItemCount)
        Publish the CompletedOutboundSyncEvent with success set to false when the synchronization is done
        Parameters:
        cronJobPk - PK of the cronjob being executed
        changeItemCount - The number of changed items detected
      • getCronJob

        protected java.util.Optional<CronJobModel> getCronJob​(PK cronJobPk)
        Gets the CronJobModel from the database
        Parameters:
        cronJobPk - PK of the cronjob being executed
        Returns:
        The cronjob wrapped in an Optional if found, otherwise an Optional.empty()