Class CommunicationService

Listens to events from EPiServer and send events to listening workflow instances. It also captuers events from workflow instances and Broadcast them

Inheritance
System.Object
CommunicationService
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: EPiServer.WorkflowFoundation.Services
Assembly: EPiServer.WorkflowFoundation.dll
Version: 8.11.0
Syntax
public class CommunicationService : IWorkflowCommunication
Remarks

This class should intended to be programmed directly against. It is used to handle communication between workflow host and workflow instances

Constructors

CommunicationService(ICommunicationServiceCallback)

Creates an instance of CommunicationService

Declaration
public CommunicationService(ICommunicationServiceCallback callback)
Parameters
Type Name Description
ICommunicationServiceCallback callback

The component to notify when a invoked based activity executes

Methods

AddHistoryItem(String, String, String, Guid)

Adds a history item to an workflow instance. Useful when an workflow instance wants to log something

Declaration
public void AddHistoryItem(string ItemSubject, string ItemDescription, string User, Guid InstanceId)
Parameters
Type Name Description
System.String ItemSubject

The subject of the item to be logged

System.String ItemDescription

The description of the item to be logged

System.String User

The user associated with this item (if any)

System.Guid InstanceId

The instance id.

AddUserData(String, Object, Boolean, Guid)

Adds a serializable custom object to the UserData collection of the workflow instance. Can be used to pass data from an workflow instance so it's accessible through host.

Declaration
public void AddUserData(string Key, object Value, bool LogAction, Guid InstanceId)
Parameters
Type Name Description
System.String Key

The key.

System.Object Value

The value.

System.Boolean LogAction

if set to true this action is added to History items for workflow instance

System.Guid InstanceId

The instance id.

Remarks

passed object must be serializable

AssociateWithPage(PageReference, Boolean, Guid)

Associates the workflow instance with a EPiServer page.

Declaration
public void AssociateWithPage(PageReference PageLink, bool LogAction, Guid InstanceId)
Parameters
Type Name Description
PageReference PageLink

The page link.

System.Boolean LogAction

if set to true this action is added to History items for workflow instance

System.Guid InstanceId

The instance of the workflow

Remarks

A instance associated with a page will only recieve page related events

CreateTask(String, String, String, DateTime, PageReference, String, Boolean, Boolean, Boolean, Dictionary<String, Object>, Guid)

Represents the CreateTask activity. Used when Workflow instances will create a task inside EPiServer

Declaration
public void CreateTask(string AssignTo, string TaskSubject, string TaskDescription, DateTime DueDate, PageReference PageLink, string EventActivityName, bool NotifyByEmail, bool LogAction, bool ActivityRelated, Dictionary<string, object> StateBag, Guid InstanceId)
Parameters
Type Name Description
System.String AssignTo

Who the task should be assigend to

System.String TaskSubject

Subject for the task

System.String TaskDescription

Description for the task

System.DateTime DueDate

The due date.

PageReference PageLink

If the task is associated with a page

System.String EventActivityName

Name of the event activity.

System.Boolean NotifyByEmail

if set to true a notification is sent to assignedTo by email

System.Boolean LogAction

if set to true this action is added to History items for workflow instance

System.Boolean ActivityRelated

if set to true [activity related].

System.Collections.Generic.Dictionary<System.String, System.Object> StateBag

The state bag on the task

System.Guid InstanceId

The id of the Workflow instance, which task will be related to

DeleteTask(Int32, Boolean, Guid)

Deletes the task.

Declaration
public void DeleteTask(int TaskId, bool LogAction, Guid InstanceId)
Parameters
Type Name Description
System.Int32 TaskId

The task id.

System.Boolean LogAction

if set to true this action is added to History items for workflow instance

System.Guid InstanceId

The instance id.

DeleteTasksForInstance(Boolean, Guid)

Deletes all tasks related to the instance.

Declaration
public void DeleteTasksForInstance(bool LogAction, Guid InstanceId)
Parameters
Type Name Description
System.Boolean LogAction

if set to true this action is added to History items for workflow instance

System.Guid InstanceId

The instance id.

Initialize()

Sets up event listening towards DataFactory, UnifiedFile and UnifiedDirectory

Declaration
public virtual void Initialize()

ReleaseResources()

Clean up resources

Declaration
public virtual void ReleaseResources()

UpdateTask(Int32, TaskStatus, String, String, String, Boolean, Boolean, Guid)

Represents the UpdateTask activity. Used when Workflow instances will update a task inside EPiServer

Declaration
public void UpdateTask(int TaskId, TaskStatus Status, string AssignTo, string TaskSubject, string TaskDescription, bool NotifyByEmail, bool LogAction, Guid InstanceId)
Parameters
Type Name Description
System.Int32 TaskId

The task id

TaskStatus Status

The status of the task

System.String AssignTo

Who the task should be assigend to

System.String TaskSubject

Subject for the task

System.String TaskDescription

Description for the task

System.Boolean NotifyByEmail

if set to true notify assignedTo by email.

System.Boolean LogAction

if set to true this action is added to History items for workflow instance

System.Guid InstanceId

The id of the Workflow instance, which task will be related to

Events

DirectoryAdded

Event to signal to OnFileAdded activity

Declaration
public event EventHandler<WorkflowFileSystemEventArgs> DirectoryAdded
Event Type
Type Description
System.EventHandler<WorkflowFileSystemEventArgs>

DirectoryCopied

Event to signal to OnDirectoryCopied activity

