Class ecm.model.AsyncTask


Extends ecm.model._ModelObject.
Represents an asynchronous task from ECM TaskManager. An asynchronous task is any type of long running process that once started will report its completion at a later time without needing the user to wait for it to finish. This is intended for any actions that may tie up a graphical user interface for an extended period of time. Once an asynchronous task is started, users can view that it's running and can come back at a later time to view its completion or whether it has failed.

For an asynchronous task, it will also have an ecm.model.AsyncTaskType which represents a type of the current task. An AsyncTask can also be recurring and if it does, it will have multiple ecm.model.AsyncTaskInstace which represents each run as it repeats.

This model object shouldn't be created by hand. It is created from calling functions inside ecm.model.TaskManager to be placed inside of a ecm.widget.listView.ContentList.


Defined in: <ecm\model\AsyncTask.js>.

Constructor Summary

Constructor Attributes Constructor Name and Description
 

Field Summary

Field Attributes Field Name and Description
 
The set of attributes for this task
 
audits 
A result set of ecm.model.AsyncTaskAudit items associated with this task.
 
errors 
The errors associated with the task if they exist.
 
A boolean that indicates whether this task is a recurring task.
 
mode 
The mode for this task.
 
parent 
The parent of the task
 
The instances for recurring tasks.
 
The results for this task when the task completes.
 
The result set that the task came from if applicable
 
All the request information used to schedule this task
Fields borrowed from class ecm.model._ModelObject:
categorization, id, name, nameFilter, pane, status, type, userId

Method Summary

Method Attributes Method Name and Description
 
Deletes all error records associated with this async task if they exist.
 
deleteTask(callback)
Deletes the task permanently from the ECM TaskManager.
 
Returns the ecm.model.AsyncTaskType object associated with this task.
 
getAttributeType(attribute)
Returns the type of the attribute.
 
getDetails(onComplete, forcedRefresh, skipOnChange)
Obtains the details for this task.
 
getDisplayValue(attribute)
Returns the attribute value in a format that can be displayed in the user interface.
 
If this task was obtained in a result set that contained a parent category, it will return an array of the path to this task.
 
getResults(callback)
Returns the results associated with this task if they exist.
 
getUserInfo(propertyName)
Returns the user information for this task.
 
hasPrivilege(privilege)
Returns true if this item has the specified privilege.
 
Returns whether this task is a recurring task.
 
onChange(modelObject)
The onChange event that is invoked when a change occurs on this task.
 
pause(callback)
Pauses the current task.
 
Refreshes the current task by fetching all of its details again.
<static>  
ecm.model.AsyncTask.registerFactory(factory)
Static function that registers a factory for sub-classes of AsyncTask.
 
reschedule(callback, taskRequest)
Reschedules the task with the new task request information.
 
resume(callback)
Resumes the current task.
 
retrieveAsyncTaskInstances(callback, forcedRefresh)
Retrieves all async task instances for this task.
 
retrieveAudits(filterParameters, callback, forcedRefresh)
Retrieves a result set of ecm.model.AsyncTaskAudit items associated with this task.
 
update(item)
Updates an item with the provided new item's properties and attributes
Methods borrowed from class ecm.model._ModelObject:
destroy, own, toString

Constructor Detail

ecm.model.AsyncTask()

Since:
2.0.2

Field Detail

attributes

The set of attributes for this task

audits

A result set of ecm.model.AsyncTaskAudit items associated with this task. It will be available once retrieveAudits() is called.
Since:
2.0.3

errors

The errors associated with the task if they exist. It will be available once getDetails() is called. Otherwise it is always null.

isRecurring

A boolean that indicates whether this task is a recurring task. A task is recurring if the mode is FixedIntervalSchedule or CalendarSchedule.
Since:
2.0.3

mode

The mode for this task. It can be
Since:
2.0.3

parent

The parent of the task

recurringTaskInstances

The instances for recurring tasks. This is only available for recurring tasks and only available once retrieveAsyncTaskInstances() is called.

results

The results for this task when the task completes. The results for this task is a json object set by the task writer in the task's information. It will depend on each task whether it will be available. This variable will be populated once getDetails() is called. Otherwise it is always null.

