Interface IServerTask
The system entity for a server task, which can be offloaded and run on the task services rather than locally
See https://help.lemonedge.com/help/open-architecture/status/server-tasks/intro.html for more information
Inherited Members
Namespace: LemonEdge.API.Entities.Tasks
Assembly: LemonEdge.API.dll
Syntax
[EntityDefinition(EntityID.ServerTask, "dbo.LT_ServerTasks", "ServerTask", LabelColumn = "Description", SelectWithNoLock = false, HelpURL = "help/open-architecture/status/server-tasks/intro.html")]
[DefaultEntityIcon(ImageType.ServerProcess)]
[EntityIndex(Name = "Status", ColumnNames = new string[] { "Cancel", "Enabled", "Locked", "Status" }, IndexOrder = new IndexOrder[] { IndexOrder.Ascending, IndexOrder.Ascending, IndexOrder.Ascending, IndexOrder.Ascending }, IncludeColumns = new string[] { "NextRunDate" }, IsClustered = false, IsUnique = false)]
public interface IServerTask : IBaseEntityWithPermissions, ICanBeLocked, IQueueableItemOnSave, IBaseEntity, IEquatable<IBaseEntity>, INotifyPropertyChanged, INotifyPropertyChanging, ICloneableAsync, ICanTrackProperties, ISetCopier
Properties
Cancel
Indicates the user has cancelled the execution of this task.
Declaration
[EntityProperty(SQLType.Bit, false)]
[EntityDescription("Indicates the user has cancelled the execution of this task.")]
bool Cancel { get; set; }
Property Value
Type | Description |
---|---|
bool |
ChainRecreateWhenChaining
Indicates the chained task is re-created as a chained task in the created task - this creates a recursive set of tasks that are created and executed until the ChainedGuardFormula fails
Declaration
[EntityProperty(SQLType.Bit, false, "0")]
[EntityDescription("Indicates the chained task is re-created as a chained task in the created task - this creates a recursive set of tasks that are created and executed until the ChainedGuardFormula fails.")]
bool ChainRecreateWhenChaining { get; set; }
Property Value
Type | Description |
---|---|
bool |
ChainedGuardFormula
A formula that when returning true indicates we should run the chained task
Declaration
[EntityProperty(SQLType.NVarChar, true)]
[EntityDescription("A formula that when returning true indicates we should run the chained task.")]
string ChainedGuardFormula { get; set; }
Property Value
Type | Description |
---|---|
string |
ChainedTaskType
The typeof task to run on the server as a chained task after this onee is complete.
Declaration
[EntityProperty(SQLType.UniqueIdentifier, true)]
[EntityDescription("The typeof task to run on the server as a chained task after this onee is complete.")]
Guid? ChainedTaskType { get; set; }
Property Value
Type | Description |
---|---|
Guid? |
Description
A user friendly description of the task to be processed
Declaration
[EntityProperty(SQLType.NVarChar, 2000, true)]
[EntityDescription("A user friendly description of this server task.")]
string Description { get; set; }
Property Value
Type | Description |
---|---|
string |
Enabled
Indicates if this task is enabled - only enabled tasks will be processed by the task services
Declaration
[EntityProperty(SQLType.Bit, false, "0")]
[EntityDescription("Indicates if the task is disabled or should not.")]
[HardCodedDefaultValueOnNew("0")]
bool Enabled { get; set; }
Property Value
Type | Description |
---|---|
bool |
EndRunDate
If this task has an Occurrence and Frequency (i.e. is set to repeat) then this date indicates the date the repeating task should stop.
This doesn't have to be set - if it is blank, a task will repeat forever.
Declaration
[EntityProperty(SQLType.DateTimeOffset, true)]
[EntityDescription("If this task has an occurance, this indicates what date the task should stop recreating itself after.")]
DateTimeOffset? EndRunDate { get; set; }
Property Value
Type | Description |
---|---|
DateTimeOffset? |
EndedRunDate
Holds the data and time the task services finished processing this task.
Declaration
[EntityProperty(SQLType.DateTimeOffset, true)]
[EntityDescription("The date/time this task ended (failure or completion) being processed.")]
DateTimeOffset? EndedRunDate { get; set; }
Property Value
Type | Description |
---|---|
DateTimeOffset? |
Frequency
Used in conjunction with Occurrence to specify how often the task should repeat.
i.e.with an Occurrence of Days and a Frequency of 1, the task would repeat every day.With an Occurrence of Months and a Frequency of 3, it would repeat every 3 months (or quarter).
Declaration
[EntityProperty(SQLType.SmallInt, false)]
[EntityDescription("If this task has an Occurance, this Frequency indicates how many dayes/weeks/months/etc after the task was run that it should be recreated to run again for.")]
short Frequency { get; set; }
Property Value
Type | Description |
---|---|
short |
HasResult
Returns true if this task has a result record in IServerTaskData
Declaration
[EntityProperty(SQLType.Bit, false, "0")]
[EntityDescription("Returns true if this task has a result record in an IServerTaskData record.")]
bool HasResult { get; set; }
Property Value
Type | Description |
---|---|
bool |
NextRunDate
If this is a scheduled task to run at some point in the future, this will hold the date/time the task should next run.
If this is blank then the task should be processed at the earliest possible convinience
Declaration
[EntityProperty(SQLType.DateTimeOffset, true)]
[EntityDescription("The date time to next run this task. If null then is to be run immediately.")]
DateTimeOffset? NextRunDate { get; set; }
Property Value
Type | Description |
---|---|
DateTimeOffset? |
Occurance
If this task is to repeat then you can use this to specify how often you want it to repeat [Days, Weeks, Months, Years]
Declaration
[EntityProperty(SQLType.SmallInt, true)]
[EntityDescription("Indicates if this task should be recreated again after it has completed running. If so, what period is used to provide a date for the new instance of the task.")]
ServerTaskOccurrence? Occurance { get; set; }
Property Value
Type | Description |
---|---|
ServerTaskOccurrence? |
RunAsUser
The user to run the task under
Declaration
[EntityProperty(SQLType.UniqueIdentifier, true)]
[EntityRelationship(EntityID.Users, "ID", SingleJoinType.ZeroToOne, "Run Task As User", "Tasks Run As Impersonated User")]
[EntityDescription("The user to run the task under")]
[DBTrackChanges]
Guid? RunAsUser { get; set; }
Property Value
Type | Description |
---|---|
Guid? |
StartedRunDate
Holds the date and time the task was picked up by a task service and started processing.
Declaration
[EntityProperty(SQLType.DateTimeOffset, true)]
[EntityDescription("The date/time this task started being processed.")]
DateTimeOffset? StartedRunDate { get; set; }
Property Value
Type | Description |
---|---|
DateTimeOffset? |
Status
The status of the task
Declaration
[EntityProperty(SQLType.SmallInt, false)]
[EntityDescription("Current status of server task.")]
ServerTaskStatusEnum Status { get; set; }
Property Value
Type | Description |
---|---|
ServerTaskStatusEnum |
TaskType
The type of task being processed. Custom tasks coded against our API (inheriting from ITaskProcessor) will also appear here.
Declaration
[EntityProperty(SQLType.UniqueIdentifier, false)]
[EntityDescription("The typeof task to run on the server.")]
Guid TaskType { get; set; }
Property Value
Type | Description |
---|---|
Guid |
TotalRunTime
Holds the total amount of time spent processing the task (End Run Date - Started Run Date).
Is a calculated property, is not stored in the database
Declaration
string TotalRunTime { get; }
Property Value
Type | Description |
---|---|
string |