Declaration
public event EventHandler<WorkflowFileSystemEventArgs> DirectoryCopied
Event Type
Type Description
System.EventHandler<WorkflowFileSystemEventArgs>

DirectoryDeleted

Event to signal to OnFileDeleted activity

Declaration
public event EventHandler<WorkflowFileSystemEventArgs> DirectoryDeleted
Event Type
Type Description
System.EventHandler<WorkflowFileSystemEventArgs>

DirectoryMoved

Event to signal to OnDirectoryMoved activity

Declaration
public event EventHandler<WorkflowFileSystemEventArgs> DirectoryMoved
Event Type
Type Description
System.EventHandler<WorkflowFileSystemEventArgs>

FileAdded

Event to signal to OnFileAdded activity

Declaration
public event EventHandler<WorkflowFileSystemEventArgs> FileAdded
Event Type
Type Description
System.EventHandler<WorkflowFileSystemEventArgs>

FileCheckedIn

Event to signal to OnFileCheckedIn activity

Declaration
public event EventHandler<WorkflowFileSystemEventArgs> FileCheckedIn
Event Type
Type Description
System.EventHandler<WorkflowFileSystemEventArgs>

FileCheckedOut

Event to signal to OnFileCheckedOut activity

Declaration
public event EventHandler<WorkflowFileSystemEventArgs> FileCheckedOut
Event Type
Type Description
System.EventHandler<WorkflowFileSystemEventArgs>

FileCopied

Event to signal to OnFileCopied activity

Declaration
public event EventHandler<WorkflowFileSystemEventArgs> FileCopied
Event Type
Type Description
System.EventHandler<WorkflowFileSystemEventArgs>

FileDeleted

Event to signal to OnFileDeleted activity

Declaration
public event EventHandler<WorkflowFileSystemEventArgs> FileDeleted
Event Type
Type Description
System.EventHandler<WorkflowFileSystemEventArgs>

FileMoved

Event to signal to OnFileMoved activity

Declaration
public event EventHandler<WorkflowFileSystemEventArgs> FileMoved
Event Type
Type Description
System.EventHandler<WorkflowFileSystemEventArgs>

FileSystemEvent

Event that will be signaled for all FileSystem events (both files and Directories)

Declaration
public event EventHandler<WorkflowFileSystemEventArgs> FileSystemEvent
Event Type
Type Description
System.EventHandler<WorkflowFileSystemEventArgs>

FileSystemRelatedEvent

Occurrs when a FileSystem related event occurs from UnifiedFileSytem. It is also possible to start new workflow instance and pass arguments to instance by setting properties on argument class.

Declaration
public event EventHandler<FileSystemRelatedEventArgs> FileSystemRelatedEvent
Event Type
Type Description
System.EventHandler<FileSystemRelatedEventArgs>

PageCheckedIn

Event to signal to OnPageCheckedIn activity

Declaration
public event EventHandler<WorkflowPageEventArgs> PageCheckedIn
Event Type
Type Description
System.EventHandler<WorkflowPageEventArgs>

PageCreated

Event to signal to OnPageCreated activity

Declaration
public event EventHandler<WorkflowPageEventArgs> PageCreated
Event Type
Type Description
System.EventHandler<WorkflowPageEventArgs>

PageDeleted

Event to signal to OnPageDeleted activity

Declaration
public event EventHandler<WorkflowPageEventArgs> PageDeleted
Event Type
Type Description
System.EventHandler<WorkflowPageEventArgs>

PageEvent

Event that will be signaled for all page events

Declaration
public event EventHandler<WorkflowPageEventArgs> PageEvent
Event Type
Type Description
System.EventHandler<WorkflowPageEventArgs>
Remarks

Will only be fired to instances that has page associated

PageLanguageDeleted

Event to signal to OnPageLanguageDeleted activity

Declaration
public event EventHandler<WorkflowPageEventArgs> PageLanguageDeleted
Event Type
Type Description
System.EventHandler<WorkflowPageEventArgs>

PageMoved

Event to signal to OnPageMoved activity

Declaration
public event EventHandler<WorkflowPageEventArgs> PageMoved
Event Type
Type Description
System.EventHandler<WorkflowPageEventArgs>

PagePublished

Event to signal to OnPagePublished activity

Declaration
public event EventHandler<WorkflowPageEventArgs> PagePublished
Event Type
Type Description
System.EventHandler<WorkflowPageEventArgs>

PageRelatedEvent

Occurrs when a page related event occurs from DataFactory. Gives chance to cancel event by setting CancelAction to true. It is also possible to start new workflow instance and pass arguments to instance by setting properties on argument class. CancelAction has not meaning for all events

Declaration
public event EventHandler<PageRelatedEventArgs> PageRelatedEvent
Event Type
Type Description
System.EventHandler<PageRelatedEventArgs>

PageSaved

Event to signal to OnPageSaved activity

Declaration
public event EventHandler<WorkflowPageEventArgs> PageSaved
Event Type
Type Description
System.EventHandler<WorkflowPageEventArgs>

TaskDeleted

Event to signal to OnTaskDeleted activity

Declaration
public event EventHandler<WorkflowTaskEventArgs> TaskDeleted
Event Type
Type Description
System.EventHandler<WorkflowTaskEventArgs>

TaskStatusChanged

Event to signal to OnTaskStatusChanged activity

Declaration
public event EventHandler<WorkflowTaskEventArgs> TaskStatusChanged
Event Type
Type Description
System.EventHandler<WorkflowTaskEventArgs>

Implements