Class OutboundSyncJobStateAggregator

java.lang.Object
de.hybris.platform.outboundsync.job.impl.OutboundSyncJobStateAggregator
All Implemented Interfaces:
OutboundSyncJob

public final class OutboundSyncJobStateAggregator extends Object implements OutboundSyncJob
This aggregator keeps track of an outbound sync job by aggregating OutboundSyncEvents indicating the job progress.
  • Method Details

    • create

      public static OutboundSyncJobStateAggregator create(@NotNull @NotNull OutboundSyncCronJobModel model)
      Instantiates this state aggregator.
      Parameters:
      model - a job model representing the cron job, for which state has to be managed by this aggregator.
    • getId

      public PK getId()
      Description copied from interface: OutboundSyncJob
      Retrieves identifier of this outbound sync job. The default implementation in this interface always returns PK.fromLong(0), so this method must be overridden by the implementation to provide correct behavior.
      Specified by:
      getId in interface OutboundSyncJob
      Returns:
      identifier of this job, i.e. a value that differs one outbound sync job from the other: for example, a customer synchronization from product synchronization. Therefore, this ID should persist for different executions of the same job.
    • applyEvent

      public void applyEvent(@NotNull @NotNull OutboundSyncEvent event)
      Description copied from interface: OutboundSyncJob
      Applies an event and recalculates state of the context outbound sync job.
      Specified by:
      applyEvent in interface OutboundSyncJob
      Parameters:
      event - a job state changing event.
    • getFinalState

      @NotNull public @NotNull OutboundSyncState getFinalState()
      Description copied from interface: OutboundSyncJob
      Retrieves state of the context job after the last event was applied.
      Specified by:
      getFinalState in interface OutboundSyncJob
      Returns:
      the OutboutndSyncState after the latch has been released
    • getCurrentState

      public OutboundSyncState getCurrentState()
      Description copied from interface: OutboundSyncJob
      Retrieves the current state of the context job.
      Specified by:
      getCurrentState in interface OutboundSyncJob
      Returns:
      current state of the context outbound sync job.
    • addStateObserver

      public void addStateObserver(OutboundSyncStateObserver observer)
      Registers an observer to be notified whenever this aggregate state changes, i.e. the cron job status changes, cron job result changes or StartedOutboundSyncEvent was applied.
      Specified by:
      addStateObserver in interface OutboundSyncJob
      Parameters:
      observer - an observer to notify
    • stop

      public void stop()
      Description copied from interface: OutboundSyncJob
      Forces this job to stop, so that it changes its status to FINISHED, even if its state does not show that all expected items have been processed. This means that changes processed by this job may continue being synchronized, but result of their synchronization may be ignored and not reported in the job's PerformResult

      Default implementation in this interface does nothing, meaning the job won't be stopped by default. Implementations of this interface must implement the stop() logic.

      Specified by:
      stop in interface OutboundSyncJob
    • toString

      public String toString()
      Overrides:
      toString in class Object