resultSet

The result set that the task came from if applicable

taskRequest

All the request information used to schedule this task

Method Detail

deleteErrors()

Deletes all error records associated with this async task if they exist.
Since:
2.0.3

deleteTask(callback)

Deletes the task permanently from the ECM TaskManager.
Parameters:
callback
The callback function that will be invoked when delete completes.

getAsyncTaskType()

Returns the ecm.model.AsyncTaskType object associated with this task.
Since:
2.0.3

{string} getAttributeType(attribute)

Returns the type of the attribute.
Parameters:
attribute
The attribute name
Returns:
{string} The type of the attribute

getDetails(onComplete, forcedRefresh, skipOnChange)

Obtains the details for this task. It will grab additional attributes for this task such as errors and etc.
Parameters:
onComplete
A callback when the details for this task has been retrieved.
forcedRefresh
A boolean that indicates whether to force a refresh and always grab go back to the server to obtain the details
skipOnChange
A boolean that indicates whether to skip on throwing the onChange event.

getDisplayValue(attribute)

Returns the attribute value in a format that can be displayed in the user interface.
Parameters:
attribute
The name of the attribute.

getPath()

If this task was obtained in a result set that contained a parent category, it will return an array of the path to this task. If not, it will return with an empty array.

getResults(callback)

Returns the results associated with this task if they exist. The results is just a json array stored along with the task's information.
Parameters:
callback
The callback function that will be invoked once results are obtained.

getUserInfo(propertyName)

Returns the user information for this task.
Parameters:
propertyName
Since:
2.0.3

hasPrivilege(privilege)

Returns true if this item has the specified privilege. It will always return true.
Parameters:
privilege
The name of the privilege.

isTaskRecurring()

Returns whether this task is a recurring task.

onChange(modelObject)

The onChange event that is invoked when a change occurs on this task.
Parameters:
modelObject

pause(callback)

Pauses the current task. Once paused, the status of the task will be changed to paused. This paused command will also be sent to the asynchronous task for it to pause its current state. For a recurring task, pausing the current instance will cause the entire task to not execute until resume() is called.
Parameters:
callback
The callback function to be invoked when pause completes.

refresh()

Refreshes the current task by fetching all of its details again.

<static> ecm.model.AsyncTask.registerFactory(factory)

Static function that registers a factory for sub-classes of AsyncTask.
Parameters:
factory
A factory object with createFromJSON() method to possibly create a sub-class of AsyncTask from JSON. The factory method should return null when the given JSON is not one for known sub-classes, giving chances for other factories to create one or falling back to the default AsyncTask construction.

reschedule(callback, taskRequest)

Reschedules the task with the new task request information. Users can modify the taskRequest attribute associated with this task and reschedule with this new information. The name of the task and the schedule information can not be changed in a reschedule.
Parameters:
callback
The callback function that will be invoked when rescheduling completes.
taskRequest
The new task request information that will be passed into the task when rescheduling.

resume(callback)

Resumes the current task. Once resumed, the task will be rescheduled with its original schedule. The resume command will also be sent to the asynchronous task for it to resume from its current state.
Parameters:
callback
The callback function to be invoked when resume completes.
Since:
2.0.3

retrieveAsyncTaskInstances(callback, forcedRefresh)

Retrieves all async task instances for this task. This only applies for recurring tasks.
Parameters:
callback
a callback when all the async task instances have been retrieved.
forcedRefresh
refresh and go to the server to obtain all the async task instances again.

retrieveAudits(filterParameters, callback, forcedRefresh)

Retrieves a result set of ecm.model.AsyncTaskAudit items associated with this task. This result set can be placed into a ecm.widget.listView.ContentList for displaying purposes.

Users can filter the amount of audits return with the following filter parameters:

Parameters:
filterParameters
Parameters that can filter the amount of audits returned.
callback
The callback function that will be called when the result set of audits have returned.
forcedRefresh
Boolean to force a refresh and not to return with the cached set of audits.
Since:
2.0.3

update(item)

Updates an item with the provided new item's properties and attributes
Parameters:
item