Class ServerTaskFactory
Implements
Inherited Members
Namespace: LemonEdge.API.Core.Tasks
Assembly: LemonEdge.API.dll
Syntax
public class ServerTaskFactory : IServerTaskFactory
Constructors
ServerTaskFactory(IDomainContextEventHandler, IEntityDescriptorFactory, IReflectionHelper, IFactoryInjector)
Declaration
public ServerTaskFactory(IDomainContextEventHandler addinHandler, IEntityDescriptorFactory descriptors, IReflectionHelper reflector, IFactoryInjector injector)
Parameters
Type | Name | Description |
---|---|---|
IDomainContextEventHandler | addinHandler | |
IEntityDescriptorFactory | descriptors | |
IReflectionHelper | reflector | |
IFactoryInjector | injector |
Properties
Instance
Declaration
public static IServerTaskFactory Instance { get; set; }
Property Value
Type | Description |
---|---|
IServerTaskFactory |
Methods
CanOnlyRunOnServer(Guid)
Indicates if the specified task type can only be processed on the server and can not run locally to a client
To be runnable on a client, the client needs the ITaskProcessor marked with the ServerTaskAttribute.
If we just have the parameters and the ServerTaskParametersAttribute then we can create the parameters but the task has no choice but to be processed on a serviceDeclaration
public bool CanOnlyRunOnServer(Guid forTaskID)
Parameters
Type | Name | Description |
---|---|---|
Guid | forTaskID | The globally unique id of this task type UniqueTaskID |
Returns
Type | Description |
---|---|
bool | If the specified task type can only be processed on the server and can not run locally to a client |
CreateTaskProcessor(ServerTaskAttribute)
Creates an instance of the Task Processor for the specified task type ( UniqueTaskID)
Declaration
public ITaskProcessor CreateTaskProcessor(ServerTaskAttribute forTaskType)
Parameters
Type | Name | Description |
---|---|---|
ServerTaskAttribute | forTaskType | The type of task to retrieve its associated task processor for |
Returns
Type | Description |
---|---|
ITaskProcessor | An instance of the Task Processor for the specified task type ( UniqueTaskID) |
CreateTaskResultHandler(ServerTaskResultAttribute)
Creates an instance of the result handler for the specified task type
Declaration
public ITaskResultHandler CreateTaskResultHandler(ServerTaskResultAttribute forTaskType)
Parameters
Type | Name | Description |
---|---|---|
ServerTaskResultAttribute | forTaskType | The attribute (either associated with the server or client handler) defining the ITaskResultHandler implementation to use |
Returns
Type | Description |
---|---|
ITaskResultHandler | An instance of the result handler for the specified task type |
CreateTaskResultHandler(Guid, ServerTaskResultType)
Creates an instance of the result handler for the specified task type
Declaration
public ITaskResultHandler CreateTaskResultHandler(Guid forTaskID, ServerTaskResultType type)
Parameters
Type | Name | Description |
---|---|---|
Guid | forTaskID | The globally unique id of this task type UniqueTaskID |
ServerTaskResultType | type | The type of handler required - either for the server or client |
Returns
Type | Description |
---|---|
ITaskResultHandler | An instance of the result handler for the specified task type |
GetDefaultSaveParameters(ServerTaskParametersAttribute, IBaseEntity, IEntityUpdater)
Returns an instance of the default ServerTaskParameter from the specified attr
Declaration
public ServerTaskParameter GetDefaultSaveParameters(ServerTaskParametersAttribute attr, IBaseEntity forItem, IEntityUpdater context)
Parameters
Type | Name | Description |
---|---|---|
ServerTaskParametersAttribute | attr | The attribute specifying the ParameterType to create an instance of |
IBaseEntity | forItem | The optional item to use when creating the default parameter for |
IEntityUpdater | context | A context for use when creating the default parameters |
Returns
Type | Description |
---|---|
ServerTaskParameter | An instance of the default ServerTaskParameter from the specified |
GetDefaultSaveParameters(IHasSaveProcessingTask, IEntityUpdater)
If the specified forItem
has a current
SavedTaskParam then it returns that as the current
ServerTaskParameter
Otherwise it gets the default ServerTaskParameter from the ServerTaskParametersAttribute for this item type (definied with DefaultForHasSaveProcessingTask)
Declaration
public ServerTaskParameter GetDefaultSaveParameters(IHasSaveProcessingTask forItem, IEntityUpdater context)
Parameters
Type | Name | Description |
---|---|---|
IHasSaveProcessingTask | forItem | The item to return its parameters (SavedTaskParam) or default parameter instances for |
IEntityUpdater | context | The context for querying and updating all data in the platform |
Returns
Type | Description |
---|---|
ServerTaskParameter | The specified items parameters (SavedTaskParam) or default parameter instance |
GetSaveServerTask(IHasSaveProcessingTask)
Retrieves the attribute specifying information on the default ( DefaultForHasSaveProcessingTask) parameters for the task the specified item can automatically create
Declaration
public ServerTaskParametersAttribute GetSaveServerTask(IHasSaveProcessingTask forItem)
Parameters
Type | Name | Description |
---|---|---|
IHasSaveProcessingTask | forItem | The item to retrieve the server task parameters attribute for |
Returns
Type | Description |
---|---|
ServerTaskParametersAttribute | The attribute specifying information on the default ( DefaultForHasSaveProcessingTask) parameters for the task the specified item can automatically create |
GetSaveServerTask(Guid)
Retrieves the attribute specifying information on the parameters for the specified task type
Declaration
public ServerTaskParametersAttribute GetSaveServerTask(Guid forTaskID)
Parameters
Type | Name | Description |
---|---|---|
Guid | forTaskID | The globally unique id of this task type UniqueTaskID |
Returns
Type | Description |
---|---|
ServerTaskParametersAttribute | The attribute specifying information on the parameters for the specified task type |
GetServerTask(ITaskProcessor)
Retrieves the attribute specifying information on the parameters for the specified task type
Declaration
public ServerTaskParametersAttribute GetServerTask(ITaskProcessor fromRunningProcessor)
Parameters
Type | Name | Description |
---|---|---|
ITaskProcessor | fromRunningProcessor | An instance of the task processor that we wanted the associated parameter info for |
Returns
Type | Description |
---|---|
ServerTaskParametersAttribute | The attribute specifying information on the parameters for the specified task type |
GetServerTask(Guid)
Declaration
public ServerTaskAttribute GetServerTask(Guid forTaskID)
Parameters
Type | Name | Description |
---|---|---|
Guid | forTaskID |
Returns
Type | Description |
---|---|
ServerTaskAttribute |
GetServerTaskParameterInfo(Guid)
Returns the type of the class used to contain the parameters for the specified task type
Declaration
public Type GetServerTaskParameterInfo(Guid forTaskID)
Parameters
Type | Name | Description |
---|---|---|
Guid | forTaskID | The globally unique id of this task type UniqueTaskID |
Returns
Type | Description |
---|---|
Type | The type of the class used to contain the parameters for the specified task type |
GetServerTaskResultHandler(Guid, ServerTaskResultType)
Returns the attribute defining the ITaskResultHandler implementation for handling the specified task associated ServerTaskResult
Declaration
public ServerTaskResultAttribute GetServerTaskResultHandler(Guid forTaskID, ServerTaskResultType type)
Parameters
Type | Name | Description |
---|---|---|
Guid | forTaskID | The globally unique id of this task type UniqueTaskID |
ServerTaskResultType | type | The type of handler required - either for the server or client |
Returns
Type | Description |
---|---|
ServerTaskResultAttribute | The attribute defining the ITaskResultHandler implementation for handling the specified task associated ServerTaskResult |
GetServerTasks()
Returns the attributes with information on all tasks in the system
Declaration
public IEnumerable<ServerTaskParametersAttribute> GetServerTasks()
Returns
Type | Description |
---|---|
IEnumerable<ServerTaskParametersAttribute> | A list of attributes with information on all tasks in the system |
GetUserFriendlyTaskInstanceIdentityInfo(IServerTask, IServerTaskData)
Returns the user friendly string for identifying the specified task
Calculated from the tasks GetUserFriendlyTaskInstanceIdentityInfo(IServerTask) or from its ServerTaskAttribute
Declaration
public string GetUserFriendlyTaskInstanceIdentityInfo(IServerTask task, IServerTaskData data)
Parameters
Type | Name | Description |
---|---|---|
IServerTask | task | The task to return a user friendly string for |
IServerTaskData | data | An optional data record for the task to provide a more detailed description |
Returns
Type | Description |
---|---|
string | A user friendly string for identifying the specified task |