public abstract class AbstractBatchProgressMonitor extends Object implements IBatchProgressMonitorExt
| Modifier and Type | Field and Description |
|---|---|
protected List<AbstractBatchProgressMonitor> |
currentChildren |
protected Object |
currentItem
Current item being processed
|
protected boolean |
done |
protected Long |
endTime |
protected String |
executionId |
protected long |
itemCount |
protected AbstractBatchProgressMonitor |
parent |
protected List<String> |
rejectedItems |
protected long |
startTime |
protected List<String> |
successItems |
protected String |
taskName
Name of the task, set with beginTask
Init to null : cannot be set multiple times. beginTask will fail if
taskName is not null.
|
protected int |
totalWork |
protected int |
worked |
UNKNOW| Modifier | Constructor and Description |
|---|---|
|
AbstractBatchProgressMonitor(String executionId,
IBatch batch)
Constructor used for main monitor.
|
protected |
AbstractBatchProgressMonitor(String executionId,
IBatchProgressMonitor parent,
int parentWork,
IBatch batch)
Protected constructor used to create a sub task.
|
| Modifier and Type | Method and Description |
|---|---|
void |
beginTask(String name,
String description,
int totalWork)
Begin a task execution.
|
IBatchProgressMonitor |
createSubTask(int work)
Create a sub task of this task with the amount of work the subtask
execution will done.
|
void |
done()
Set the task is done.
|
protected void |
endBatch(boolean success) |
protected void |
endTask(boolean success) |
void |
fail(String reason)
Report global failure.
|
void |
fail(String reason,
Throwable t)
Report global failure.
|
IBatch |
getBatch() |
Object |
getCurrentItem() |
protected Date |
getEndDate()
Returns end date is the task is finished, or an estimate if task is still
running.
|
long |
getItemCount() |
String |
getLastMessage() |
Date |
getLastUpdate() |
protected org.slf4j.Logger |
getLogger() |
protected AbstractBatchProgressMonitor |
getMainMonitor()
Get the top parent.
|
protected int |
getParentWork() |
float |
getProgress()
Get current progress.
|
List<String> |
getRejectedItems()
Get the list of rejected items.
|
protected Date |
getStartDate() |
String |
getTaskDescription() |
String |
getTaskGroup() |
String |
getTaskName() |
int |
getTotalWork()
Retrieve the total amount of work for this task.
|
long |
getWritingDelay() |
boolean |
isCancelRequested()
Returns true if cancel has been requested for the current job, usually
from a control UI.
|
boolean |
isDone() |
boolean |
isSuccess() |
void |
message(String message)
Send a message during the task execution.
|
protected abstract IBatchProgressMonitor |
newInstance(int work) |
protected void |
onBatchEnd() |
void |
reject(String[] itemIds,
String reason)
Reject a set of items during the task processing.
|
void |
reject(String[] itemIds,
String reason,
Throwable e)
Reject a set of items during the task processing.
|
void |
reject(String itemId,
String reason)
Reject one item during the task processing.
|
void |
reject(String itemId,
String reason,
Throwable e)
* Reject one item during the task processing.
|
void |
setCurrentItem(Object item)
Set the current item which is being processed.
|
void |
setLogger(org.slf4j.Logger loggerParam)
Set the logger to use for the current batch.
|
void |
setTotalWork(int totalWork) |
void |
setWritingDelay(long writingDelay)
Set the writing delay.
|
protected void |
touch()
Updated 'lastUpdate' value.
|
void |
worked(int work)
Notify the processing of items.
|
protected List<AbstractBatchProgressMonitor> currentChildren
protected Object currentItem
protected boolean done
protected Long endTime
protected final String executionId
protected long itemCount
protected AbstractBatchProgressMonitor parent
protected long startTime
protected String taskName
Init to null : cannot be set multiple times. beginTask will fail if taskName is not null.
protected int totalWork
protected int worked
public AbstractBatchProgressMonitor(String executionId, IBatch batch)
executionId - job execution idprotected AbstractBatchProgressMonitor(String executionId, IBatchProgressMonitor parent, int parentWork, IBatch batch)
executionId - execution idparent - parent monitorparentWork - parent amount of workpublic void beginTask(String name, String description, int totalWork)
beginTask in interface IBatchProgressMonitorname - task namedescription - task descriptiontotalWork - task amount of work to be donepublic IBatchProgressMonitor createSubTask(int work)
createSubTask in interface IBatchProgressMonitorwork - work units of the task done by the subtaskpublic void done()
done in interface IBatchProgressMonitorprotected void endBatch(boolean success)
protected void endTask(boolean success)
public void fail(String reason)
IBatchProgressMonitorUse this when the batch has issued a major error and cannot continue.
fail in interface IBatchProgressMonitorpublic void fail(String reason, Throwable t)
IBatchProgressMonitorUse this when the batch has issued a major error and cannot continue.
fail in interface IBatchProgressMonitort - Exception which caused the failure.public IBatch getBatch()
public Object getCurrentItem()
protected Date getEndDate()
public long getItemCount()
getItemCount in interface IBatchProgressMonitorExtpublic String getLastMessage()
getLastMessage in interface IBatchProgressMonitorExtpublic Date getLastUpdate()
getLastUpdate in interface IBatchProgressMonitorprotected org.slf4j.Logger getLogger()
protected AbstractBatchProgressMonitor getMainMonitor()
protected int getParentWork()
public float getProgress()
IBatchProgressMonitorExtgetProgress in interface IBatchProgressMonitorExtpublic List<String> getRejectedItems()
protected Date getStartDate()
public String getTaskDescription()
public String getTaskGroup()
public String getTaskName()
public int getTotalWork()
getTotalWork in interface IBatchProgressMonitorgetTotalWork in interface IBatchProgressMonitorExtpublic long getWritingDelay()
public boolean isCancelRequested()
IBatchProgressMonitorisCancelRequested in interface IBatchProgressMonitorpublic boolean isDone()
public boolean isSuccess()
public void message(String message)
message in interface IBatchProgressMonitormessage - messageprotected abstract IBatchProgressMonitor newInstance(int work)
protected void onBatchEnd()
public void reject(String itemId, String reason)
Use this when :
reject in interface IBatchProgressMonitoritemId - rejected item idreason - the reasonIBatchProgressMonitor#reject(String, String, Throwable) can be used
to provide the exception which has caused the failure.public void reject(String itemId, String reason, Throwable e)
reject in interface IBatchProgressMonitore - ExceptionIBatchProgressMonitor.reject(String, String)public void reject(String[] itemIds, String reason)
reject in interface IBatchProgressMonitoritemIds - Array of item ids rejectedreason - the reasonIBatchProgressMonitor.reject(String, String)public void reject(String[] itemIds, String reason, Throwable e)
reject in interface IBatchProgressMonitore - ExceptionIBatchProgressMonitor.reject(String, String)public void setCurrentItem(Object item)
setCurrentItem in interface IBatchProgressMonitoritem - current processed itempublic void setLogger(org.slf4j.Logger loggerParam)
IBatchProgressMonitorsetLogger in interface IBatchProgressMonitorpublic void setTotalWork(int totalWork)
public void setWritingDelay(long writingDelay)
writingDelay - writing delayprotected void touch()
public void worked(int work)
worked in interface IBatchProgressMonitorwork - items processedCopyright © 2010–2016. All rights reserved.