Class Reference
IRIS for UNIX 2024.1.2
InterSystems: The power behind what matters   
Documentation  Search
  [USER] >  [%SYS] >  [Task] >  [Definition]
Private  Storage   

class %SYS.Task.Definition extends %RegisteredObject

This class 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.

Inventory

Parameters Properties Methods Queries Indices ForeignKeys Triggers
4 2 9


Summary

Properties
%RunDate %RunTime

Methods
%AddToSaveSet %ClassIsLatestVersion %ClassName %ConstructClone
%DispatchClassMethod %DispatchGetModified %DispatchGetProperty %DispatchMethod
%DispatchSetModified %DispatchSetMultidimProperty %DispatchSetProperty %Extends
%GetParameter %IsA %IsModified %New
%NormalizeObject %ObjectModified %OriginalNamespace %PackageName
%RemoveFromSaveSet %SerializeObject %SetModified %ValidateObject
CheckPermission GetCollectionType GetPropertyName GetSettings
GetTaskName OnSubmit OnTask SetSettings

Subclasses
%SYS.Task.BackupAllDatabases %SYS.Task.BackupCumulativeDatabaseList %SYS.Task.BackupFullDatabaseList
%SYS.Task.BackupIncrementDatabaseList %SYS.Task.CheckLogging %SYS.Task.CleanSourceJournal
%SYS.Task.DeepSeeBuild %SYS.Task.DeepSeeSynchronize %SYS.Task.DiagnosticReport
%SYS.Task.IntegrityCheck %SYS.Task.InventoryScan %SYS.Task.PurgeAudit
%SYS.Task.PurgeBackupLog %SYS.Task.PurgeErrorsAndLogs %SYS.Task.PurgeJournal
%SYS.Task.PurgeTaskHistory %SYS.Task.PurgeZENReports %SYS.Task.RunLegacyTask
%SYS.Task.SecurityScan %SYS.Task.ShadowPurge %SYS.Task.SwitchJournal
Ens.Util.Tasks.Purge Ens.Util.Tasks.PurgeActivityData Ens.Util.Tasks.PurgeMessageBank
Ens.Util.Tasks.UpdateSettingsReport

Parameters

• parameter DOMAIN = "%Utility";
Default Localization Domain
• parameter PROPERTYVALIDATION = 2;
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 RESOURCE;
This specifies a security resource and optional permission. Access to the resource will be required to create, modify or run a task of this type. The format is ":". If is ommited, "USE" is implied. Note that this parameter cannot be overridden using the COSEXPRESSION parameter type.
• parameter TaskName;
This defines the user-visible name of this task. It is defined in the subclasses.

Properties

• property %RunDate as %Date;
• property %RunTime as %Time;

Methods

• classmethod CheckPermission(taskClass As %String, namespace As %String, Output sc As %Status) as %Boolean
This method checks if the current process has the permission defined by the RESOURCE parameter for the given Task class. This will return 1 if the process has permission, or if no RESOURCE is defined. It will return 0 otherwise.
• 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 a serialized list of user-defined Property values for an instance of this Task as a $List. This serialized list is stored in %SYS.Task.Settings for the scheduled Task and used by the Task Manager to set the Properties before OnTask() is run.
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
Called by the Task Manager prior to running OnTask() to set all Property values.
The 'pState' value is the serialized list of Property values stored in the scheduled Task in %SYS.Task.Settings.


Copyright (c) 2025 by InterSystems Corporation. Cambridge, Massachusetts, U.S.A. All rights reserved. Confidential property of InterSystems Corporation.