Package org.nuxeo.ecm.core.bulk.message
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:
 - Serialized Form
 
 
- 
- 
Nested Class Summary
Nested Classes Modifier and Type Class Description static classBulkStatus.StatePossible states of a bulk command: 
- 
Field Summary
Fields Modifier and Type Field Description protected Stringactionprotected StringcommandIdprotected LongcompletedTimeprotected booleandeltaprotected IntegererrorCodeprotected longerrorCountprotected StringerrorMessageprotected static StringMERGE_RESULT_FLAGprotected Longprocessedprotected LongprocessingDurationMillisprotected LongprocessingEndTimeprotected LongprocessingStartTimeprotected booleanqueryLimitReachedprotected Map<String,Serializable>resultprotected LongscrollEndTimeprotected LongscrollStartTimeprotected LongskipCountprotected BulkStatus.Statestateprotected LongsubmitTimeprotected Longtotalprotected Stringusername 
- 
Constructor Summary
Constructors Modifier Constructor Description protectedBulkStatus()BulkStatus(String commandId) 
- 
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcheckForCompletedState()static BulkStatusdeltaOf(String commandId)Creates a delta status for a command.booleanequals(Object o)StringgetAction()Gets the action name of the command.InstantgetCompletedTime()Gets the time when the command has been detected as completed.intgetErrorCode()Gets the error code if any.longgetErrorCount()Returns the number of errors encounteredStringgetErrorMessage()Returns the first error message if any or null.StringgetId()Gets the asynchronous task id.longgetProcessed()For a full status returns the number of documents where the action has been applied so far.longgetProcessingDurationMillis()Gets the accumulated processing time in milliseconds.InstantgetProcessingEndTime()Gets the time when the last action computation has terminated.InstantgetProcessingStartTime()Gets the time when the action computation starts.Map<String,Serializable>getResult()Gets unmodifiable action result.InstantgetScrollEndTime()Gets the time when the scrolling is completed.InstantgetScrollStartTime()Gets the time when the scroll computation starts.longgetSkipCount()For a full status returns the number of documents where the action has been skipped so far.BulkStatus.StategetState()Gets the state of the command.InstantgetSubmitTime()Gets the time when the command was submitted to the Bulk service.longgetTotal()Gets the total number of documents in the document set.StringgetUsername()Gets the username of the user running the command.booleanhasError()Checks if there is any error.inthashCode()voidincrementSkipCount()voidinError(long count, String message)An error occurred during the processingvoidinError(long count, String message, int code)An error occurred during the processingvoidinError(String message)An error occurred during the processingvoidinError(String message, int code)An error occurred during the processingbooleanisCompleted()Returns true if command is completed.booleanisDelta()This is an update of a status containing only partial information.booleanisQueryLimitReached()Returns true if the query used by the scroller has been limited.voidmerge(BulkStatus update)Updates the status with the provided update.voidmergeResult(Map<String,Serializable> result)Merge the given result map by doing a sum between old and new value extendingNumberfor each common key.voidsetAction(String action)voidsetCompletedTime(Instant completedTime)voidsetErrorCount(long errorCount)voidsetId(String id)voidsetProcessed(long processed)Sets number of processed documents.voidsetProcessingDurationMillis(long processingDurationMillis)voidsetProcessingEndTime(Instant processingEndTime)voidsetProcessingStartTime(Instant processingStartTime)voidsetQueryLimitReached(boolean queryLimitReached)voidsetResult(Map<String,Serializable> result)Sets action result.voidsetScrollEndTime(Instant scrollEndTime)voidsetScrollStartTime(Instant scrollStartTime)voidsetSkipCount(long skipCount)Sets number of skipped documents.voidsetState(BulkStatus.State state)voidsetSubmitTime(Instant submitTime)voidsetTotal(long count)Sets the total number of documents in the document setvoidsetUsername(String username)StringtoString()static BulkStatusunknownOf(String commandId)Creates a delta status for a command. 
 - 
 
- 
- 
Field Detail
- 
MERGE_RESULT_FLAG
protected static final String MERGE_RESULT_FLAG
- Since:
 - 2023
 - See Also:
 - Constant Field Values
 
 
- 
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 Detail
- 
BulkStatus
protected BulkStatus()
 
- 
BulkStatus
public BulkStatus(@NotNull String commandId) 
 - 
 
- 
Method Detail
- 
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:AsyncStatusGets the asynchronous task id.- Specified by:
 getIdin interfaceAsyncStatus<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:AsyncStatusReturns true if command is completed.- Specified by:
 isCompletedin interfaceAsyncStatus<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 duringmerge(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 duringmerge(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 extendingNumberfor 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:AsyncStatusChecks if there is any error.- Specified by:
 hasErrorin interfaceAsyncStatus<String>- Returns:
 trueif there is any error,falseotherwise
 
- 
getErrorMessage
public String getErrorMessage()
Returns the first error message if any or null.- Specified by:
 getErrorMessagein interfaceAsyncStatus<String>- Returns:
 - the error message if any, 
nullotherwise 
 
- 
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 
- 
getErrorCode
public int getErrorCode()
Description copied from interface:AsyncStatusGets the error code if any.- Specified by:
 getErrorCodein interfaceAsyncStatus<String>- Returns:
 - the error code if any, 
0otherwise 
 
 - 
 
 -