Class BulkStatus

java.lang.Object
org.nuxeo.ecm.core.bulk.message.BulkStatus
All Implemented Interfaces:
Serializable, AsyncStatus<String>

public class BulkStatus extends Object implements AsyncStatus<String>
A message representing a command status or a change of status (delta).
Since:
10.2
See Also:
  • Field Details

    • MERGE_RESULT_FLAG

      protected static final String MERGE_RESULT_FLAG
      Since:
      2023
      See Also:
    • commandId

      protected String commandId
    • action

      @Nullable protected String action
    • username

      @Nullable protected String username
    • delta

      protected boolean delta
    • errorCount

      protected long errorCount
    • errorMessage

      @Nullable protected String errorMessage
    • errorCode

      @Nullable protected Integer errorCode
      Since:
      11.5
    • processed

      @Nullable protected Long processed
    • skipCount

      @Nullable protected Long skipCount
    • state

      @Nullable protected BulkStatus.State state
    • submitTime

      @Nullable protected Long submitTime
    • scrollStartTime

      @Nullable protected Long scrollStartTime
    • scrollEndTime

      @Nullable protected Long scrollEndTime
    • processingStartTime

      @Nullable protected Long processingStartTime
    • processingEndTime

      @Nullable protected Long processingEndTime
    • completedTime

      @Nullable protected Long completedTime
    • total

      @Nullable protected Long total
    • processingDurationMillis

      @Nullable protected Long processingDurationMillis
    • queryLimitReached

      protected boolean queryLimitReached
    • result

      @Nullable protected Map<String,Serializable> result
  • Constructor Details

    • BulkStatus

      protected BulkStatus()
    • BulkStatus

      public BulkStatus(@NotNull String commandId)
  • Method Details

    • deltaOf

      public static BulkStatus deltaOf(@NotNull String commandId)
      Creates a delta status for a command.
    • unknownOf

      public static BulkStatus unknownOf(@NotNull String commandId)
      Creates a delta status for a command.
    • merge

      public void merge(@NotNull BulkStatus update)
      Updates the status with the provided update.
      Since:
      10.3
    • checkForCompletedState

      protected void checkForCompletedState()
    • getId

      public String getId()
      Description copied from interface: AsyncStatus
      Gets the asynchronous task id.
      Specified by:
      getId in interface AsyncStatus<String>
    • setId

      public void setId(String id)
    • getState

      public BulkStatus.State getState()
      Gets the state of the command.
    • setState

      public void setState(BulkStatus.State state)
    • getSubmitTime

      public Instant getSubmitTime()
      Gets the time when the command was submitted to the Bulk service.
    • setSubmitTime

      public void setSubmitTime(@NotNull Instant submitTime)
    • getScrollStartTime

      public Instant getScrollStartTime()
      Gets the time when the scroll computation starts.
    • setScrollStartTime

      public void setScrollStartTime(@NotNull Instant scrollStartTime)
    • getScrollEndTime

      public Instant getScrollEndTime()
      Gets the time when the scrolling is completed.
    • setScrollEndTime

      public void setScrollEndTime(@NotNull Instant scrollEndTime)
    • getProcessingStartTime

      public Instant getProcessingStartTime()
      Gets the time when the action computation starts.
    • setProcessingStartTime

      public void setProcessingStartTime(@NotNull Instant processingStartTime)
    • getProcessingEndTime

      public Instant getProcessingEndTime()
      Gets the time when the last action computation has terminated.
    • setProcessingEndTime

      public void setProcessingEndTime(@NotNull Instant processingEndTime)
    • getCompletedTime

      public Instant getCompletedTime()
      Gets the time when the command has been detected as completed.
    • setCompletedTime

      public void setCompletedTime(@NotNull Instant completedTime)
    • isQueryLimitReached

      public boolean isQueryLimitReached()
      Returns true if the query used by the scroller has been limited.
      Since:
      11.4
    • setQueryLimitReached

      public void setQueryLimitReached(boolean queryLimitReached)
      Since:
      11.4
    • isCompleted

      public boolean isCompleted()
      Description copied from interface: AsyncStatus
      Returns true if command is completed.
      Specified by:
      isCompleted in interface AsyncStatus<String>
    • getProcessed

      public long getProcessed()
      For a full status returns the number of documents where the action has been applied so far.
    • setProcessed

      public void setProcessed(long processed)
      Sets number of processed documents. For a delta this is a relative value that is aggregated during merge(BulkStatus) operation.
    • getSkipCount

      public long getSkipCount()
      For a full status returns the number of documents where the action has been skipped so far.
      Since:
      2023
    • setSkipCount

      public void setSkipCount(long skipCount)
      Sets number of skipped documents. For a delta this is a relative value that is aggregated during merge(BulkStatus) operation.
      Since:
      2023
    • getTotal

      public long getTotal()
      Gets the total number of documents in the document set. Returns 0 when the scroll is not yet completed.
    • setTotal

      public void setTotal(long count)
      Sets the total number of documents in the document set
    • getResult

      public Map<String,Serializable> getResult()
      Gets unmodifiable action result.
      Returns:
      the action result
      Since:
      10.3
    • setResult

      public void setResult(Map<String,Serializable> result)
      Sets action result.
      Parameters:
      result - the action result
      Since:
      10.3
    • mergeResult

      public void mergeResult(Map<String,Serializable> result)
      Merge the given result map by doing a sum between old and new value extending Number for each common key.
      Since:
      2023
    • isDelta

      public boolean isDelta()
      This is an update of a status containing only partial information. For a delta the processing start and end time, and the processed count are also delta.
      Since:
      10.3
    • getAction

      public String getAction()
      Gets the action name of the command.
    • setAction

      public void setAction(String action)
    • getUsername

      public String getUsername()
      Gets the username of the user running the command.
    • setUsername

      public void setUsername(String username)
    • getProcessingDurationMillis

      public long getProcessingDurationMillis()
      Gets the accumulated processing time in milliseconds.
    • setProcessingDurationMillis

      public void setProcessingDurationMillis(long processingDurationMillis)
    • hasError

      public boolean hasError()
      Description copied from interface: AsyncStatus
      Checks if there is any error.
      Specified by:
      hasError in interface AsyncStatus<String>
      Returns:
      true if there is any error, false otherwise
    • getErrorMessage

      public String getErrorMessage()
      Returns the first error message if any or null.
      Specified by:
      getErrorMessage in interface AsyncStatus<String>
      Returns:
      the error message if any, null otherwise
    • getErrorCount

      public long getErrorCount()
      Returns the number of errors encountered
    • setErrorCount

      public void setErrorCount(long errorCount)
    • incrementSkipCount

      public void incrementSkipCount()
    • inError

      public void inError(String message)
      An error occurred during the processing
    • inError

      public void inError(long count, String message)
      An error occurred during the processing
    • inError

      public void inError(String message, int code)
      An error occurred during the processing
      Since:
      11.5
    • inError

      public void inError(long count, String message, int code)
      An error occurred during the processing
    • hashCode

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

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

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

      public int getErrorCode()
      Description copied from interface: AsyncStatus
      Gets the error code if any.
      Specified by:
      getErrorCode in interface AsyncStatus<String>
      Returns:
      the error code if any, 0 otherwise