/// <summary> /// creates a new <see cref="WorkflowExecutionController"/> /// </summary> /// <param name="logger">access to logging</param> /// <param name="executionservice">access to workflow execution service</param> /// <param name="compiler">compiles workflow data for execution</param> /// <param name="taskservice">access to task objects</param> public WorkflowExecutionController(ILogger <WorkflowExecutionController> logger, IWorkflowExecutionService executionservice, IWorkflowCompiler compiler, ITaskService taskservice) { this.logger = logger; this.executionservice = executionservice; this.compiler = compiler; this.taskservice = taskservice; }
/// <summary> /// creates a new <see cref="System.Threading.Tasks.TaskScheduler"/> /// </summary> /// <param name="logger">access to logging</param> /// <param name="configuration">access to configuration</param> /// <param name="scheduledtaskservice">access to scheduled task data</param> /// <param name="workflowexecutor">executes workflows</param> /// <param name="scriptexecutor">executes scripts</param> /// <param name="workflowcompiler">compiler for workflow data</param> public TaskScheduler(ILogger <TaskScheduler> logger, IConfiguration configuration, IScheduledTaskService scheduledtaskservice, IWorkflowExecutionService workflowexecutor, IScriptExecutionService scriptexecutor, IWorkflowCompiler workflowcompiler) { this.logger = logger; this.configuration = configuration; this.scheduledtaskservice = scheduledtaskservice; this.workflowexecutor = workflowexecutor; this.scriptexecutor = scriptexecutor; this.workflowcompiler = workflowcompiler; }
/// <summary> /// creates a new <see cref="WorkableExecutor"/> /// </summary> /// <param name="logger">used for logging in workflow</param> /// <param name="workflowservice">access to workflow data</param> /// <param name="compiler">compiled workflows</param> /// <param name="executor">executes compiled workflows</param> /// <param name="name">name of workflow to execute</param> /// <param name="revision">workflow revision (optional)</param> public LuaWorkableExecutor(WorkableLogger logger, IWorkflowService workflowservice, IWorkflowCompiler compiler, IWorkflowExecutionService executor, string name, int?revision) { this.logger = logger; this.workflowservice = workflowservice; this.compiler = compiler; this.executor = executor; this.name = name; this.revision = revision; }
/// <summary> /// creates a new <see cref="WorkflowInstanceState"/> /// </summary> /// <param name="workflow">currently executing workflow</param> /// <param name="logger">access to logging</param> /// <param name="variables">workflow state variables</param> /// <param name="workflowprovider">provides workflows by name</param> /// <param name="workflowexecutor">executor for workflows</param> /// <param name="language">default language used for code execution</param> /// <param name="profiling">determines whether to profile performance</param> public WorkflowInstanceState(WorkflowIdentifier workflow, WorkableLogger logger, StateVariableProvider variables, Func <string, Task <WorkflowInstance> > workflowprovider, IWorkflowExecutionService workflowexecutor, ScriptLanguage?language, bool profiling) { this.workflowprovider = workflowprovider; Logger = logger; Variables = variables; WorkflowExecutor = workflowexecutor; Language = language; Profiling = profiling; Workflow = workflow; }
/// <summary> /// Starts execution of an <see cref="IWorkflowSubject"/> object /// in the workflow associated with the object. /// </summary> /// <param name="workflowExeService"> /// Reference to the <see cref="IWorkflowExecutionService"/> /// to call /// </param> /// <param name="workflowSubject"> /// <see cref="IWorkflowSubject"/> to start in the workflow /// </param> /// <returns> /// Returns a <see cref="WorkflowExecutionResult"/> object /// that encapsulates the result of the operation. /// </returns> /// <remarks> /// This is a short-cut method for <see cref="IWorkflowSubject"/> /// objects that already have a value assigned to /// <see cref="IWorkflowSubject.WorkflowName"/>. /// </remarks> public static WorkflowExecutionResult StartWorkflow(this IWorkflowExecutionService workflowExeService, IWorkflowSubject workflowSubject) { if (workflowSubject == null) { throw new ArgumentNullException(nameof(workflowSubject)); } var workflowName = workflowSubject.WorkflowName; if (string.IsNullOrEmpty(workflowName)) { var msg = $"{workflowSubject} is not associated with a workflow"; throw new InvalidOperationException(msg); } return(workflowExeService.StartWorkflow(workflowSubject, workflowName)); }
/// <summary> /// Gets the collection of allowed transition names that are available /// for the given <see cref="IWorkflowSubject"/> from its /// <see cref="IWorkflowSubject.CurrentState"/>. /// </summary> /// <param name="workflowExeService"> /// Reference to the <see cref="IWorkflowExecutionService"/> /// to call /// </param> /// <param name="workflowSubject"> /// Workflow subject to get transitions for /// </param> /// <returns> /// Returns a collection of transition names /// </returns> public static IEnumerable <string> GetAllowedTransitionNames(this IWorkflowExecutionService workflowExeService, IWorkflowSubject workflowSubject) { if (workflowSubject == null) { throw new ArgumentNullException(nameof(workflowSubject)); } var workflowName = workflowSubject.WorkflowName; if (string.IsNullOrEmpty(workflowName)) { var msg = $"{workflowSubject} is not associated with a workflow"; throw new InvalidOperationException(msg); } return(workflowExeService.GetAllowedTransitions(workflowSubject) .Select(t => t.Name)); }
/// <summary> /// creates a new <see cref="ScriptIdMethod"/> /// </summary> /// <param name="workflowname">name of workflow</param> /// <param name="revision">revision of workflow to execute</param> /// <param name="workflowservice">access to workflow data</param> /// <param name="executor">executor used to execute workflow</param> /// <param name="compiler">compiles workflow data for execution</param> public WorkflowNameMethod(string workflowname, int?revision, IWorkflowService workflowservice, IWorkflowExecutionService executor, IWorkflowCompiler compiler) : base(executor, compiler) { this.workflowname = workflowname; this.revision = revision; this.workflowservice = workflowservice; }
/// <summary> /// creates a new <see cref="ScriptIdMethod"/> /// </summary> /// <param name="workflowid">id of workflow</param> /// <param name="revision">revision of workflow to execute</param> /// <param name="workflowservice">access to workflow data</param> /// <param name="executor">executor used to execute workflow</param> /// <param name="compiler">compiles workflow data for execution</param> public WorkflowIdMethod(long workflowid, int?revision, IWorkflowService workflowservice, IWorkflowExecutionService executor, IWorkflowCompiler compiler) : base(executor, compiler) { this.workflowid = workflowid; this.revision = revision; this.workflowservice = workflowservice; }
/// <summary> /// creates a new <see cref="WorkflowMethod"/> /// </summary> /// <param name="executor">executor used to execute workflow</param> /// <param name="compiler">compiles workflow data for execution</param> protected WorkflowMethod(IWorkflowExecutionService executor, IWorkflowCompiler compiler) { this.executor = executor; this.compiler = compiler; }