Interface IInstanceHandler
Specifies methods etc. regarding instance handling
Namespace: EPiServer.WorkflowFoundation.Interfaces
Assembly: EPiServer.WorkflowFoundation.dll
Version: 8.11.0Syntax
public interface IInstanceHandler
Methods
ContainsInstance(Guid)
Indicates wetter there exists an instance with this id
Declaration
bool ContainsInstance(Guid workflowInstanceId)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | workflowInstanceId | instance id |
Returns
Type | Description |
---|---|
System.Boolean | wetter instance exist |
CreateTaskForInstance(Guid, String, String, String, PageReference, Boolean, Boolean, Boolean)
Creates a task and associates it with the instance
Declaration
Task CreateTaskForInstance(Guid workflowInstanceId, string assignedTo, string subject, string description, PageReference pageLink, bool notifyByEmail, bool logAction, bool activityRelated)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | workflowInstanceId | The workflow instance id. |
System.String | assignedTo | The person/group this task is assigned to |
System.String | subject | The subject of the task |
System.String | description | The description of the task |
PageReference | pageLink | The page if the task should be associated with a page |
System.Boolean | notifyByEmail | if set to |
System.Boolean | logAction | if set to |
System.Boolean | activityRelated | if set to |
Returns
Type | Description |
---|---|
Task | the created task |
Exceptions
Type | Condition |
---|---|
WorkflowInstanceException | If instance not found |
GetInstance(Guid)
Gets instance with specified id
Declaration
WorkflowDefinitionInstance GetInstance(Guid workflowInstanceId)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | workflowInstanceId | instance id |
Returns
Type | Description |
---|---|
WorkflowDefinitionInstance | instance |
Exceptions
Type | Condition |
---|---|
WorkflowInstanceException | If instance not found |
GetInstance(Guid, AccessLevel)
Gets instance with specified id.
Declaration
WorkflowDefinitionInstance GetInstance(Guid workflowInstanceId, AccessLevel accessLevel)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | workflowInstanceId | instance id |
AccessLevel | accessLevel | The acess level. |
Returns
Type | Description |
---|---|
WorkflowDefinitionInstance | instance |
Exceptions
Type | Condition |
---|---|
WorkflowInstanceException | If instance not found |
GetInstances()
Gets all running Workflow instances
Declaration
IList<WorkflowDefinitionInstance> GetInstances()
Returns
Type | Description |
---|---|
System.Collections.Generic.IList<WorkflowDefinitionInstance> | A list of all workflow instances |
GetInstances(PageReference)
Returns information about all running Workflows attached to a specific page
Declaration
IList<WorkflowDefinitionInstance> GetInstances(PageReference pageLink)
Parameters
Type | Name | Description |
---|---|---|
PageReference | pageLink | pageLink |
Returns
Type | Description |
---|---|
System.Collections.Generic.IList<WorkflowDefinitionInstance> | information about all Workflow instances |
Remarks
It will return instances that are associated with any version of the page
GetInstances(PageReference, AccessLevel)
Returns information about all running Workflows attached to a specific page for a given acess level
Declaration
IList<WorkflowDefinitionInstance> GetInstances(PageReference pageLink, AccessLevel accessLevel)
Parameters
Type | Name | Description |
---|---|---|
PageReference | pageLink | pageLink |
AccessLevel | accessLevel | The access level. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IList<WorkflowDefinitionInstance> | information about all Workflow instances |
Remarks
It will return instances that are associated with any version of the page
GetInstances(AccessLevel)
Gets all running Workflow instances for a given access level
Declaration
IList<WorkflowDefinitionInstance> GetInstances(AccessLevel accessLevel)
Parameters
Type | Name | Description |
---|---|---|
AccessLevel | accessLevel | The acess level. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IList<WorkflowDefinitionInstance> | All instances that matches the access level |
GetInstances(Guid)
Returns all instantiated Workflows of a certain definition that are not completed
Declaration
IList<WorkflowDefinitionInstance> GetInstances(Guid workflowDefinitionId)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | workflowDefinitionId | The definitionId |
Returns
Type | Description |
---|---|
System.Collections.Generic.IList<WorkflowDefinitionInstance> | workflow instances |
GetInstances(Guid, AccessLevel)
Returns all instantiated Workflows of a certain definition that are not completed
Declaration
IList<WorkflowDefinitionInstance> GetInstances(Guid workflowDefinitionId, AccessLevel accessLevel)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | workflowDefinitionId | The definitionId |
AccessLevel | accessLevel | The acess level. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IList<WorkflowDefinitionInstance> | workflow instances |
GetInstances(Type)
Returns all instantiated Workflows of a certain type that are not completed
Declaration
IList<WorkflowDefinitionInstance> GetInstances(Type workflowType)
Parameters
Type | Name | Description |
---|---|---|
System.Type | workflowType | Type of the workflow to match against |
Returns
Type | Description |
---|---|
System.Collections.Generic.IList<WorkflowDefinitionInstance> | workflow instances |
GetInstances(Type, AccessLevel)
Returns all instantiated Workflows of a certain type that are not completed
Declaration
IList<WorkflowDefinitionInstance> GetInstances(Type workflowType, AccessLevel accessLevel)
Parameters
Type | Name | Description |
---|---|---|
System.Type | workflowType | Type of the workflow. |
AccessLevel | accessLevel | The acess level. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IList<WorkflowDefinitionInstance> | workflow instances |
GetQueueInfo(Guid)
Gets the Workflow queue for a specific Workflow instance, could be used i.e. to determine which event a specific Workflow waits for
Declaration
ReadOnlyCollection<WorkflowQueueInfo> GetQueueInfo(Guid workflowInstanceId)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | workflowInstanceId | The workflow instance id. |
Returns
Type | Description |
---|---|
System.Collections.ObjectModel.ReadOnlyCollection<System.Workflow.Runtime.WorkflowQueueInfo> | Gets all items in queue |
Exceptions
Type | Condition |
---|---|
WorkflowInstanceException | If instance not found |
GetSystemInstance(Guid)
Gets the wrapped system instance
Declaration
WorkflowInstance GetSystemInstance(Guid workflowInstanceId)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | workflowInstanceId | The workflow instance id. |
Returns
Type | Description |
---|---|
System.Workflow.Runtime.WorkflowInstance | system instance |
GetTasks(Guid)
Gets all tasks related to a workflow instance
Declaration
IList<Task> GetTasks(Guid workflowInstanceId)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | workflowInstanceId | The workflow instance id. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IList<Task> | A list of all tasks related to the specified instance |
GetWaitingEvents(Guid)
Gets the Acivitys for the Workflow that are registered to listen for events
Declaration
IList<Activity> GetWaitingEvents(Guid workflowInstanceId)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | workflowInstanceId | The workflow instance id. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IList<System.Workflow.ComponentModel.Activity> | waiting activities |
Exceptions
Type | Condition |
---|---|
WorkflowInstanceException | If instance not found |
SaveInstance(WorkflowDefinitionInstance)
Saves the instance
Declaration
void SaveInstance(WorkflowDefinitionInstance instance)
Parameters
Type | Name | Description |
---|---|---|
WorkflowDefinitionInstance | instance | The updated instance |
Exceptions
Type | Condition |
---|---|
AccessDeniedException | If current user has not rights to save instance |
WorkflowInstanceException | If instance not found |
WorkflowDefinitionException | If definition not found |
SaveInstance(WorkflowDefinitionInstance, AccessLevel)
Saves the instance
Declaration
void SaveInstance(WorkflowDefinitionInstance instance, AccessLevel access)
Parameters
Type | Name | Description |
---|---|---|
WorkflowDefinitionInstance | instance | The updated instance |
AccessLevel | access | The access. |
Exceptions
Type | Condition |
---|---|
AccessDeniedException | If current user has not rights to save instance |
WorkflowInstanceException | If instance not found |
WorkflowDefinitionException | If definition not found |
StartInstance(Guid)
Starts a Workflow of specified definition
Declaration
WorkflowDefinitionInstance StartInstance(Guid definitionId)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | definitionId | The definition id. |
Returns
Type | Description |
---|---|
WorkflowDefinitionInstance | The created instance |
Exceptions
Type | Condition |
---|---|
AccessDeniedException | Access denied |
WorkflowInstanceException | Action was cancelled |
WorkflowException | Unexpected failure |
StartInstance(Guid, IDictionary<String, Object>)
Starts a Workflow of specified definition
Declaration
WorkflowDefinitionInstance StartInstance(Guid definitionId, IDictionary<string, object> args)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | definitionId | The definition id. |
System.Collections.Generic.IDictionary<System.String, System.Object> | args | optional start params passed to Workflow |
Returns
Type | Description |
---|---|
WorkflowDefinitionInstance | The created instance |
Exceptions
Type | Condition |
---|---|
AccessDeniedException | Access denied |
WorkflowInstanceException | Action was cancelled |
WorkflowException | Unexpected failure |
StartInstance(Guid, IDictionary<String, Object>, PageReference)
Starts a Workflow of specified definition
Declaration
WorkflowDefinitionInstance StartInstance(Guid definitionId, IDictionary<string, object> args, PageReference pageLink)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | definitionId | The definition id. |
System.Collections.Generic.IDictionary<System.String, System.Object> | args | optional start params passed to Workflow |
PageReference | pageLink | If given, associates Workflow with the given page |
Returns
Type | Description |
---|---|
WorkflowDefinitionInstance | The created instance |
Exceptions
Type | Condition |
---|---|
AccessDeniedException | Access denied |
WorkflowInstanceException | Action was cancelled |
WorkflowException | Unexpected failure |
StartInstance(Guid, IDictionary<String, Object>, PageReference, AccessLevel)
Starts a Workflow of specified definition
Declaration
WorkflowDefinitionInstance StartInstance(Guid definitionId, IDictionary<string, object> args, PageReference pageLink, AccessLevel access)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | definitionId | The definition id. |
System.Collections.Generic.IDictionary<System.String, System.Object> | args | optional start params passed to Workflow |
PageReference | pageLink | If given, associates Workflow with the given page |
AccessLevel | access | The required access level for start instance |
Returns
Type | Description |
---|---|
WorkflowDefinitionInstance | The created instance |
Exceptions
Type | Condition |
---|---|
AccessDeniedException | Access denied |
WorkflowInstanceException | Action was cancelled |
WorkflowException | Unexpected failure |
StartInstance(Guid, IDictionary<String, Object>, Guid)
Starts a Workflow of specified definition with a specified instance id
Declaration
WorkflowDefinitionInstance StartInstance(Guid definitionId, IDictionary<string, object> args, Guid instanceId)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | definitionId | The definition id. |
System.Collections.Generic.IDictionary<System.String, System.Object> | args | optional start params passed to Workflow |
System.Guid | instanceId | The id of the instance to be created |
Returns
Type | Description |
---|---|
WorkflowDefinitionInstance | The created instance |
Exceptions
Type | Condition |
---|---|
AccessDeniedException | Access denied |
WorkflowInstanceException | Action was cancelled |
WorkflowException | Unexpected failure |
StartInstance(Guid, IDictionary<String, Object>, Guid, AccessLevel)
Starts a Workflow of specified definition with a specified instance id
Declaration
WorkflowDefinitionInstance StartInstance(Guid definitionId, IDictionary<string, object> args, Guid instanceId, AccessLevel access)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | definitionId | The definition id. |
System.Collections.Generic.IDictionary<System.String, System.Object> | args | optional start params passed to Workflow |
System.Guid | instanceId | The id of the instance to be created |
AccessLevel | access | The access. |
Returns
Type | Description |
---|---|
WorkflowDefinitionInstance | The created instance |
Exceptions
Type | Condition |
---|---|
AccessDeniedException | Access denied |
WorkflowInstanceException | Action was cancelled |
WorkflowException | Unexpected failure |
TerminateInstance(Guid, String)
Terminates a given Workflow instance
Declaration
void TerminateInstance(Guid workflowInstanceId, string reason)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | workflowInstanceId | The id of the instance to terminate |
System.String | reason | A description why the instances was terminated |
Exceptions
Type | Condition |
---|---|
AccessDeniedException | If current user has not rights to terminate instance |
WorkflowInstanceException | If instance not found |
System.InvalidOperationException | If instance not found in persistance store |
TerminateInstance(Guid, String, AccessLevel)
Terminates a given Workflow instance
Declaration
void TerminateInstance(Guid workflowInstanceId, string reason, AccessLevel access)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | workflowInstanceId | The workflow instance id. |
System.String | reason | A description why the instances was terminated |
AccessLevel | access | The required access level for terminate instance |
Exceptions
Type | Condition |
---|---|
AccessDeniedException | If current user has not rights to terminate instance |
WorkflowInstanceException | If instance not found |
System.InvalidOperationException | If instance not found in persistance store |
TryGetInstance(Guid, AccessLevel, out WorkflowDefinitionInstance)
Tries to get the instance with specified id
Declaration
bool TryGetInstance(Guid workflowInstanceId, AccessLevel access, out WorkflowDefinitionInstance workflowInstance)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | workflowInstanceId | The id of the instance to get |
AccessLevel | access | The access to match against |
WorkflowDefinitionInstance | workflowInstance | The workflow instance with the given id |
Returns
Type | Description |
---|---|
System.Boolean | true if instance exist else false |
TryGetInstance(Guid, out WorkflowDefinitionInstance)
Tries to get the instance with specified id
Declaration
bool TryGetInstance(Guid workflowInstanceId, out WorkflowDefinitionInstance workflowInstance)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | workflowInstanceId | The id of the instance to get |
WorkflowDefinitionInstance | workflowInstance | The workflow instance with the given id |
Returns
Type | Description |
---|---|
System.Boolean | true if instance exist else false |
Events
InstanceDeleted
Occurs when an instances was deleted, for example when it is completed or terminated.
Declaration
event EventHandler<WorkflowDeletedEventArgs> InstanceDeleted
Event Type
Type | Description |
---|---|
System.EventHandler<WorkflowDeletedEventArgs> |
InstanceStarting
Occurs when a workflow instance is about to be created. It gives possibilities to set start arguments
Declaration
event EventHandler<StartInstanceEventArgs> InstanceStarting
Event Type
Type | Description |
---|---|
System.EventHandler<StartInstanceEventArgs> |
Examples
Shows how event can be used to pass start parameters to workflow instance
InstanceStartingCancelled
Occurs when starting of an instance was cancelled.
Declaration
event EventHandler<StartInstanceCancelledEventArgs> InstanceStartingCancelled
Event Type
Type | Description |
---|---|
System.EventHandler<StartInstanceCancelledEventArgs> |