Ejemplo n.º 1
0
        public static StartWorkflowRequest For <T>(string workflowId) where T : Workflow
        {
            Ensure.NotNullAndEmpty(workflowId, "workflowId");
            var workflowDescription = WorkflowDescription.FindOn <T>();

            return(new StartWorkflowRequest(workflowDescription.Name, workflowDescription.Version, workflowId));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Returns the parent child-workflow for <see cref="TWorkflow"/> and positional name. Returns null if not
        /// </summary>
        /// <typeparam name="TWorkflow"></typeparam>
        /// <param name="workflowItem"></param>
        /// <param name="positionalName"></param>
        /// <returns></returns>
        public static IChildWorkflowItem ParentChildWorkflow <TWorkflow>(this IWorkflowItem workflowItem, string positionalName = "")
            where TWorkflow : Workflow
        {
            Ensure.NotNull(workflowItem, nameof(workflowItem));
            var desc = WorkflowDescription.FindOn <TWorkflow>();

            return(workflowItem.ParentChildWorkflow(desc.Name, desc.Version, positionalName));
        }
Ejemplo n.º 3
0
 private void PopulateHostedWorkflows(IEnumerable <Workflow> workflows)
 {
     foreach (var workflow in workflows)
     {
         var workflowDescription = WorkflowDescription.FindOn(workflow.GetType());
         var hostedWorkflowKey   = workflowDescription.Name + workflowDescription.Version;
         if (_workflows.ContainsKey(hostedWorkflowKey))
         {
             throw new WorkflowAlreadyHostedException(string.Format(Resources.Workflow_already_hosted, workflowDescription.Name, workflowDescription.Version));
         }
         _workflows.Add(hostedWorkflowKey, workflow);
     }
 }
        internal static IChildWorkflowItem First <TWorkflow>(this IEnumerable <IChildWorkflowItem> items, string positionalName = "") where TWorkflow : Workflow
        {
            var desc = WorkflowDescription.FindOn <TWorkflow>();

            return(items.First(desc.Name, desc.Version, positionalName));
        }
Ejemplo n.º 5
0
        public IFluentChildWorkflowItem AfterChildWorkflow <TWorkflow>(string positionalName) where TWorkflow : Workflow
        {
            var desc = WorkflowDescription.FindOn <TWorkflow>();

            return(AfterChildWorkflow(desc.Name, desc.Version, positionalName));
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Jump to child workflow. It will cause the workflow to fail if target child workflow is already active.
        /// </summary>
        /// <typeparam name="TWorkflow"></typeparam>
        /// <param name="positionalName"></param>
        /// <returns></returns>
        internal JumpWorkflowAction ToChildWorkflow <TWorkflow>(string positionalName = "") where TWorkflow : Workflow
        {
            var desc = WorkflowDescription.FindOn <TWorkflow>();

            return(ToChildWorkflow(desc.Name, desc.Version, positionalName));
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Returns workflow action to cancel the child workflow.
        /// </summary>
        /// <typeparam name="TWorkflow"></typeparam>
        /// <param name="positionalName"></param>
        /// <returns></returns>
        public WorkflowAction ForChildWorkflow <TWorkflow>(string positionalName = "") where TWorkflow : Workflow
        {
            var desc = WorkflowDescription.FindOn <TWorkflow>();

            return(ForChildWorkflow(desc.Name, desc.Version, positionalName));
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Schedule the child workflow.
        /// </summary>
        /// <typeparam name="T">Type of child workflow.</typeparam>
        /// <param name="positionalName">Positional parameter, if any, useful in scheduling same workflow multiple times.</param>
        /// <returns></returns>
        protected IFluentChildWorkflowItem ScheduleChildWorkflow <T>(string positionalName = "") where T : Workflow
        {
            var desc = WorkflowDescription.FindOn <T>();

            return(ScheduleChildWorkflow(desc.Name, desc.Version, positionalName));
        }