Tracks progress for a single JsProcessable task and, once marked complete, invokes the app's callback function if one was registered on the task. An instance is created by JsProcessable and installed as its status tracker, so calling setComplete with true, typically done by the async processor when the task finishes running, resolves the current organisation or website branch root folder, runs as the invoking user where one is set, and invokes the callback function through the app's controller mapping cache.
Extends: StatusInfo
Inherited from StatusInfo
Properties
| Property | Returns | Description |
|---|---|---|
| cancelled | boolean | Whether the job has been cancelled. |
| cancelledDate | Date | The date and time the job was cancelled. |
| complete | boolean | Whether the job has been marked as complete by the async processing framework. |
| completedDate | Date | The date and time the job was marked complete. |
| createdDate | Date | The date and time the job was created. Defaults to the time this status info was constructed. |
| stateData | String | Custom job state data, as a string, that the job has published for display or for JS job functions to read. |
Methods
isComplete() · setComplete(boolean b) · setCancelled(boolean b) · isCancelled() · getCompletedDate() · setCreatedDate(Date createdDate) · getCreatedDate() · getCancelledDate() · getStateData() · job()
isComplete()
Returns: boolean
Whether the job has been marked as complete by the async processing framework.
setComplete(boolean b)
Returns: void
Marks the job as complete or not, and records the current time as the completed date. Called by the async processor when the job finishes.
| Parameter | Description |
|---|---|
b | true to mark the job complete, false to clear the complete flag |
setCancelled(boolean b)
Returns: void
Marks the job as cancelled or not, and records the current time as the cancelled date.
| Parameter | Description |
|---|---|
b | true to mark the job cancelled, false to clear the cancelled flag |
isCancelled()
Returns: boolean
Whether the job has been cancelled.
getCompletedDate()
Returns: Date
The date and time the job was marked complete.
setCreatedDate(Date createdDate)
Returns: void
Sets the date and time the job was created.
| Parameter | Description |
|---|---|
createdDate | the created date to record |
getCreatedDate()
Returns: Date
The date and time the job was created. Defaults to the time this status info was constructed.
getCancelledDate()
Returns: Date
The date and time the job was cancelled.
getStateData()
Returns: String
Custom job state data, as a string, that the job has published for display or for JS job functions to read.
job()
Returns: AsyncJob
The underlying async job this status info was built from.
Methods
setStateData(String stateData)
Returns: void
Records the current state data for this task, delegating to the base implementation.
| Parameter | Description |
|---|---|
stateData | the state data to record |
setComplete(boolean complete)
Returns: void
Marks the task as complete or not, and, when marking it complete and a callback function has been registered on the owning JsProcessable, invokes that callback through the app's controller mapping cache. Errors raised while invoking the callback are logged rather than thrown.
| Parameter | Description |
|---|---|
complete | true to mark the task complete and trigger its callback, false to mark it incomplete |