Difference between revisions of "CatTaskScheduleHelper class"

From Catglobe Wiki
Jump to: navigation, search
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 +
{{CGscriptClass_Template
 +
|Name=<nowiki>CatTaskScheduleHelper</nowiki>
 +
|Description=<nowiki>Helper class for scheduling CatTasks</nowiki>
 +
|InheritsFrom=object|Constructors=
 +
{{CGscriptConstructors_Template|Description=<nowiki>Instanciate helper</nowiki>}}
 +
|Methods=
 +
{{CGscriptMethods_Template|ReturnType=CatTaskSchedule|Name=<nowiki>GetScheduleByInstanceId</nowiki>|Parameters=
 +
{{CGscriptParameters_Template|Type=int|Name=<nowiki>instanceId</nowiki>|Description=<nowiki>Id of an instance of a task</nowiki>}}
 +
|Description=<nowiki>From an instance, find the task and find its schedule</nowiki>}}
 +
{{CGscriptMethods_Template|ReturnType=CatTaskSchedule|Name=<nowiki>GetScheduleByMetaDataId</nowiki>|Parameters=
 +
{{CGscriptParameters_Template|Type=int|Name=<nowiki>taskId</nowiki>|Description=<nowiki>Id of a task</nowiki>}}
 +
|Description=<nowiki>From a task, find its schedule</nowiki>}}
 +
{{CGscriptMethods_Template|ReturnType=CatTaskStatus|Name=<nowiki>GetTaskStatusByInstanceId</nowiki>|Parameters=
 +
{{CGscriptParameters_Template|Type=int|Name=<nowiki>instanceId</nowiki>|Description=<nowiki>Id of an instance of a task</nowiki>}}
 +
|Description=<nowiki>From an instance, get the execution status</nowiki>}}
 +
{{CGscriptMethods_Template|ReturnType=Empty|Name=<nowiki>RescheduleByInstanceId</nowiki>|Parameters=
 +
{{CGscriptParameters_Template|Type=int|Name=<nowiki>instanceId</nowiki>|Description=<nowiki>Id of an instance of a task</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=CatTaskSchedule|Name=<nowiki>schedule</nowiki>|Description=<nowiki>The new schedule to use</nowiki>}}
 +
|Description=<nowiki>From an instance, find the task and alter its schedule</nowiki>}}
 +
{{CGscriptMethods_Template|ReturnType=Empty|Name=<nowiki>RescheduleByMetaDataId</nowiki>|Parameters=
 +
{{CGscriptParameters_Template|Type=int|Name=<nowiki>taskId</nowiki>|Description=<nowiki>Id of a task</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=CatTaskSchedule|Name=<nowiki>schedule</nowiki>|Description=<nowiki>The new schedule to use</nowiki>}}
 +
|Description=<nowiki>From a task, alter its schedule</nowiki>}}
 +
{{CGscriptMethods_Template|ReturnType=string|Name=<nowiki>ToString</nowiki>|Inherited=object|Description=<nowiki>The string representation of the object.</nowiki>}}
 +
|Properties=
 +
{{CGscriptProperties_Template|ReturnType=string|Name=<nowiki>ObjectTypeName</nowiki>|HasGetter=1|Description=<nowiki>The name of the type of object.</nowiki>}}
 +
{{CGscriptProperties_Template|ReturnType=TypeInformation|Name=<nowiki>TypeInformation</nowiki>|HasGetter=1|Inherited=object|Description=<nowiki>Get information about this class.</nowiki>}}
 +
}}
  
Helper class for scheduling CatTasks
 
  
Constructors
+
=== <span style="color:#DF8621">'''Examples'''</span> ===
 +
<source lang="javascript">
 +
//RescheduleByMetaDataId
 +
CatTaskScheduleHelper csHelper = new CatTaskScheduleHelper();
 +
number taskId = 54183;
 +
CatTaskNeverSchedule schedule = new CatTaskNeverSchedule();
 +
csHelper.RescheduleByMetaDataId(taskId, schedule);
 +
</source>
 +
<source lang="javascript">
 +
//GetScheduleByInstanceId
 +
