Class OutboundSyncState

java.lang.Object
de.hybris.platform.outboundsync.job.impl.OutboundSyncState

@Immutable public final class OutboundSyncState extends Object
Represents state of a single outbound sync cron job run.
  • Method Details

    • isAllItemsProcessed

      public boolean isAllItemsProcessed()
      Determines whether all changes detected by the outbound sync job have been processed or not.
      Returns:
      true, if all changes are processed; false, if at least one change remains queued and not processed.
    • isAborted

      public boolean isAborted()
      Determines whether the outbound sync job is aborted
      Returns:
      true, if outbound sync job is aborted; else false
    • isSystemicError

      public boolean isSystemicError()
      Determines whether there is a systemic error which cannot be recovered. A systemic error is an error that does not depend on a specific item but would happen for any item being synchronized.
      Returns:
      true, if a systemic error exists; else false
    • isFinal

      public boolean isFinal()
      Determines whether this state is final or not.
      Returns:
      true, if this state is final, i.e. job has finished and the result is already known; false, if the outbound sync continues processing.
    • getTotalItemsRequested

      @NotNull public @NotNull OptionalInt getTotalItemsRequested()
      Retrieves total number of changes to by synchronized to an external system.
      Returns:
      Optional containing total number of changes, or an empty Optional, if the total number of changes is not known yet.
    • getSuccessCount

      public int getSuccessCount()
      Retrieves number of changes reported by the delta detect that synchronized successfully.
      Returns:
      number of successfully synchronized changes or 0 when all items failed to synchronize or the job is aborted before any item synchronized successfully.
    • getErrorCount

      public int getErrorCount()
      Retrieves number of changes reported by the delta detect that failed to synchronize.
      Returns:
      number of failed to synchronize changes or 0, if all items synchronized successfully or the job was aborted before any item failed to synchronize.
    • getUnprocessedCount

      public int getUnprocessedCount()
      Retrieves number of changes, reported by the delta detect, ignored after the job was aborted.
      Returns:
      number of changes ignored or 0, if the job was not aborted.
    • getRemainingItemsCount

      public OptionalInt getRemainingItemsCount()
      Retrieves number of items that have not been processed by the outbound sync yet and not included in this state.
      Returns:
      difference between the total number of items collected by the delta detect and successfully processed items, items processed with errors, and unprocessed items, i.e. getTotalItemsRequested() - getSuccessCount() - getErrorCount() - getUnprocessedCount(). If getTotalItemsRequested() is empty, then this method also returns an OptionalInt.empty()
    • getStartTime

      @NotNull public @NotNull Date getStartTime()
      Retrieves the outbound sync job start time
      Returns:
      time when the job started.
    • getEndTime

      public Date getEndTime()
      Retrieves the outbound sync job end time.
      Returns:
      time when the job finished, i.e. all changes are processed. This value may be null while the job is still running.
    • getCronJobStatus

      @NotNull public @NotNull CronJobStatus getCronJobStatus()
      Retrieves current status of the outbound sync job.
      Returns:
      current status of the job
    • getCronJobResult

      @NotNull public @NotNull CronJobResult getCronJobResult()
      Retrieves current result of the outbound sync job.
      Returns:
      current result of the job. The result is CronJobResult.UNKNOWN while the job is still running. Once the job is finished or aborted, the result becomes either CronJobResult.ERROR or CronJobResult.SUCCESS depending on whether errors are present or not, i.e. getErrorCount() > 0.
    • asPerformResult

      @NotNull public @NotNull PerformResult asPerformResult()
      Represents this state as PerformResult
      Returns:
      this state as PerformResult
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • isChangedFrom

      public boolean isChangedFrom(OutboundSyncState prevState)
      Determines whether the job state changed beyond just a count change.
      Parameters:
      prevState - a previous state to compare with
      Returns:
      true, if the job status, the job result or number of total items to process changed; false, if these states are identical or only already changed count got incremented.