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 class
BulkStatus.State
Possible states of a bulk command:
-
Field Summary
Fields Modifier and Type Field Description protected String
action
protected String
commandId
protected Long
completedTime
protected boolean
delta
protected Integer
errorCode
protected long
errorCount
protected String
errorMessage
protected static String
MERGE_RESULT_FLAG
protected Long
processed
protected Long
processingDurationMillis
protected Long
processingEndTime
protected Long
processingStartTime
protected boolean
queryLimitReached
protected Map<String,Serializable>
result
protected Long
scrollEndTime
protected Long
scrollStartTime
protected Long
skipCount
protected BulkStatus.State
state
protected Long
submitTime
protected Long
total
protected String
username
-
Constructor Summary
Constructors Modifier Constructor Description protected
BulkStatus()
BulkStatus(String commandId)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
checkForCompletedState()
static BulkStatus
deltaOf(String commandId)
Creates a delta status for a command.boolean
equals(Object o)
String
getAction()
Gets the action name of the command.Instant
getCompletedTime()
Gets the time when the command has been detected as completed.int
getErrorCode()
Gets the error code if any.long
getErrorCount()
Returns the number of errors encounteredString
getErrorMessage()
Returns the first error message if any or null.String
getId()
Gets the asynchronous task id.long
getProcessed()
For a full status returns the number of documents where the action has been applied so far.long
getProcessingDurationMillis()
Gets the accumulated processing time in milliseconds.Instant
getProcessingEndTime()
Gets the time when the last action computation has terminated.Instant
getProcessingStartTime()
Gets the time when the action computation starts.Map<String,Serializable>
getResult()
Gets unmodifiable action result.Instant
getScrollEndTime()
Gets the time when the scrolling is completed.Instant
getScrollStartTime()
Gets the time when the scroll computation starts.long
getSkipCount()
For a full status returns the number of documents where the action has been skipped so far.BulkStatus.State
getState()
Gets the state of the command.Instant
getSubmitTime()
Gets the time when the command was submitted to the Bulk service.long
getTotal()
Gets the total number of documents in the document set.String
getUsername()
Gets the username of the user running the command.boolean
hasError()
Checks if there is any error.int
hashCode()
void
incrementSkipCount()
void
inError(long count, String message)
An error occurred during the processingvoid
inError(long count, String message, int code)
An error occurred during the processingvoid
inError(String message)
An error occurred during the processingvoid
inError(String message, int code)
An error occurred during the processingboolean
isCompleted()
Returns true if command is completed.boolean
isDelta()
This is an update of a status containing only partial information.boolean
isQueryLimitReached()
Returns true if the query used by the scroller has been limited.void
merge(BulkStatus update)
Updates the status with the provided update.void
mergeResult(Map<String,Serializable> result)
Merge the given result map by doing a sum between old and new value extendingNumber
for each common key.void
setAction(String action)
void
setCompletedTime(Instant completedTime)
void
setErrorCount(long errorCount)
void
setId(String id)
void
setProcessed(long processed)
Sets number of processed documents.void
setProcessingDurationMillis(long processingDurationMillis)
void
setProcessingEndTime(Instant processingEndTime)
void
setProcessingStartTime(Instant processingStartTime)
void
setQueryLimitReached(boolean queryLimitReached)
void
setResult(Map<String,Serializable> result)
Sets action result.void
setScrollEndTime(Instant scrollEndTime)
void
setScrollStartTime(Instant scrollStartTime)
void
setSkipCount(long skipCount)
Sets number of skipped documents.void
setState(BulkStatus.State state)
void
setSubmitTime(Instant submitTime)
void
setTotal(long count)
Sets the total number of documents in the document setvoid
setUsername(String username)
String
toString()
static BulkStatus
unknownOf(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:AsyncStatus
Gets the asynchronous task id.- Specified by:
getId
in 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:AsyncStatus
Returns true if command is completed.- Specified by:
isCompleted
in 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 extendingNumber
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 interfaceAsyncStatus<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 interfaceAsyncStatus<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
-
getErrorCode
public int getErrorCode()
Description copied from interface:AsyncStatus
Gets the error code if any.- Specified by:
getErrorCode
in interfaceAsyncStatus<String>
- Returns:
- the error code if any,
0
otherwise
-
-