public async Task IntegrationTestWorkflowNonStoreFail() { using (var engine = new WorkflowEngine()) { #pragma warning disable 1998 var storeWorkflow = new SequentialWorkflow( async instance => #pragma warning restore 1998 { var store = WorkflowStore.TryGetStore(instance); var argStoreLoaded = instance.GetArgument <bool>("StoreLoaded"); if (store != null) { argStoreLoaded.Value = true; } }); var workflowInstance = engine.CreateWorkflow(storeWorkflow); await workflowInstance.Start(new Argument <bool>("StoreLoaded")); await workflowInstance.Wait(); Assert.AreEqual(false, workflowInstance.GetArgument <bool>("StoreLoaded").Value); } }
public void Save_Workflow() { var path = $@"..\..\..\Activities\XAMLs\{nameof(Save_Workflow)}.xaml"; var expected = File.ReadAllText(path); var wf = new SequentialWorkflow { Title = "Test" }; wf.Activities.Add(new Delay { Timeout = 300 }); var forRange = new ForRange { Start = 3, Count = 10 }; forRange.Activities.Add(new Click { Position = new Point(0, 123) }); forRange.Activities.Add(new KeyStroke { Timeout = 500, Key = Keys.Control | Keys.A }); wf.Activities.Add(forRange); Assert.AreEqual(expected, XamlServices.Save(wf)); var o = (SequentialWorkflow)XamlServices.Parse(expected); }
public override Activity GenerateActivityOnWorkflow(SequentialWorkflow workflow) { Logger.Instance.WriteMethodEntry(); try { // Create a new instance of the GenerateUniqueValue activity and assign // dependenty property values based on inputs to standard activity controls GenerateUniqueValue wfa = new GenerateUniqueValue { ActivityDisplayName = this.activityDisplayName.Value, ActivityExecutionCondition = this.activityExecutionCondition.Value, PublicationTarget = this.publicationTarget.Value, ConflictFilter = this.conflictFilter.Value, QueryLdap = this.queryLdap.Value, UniquenessSeed = this.uniquenessSeed.Value, ValueExpressions = this.FetchValueExpressions() }; DefinitionsConverter ldapQueriesConverter = new DefinitionsConverter(this.ldapQueries.DefinitionListings); wfa.LdapQueriesTable = ldapQueriesConverter.DefinitionsTable; return(wfa); } catch (Exception e) { Logger.Instance.ReportError(e); throw; } finally { Logger.Instance.WriteMethodExit(); } }
public void GetPi_Methods() { var context = new WorkflowContext(); context.Variables.Add(new Variable <double> { VariableName = "sum", Value = 1.0 }); context.Variables.Add(new Variable <double> { VariableName = "p", Value = 1.0 }); var wf = new SequentialWorkflow(); var forRange = new ForRange { Start = 3, Count = 50, Step = 2 }; forRange.Activities.Add(new InvokeMethod { Type = typeof(SequentialWorkflowTest), MethodName = "NextP" }); forRange.Activities.Add(new InvokeMethod { Type = typeof(SequentialWorkflowTest), MethodName = "AddTerm" }); wf.Activities.Add(forRange); wf.Activities.Add(new InvokeMethod { Type = typeof(SequentialWorkflowTest), MethodName = "Sqrt12" }); wf.Execute(context); AssertNearlyEqual(Math.PI, context.Variables.Get <double>("pi")); }
public void GetSqrt_Expression() { var context = new WorkflowContext(); context.Variables.Add(new Variable <double> { VariableName = "a", Value = 5.0 }); var wf = new SequentialWorkflow(); wf.Activities.Add(new Expression { Text = "x = a" }); var forRange = new ForRange { Count = 100 }; forRange.Activities.Add(new Expression { Text = "xi = (x + a / x) / 2" }); var ifReturn = new If { Condition = "x == xi" }; ifReturn.Activities.Add(new Return()); forRange.Activities.Add(ifReturn); forRange.Activities.Add(new Expression { Text = "x = xi" }); wf.Activities.Add(forRange); wf.Execute(context); AssertNearlyEqual(Math.Sqrt(5.0), context.Variables.Get <double>("x")); }
public void GetPi_Expression() { var context = new WorkflowContext(); context.Variables.Add(new Variable <double> { VariableName = "sum", Value = 1.0 }); context.Variables.Add(new Variable <double> { VariableName = "p", Value = 1.0 }); var wf = new SequentialWorkflow(); var forRange = new ForRange { Start = 3, Count = 50, Step = 2 }; forRange.Activities.Add(new Expression { Text = "p *= -3" }); forRange.Activities.Add(new Expression { Text = "sum += 1 / (i * p)" }); wf.Activities.Add(forRange); wf.Activities.Add(new Expression { Text = "pi = Math.Sqrt(12) * sum" }); wf.Execute(context); AssertNearlyEqual(Math.PI, context.Variables.Get <double>("pi")); }
public override Activity GenerateActivityOnWorkflow(SequentialWorkflow workflow) { Logger.Instance.WriteMethodEntry(); try { // Create a new instance of the SendEmailNotification activity and assign // dependenty property values based on inputs to standard activity controls SendEmailNotification wfa = new SendEmailNotification { ActivityDisplayName = this.activityDisplayName.Value, Advanced = this.advanced.Value, ActivityExecutionCondition = this.activityExecutionCondition.Value, EmailTemplate = this.emailTemplate.Value, To = this.to.Value, CC = this.cc.Value, Bcc = this.bcc.Value, SuppressException = this.suppressException.Value, }; return(wfa); } catch (Exception e) { Logger.Instance.ReportError(e); throw; } finally { Logger.Instance.WriteMethodExit(); } }
public override Activity GenerateActivityOnWorkflow(SequentialWorkflow workflow) { Logger.Instance.WriteMethodEntry(); try { // Create a new instance of the RequestApproval activity and assign // dependenty property values based on inputs to standard activity controls RequestApproval wfa = new RequestApproval { ActivityDisplayName = this.activityDisplayName.Value, ActivityExecutionCondition = this.activityExecutionCondition.Value, Approvers = this.approvers.Value, Threshold = this.threshold.Value, Duration = this.duration.Value, Escalation = this.escalation.Value, ApprovalEmailTemplate = this.approvalEmailTemplate.Value, EscalationEmailTemplate = this.approvalEscalationEmailTemplate.Value, ApprovalCompleteEmailTemplate = this.approvalCompleteEmailTemplate.Value, ApprovalDeniedEmailTemplate = this.approvalDeniedEmailTemplate.Value, ApprovalTimeoutEmailTemplate = this.approvalTimeoutEmailTemplate.Value, }; return(wfa); } catch (Exception e) { Logger.Instance.ReportError(e); throw; } finally { Logger.Instance.WriteMethodExit(); } }
protected override void Initialize(IServiceProvider provider) { SequentialWorkflow containingSequentialWorkflow = null; SequentialWorkflow.TryGetContainingWorkflow(this, out containingSequentialWorkflow); //using (ServiceSecurityContext.Current.WindowsIdentity.Impersonate()) //{ // using (DefaultClient client = new DefaultClient()) // { // client.RefreshSchema(); // Guid targetUser; // if (containingSequentialWorkflow.ActorId == CellOTPGate.AnonymousID) // { targetUser = containingSequentialWorkflow.TargetId; } // else // { targetUser = containingSequentialWorkflow.ActorId; } // RmPerson person = client.Get(new Microsoft.ResourceManagement.ObjectModel.RmReference(targetUser.ToString())) as RmPerson; // userCellPhone = person.MobilePhone; // } //} base.Initialize(provider); }
public override Activity GenerateActivityOnWorkflow(SequentialWorkflow workflow) { Logger.Instance.WriteMethodEntry(); try { // Create a new instance of the AddDelay activity and assign // dependenty property values based on inputs to standard activity controls AddDelay wfa = new AddDelay { ActivityDisplayName = this.activityDisplayName.Value, ActivityExecutionCondition = this.activityExecutionCondition.Value, TimeoutDuration = this.timeoutDuration.Value, }; return(wfa); } catch (Exception e) { Logger.Instance.ReportError(e); throw; } finally { Logger.Instance.WriteMethodExit(); } }
/// <summary> /// Copy the FIM WorkflowData items to a Dictionary /// </summary> /// <param name="variablesInputString">the String containing the WorkflowData item name(s)</param> /// <returns>a Dictionary containing WorkflowData.Name WorkflowData.Value</returns> private Dictionary <String, Object> PowerShellSessionVariables(String variablesInputString) { Dictionary <String, Object> powerShellSessionVariables = new Dictionary <String, Object>(); // In order to read the Workflow Dictionary we need to get the containing (parent) workflow SequentialWorkflow containingWorkflow = null; if (!SequentialWorkflow.TryGetContainingWorkflow(this, out containingWorkflow)) { throw new InvalidOperationException("Unable to get Containing Workflow"); } String logOutput = "Containing Workflow Dictionary (WorkflowData):"; foreach (String workflowDataName in variablesInputString.Split(new Char[] { ' ', ',', '.', ':', ';' })) { try { String workflowDataValue = containingWorkflow.WorkflowDictionary[workflowDataName].ToString(); powerShellSessionVariables.Add(workflowDataName, workflowDataValue); logOutput += String.Format("\n\t{0}: {1}", workflowDataName, workflowDataValue); } catch (KeyNotFoundException keyNotFoundException) { trace.TraceFatal("Required item missing from FIM Workflow Data.\n", keyNotFoundException.StackTrace); throw new KeyNotFoundException("Required item missing from FIM Workflow Data.", keyNotFoundException.InnerException); } } trace.TraceVerbose(logOutput); return(powerShellSessionVariables); }
public async Task TestWorkflowStoreInterfaceSyncState <TStore>(WorkflowEngine <TStore> engine) where TStore : IWorkflowStore { var storeWorkflow = new SequentialWorkflow( async instance => { var store = WorkflowStore.TryGetStore(instance); var argCounter = instance.GetArgument <int>("Counter"); var argInternalCounter = instance.GetArgument <int>("InternalCounter"); var parallelWorkflow = new ParallelWorkflow(); parallelWorkflow.Add( Workflow.Create( async internalInstance => { // only one sync state should make it through for outer instance if (!await store.SyncState("SyncIncrement", instance)) { argCounter.Value += 1; } // both parallel workflows should be able to enter their internal instance sync state if (!await store.SyncState("SyncIncrement", internalInstance)) { argInternalCounter.Value += 1; } })); parallelWorkflow.Add( Workflow.Create( async internalInstance => { // only one sync state should make it through for outer instance if (!await store.SyncState("SyncIncrement", instance)) { argCounter.Value += 1; } // both parallel workflows should be able to enter their internal instance sync state if (!await store.SyncState("SyncIncrement", internalInstance)) { argInternalCounter.Value += 1; } })); await instance.EnterWorkflow(parallelWorkflow); }); var workflowInstance = engine.CreateWorkflow(storeWorkflow); await workflowInstance.Start(new Argument <int>("Counter"), new Argument <int>("InternalCounter")); await workflowInstance.Wait(); Assert.AreEqual(1, workflowInstance.GetArgument <int>("Counter").Value); Assert.AreEqual(2, workflowInstance.GetArgument <int>("InternalCounter").Value); }
public override Activity GenerateActivityOnWorkflow(SequentialWorkflow workflow) { Logger.Instance.WriteMethodEntry(); try { // Generate a new instance of the Run PowerShell Script activity // and add properties based on specified values RunPowerShellScript wfa = new RunPowerShellScript { ActivityDisplayName = this.activityDisplayName.Value, Advanced = this.advanced.Value, ActivityExecutionCondition = this.activityExecutionCondition.Value, PowerShellUser = this.powerShellUser.Value, PowerShellUserPassword = this.powerShellUserPassword.Value, ImpersonatePowerShellUser = this.impersonatePowerShellUser.Value, ImpersonatePowerShellUserLoadUserProfile = this.loadUserProfile.Value, ImpersonatePowerShellUserLogOnType = this.impersonatePowerShellUser.Value ? GetImpersonationLogOnType(this.impersonationLogOnType.Value) : LogOnType.None, ScriptLocation = GetScriptLocation(this.scriptLocation.Value), Script = this.script.Value, FailOnMissing = this.failOnMissing.Value, InputType = GetInputType(this.inputType.Value), ReturnType = GetReturnType(this.returnType.Value), ReturnValueLookup = this.returnValueLookup.Value }; // Depending on the input type selection, // the activity will be configured with parameters or arguments, but not both switch (wfa.InputType) { case PowerShellInputType.Parameters: { DefinitionsConverter parametersConverter = new DefinitionsConverter(this.parameters.DefinitionListings); wfa.ParametersTable = parametersConverter.DefinitionsTable; } break; case PowerShellInputType.Arguments: { wfa.Arguments = this.FetchArguments(); } break; } return(wfa); } catch (Exception e) { Logger.Instance.ReportError(e); throw; } finally { Logger.Instance.WriteMethodExit(); } }
public override Activity GenerateActivityOnWorkflow(SequentialWorkflow workflow) { CellOTPGate cellOTPGate = new CellOTPGate(); AuthenticationGateActivity authNGateActivity = new AuthenticationGateActivity(); authNGateActivity.AuthenticationGate = cellOTPGate; return authNGateActivity; }
protected override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext) { SequentialWorkflow containingSequentialWorkflow = null; SequentialWorkflow.TryGetContainingWorkflow(this, out containingSequentialWorkflow); this.readResourceActivity1.ActorId = new Guid("e05d1f1b-3d5e-4014-baa6-94dee7d68c89"); this.readResourceActivity1.ResourceId = containingSequentialWorkflow.TargetId; return(base.Execute(executionContext)); }
/// <summary> /// Called when a user clicks the Save button in the Workflow Designer. /// Returns an instance of the Activity class that /// has its properties set to the values entered into the text box controls /// used in the UI of the activity. /// </summary> public override Activity GenerateActivityOnWorkflow(SequentialWorkflow workflow) { PowerShellActivity powerShellActivity = new PowerShellActivity(); powerShellActivity.Script = this.GetText("txtScript"); powerShellActivity.PowerShellModule = this.GetText("txtPowerShellModule"); powerShellActivity.PowerShellVariables = this.GetText("txtPowerShellVariables"); powerShellActivity.WorkflowDataNameForOutput = this.GetText("txtWorkflowDataNameForOutput"); return powerShellActivity; }
public override Activity GenerateActivityOnWorkflow(SequentialWorkflow workflow) { CellOTPGate cellOTPGate = new CellOTPGate(); AuthenticationGateActivity authNGateActivity = new AuthenticationGateActivity(); authNGateActivity.AuthenticationGate = cellOTPGate; return(authNGateActivity); }
public override Activity GenerateActivityOnWorkflow(SequentialWorkflow workflow) { if (!this.ValidateInputs()) { return(null); } CustomCodeActivity activity = new CustomCodeActivity(); SaveSettingsOnActivity(activity); return(activity); }
/// <summary> /// Called when a user clicks the Save button in the Workflow Designer. /// Returns an instance of the Activity class that /// has its properties set to the values entered into the text box controls /// used in the UI of the activity. /// </summary> public override Activity GenerateActivityOnWorkflow(SequentialWorkflow workflow) { PowerShellActivity powerShellActivity = new PowerShellActivity(); powerShellActivity.Script = this.GetText("txtScript"); powerShellActivity.PowerShellModule = this.GetText("txtPowerShellModule"); powerShellActivity.PowerShellVariables = this.GetText("txtPowerShellVariables"); powerShellActivity.WorkflowDataNameForOutput = this.GetText("txtWorkflowDataNameForOutput"); return(powerShellActivity); }
/// <summary> /// Called when a user clicks the Save button in the Workflow Designer. /// Returns an instance of the RequestLoggingActivity class that /// has its properties set to the values entered into the text box controls /// used in the UI of the activity. /// </summary> public override Activity GenerateActivityOnWorkflow(SequentialWorkflow workflow) { if (!this.ValidateInputs()) { return(null); } AssignManagerToCostCenterActivity _calc = new AssignManagerToCostCenterActivity(); // _calc.SetSource1 = this.GetText("_src"); // _calc.SetDest1 = this.GetText("_dest"); return(_calc); }
void RecordButton_Unchecked(object sender, RoutedEventArgs e) { RecordButton.Content = "Record"; MouseHook.Stop(); KeyboardHook.Stop(); workflow = input.GetWorkflow(); if (workflow.Activities.Any()) { XamlServices.Save($@"{OutputDirName}\{DateTime.Now:yyyyMMdd-HHmmss}.xaml", workflow); } }
/// <summary> /// Called when a user clicks the Save button in the Workflow Designer. /// Returns an instance of the RequestLoggingActivity class that /// has its properties set to the values entered into the text box controls /// used in the UI of the activity. /// </summary> public override Activity GenerateActivityOnWorkflow(SequentialWorkflow workflow) { if (!this.ValidateInputs()) { return(null); } DerivativeAttributesGeneration _calc = new DerivativeAttributesGeneration(); _calc.UpnSuffix = this.GetText("_upnSuffix"); // _calc.SetSource1 = this.GetText("_src"); // _calc.SetDest1 = this.GetText("_dest"); return(_calc); }
/// <summary> /// Handles the ExecuteCode event of the PrepareDelete CodeActivity. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> private void PrepareDelete_ExecuteCode(object sender, EventArgs e) { Logger.Instance.WriteMethodEntry(EventIdentifier.DeleteResourcesPrepareDeleteExecuteCode, "TargetType: '{0}'.", this.TargetType); try { // Determine the resources to be deleted based on the target type switch (this.TargetType) { case DeleteResourcesTargetType.WorkflowTarget: // If the activity is configured to delete the workflow target, // load the target from the parent workflow SequentialWorkflow parentWorkflow; if (SequentialWorkflow.TryGetContainingWorkflow(this, out parentWorkflow)) { this.Targets.Add(parentWorkflow.TargetId); } break; case DeleteResourcesTargetType.SearchForTarget: // If the activity is configured to search for the target(s), // the targets should be the bound results of the find resources activity break; case DeleteResourcesTargetType.ResolveTarget: // If the activity is configured to resolve target(s), // verify that the supplied lookup resolved to a Guid or List<Guid> and assign the resolved // values as targets if (this.Resolve.Lookups.ContainsKey(this.TargetExpression) && this.Resolve.Lookups[this.TargetExpression] != null) { if (this.Resolve.Lookups[this.TargetExpression] is Guid) { this.Targets.Add((Guid)this.Resolve.Lookups[this.TargetExpression]); } else if (this.Resolve.Lookups[this.TargetExpression].GetType() == typeof(List <Guid>)) { this.Targets = (List <Guid>) this.Resolve.Lookups[this.TargetExpression]; } } break; } } finally { Logger.Instance.WriteMethodExit(EventIdentifier.DeleteResourcesPrepareDeleteExecuteCode, "TargetType: '{0}'. Target Count: {1}.", this.TargetType, this.Targets.Count); } }
/// <summary> /// Called when a user clicks the Save button in the Workflow Designer. /// Returns an instance of the RequestLoggingActivity class that /// has its properties set to the values entered into the text box controls /// used in the UI of the activity. /// </summary> public override Activity GenerateActivityOnWorkflow(SequentialWorkflow workflow) { if (!this.ValidateInputs()) { return(null); } return(new OktaFactorReset { TenantUrl = this.GetText(OktaFactorResetUI.TenantUrlID), AllowedFactorTypes = this.GetText(OktaFactorResetUI.AllowedFactorTypesID), OktaIdAttributeName = this.GetText(OktaFactorResetUI.OktaIdAttributeNameID) }); }
/// <summary> /// Executes the activity. /// </summary> /// <param name="executionContext">The execution context.</param> /// <returns>The <see cref="ActivityExecutionStatus"/> object.</returns> protected override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext) { Logger.Instance.WriteMethodEntry(EventIdentifier.AsyncUpdateResourceExecute); try { // Ideally we would set CallContext in OnActivityExecutionContextLoad instead here in Execute // as OnActivityExecutionContextLoad gets called on each hydration and rehydration of the workflow instance // but looks like it's invoked on a different thread context than the rest of the workflow instance execution. // To minimize the loss of the CallContext on rehydration, we'll set it in the Execute of every WAL child activities. // It will still get lost (momentarily) when the workflow is persisted in the middle of the execution of a replicator activity, for example. Logger.SetContextItem(this, this.WorkflowInstanceId); SequentialWorkflow parentWorkflow; if (!SequentialWorkflow.TryGetContainingWorkflow(this, out parentWorkflow)) { throw Logger.Instance.ReportError(new InvalidOperationException(Messages.UnableToGetParentWorkflowError)); } // Create the workflow program queue so we can facilitate asynchronous // submission of requests WorkflowQueue queue = CreateWorkflowProgramQueue(this.queuingService, this); object[] args = new object[] { this.ActorId, this.ResourceId, this.UpdateParameters, parentWorkflow.RequestId, this.ApplyAuthorizationPolicy, 0, queue.QueueName }; Logger.Instance.WriteVerbose(EventIdentifier.AsyncUpdateResourceExecute, "Invoking DataAccessService.Update() for ActorId: '{0}', ResourceId: '{1}', ParentRequestId: '{3}' ApplyAuthorizationPolicy: '{4}' and QueueName: '{6}'.", args); // Submit the request via reflection and cleanup the queue // Added the AuthorizationTimeOut value of 0, which is "Fire and Forget" this.dataAccessServiceType.InvokeMember( "Update", BindingFlags.InvokeMethod | BindingFlags.Public | BindingFlags.Instance, null, this.dataAccessService, args, CultureInfo.InvariantCulture); DeleteWorkflowProgramQueue(this.queuingService, queue); return(base.Execute(executionContext)); } catch (Exception ex) { throw Logger.Instance.ReportError(EventIdentifier.AsyncUpdateResourceExecuteError, ex); } finally { Logger.Instance.WriteMethodExit(EventIdentifier.AsyncUpdateResourceExecute); } }
/// <summary> /// Called when a user clicks the Save button in the Workflow Designer. /// Returns an instance of the RequestLoggingActivity class that /// has its properties set to the values entered into the text box controls /// used in the UI of the activity. /// </summary> public override Activity GenerateActivityOnWorkflow(SequentialWorkflow workflow) { if (!this.ValidateInputs()) { return(null); } return(new OktaGroupMembership { TenantUrl = this.GetText(OktaGroupMembershipUI.TenantUrlID), AllowedFactorTypes = this.GetText(OktaGroupMembershipUI.OktaGroupID), OktaIdAttributeName = this.GetText(OktaGroupMembershipUI.OktaIdAttributeNameID), MembershipOperation = this.GetDropDownValue(OktaGroupMembershipUI.MembershipOperationID) ?? "Add", }); }
public static void SetContextItem(Activity activity, Guid workflowInstanceId) { Logger.SetContextItem("WorkflowInstanceId", workflowInstanceId); SequentialWorkflow parentWorkflow; if (!SequentialWorkflow.TryGetContainingWorkflow(activity, out parentWorkflow)) { return; } Logger.SetContextItem("RequestId", parentWorkflow.RequestId); Logger.SetContextItem("ActorId", parentWorkflow.ActorId); Logger.SetContextItem("TargetId", parentWorkflow.TargetId); Logger.SetContextItem("WorkflowDefinitionId", parentWorkflow.WorkflowDefinitionId); }
public override Activity GenerateActivityOnWorkflow(SequentialWorkflow workflow) { Logger.Instance.WriteMethodEntry(); try { // Create a new instance of the CreateResource activity and assign // dependency property values based on inputs to standard activity controls CreateResource wfa = new CreateResource { ActivityDisplayName = this.activityDisplayName.Value, ResourceType = this.resourceType.Value, Advanced = this.advanced.Value, QueryResources = this.queryResources.Value, ActivityExecutionCondition = this.activityExecutionCondition.Value, Iteration = this.iteration.Value, ActorType = GetActorType(this.actorType.Value), ActorString = this.actorString.Value, ApplyAuthorizationPolicy = this.applyAuthorizationPolicy.Value, CreatedResourceIdTarget = this.createdResourceIdTarget.Value, CheckForConflict = this.checkForConflict.Value, ConflictFilter = this.conflictFilter.Value, ConflictingResourceIdTarget = this.conflictingResourceIdTarget.Value, FailOnConflict = this.failOnConflict.Value }; // Convert the definition listings (web controls) to hash tables which can be serialized to the XOML workflow definition // A hash table is used due to issues with deserialization of lists and other structured data DefinitionsConverter queriesConverter = new DefinitionsConverter(this.queries.DefinitionListings); DefinitionsConverter attributesConverter = new DefinitionsConverter(this.attributes.DefinitionListings); wfa.QueriesTable = queriesConverter.DefinitionsTable; wfa.AttributesTable = attributesConverter.DefinitionsTable; return(wfa); } catch (Exception e) { Logger.Instance.ReportError(e); throw; } finally { Logger.Instance.WriteMethodExit(); } }
private void InitializeUpdate_ExecuteCode(object sender, EventArgs e) { if (readResourceActivity1.Resource["labSource"].ToString() == "INTERNAL") { if (countUpn <= 1) { displayName = firstName + " " + lastName; } else { displayName = firstName + " " + lastName + countUpn.ToString(); } } else { if (countUpn <= 1) { displayName = firstName + " " + lastName + ",EX"; } else { displayName = firstName + " " + lastName + countUpn.ToString() + ",EX"; } } //Get containing Workflow SequentialWorkflow containingWorkflow = null; if (!SequentialWorkflow.TryGetContainingWorkflow(this, out containingWorkflow)) { throw new InvalidOperationException("Could not get parent workflow!"); } string displayNameSuffix = ReadWorkFlowParameters(UpnSuffix, containingWorkflow); displayName += displayNameSuffix; updateResourceActivity1_ActorId1 = requestorGUID; updateResourceActivity1_ResourceId1 = targetGUID; updateResourceActivity1.UpdateParameters = new UpdateRequestParameter[] { new UpdateRequestParameter("AccountName", UpdateMode.Modify, samAccountName), new UpdateRequestParameter("DisplayName", UpdateMode.Modify, displayName), new UpdateRequestParameter("labUpn", UpdateMode.Modify, upn) }; }
public override Activity GenerateActivityOnWorkflow(SequentialWorkflow workflow) { Logger.Instance.WriteMethodEntry(); try { // Create a new instance of the DeleteResources activity and assign // dependenty property values based on inputs to standard activity controls DeleteResources wfa = new DeleteResources { ActivityDisplayName = this.activityDisplayName.Value, Advanced = this.advanced.Value, ActivityExecutionCondition = this.activityExecutionCondition.Value, Iteration = this.iteration.Value, ActorType = GetActorType(this.actorType.Value), ActorString = this.actorString.Value, ApplyAuthorizationPolicy = this.applyAuthorizationPolicy.Value, TargetExpression = this.targetExpression.Value }; if (this.targetType.Value == DeleteResourcesTargetType.WorkflowTarget.ToString()) { wfa.TargetType = DeleteResourcesTargetType.WorkflowTarget; } else if (this.targetType.Value == DeleteResourcesTargetType.ResolveTarget.ToString()) { wfa.TargetType = DeleteResourcesTargetType.ResolveTarget; } else if (this.targetType.Value == DeleteResourcesTargetType.SearchForTarget.ToString()) { wfa.TargetType = DeleteResourcesTargetType.SearchForTarget; } return(wfa); } catch (Exception e) { Logger.Instance.ReportError(e); throw; } finally { Logger.Instance.WriteMethodExit(); } }
private void InitiliazeReadSubject_ExecuteCode(object sender, EventArgs e) { RequestType currentRequest = this.ReadCurrentRequestActivity.CurrentRequest; ReadOnlyCollection <CreateRequestParameter> requestParameters = currentRequest.ParseParameters <CreateRequestParameter>(); SequentialWorkflow containingWorkflow = null; if (!SequentialWorkflow.TryGetContainingWorkflow(this, out containingWorkflow)) { throw new InvalidOperationException("Unable to get Containing Workflow"); } this.readResourceActivity1_ActorId1 = FIMADMGUID; this.readResourceActivity1_ResourceId1 = containingWorkflow.TargetId; requestorGUID = containingWorkflow.ActorId; targetGUID = containingWorkflow.TargetId; }
public override Activity GenerateActivityOnWorkflow(SequentialWorkflow workflow) { Logger.Instance.WriteMethodEntry(); try { // Create a new instance of the SendEmailNotification activity and assign // dependenty property values based on inputs to standard activity controls SendEmailNotification wfa = new SendEmailNotification { ActivityDisplayName = this.activityDisplayName.Value, QueryResources = this.queryResources.Value, Advanced = this.advanced.Value, ActivityExecutionCondition = this.activityExecutionCondition.Value, Iteration = this.iteration.Value, EmailTemplate = this.emailTemplate.Value, To = this.to.Value, CC = this.cc.Value, Bcc = this.bcc.Value, SuppressException = this.suppressException.Value, }; // Convert the definition listings (web controls) to hash tables which can be serialized to the XOML workflow definition // A hash table is used due to issues with deserialization of lists and other structured data DefinitionsConverter queriesConverter = new DefinitionsConverter(this.queries.DefinitionListings); DefinitionsConverter workflowDataVariablesConverter = new DefinitionsConverter(this.workflowDataVariables.DefinitionListings); wfa.QueriesTable = queriesConverter.DefinitionsTable; wfa.WorkflowDataVariablesTable = workflowDataVariablesConverter.DefinitionsTable; return(wfa); } catch (Exception e) { Logger.Instance.ReportError(e); throw; } finally { Logger.Instance.WriteMethodExit(); } }
public override Activity GenerateActivityOnWorkflow(SequentialWorkflow workflow) { Logger.Instance.WriteMethodEntry(); try { // Generate a new instance of the Run PowerShell Script activity // and add properties based on specified values RunPowerShellScript wfa = new RunPowerShellScript { ActivityDisplayName = this.activityDisplayName.Value, Advanced = this.advanced.Value, ActivityExecutionCondition = this.activityExecutionCondition.Value, PowerShellUser = this.powerShellUser.Value, PowerShellUserPassword = this.powerShellUserPassword.Value, ImpersonatePowerShellUser = this.impersonatePowerShellUser.Value, ImpersonatePowerShellUserLoadUserProfile = this.loadUserProfile.Value, ImpersonatePowerShellUserLogOnType = this.impersonatePowerShellUser.Value ? GetImpersonationLogOnType(this.impersonationLogOnType.Value) : LogOnType.None, ScriptLocation = GetScriptLocation(this.scriptLocation.Value), Script = this.script.Value, FailOnMissing = this.failOnMissing.Value, InputType = GetInputType(this.inputType.Value), ReturnType = GetReturnType(this.returnType.Value), ReturnValueLookup = this.returnValueLookup.Value }; // Depending on the input type selection, // the activity will be configured with parameters or arguments, but not both switch (wfa.InputType) { case PowerShellInputType.Parameters: { DefinitionsConverter parametersConverter = new DefinitionsConverter(this.parameters.DefinitionListings); wfa.ParametersTable = parametersConverter.DefinitionsTable; } break; case PowerShellInputType.Arguments: { wfa.Arguments = this.FetchArguments(); } break; } return wfa; } catch (Exception e) { Logger.Instance.ReportError(e); throw; } finally { Logger.Instance.WriteMethodExit(); } }
public override Activity GenerateActivityOnWorkflow(SequentialWorkflow workflow) { Logger.Instance.WriteMethodEntry(); try { // Create a new instance of the UpdateResources activity and assign // dependenty property values based on inputs to standard activity controls UpdateResources wfa = new UpdateResources { ActivityDisplayName = this.activityDisplayName.Value, QueryResources = this.queryResources.Value, Advanced = this.advanced.Value, ActivityExecutionCondition = this.activityExecutionCondition.Value, Iteration = this.iteration.Value, ActorType = GetActorType(this.actorType.Value), ActorString = this.actorString.Value, ApplyAuthorizationPolicy = this.applyAuthorizationPolicy.Value, ResolveDynamicGrammar = this.resolveDynamicGrammar.Value }; // Convert the definition listings (web controls) to hash tables which can be serialized to the XOML workflow definition // A hash table is used due to issues with deserialization of lists and other structured data DefinitionsConverter queriesConverter = new DefinitionsConverter(this.queries.DefinitionListings); DefinitionsConverter updatesConverter = new DefinitionsConverter(this.updates.DefinitionListings); wfa.QueriesTable = queriesConverter.DefinitionsTable; wfa.UpdatesTable = updatesConverter.DefinitionsTable; return wfa; } catch (Exception e) { Logger.Instance.ReportError(e); throw; } finally { Logger.Instance.WriteMethodExit(); } }
public override Activity GenerateActivityOnWorkflow(SequentialWorkflow workflow) { Logger.Instance.WriteMethodEntry(); try { // Create a new instance of the SendEmailNotification activity and assign // dependenty property values based on inputs to standard activity controls SendEmailNotification wfa = new SendEmailNotification { ActivityDisplayName = this.activityDisplayName.Value, Advanced = this.advanced.Value, ActivityExecutionCondition = this.activityExecutionCondition.Value, EmailTemplate = this.emailTemplate.Value, To = this.to.Value, CC = this.cc.Value, Bcc = this.bcc.Value, SuppressException = this.suppressException.Value, }; return wfa; } catch (Exception e) { Logger.Instance.ReportError(e); throw; } finally { Logger.Instance.WriteMethodExit(); } }
public override Activity GenerateActivityOnWorkflow(SequentialWorkflow workflow) { return new SMSPasswordReset(); }
public override Activity GenerateActivityOnWorkflow(SequentialWorkflow workflow) { Logger.Instance.WriteMethodEntry(); try { // Create a new instance of the DeleteResources activity and assign // dependenty property values based on inputs to standard activity controls DeleteResources wfa = new DeleteResources { ActivityDisplayName = this.activityDisplayName.Value, Advanced = this.advanced.Value, ActivityExecutionCondition = this.activityExecutionCondition.Value, Iteration = this.iteration.Value, ActorType = GetActorType(this.actorType.Value), ActorString = this.actorString.Value, ApplyAuthorizationPolicy = this.applyAuthorizationPolicy.Value, TargetExpression = this.targetExpression.Value }; if (this.targetType.Value == DeleteResourcesTargetType.WorkflowTarget.ToString()) { wfa.TargetType = DeleteResourcesTargetType.WorkflowTarget; } else if (this.targetType.Value == DeleteResourcesTargetType.ResolveTarget.ToString()) { wfa.TargetType = DeleteResourcesTargetType.ResolveTarget; } else if (this.targetType.Value == DeleteResourcesTargetType.SearchForTarget.ToString()) { wfa.TargetType = DeleteResourcesTargetType.SearchForTarget; } return wfa; } catch (Exception e) { Logger.Instance.ReportError(e); throw; } finally { Logger.Instance.WriteMethodExit(); } }
public override Activity GenerateActivityOnWorkflow(SequentialWorkflow workflow) { Logger.Instance.WriteMethodEntry(); try { // Create a new instance of the VerifyRequest activity and assign // dependenty property values based on inputs to standard activity controls VerifyRequest wfa = new VerifyRequest { ActivityDisplayName = this.activityDisplayName.Value, Advanced = this.advanced.Value, ActivityExecutionCondition = this.activityExecutionCondition.Value, CheckForConflict = this.checkForConflict.Value, ConflictFilter = this.conflictFilter.Value, ConflictDenialMessage = this.conflictDenialMessage.Value, CheckForRequestConflict = this.checkForRequestConflict.Value, RequestConflictAdvancedFilter = this.requestConflictAdvancedFilter.Value, RequestConflictMatchCondition = this.requestConflictMatchCondition.Value, RequestConflictDenialMessage = this.requestConflictDenialMessage.Value }; // Convert the definition listings (web controls) to a hash table which can be serialized to the XOML workflow definition // A hash table is used due to issues with deserialization of lists and other structured data DefinitionsConverter converter = new DefinitionsConverter(this.conditions.DefinitionListings); wfa.ConditionsTable = converter.DefinitionsTable; return wfa; } catch (Exception e) { Logger.Instance.ReportError(e); throw; } finally { Logger.Instance.WriteMethodExit(); } }
public override Activity GenerateActivityOnWorkflow(SequentialWorkflow workflow) { Logger.Instance.WriteMethodEntry(); try { // Create a new instance of the RequestApproval activity and assign // dependenty property values based on inputs to standard activity controls RequestApproval wfa = new RequestApproval { ActivityDisplayName = this.activityDisplayName.Value, ActivityExecutionCondition = this.activityExecutionCondition.Value, Approvers = this.approvers.Value, Threshold = this.threshold.Value, Duration = this.duration.Value, Escalation = this.escalation.Value, ApprovalEmailTemplate = this.approvalEmailTemplate.Value, EscalationEmailTemplate = this.approvalEscalationEmailTemplate.Value, ApprovalCompleteEmailTemplate = this.approvalCompleteEmailTemplate.Value, ApprovalDeniedEmailTemplate = this.approvalDeniedEmailTemplate.Value, ApprovalTimeoutEmailTemplate = this.approvalTimeoutEmailTemplate.Value, }; return wfa; } catch (Exception e) { Logger.Instance.ReportError(e); throw; } finally { Logger.Instance.WriteMethodExit(); } }
public override Activity GenerateActivityOnWorkflow(SequentialWorkflow workflow) { Logger.Instance.WriteMethodEntry(); try { // Create a new instance of the AddDelay activity and assign // dependenty property values based on inputs to standard activity controls AddDelay wfa = new AddDelay { ActivityDisplayName = this.activityDisplayName.Value, ActivityExecutionCondition = this.activityExecutionCondition.Value, TimeoutDuration = this.timeoutDuration.Value, }; return wfa; } catch (Exception e) { Logger.Instance.ReportError(e); throw; } finally { Logger.Instance.WriteMethodExit(); } }
public override Activity GenerateActivityOnWorkflow(SequentialWorkflow workflow) { Logger.Instance.WriteMethodEntry(); try { // Create a new instance of the GenerateUniqueValue activity and assign // dependenty property values based on inputs to standard activity controls GenerateUniqueValue wfa = new GenerateUniqueValue { ActivityDisplayName = this.activityDisplayName.Value, ActivityExecutionCondition = this.activityExecutionCondition.Value, PublicationTarget = this.publicationTarget.Value, ConflictFilter = this.conflictFilter.Value, QueryLdap = this.queryLdap.Value, UniquenessSeed = this.uniquenessSeed.Value, ValueExpressions = this.FetchValueExpressions() }; DefinitionsConverter ldapQueriesConverter = new DefinitionsConverter(this.ldapQueries.DefinitionListings); wfa.LdapQueriesTable = ldapQueriesConverter.DefinitionsTable; return wfa; } catch (Exception e) { Logger.Instance.ReportError(e); throw; } finally { Logger.Instance.WriteMethodExit(); } }