コード例 #1
0
        private async ValueTask <Variables> GetActivityPropertiesAsync(IWorkflowBlueprintWrapper workflowBlueprintWrapper, IActivityBlueprintWrapper activityBlueprintWrapper, CancellationToken cancellationToken)
        {
            var workflowBlueprint = workflowBlueprintWrapper.WorkflowBlueprint;
            var activityBlueprint = activityBlueprintWrapper.ActivityBlueprint;
            var activityId        = activityBlueprint.Id;
            var activityPropertyValueProviders = workflowBlueprint.ActivityPropertyProviders.GetProviders(activityId);
            var activityWrapper = workflowBlueprintWrapper.GetActivity(activityId) !;
            var properties      = new Variables();

            if (activityPropertyValueProviders == null)
            {
                return(properties);
            }

            foreach (var valueProvider in activityPropertyValueProviders)
            {
                var value = await activityWrapper.EvaluatePropertyValueAsync(valueProvider.Key, cancellationToken);

                properties.Set(valueProvider.Key, value);
            }

            return(properties);
        }
コード例 #2
0
 public static IActivityBlueprintWrapper <TActivity> GetUnfilteredActivity <TActivity>(this IWorkflowBlueprintWrapper workflowBlueprintWrapper, string id) where TActivity : IActivity => workflowBlueprintWrapper.FindUnfilteredActivity <TActivity>(x => x.ActivityBlueprint.Id == id) !;
コード例 #3
0
 public TriggerProviderContext(IWorkflowBlueprintWrapper workflowWrapper, IActivityBlueprintWrapper activityWrapper)
 {
     WorkflowWrapper = workflowWrapper;
     ActivityWrapper = activityWrapper;
 }
コード例 #4
0
 public static IActivityBlueprintWrapper <TActivity>?FindUnfilteredActivity <TActivity>(this IWorkflowBlueprintWrapper workflowBlueprintWrapper, Func <IActivityBlueprintWrapper <TActivity>, bool> predicate) where TActivity : IActivity => workflowBlueprintWrapper.Activities.Select(x => x.As <TActivity>()).Where(predicate).FirstOrDefault();
コード例 #5
0
 public static IActivityBlueprintWrapper?GetActivity(this IWorkflowBlueprintWrapper workflowBlueprintWrapper, string id) => workflowBlueprintWrapper.Activities.FirstOrDefault(x => x.ActivityBlueprint.Id == id);
コード例 #6
0
 public static IActivityBlueprintWrapper <TActivity>?FindActivity <TActivity>(this IWorkflowBlueprintWrapper workflowBlueprintWrapper, Func <IActivityBlueprintWrapper <TActivity>, bool>?predicate = default) where TActivity : IActivity => workflowBlueprintWrapper.Filter(predicate).FirstOrDefault();
コード例 #7
0
        public static IEnumerable <IActivityBlueprintWrapper <TActivity> > Filter <TActivity>(this IWorkflowBlueprintWrapper workflowBlueprintWrapper, Func <IActivityBlueprintWrapper <TActivity>, bool>?predicate = default)
            where TActivity : IActivity
        {
            var query = workflowBlueprintWrapper.Activities.Where(x => x.ActivityBlueprint.Type == typeof(TActivity).Name).Select(x => x.As <TActivity>());

            if (predicate != null)
            {
                query = query.Where(predicate);
            }

            return(query);
        }
コード例 #8
0
        private async ValueTask <(Variables InputProperties, Variables OutputProperties)> GetActivityPropertiesAsync(IWorkflowBlueprintWrapper workflowBlueprintWrapper, IActivityBlueprintWrapper activityBlueprintWrapper, CancellationToken cancellationToken)
        {
            var activityBlueprint = activityBlueprintWrapper.ActivityBlueprint;
            var activityType      = await _activityTypeService.GetActivityTypeAsync(activityBlueprint.Type, cancellationToken);

            var activityDescriptor = await _activityTypeService.DescribeActivityType(activityType, cancellationToken);

            var activityId       = activityBlueprint.Id;
            var activityWrapper  = workflowBlueprintWrapper.GetActivity(activityId) !;
            var inputProperties  = new Variables();
            var outputProperties = new Variables();

            foreach (var property in activityDescriptor.InputProperties)
            {
                var value = await GetPropertyValueAsync(workflowBlueprintWrapper.WorkflowBlueprint, activityWrapper, property, cancellationToken);

                inputProperties.Set(property.Name, value);
            }

            foreach (var property in activityDescriptor.OutputProperties)
            {
                // Declare output properties to have at least a complete schema.
                outputProperties.Set(property.Name, null);
            }

            return(inputProperties, outputProperties);
        }