Class DefaultDeleteOutboundSyncService

java.lang.Object
de.hybris.platform.outboundsync.activator.impl.DefaultDeleteOutboundSyncService
All Implemented Interfaces:
DeleteOutboundSyncService

public class DefaultDeleteOutboundSyncService extends Object implements DeleteOutboundSyncService
Default implementation of the DeleteOutboundSyncService
  • Constructor Details

    • DefaultDeleteOutboundSyncService

      @Deprecated(since="2205", forRemoval=true) public DefaultDeleteOutboundSyncService(@NotNull @NotNull DeleteRequestSender deleteRequestSender, @NotNull @NotNull ItemModelSearchService itemModelSearchService, @NotNull @NotNull EventService eventService, @NotNull @NotNull OutboundItemConsumer outboundItemConsumer)
      Deprecated, for removal: This API element is subject to removal in a future version.
      use DefaultDeleteOutboundSyncService(ItemModelSearchService, OutboundItemFactory, OutboundSyncJobRegister, DeleteRequestSender) This constructor does not set the EventService and the OutboundItemConsumer anymore. If this constructor is used, the dependencies must be wired through the corresponding setters now.
      Instantiates this 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
      See Also:
      • BaseOutboundSyncService.setEventService(EventService)
      • BaseOutboundSyncService.setOutboundItemConsumer(OutboundItemConsumer)
    • DefaultDeleteOutboundSyncService

      public DefaultDeleteOutboundSyncService(@NotNull @NotNull ItemModelSearchService searchService, @NotNull @NotNull OutboundItemFactory factory, @NotNull @NotNull OutboundSyncJobRegister register, @NotNull @NotNull DeleteRequestSender sender)
      Instantiates this services with its required dependencies
      Parameters:
      searchService - a service to use for the cron job and changed item model searches
      factory - A factory implementation to create instances of OutboundItem
      register - a register to inquire about currently running outbound sync jobs
      sender - a sender to use for sending the delete changes out
  • Method Details

    • sync

      public void sync(OutboundItemDTO deletedItem)
      Description copied from interface: DeleteOutboundSyncService
      Synchronize the item deletion
      Specified by:
      sync in interface DeleteOutboundSyncService
      Parameters:
      deletedItem - Contains the data about the deleted item
    • syncInternal

      protected void syncInternal(PK cronJobPk, Collection<OutboundItemDTOGroup> groups, 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
      groups - collection of groups of items being synchronized
      synchronizer - Synchronizer to execute when the cronjob is in the appropriate state
    • syncInternal

      protected void syncInternal(PK cronJobPk, OutboundItemDTOGroup group, de.hybris.platform.outboundsync.activator.impl.BaseOutboundSyncService.Synchronizer synchronizer)
    • publishSystemErrorEvent

      protected void publishSystemErrorEvent(PK cronJobPk, OutboundItemDTOGroup group)
      Publish then SystemErrorOutboundSyncEvent if a system error occurs
      Parameters:
      cronJobPk - PK of the cronjob being executed
      group - group of the items, for which were not processed because of a systemic problem with the outbound sync.
    • publishSystemErrorEvent

      protected void publishSystemErrorEvent(PK cronJobPk, Collection<OutboundItemDTOGroup> groups)
    • publishSuccessfulCompletedEvent

      protected void publishSuccessfulCompletedEvent(OutboundItemDTOGroup group)
      Publish the CompletedOutboundSyncEvent with success set to true when the synchronization is done
      Parameters:
      group - a group of items successfully synchronized
    • publishUnSuccessfulCompletedEvent

      protected void publishUnSuccessfulCompletedEvent(Collection<OutboundItemDTOGroup> groups)
      Publish the CompletedOutboundSyncEvent with success set to false when the synchronization is done
      Parameters:
      groups - a group of items that failed to be synchronized
    • publishUnSuccessfulCompletedEvent

      protected void publishUnSuccessfulCompletedEvent(OutboundItemDTOGroup group)
    • findItemByPk

      protected <T extends ItemModel> Optional<T> findItemByPk(PK pk)
    • asItemGroup

      protected OutboundItemDTOGroup asItemGroup(OutboundItemDTO item)
    • asItemGroup

      protected OutboundItemDTOGroup asItemGroup(Collection<OutboundItemDTO> items)
    • consumeChanges

      protected void consumeChanges(OutboundItemDTOGroup outboundItemDTOGroup)
    • consumeChange

      protected void consumeChange(OutboundItemDTO item)
    • setOutboundItemFactory

      @Deprecated(since="2205", forRemoval=true) public void setOutboundItemFactory(@NotNull @NotNull OutboundItemFactory factory)
      Deprecated, for removal: This API element is subject to removal in a future version.
      not preferred anymore. If the dependency is needed it should be injected into the concrete service class.
      Injects implementation of the OutboundItemFactory to be passed into the OutboundItemDTOGroup created by this service.
      Parameters:
      factory - an implementation of the outbound item factory to be used in this service
    • getOutboundItemConsumer

      public OutboundItemConsumer getOutboundItemConsumer()
      Retrieves the change consumer used to clear changes in the delta detect module when the change is successfully synchronized or should be ignored.
      Returns:
      changes consumer user by this service
    • setOutboundItemConsumer

      public void setOutboundItemConsumer(OutboundItemConsumer consumer)
      Injects a change consumer, which clears changes in the delta detect module when the change is successfully synchronized or should be ignored. If item consumer is not injected, the changes won't be consumed and therefore custom implementation need to manage delta detect changes themselves.
      Parameters:
      consumer - an implementation of the change consumer to use.
    • setEventService

      public void setEventService(EventService service)
      Injects implementation of the EventService to use for publishing outbound sync job events. If the event services is not injected, the outbound sync events won't be fired. Although, this dependency is optional, current implementation of the outbound sync heavily relies on the outbound sync events being fired. If a customization, decides not to inject this service, it has to manage events delivery to OutboundSyncJobStateAggregator in a customer way to maintain correct functionality.
      Parameters:
      service - a service to use for publishing events
    • setItemModelSearchService

      @Deprecated(since="2205", forRemoval=true) public void setItemModelSearchService(@NotNull @NotNull ItemModelSearchService service)
      Deprecated, for removal: This API element is subject to removal in a future version.
      not preferred anymore. Inject the ItemModelSearchService through constructor
      Injects implementation of the ItemModelSearchService to be used for searching model instances by PK. If this method is not called then, ItemModelSearchService configured in "itemModelSearchService" Spring bean will be used by default.
      Parameters:
      service - an implementation to use.
    • setJobRegister

      @Deprecated(since="2205", forRemoval=true) public void setJobRegister(@NotNull @NotNull OutboundSyncJobRegister register)
      Deprecated, for removal: This API element is subject to removal in a future version.
      not preferred anymore. Inject the OutboundSyncJobRegister through constructor
      Injects specific OutboundSyncJobRegister implementation.
      Parameters:
      register - an implementation to use