Skip to main content

%SYS.Task.Definition

class %SYS.Task.Definition extends %Library.RegisteredObject

This classes defines a task that can be executed by the Task Manager. To create a new task, create a subclass and override the OnTask method.
All public properties whose name does not start with a "%" are treated as user-configurable "settings" for this task.

Property Inventory

Method Inventory

Parameters

parameter DOMAIN = %Utility;
Default Localization Domain
parameter PROPERTYVALIDATION = 2;
Inherited description: This parameter controls the default validation behavior for the object.

It can take one of the following values:

0: NoValidate Perform no automatic property validation.
1: ValidateOnSet Perform validation (call the property's ..IsValid method) every time an attribute value is set.
2: ValidateOnSave Perform property validation (in the %ValidateObject() method)) when the object is saved. This is only applicable to persistent objects.

Note: The use of ValidateOnSet is not recommended-it can cause excessive communication between client and server in distributed applications. It is provided for compatability with previous versions.

parameter TaskName;
This defines the user-visible name of this task; This is defined in subclasses.

Properties

property %RunDate as %Date;
Property methods: %RunDateDisplayToLogical(), %RunDateGet(), %RunDateIsValid(), %RunDateLogicalToDisplay(), %RunDateLogicalToOdbc(), %RunDateNormalize(), %RunDateOdbcToLogical(), %RunDateSet()
property %RunTime as %Time;
Property methods: %RunTimeDisplayToLogical(), %RunTimeGet(), %RunTimeIsValid(), %RunTimeLogicalToDisplay(), %RunTimeLogicalToOdbc(), %RunTimeNormalize(), %RunTimeOdbcToLogical(), %RunTimeSet()

Methods

final classmethod GetCollectionType(propertyName As %String, ByRef tCollection As %String) as %String
Return a collection type for a property, by passing reference tCollection we can get all properties which are collections
final classmethod GetPropertyName(propertyName As %String) as %String
final method GetSettings() as %List
Return the serialized set of settings for this Task as a $List. This serialized value is used by the Task Manager to store settings for this task.
The serialized state is of the form:
$LB(name,val,name,val)
final classmethod GetTaskName() as %String
Returns the localized name of this task.
final method OnSubmit(ByRef pID As %String, pSubmit As %String) as %Status
This callback is called when this form is submitted. pID is the ID value associated with the form. The default implementation will perform a Save if the AutoForm is a persistent object.
pSubmit is the name of the submit button (i.e., $AUTOFORM_SAVE).
method OnTask() as %Status
This method is responsible for executing the task.
At the scheduled time, the Task Manager creates an instance of this object, sets any property values using the stored "settings" for the task, and then invokes this method to execute the task.
In order to execute a real task, override this method in a subclass.
final method SetSettings(pState As %List) as %Status

Inherited Members

Inherited Methods

Subclasses

FeedbackOpens in a new tab