public NextActivityKey SaveBadMarking( WorkflowExecutionContext context, ActivityParameterDictionary parameters) { return TryParseBlankMarking(CommonActivity.LastReadedValue, out _badMarking) ? BpcNextActivityKeys.Yes : BpcNextActivityKeys.No; }
public NextActivityKey NotCanceledCandidatesMoreThenMinRequired( WorkflowExecutionContext context, ActivityParameterDictionary parameters) { var notCanceledCandidateCount = Election.Candidates.Count(cand => !cand.Disabled); return notCanceledCandidateCount > MinRequiredNotCanceledCandidates ? BpcNextActivityKeys.Yes : BpcNextActivityKeys.No; }
public NextActivityKey Mock( WorkflowExecutionContext context, ActivityParameterDictionary parameters) { _logger.LogInfo(Message.Common_Information, parameters.GetParamValue("Text", "-")); context.Sleep(TimeSpan.FromMilliseconds(500)); return context.DefaultNextActivityKey; }
public NextActivityKey CheckCanRestoreCanceledInSD( WorkflowExecutionContext context, ActivityParameterDictionary parameters) { if (_electionManager.СanRestoreCandidateCanseledInSd) return BpcNextActivityKeys.Yes; return BpcNextActivityKeys.No; }
public NextActivityKey SaveLeft( WorkflowExecutionContext context, ActivityParameterDictionary parameters) { return short.TryParse(CommonActivity.LastReadedValue, out _left) ? BpcNextActivityKeys.Yes : BpcNextActivityKeys.No; }
public NextActivityKey IsStampControlEnabled( WorkflowExecutionContext context, ActivityParameterDictionary parameters) { return _recognitionManager.StampControlEnabled ? BpcNextActivityKeys.Yes : BpcNextActivityKeys.No; }
public NextActivityKey ApplyConfig( WorkflowExecutionContext context, ActivityParameterDictionary parameters) { return _configManager.ApplyConfig() ? BpcNextActivityKeys.Yes : BpcNextActivityKeys.No; }
public NextActivityKey SaveVotingResultProtocol( WorkflowExecutionContext context, ActivityParameterDictionary parameters) { return _votingResultManager.SaveVotingResultProtocol() ? BpcNextActivityKeys.Yes : BpcNextActivityKeys.No; }
public NextActivityKey IsSecondScannerAlreadyConnected( WorkflowExecutionContext context, ActivityParameterDictionary parameters) { return _syncManager.IsRemoteScannerConnected ? BpcNextActivityKeys.Yes : BpcNextActivityKeys.No; }
public NextActivityKey IsElectionDayNowInStateSdOnSlaveScanner( WorkflowExecutionContext context, ActivityParameterDictionary parameters) { return IsIsElectionDayOrExtra(_syncManager.RemoteScanner.IsElectionDay) ? BpcNextActivityKeys.Yes : BpcNextActivityKeys.No; }
public NextActivityKey CheckSerialNumbersEquals( WorkflowExecutionContext context, ActivityParameterDictionary parameters) { return _syncManager.LocalScannerSerialNumber == _syncManager.RemoteScannerSerialNumber ? BpcNextActivityKeys.Yes : BpcNextActivityKeys.No; }
public NextActivityKey HasSourceDataChanged( WorkflowExecutionContext context, ActivityParameterDictionary parameters) { return _electionManager.HasSourceDataChanged ? BpcNextActivityKeys.Yes : BpcNextActivityKeys.No; }
public NextActivityKey CheckControlRelations( WorkflowExecutionContext context, ActivityParameterDictionary parameters) { if (!_electionManager.NeedExecuteCheckExpressions) return BpcNextActivityKeys.Yes; return Election.IsControlRelationsSatisfied() ? BpcNextActivityKeys.Yes : BpcNextActivityKeys.No; }
public NextActivityKey GetNextDiagnosticsError( WorkflowExecutionContext context, ActivityParameterDictionary parameters) { if (!_diagnosticsErrorsEnumerator.MoveNext()) return BpcNextActivityKeys.No; return new NextActivityKey(_diagnosticsErrorsEnumerator.Current.ToString()); }
public NextActivityKey IsVotingModeResults( WorkflowExecutionContext context, ActivityParameterDictionary parameters) { return _electionManager.CurrentVotingMode == VotingMode.Results ? BpcNextActivityKeys.Yes : BpcNextActivityKeys.No; }
public NextActivityKey SetDateTime( WorkflowExecutionContext context, ActivityParameterDictionary parameters) { var utcDateTime = _date.AddHours(_time.Hour).AddMinutes(_time.Minute).ToUniversalTime(); _syncManager.SetSystemTime(utcDateTime); return context.DefaultNextActivityKey; }
public NextActivityKey IsDssEnabled( WorkflowExecutionContext context, ActivityParameterDictionary parameters) { return _scannerManager.DoubleSheetSensorEnabled ? BpcNextActivityKeys.Yes : BpcNextActivityKeys.No; }
public NextActivityKey HasCanceledCandidates( WorkflowExecutionContext context, ActivityParameterDictionary parameters) { var election = _electionManager.SourceData.Elections[ElectionIndex]; var canceledCandidatesCount = election.Candidates.Count(cand => cand.Disabled); return canceledCandidatesCount == 0 ? BpcNextActivityKeys.No : BpcNextActivityKeys.Yes; }
public NextActivityKey IsMasterScanner( WorkflowExecutionContext context, ActivityParameterDictionary parameters) { return _syncManager.ScannerRole == ScannerRole.Master ? BpcNextActivityKeys.Yes : BpcNextActivityKeys.No; }
public NextActivityKey IsElectionDayNowInStateSd( WorkflowExecutionContext context, ActivityParameterDictionary parameters) { return IsIsElectionDayOrExtra(_electionManager.IsElectionDay()) ? BpcNextActivityKeys.Yes : BpcNextActivityKeys.No; }
public NextActivityKey IsProtocolsGeneratedForAllElections( WorkflowExecutionContext context, ActivityParameterDictionary parameters) { return _electionManager.SourceData.Elections.Length == _generatedProtocolElectionIds.Count ? BpcNextActivityKeys.Yes : BpcNextActivityKeys.No; }
public NextActivityKey IsProtocolGeneratedForCurrentElection( WorkflowExecutionContext context, ActivityParameterDictionary parameters) { return _generatedProtocolElectionIds.Contains(_currentElection.ElectionId) ? BpcNextActivityKeys.Yes : BpcNextActivityKeys.No; }
public NextActivityKey NeedSayBadBulletinsCount( WorkflowExecutionContext context, ActivityParameterDictionary parameters) { if (_votingResultManager.AddBadBlankToCounterValue && BadBulletinCount > 0) return BpcNextActivityKeys.Yes; return BpcNextActivityKeys.No; }
public WorkflowExecutionContextEventArgs(WorkflowExecutionContext context, Activity activity) { CodeContract.Requires(context != null); CodeContract.Requires(activity != null); Context = context; Activity = activity; }
protected override void Initialize(WorkflowExecutionContext context) { base.Initialize(context); short thick, thin; _scannerManager.GetRelativePaperDensity(out thick, out thin); CurrentThick = Math.Abs(thick); CurrentThin = Math.Abs(thin); }
public NextActivityKey MovePreviousCandidate( WorkflowExecutionContext context, ActivityParameterDictionary parameters) { if (_currentCandidateIndex > 0) _currentCandidateIndex -= 2; else _currentCandidateIndex -= 1; return context.DefaultNextActivityKey; }
public NextActivityKey CanGoToMainVotingMode( WorkflowExecutionContext context, ActivityParameterDictionary parameters) { return _electionManager.IsElectionDay() == ElectionDayСomming.ItsElectionDay && _electionManager.SourceData.ElectionMode == ElectionMode.Real && _electionManager.SourceData.GetTimeToModeStart(VotingMode.Main) > TimeSpan.Zero ? BpcNextActivityKeys.No : BpcNextActivityKeys.Yes; }
public NextActivityKey GenerateVotingResultProtocolOnSlave( WorkflowExecutionContext context, ActivityParameterDictionary parameters) { var election = _electionManager.SourceData.GetElectionByNum(_addInfoEnteredOnMasterElectionId); if (election == null) _logger.LogWarning(Message.WorkflowElectionWithIdFromMasterNotFound, _addInfoEnteredOnMasterElectionId); _votingResultManager.GenerateVotingResultProtocol(election); return context.DefaultNextActivityKey; }
public NextActivityKey ApplyNewConfig( WorkflowExecutionContext context, ActivityParameterDictionary parameters) { short right; if (!short.TryParse(CommonActivity.LastReadedValue, out right)) return BpcNextActivityKeys.No; _scannerManager.SetDoubleSheetSensorLevel(_left, right); return BpcNextActivityKeys.Yes; }
public NextActivityKey PerformDiagnostics( WorkflowExecutionContext context, ActivityParameterDictionary parameters) { _criticalErrorFound = false; _diagnosticsErrors = _scannerManager.PerformDiagnostics(); return _diagnosticsErrors.Count == 0 ? BpcNextActivityKeys.Yes // т.е. все ОК : BpcNextActivityKeys.No; }
private BookmarkProviderContext GetBookmarkProviderContext( IActivityBlueprint activity, WorkflowExecutionContext workflowExecutionContext, CancellationToken cancellationToken, IDictionary <string, ActivityType> activityTypes) { var activityExecutionContext = _activityExecutionContextFactory.CreateActivityExecutionContext( activity, workflowExecutionContext, cancellationToken); var activityType = activityTypes[activity.Type]; return(new BookmarkProviderContext(activityExecutionContext, activityType, BookmarkIndexingMode.WorkflowBlueprint)); }
private async Task PersistAsync(WorkflowExecutionContext workflowContext) { var state = workflowContext.Workflow.State.ToObject <WorkflowState>(); state.Input = workflowContext.Input; state.Output = workflowContext.Output; state.Properties = workflowContext.Properties; state.LastResult = workflowContext.LastResult; state.ExecutedActivities = workflowContext.ExecutedActivities.ToList(); state.ActivityStates = workflowContext.Activities.ToDictionary(x => x.Key, x => x.Value.Activity.Properties); workflowContext.Workflow.State = JObject.FromObject(state); await _workflowStore.SaveAsync(workflowContext.Workflow); }
public NextActivityKey SetVotingModeToTest( WorkflowExecutionContext context, ActivityParameterDictionary parameters) { _electionManager.CurrentVotingMode = VotingMode.Test; _votingResultManager.VotingResults.SetCounterValueKeys( new[] { new VoteKey { VotingMode = VotingMode.Test, BlankType = BlankType.All } }); return(context.DefaultNextActivityKey); }
public static IEnumerable <string> GetNextActivities( WorkflowExecutionContext workflowExecutionContext, string sourceId, IEnumerable <string> outcomes) { var nextConnections = GetNextConnections(workflowExecutionContext, sourceId, outcomes); var query = from connection in nextConnections from activityBlueprint in workflowExecutionContext.WorkflowBlueprint.Activities where activityBlueprint.Id == connection.Target.Activity.Id select activityBlueprint.Id; return(query.Distinct()); }
public Task <T> EvaluateAsync <T>(string expression, WorkflowExecutionContext workflowExecutionContext, CancellationToken cancellationToken) { var workflowApi = new { getArgument = (Func <string, object>)(name => workflowExecutionContext.Workflow.Arguments.GetVariable(name)), getVariable = (Func <string, object>)(name => workflowExecutionContext.CurrentScope.GetVariable(name)), getLastResult = (Func <object>)(() => workflowExecutionContext.CurrentScope.LastResult) }; engine.SetValue("workflow", workflowApi); engine.Execute(expression); var returnValue = engine.GetCompletionValue(); return(Task.FromResult((T)returnValue.ToObject())); }
public override async Task ExecuteAsync( IWorkflowInvoker invoker, WorkflowExecutionContext workflowContext, CancellationToken cancellationToken) { var eventHandlers = workflowContext.ServiceProvider.GetServices <IWorkflowEventHandler>(); var logger = workflowContext.ServiceProvider.GetRequiredService <ILogger <FaultWorkflowResult> >(); var currentActivity = workflowContext.CurrentActivity; await eventHandlers.InvokeAsync( x => x.ActivityFaultedAsync(workflowContext, currentActivity, errorMessage, cancellationToken), logger); workflowContext.Fault(workflowContext.CurrentActivity, errorMessage); }
public NextActivityKey EstablishConnectionToScanner( WorkflowExecutionContext context, ActivityParameterDictionary parameters) { var maxTryCount = parameters.GetParamValue("MaxTryCount", 3); var delay = TimeSpan.Parse(parameters.GetParamValue("Delay", "0:0:5")); if (!_scannerManager.EstablishConnectionToScanner(maxTryCount, delay)) { return(BpcNextActivityKeys.No); } var errorId = parameters.GetParamValueOrThrow <string>("ErrorId"); _workflowManager.ResetErrorCounter(errorId); return(BpcNextActivityKeys.Yes); }
public WorkflowInstance CreateWorkflow( Guid instanceId, string workflowSchemeUri, IEnumerable <KeyValuePair <string, XmlReader> > customXmlSchemas) { CodeContract.Requires(!string.IsNullOrEmpty(workflowSchemeUri)); if (!IsStarted) { StartRuntime(); } var loader = GetService <WorkflowSchemeLoaderService>(); var workflowScheme = loader.CreateInstance(workflowSchemeUri, customXmlSchemas); var context = new WorkflowExecutionContext(workflowScheme); return(CreateWorkflow(instanceId, context)); }
private async Task <WorkflowInstance> TriggerSignalAsync(IWorkflowBlueprint workflowBlueprint, WorkflowInstance workflowInstance, string signal) { var workflowExecutionContext = new WorkflowExecutionContext(ServiceScope.ServiceProvider, workflowBlueprint, workflowInstance); var workflowBlueprintWrapper = new WorkflowBlueprintWrapper(workflowBlueprint, workflowExecutionContext); var activities = workflowBlueprintWrapper.Activities.Where(x => x.ActivityBlueprint.Type == nameof(SignalReceived)); var blockingActivityIds = workflowInstance.BlockingActivities.Where(x => x.ActivityType == nameof(SignalReceived)).Select(x => x.ActivityId).ToList(); var receiveSignalActivities = activities.Where(x => blockingActivityIds.Contains(x.ActivityBlueprint.Id)).ToList(); var receiveSignal = receiveSignalActivities.Single(activity => workflowBlueprintWrapper.GetActivity <SignalReceived>(activity.ActivityBlueprint.Id) !.EvaluatePropertyValueAsync(x => x.Signal).GetAwaiter().GetResult() == signal); var triggeredSignal = new Signal(signal); await WorkflowStorageService.UpdateInputAsync(workflowInstance, new WorkflowInput(triggeredSignal)); var result = await WorkflowRunner.RunWorkflowAsync(workflowBlueprint, workflowInstance, receiveSignal.ActivityBlueprint.Id); return(result.WorkflowInstance !); }
public ReadValueContext( WorkflowExecutionContext context, int indicatorLength, string text, string value, char passwordChar, ReadValueMode readingMode) { CodeContract.Requires(context != null); Context = context; CheckText(indicatorLength, text); OriginalText = text; Value = value; _passwordChar = passwordChar; ReadValueMode = readingMode; }
public NextActivityKey LoadSourceData( WorkflowExecutionContext context, ActivityParameterDictionary parameters) { if (_syncManager.ScannerRole == ScannerRole.Master) { _scannerManager.SetIndicator("Загрузка исходных данных..."); var result = _electionManager.LoadSourceDataFromFile( _sourceDataFileDescriptor, true, out _sourceDataFromFile); if (!result) { return(BpcNextActivityKeys.No); } _logger.LogInfo(Message.Election_SourceDataLoaded); } return(BpcNextActivityKeys.Yes); }
public SignalMethodProvider(WorkflowExecutionContext workflowContext, ISecurityTokenService securityTokenService) { _signalUrlMethod = new GlobalMethod { Name = "signalUrl", Method = serviceProvider => (Func <string, string>)((signal) => { var payload = !String.IsNullOrWhiteSpace(workflowContext.CorrelationId) ? SignalPayload.ForCorrelation(signal, workflowContext.CorrelationId) : SignalPayload.ForWorkflow(signal, workflowContext.WorkflowId); var token = securityTokenService.CreateToken(payload, TimeSpan.FromDays(7)); var httpContextAccessor = serviceProvider.GetRequiredService <IHttpContextAccessor>(); var linkGenerator = serviceProvider.GetRequiredService <LinkGenerator>(); return(linkGenerator.GetPathByAction(httpContextAccessor.HttpContext, "Trigger", "HttpWorkflow", new { area = "OrchardCore.Workflows", token })); }) }; }
public override async Task <ActivityExecutionResult> ExecuteAsync(WorkflowExecutionContext workflowContext, ActivityContext activityContext) { var outcome = "Valid"; await _reCaptchaService.ValidateCaptchaAsync((key, error) => { var updater = _updateModelAccessor.ModelUpdater; outcome = "Invalid"; if (updater != null) { updater.ModelState.TryAddModelError(Constants.ReCaptchaServerResponseHeaderName, T["Captcha validation failed. Try again."]); } }); return(Outcomes("Done", outcome)); }
public override async Task <ActivityExecutionResult> ExecuteAsync(WorkflowExecutionContext workflowContext, ActivityContext activityContext) { var content = await GetContentAsync(workflowContext); var contentItem = await ContentManager.GetAsync(content.ContentItem.ContentItemId, VersionOptions.DraftRequired); if (contentItem != null) { await ContentManager.PublishAsync(contentItem); } else { await ContentManager.PublishAsync(content.ContentItem); } return(Outcomes("Published")); }
public async Task <T> EvaluateAsync <T>(WorkflowExpression <T> expression, WorkflowExecutionContext workflowContext, TextEncoder encoder) { var templateContext = new TemplateContext(_templateOptions); var expressionContext = new WorkflowExecutionExpressionContext(templateContext, workflowContext); await _workflowContextHandlers.InvokeAsync((h, expressionContext) => h.EvaluatingExpressionAsync(expressionContext), expressionContext, _logger); // Set WorkflowContext as a local scope property. var result = await _liquidTemplateManager.RenderStringAsync( expression.Expression, encoder ?? NullEncoder.Default, new Dictionary <string, FluidValue>() { ["Workflow"] = new ObjectValue(workflowContext) } ); return(String.IsNullOrWhiteSpace(result) ? default : (T)Convert.ChangeType(result, typeof(T))); }
public async Task <T> EvaluateAsync <T>(WorkflowExpression <T> expression, WorkflowExecutionContext workflowContext, TextEncoder encoder) { var templateContext = CreateTemplateContext(workflowContext); var expressionContext = new WorkflowExecutionExpressionContext(templateContext, workflowContext); await _workflowContextHandlers.InvokeAsync((h, expressionContext) => h.EvaluatingExpressionAsync(expressionContext), expressionContext, _logger); // Set WorkflowContext as a local scope property. var result = await _liquidTemplateManager.RenderAsync( expression.Expression, encoder ?? NullEncoder.Default, scope => scope.SetValue("Workflow", workflowContext) ); return(string.IsNullOrWhiteSpace(result) ? default(T) : (T)Convert.ChangeType(result, typeof(T))); }
public override async Task ExecuteAsync(IWorkflowInvoker invoker, WorkflowExecutionContext workflowContext, CancellationToken cancellationToken) { if (workflowContext.IsFirstPass) { var activity = workflowContext.CurrentActivity; var result = await invoker.ActivityInvoker.ResumeAsync(workflowContext, activity, cancellationToken); workflowContext.IsFirstPass = false; await result.ExecuteAsync(invoker, workflowContext, cancellationToken); } else { workflowContext.Halt(); } }
public NextActivityKey CheckNewDate( WorkflowExecutionContext context, ActivityParameterDictionary parameters) { var dateValid = DateTime.TryParseExact( CommonActivity.LastReadedValue, "ddMMyyyy", null, DateTimeStyles.None, out _date); if (_date.Year < 2010) { dateValid = false; } return(dateValid ? BpcNextActivityKeys.Yes : BpcNextActivityKeys.No); }
public async Task <T> EvaluateAsync <T>(string expression, WorkflowExecutionContext workflowContext, IDictionary <string, object> arguments = null, CancellationToken cancellationToken = default) { var templateContext = await CreateTemplateContextAsync(workflowContext); var expressionContext = new WorkflowExecutionLiquidContext(templateContext, workflowContext); await _workflowContextHandlers.InvokeAsync(x => x.EvaluatingLiquidAsync(expressionContext), _logger); var result = await _liquidTemplateManager.RenderAsync(expression, System.Text.Encodings.Web.JavaScriptEncoder.Default, templateContext); return(string.IsNullOrWhiteSpace(result) ? default : (T)Convert.ChangeType(result, typeof(T))); }
public NextActivityKey WaitEvents( WorkflowExecutionContext context, ActivityParameterDictionary parameters) { var waitedEvents = GetWaitedEvents(parameters); var nextActivityKeyResolver = GetNextActivityKeyResolver(parameters); var composer = CreatePhraseComposer(parameters, true); var text = composer.ComposeText(); int occurredEventIndex; return(SayAndWaitEvents( context, text, null, null, null, true, false, waitedEvents, 0, Timeout.Infinite, nextActivityKeyResolver, out occurredEventIndex)); }
public async Task <T> EvaluateAsync <T>(WorkflowExpression <T> expression, WorkflowExecutionContext workflowContext, params IGlobalMethodProvider[] scopedMethodProviders) { if (String.IsNullOrWhiteSpace(expression.Expression)) { return(await Task.FromResult <T>(default(T))); } var workflowType = workflowContext.WorkflowType; var directive = $"js:{expression}"; var expressionContext = new WorkflowExecutionScriptContext(workflowContext); await _workflowContextHandlers.InvokeAsync((h, expressionContext) => h.EvaluatingScriptAsync(expressionContext), expressionContext, _logger); var methodProviders = scopedMethodProviders.Concat(expressionContext.ScopedMethodProviders); return((T)_scriptingManager.Evaluate(directive, null, null, methodProviders)); }
private async Task <TemplateContext> CreateTemplateContextAsync(WorkflowExecutionContext workflowContext) { var context = new TemplateContext(); var services = _serviceProvider; // Set WorkflowContext as the model. context.MemberAccessStrategy.Register <LiquidPropertyAccessor, FluidValue>((obj, name) => obj.GetValueAsync(name)); context.MemberAccessStrategy.Register <WorkflowExecutionContext>(); context.MemberAccessStrategy.Register <WorkflowExecutionContext, LiquidPropertyAccessor>("Input", obj => new LiquidPropertyAccessor(name => ToFluidValue(obj.Input, name))); context.MemberAccessStrategy.Register <WorkflowExecutionContext, LiquidPropertyAccessor>("Output", obj => new LiquidPropertyAccessor(name => ToFluidValue(obj.Output, name))); context.MemberAccessStrategy.Register <WorkflowExecutionContext, LiquidPropertyAccessor>("Properties", obj => new LiquidPropertyAccessor(name => ToFluidValue(obj.Properties, name))); context.SetValue("Workflow", workflowContext); // Add services. context.AmbientValues.Add("Services", services); // Add UrlHelper, if we have an MVC Action context. var actionContext = services.GetService <IActionContextAccessor>()?.ActionContext; if (actionContext != null) { var urlHelperFactory = services.GetRequiredService <IUrlHelperFactory>(); var urlHelper = urlHelperFactory.GetUrlHelper(actionContext); context.AmbientValues.Add("UrlHelper", urlHelper); } // Add ShapeFactory. var shapeFactory = services.GetRequiredService <IShapeFactory>(); context.AmbientValues.Add("ShapeFactory", shapeFactory); // Add View Localizer. var localizer = services.GetRequiredService <IViewLocalizer>(); context.AmbientValues.Add("ViewLocalizer", localizer); // TODO: Extract the request culture. // Give modules a chance to add more things to the template context. foreach (var handler in services.GetServices <ILiquidTemplateEventHandler>()) { await handler.RenderingAsync(context); } return(context); }
public override void SaveWorkflowInstanceState(WorkflowExecutionContext context) { try { var fileName = GetFileName(context.InstanceId); using (var stream = File.Open(fileName, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.None)) { WorkflowExecutionContext.Save(context, stream); } } catch (Exception ex) { throw new Exception(string.Format( "Ошибка сохранения состояния экземпляра потока работ с идентификатором {0}", context.InstanceId), ex); } }
private bool IsAnyBlockingActivityInScope(WorkflowExecutionContext workflowExecutionContext, string scopeActivityId) { // Get all blocking activity IDs. var blockingActivityIds = workflowExecutionContext.WorkflowInstance.BlockingActivities.Select(x => x.ActivityId).ToHashSet(); // For each blocking activity, check if it is within the current scope (taking the first one). foreach (var blockingActivityId in blockingActivityIds) { var inboundActivityIds = new[] { blockingActivityId }.Concat(workflowExecutionContext.GetInboundActivityPath(blockingActivityId)).ToHashSet(); if (inboundActivityIds.Contains(scopeActivityId)) { return(true); } } return(false); }
protected override void Initialize(WorkflowExecutionContext context) { base.Initialize(context); var app = CoreApplication.Instance; _workflowManager = app.GetSubsystemOrThrow <IWorkflowManager>(); _scannerManager = app.GetSubsystemOrThrow <IScannerManager>(); _electionManager = app.GetSubsystemOrThrow <IElectionManager>(); _votingResultManager = app.GetSubsystemOrThrow <IVotingResultManager>(); _syncManager = app.GetSubsystemOrThrow <ISynchronizationManager>(); _soundManager = app.GetSubsystemOrThrow <ISoundManager>(); _keyboard = app.GetSubsystemOrThrow <UnionKeyboard>(); _configManager = app.GetSubsystemOrThrow <IConfigurationManager>(); _fileSystemManager = app.GetSubsystemOrThrow <IFileSystemManager>(); _printingManager = app.GetSubsystemOrThrow <IPrintingManager>(); _recognitionManager = app.GetSubsystemOrThrow <IRecognitionManager>(); _logger = _workflowManager.Logger; }
private async Task <RunWorkflowResult> BeginWorkflow(WorkflowExecutionContext workflowExecutionContext, IActivityBlueprint?activity, CancellationToken cancellationToken) { if (activity == null) { activity = _startingActivitiesProvider.GetStartActivities(workflowExecutionContext.WorkflowBlueprint).FirstOrDefault() ?? workflowExecutionContext.WorkflowBlueprint.Activities.First(); } if (!await CanExecuteAsync(workflowExecutionContext, activity, false, cancellationToken)) { return(new RunWorkflowResult(workflowExecutionContext.WorkflowInstance, activity.Id, false)); } workflowExecutionContext.Begin(); workflowExecutionContext.ScheduleActivity(activity.Id); await RunAsync(workflowExecutionContext, Execute, cancellationToken); return(new RunWorkflowResult(workflowExecutionContext.WorkflowInstance, activity.Id, true)); }
public override ActivityExecutionResult Execute(WorkflowExecutionContext workflowContext, ActivityContext activityContext) { var updater = _updateModelAccessor.ModelUpdater; if (updater == null) { throw new InvalidOperationException("Cannot add model validation errors when there's no Updater present."); } var httpContext = _httpContextAccessor.HttpContext; foreach (var item in httpContext.Request.Form) { updater.ModelState.SetModelValue(item.Key, item.Value, item.Value); } return(Outcomes("Done")); }
public static IEnumerable <IConnection> GetNextConnections( WorkflowExecutionContext workflowContext, string sourceId, IEnumerable <string> outcomes) { var orderedOutcomes = outcomes.Select((outcome, order) => (outcome, order)); var query = from connection in workflowContext.WorkflowBlueprint.Connections from outcome in orderedOutcomes let connectionOutcome = connection.Source.Outcome ?? OutcomeNames.Done let isConnectionOutcome = connectionOutcome.Equals(outcome.outcome, StringComparison.OrdinalIgnoreCase) where connection.Source.Activity.Id == sourceId && isConnectionOutcome orderby outcome.order select connection; return(query); }
protected WorkflowExecutionContext CreateWorkflowExecutionContext(Entity targetEntity, Entity preEntity, Entity postEntity) { WorkflowExecutionContext workflowExecutionContext = CreateWorkflowExecutionContext(); if (targetEntity != null) { workflowExecutionContext.InputParameters[PlatformConstants.TargetText] = targetEntity; } if (preEntity != null) { workflowExecutionContext.PreEntityImages[PlatformConstants.PreBusinessEntityText] = preEntity; } if (postEntity != null) { workflowExecutionContext.PostEntityImages[PlatformConstants.PostBusinessEntityText] = postEntity; } return(workflowExecutionContext); }
protected override IList <ModificationBuilder> CreateModifications(WorkflowExecutionContext context) { var entityInfo = context.GetVariable <EntityInfo>("EntityInfo"); var entityDtoUsingText = context.GetVariable <string>("EntityDtoUsingText"); return(new List <ModificationBuilder> { new InsertionBuilder( root => root.Descendants <UsingDirectiveSyntax>().Last().GetEndLine(), entityDtoUsingText, modifyCondition: root => root.DescendantsNotContain <UsingDirectiveSyntax>(entityDtoUsingText) ), new InsertionBuilder( root => root.Descendants <ConstructorDeclarationSyntax>().Single().GetEndLine(), TextGenerator.GenerateByTemplateName("WebAutoMapperProfile_CreateMap", new { EntityInfo = entityInfo }) ) }); }