WorkflowScript wf = new WorkflowScript(15874008);
 +
CatTaskSpecificTimeSchedule schedule  = new CatTaskSpecificTimeSchedule(new DateTime());
 +
number cattaskInstaceId = wf.Schedule(schedule, false, {});
 +
CatTaskScheduleHelper ct = new CatTaskScheduleHelper ();
 +
object e = ct.GetScheduleByInstanceId(cattaskInstaceId);
 +
print(e.ObjectTypeName);//CatTaskSpecificTimeSchedule
 +
print(e.Time );//2021-08-24 07:23:36
 +
</source>
  
() - Instanciate helper
+
<source lang="javascript">
 
+
//GetTaskStatusByInstanceId
Methods
+
CatTaskScheduleHelper ct = new CatTaskScheduleHelper ();
 
+
object e = ct.GetTaskStatusByInstanceId(104675);
CatTaskSchedule GetScheduleByInstanceId(int instanceId "Id of an instance of a task") - From an instance, find the task and find its schedule
+
print(e.ObjectTypeName);//CatTaskStatusCancelled
 
+
print(e.Status);//Rescheduled by user
CatTaskSchedule GetScheduleByMetaDataId(int taskId "Id of a task") - From a task, find its schedule
+
</source>
 
 
Empty RescheduleByInstanceId(int instanceId "Id of an instance of a task", CatTaskSchedule schedule "The new schedule to use") - From an instance, find the task and alter its schedule
 
 
 
Empty RescheduleByMetaDataId(int taskId "Id of a task", CatTaskSchedule schedule "The new schedule to use") - From a task, alter its schedule
 
 
 
string ToString() - The string representation of the object.
 
 
 
Properties
 
 
 
string ObjectTypeName { get; } - The name of the type of object.
 
 
 
TypeInformation TypeInformation { get; } - Get information about this class.
 
[[Category:Classes]]
 

Latest revision as of 08:35, 24 August 2021

CatTaskScheduleHelper



Helper class for scheduling CatTasks

Parent class

Inherits from object

Constructors

  • () - Instanciate helper

Methods

  • CatTaskSchedule GetScheduleByInstanceId(int instanceId "Id of an instance of a task") - From an instance, find the task and find its schedule
  • CatTaskSchedule GetScheduleByMetaDataId(int taskId "Id of a task") - From a task, find its schedule
  • CatTaskStatus GetTaskStatusByInstanceId(int instanceId "Id of an instance of a task") - From an instance, get the execution status
  • Empty RescheduleByInstanceId(int instanceId "Id of an instance of a task", CatTaskSchedule schedule "The new schedule to use") - From an instance, find the task and alter its schedule
  • Empty RescheduleByMetaDataId(int taskId "Id of a task", CatTaskSchedule schedule "The new schedule to use") - From a task, alter its schedule
  • (From object) string ToString() - The string representation of the object.

Properties

  • string ObjectTypeName { get; } - The name of the type of object.
  • (From object) TypeInformation TypeInformation { get; } - Get information about this class.


Examples

//RescheduleByMetaDataId
CatTaskScheduleHelper csHelper = new CatTaskScheduleHelper();
number taskId = 54183;
CatTaskNeverSchedule schedule = new CatTaskNeverSchedule();
csHelper.RescheduleByMetaDataId(taskId, schedule);
//GetScheduleByInstanceId
WorkflowScript wf = new WorkflowScript(15874008);
CatTaskSpecificTimeSchedule schedule  = new CatTaskSpecificTimeSchedule(new DateTime());
number cattaskInstaceId = wf.Schedule(schedule, false, {});
CatTaskScheduleHelper ct = new CatTaskScheduleHelper ();
object e = ct.GetScheduleByInstanceId(cattaskInstaceId);
print(e.ObjectTypeName);//CatTaskSpecificTimeSchedule
print(e.Time );//2021-08-24 07:23:36
//GetTaskStatusByInstanceId
CatTaskScheduleHelper ct = new CatTaskScheduleHelper ();
object e = ct.GetTaskStatusByInstanceId(104675);
print(e.ObjectTypeName);//CatTaskStatusCancelled
print(e.Status);//Rescheduled by user