Class OutboundSyncState
- java.lang.Object
-
- de.hybris.platform.outboundsync.job.impl.OutboundSyncState
-
@Immutable public final class OutboundSyncState extends java.lang.ObjectRepresents state of a single outbound sync cron job run.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classOutboundSyncState.BuilderA builder for creating immutableOutboundSyncState
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description @NotNull PerformResultasPerformResult()Represents this state asPerformResultbooleanequals(java.lang.Object o)@NotNull CronJobResultgetCronJobResult()Retrieves current result of the outbound sync job.@NotNull CronJobStatusgetCronJobStatus()Retrieves current status of the outbound sync job.java.util.DategetEndTime()Retrieves the outbound sync job end time.intgetErrorCount()Retrieves number of changes reported by the delta detect that failed to synchronize.@NotNull java.util.DategetStartTime()Retrieves the outbound sync job start timeintgetSuccessCount()Retrieves number of changes reported by the delta detect that synchronized successfully.@NotNull java.util.OptionalIntgetTotalItemsRequested()Retrieves total number of changes to by synchronized to an external system.intgetUnprocessedCount()Retrieves number of changes, reported by the delta detect, ignored after the job was aborted.inthashCode()booleanisAllItemsProcessed()Determines whether all changes detected by the outbound sync job have been processed or not.booleanisChangedFrom(OutboundSyncState prevState)Determines whether the job state changed beyond just a count change.java.lang.StringtoString()
-
-
-
Method Detail
-
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.
-
getTotalItemsRequested
@NotNull public @NotNull java.util.OptionalInt getTotalItemsRequested()
Retrieves total number of changes to by synchronized to an external system.- Returns:
Optionalcontaining total number of changes, or an emptyOptional, 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.
-
getStartTime
@NotNull public @NotNull java.util.Date getStartTime()
Retrieves the outbound sync job start time- Returns:
- time when the job started.
-
getEndTime
public java.util.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
nullwhile 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.UNKNOWNwhile the job is still running. Once the job is finished or aborted, the result becomes eitherCronJobResult.ERRORorCronJobResult.SUCCESSdepending on whether errors are present or not, i.e.getErrorCount() > 0.
-
asPerformResult
@NotNull public @NotNull PerformResult asPerformResult()
Represents this state asPerformResult- Returns:
- this state as
PerformResult
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.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.
-
-