Class DefaultOutboundSyncService

    • Constructor Detail

      • DefaultOutboundSyncService

        public DefaultOutboundSyncService()
    • Method Detail

      • sync

        public void sync​(java.util.Collection<OutboundItemDTO> outboundItemDTOs)
        Description copied from interface: OutboundSyncService
        Consumes a DTO with the item changed information and handles the message based on the change type.
        Specified by:
        sync in interface OutboundSyncService
        Parameters:
        outboundItemDTOs - A collection of DTOs with the information about the changes in the item.
      • handleResponse

        protected void handleResponse​(org.springframework.http.ResponseEntity<java.util.Map> responseEntity,
                                      OutboundItemDTOGroup outboundItemDTOGroup)
      • 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()
      • findItemByPk

        protected ItemModel findItemByPk​(PK pk)
      • handleSuccessfulSync

        protected void handleSuccessfulSync​(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
      • setOutboundServiceFacade

        public void setOutboundServiceFacade​(OutboundServiceFacade outboundServiceFacade)
      • setOutboundItemConsumer

        public void setOutboundItemConsumer​(OutboundItemConsumer outboundItemConsumer)
      • setSyncRetryService

        public void setSyncRetryService​(SyncRetryService syncRetryService)
      • setEventService

        public void setEventService​(EventService eventService)
      • 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 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