DsfForEachActivity SetupArguments(string currentDl, string testData, enForEachType type, bool isInputMapping = false, string inputMapping = null, string from = null, string to = null, string csvIndexes = null, string numberExecutions = null) { var activityFunction = new ActivityFunc <string, bool>(); var activity = inputMapping != null?CreateWorkflow(inputMapping, isInputMapping) : CreateWorkflow(); activityFunction.Handler = activity; var id = Guid.NewGuid().ToString(); var dsfForEachActivity = new DsfForEachActivity { DataFunc = activityFunction, ForEachType = type, NumOfExections = numberExecutions, From = @from, To = to, CsvIndexes = csvIndexes, UniqueID = id }; TestStartNode = new FlowStep { Action = dsfForEachActivity }; CurrentDl = testData; TestData = currentDl; return(dsfForEachActivity); }
//MO - Changed : new ctor that accepts the new arguments public ForEachBootstrapTOOld(enForEachType forEachType, string from, string to, string csvNumbers, string numberOfExecutes, string recordsetName, Guid dlID, IDataListCompiler compiler, out ErrorResultTO errors) { errors = new ErrorResultTO(); ForEachType = forEachType; IDev2IteratorCollection colItr = Dev2ValueObjectFactory.CreateIteratorCollection(); IndexIterator localIndexIterator; IndexList indexList; switch (forEachType) { case enForEachType.InRecordset: IBinaryDataListEntry recordset = compiler.Evaluate(dlID, enActionType.User, recordsetName, false, out errors); if (recordset == null || !recordset.IsRecordset) { errors.AddError("When selecting a recordset only valid recordsets can be used"); break; } var isEmpty = recordset.IsEmpty(); if (isEmpty) { indexList = new IndexList(new HashSet <int> { 1 }, 0); localIndexIterator = new IndexIterator(new HashSet <int> { 1 }, 0); } else { indexList = new IndexList(new HashSet <int>(), 0) { MinValue = 1, MaxValue = recordset.FetchLastRecordsetIndex() }; localIndexIterator = new IndexIterator(new HashSet <int>(), 0); } localIndexIterator.IndexList = indexList; IndexIterator = localIndexIterator; break; case enForEachType.InRange: if (string.IsNullOrWhiteSpace(from)) { errors.AddError("The from field can not be left empty."); break; } if (string.IsNullOrWhiteSpace(to)) { errors.AddError("The to field can not be left empty."); break; } if (from.Contains("(*)")) { errors.AddError("The Star notation is not accepted in the From field."); break; } var fromItr = CreateDataListEvaluateIterator(from, dlID, compiler, colItr, errors); colItr.AddIterator(fromItr); int intFrom; if (!int.TryParse(colItr.FetchNextRow(fromItr).TheValue, out intFrom) || intFrom < 1) { errors.AddError("From range must be a whole number from 1 onwards."); break; } if (to.Contains("(*)")) { errors.AddError("The Star notation is not accepted in the To field."); break; } var toItr = CreateDataListEvaluateIterator(to, dlID, compiler, colItr, errors); colItr.AddIterator(toItr); int intTo; if (!int.TryParse(colItr.FetchNextRow(toItr).TheValue, out intTo) || intTo < 1) { errors.AddError("To range must be a whole number from 1 onwards."); break; } if (intFrom > intTo) { indexList = new IndexList(new HashSet <int>(), 0) { MinValue = intFrom, MaxValue = intTo }; ReverseIndexIterator revIdxItr = new ReverseIndexIterator(new HashSet <int>(), 0) { IndexList = indexList }; IndexIterator = revIdxItr; } else { indexList = new IndexList(new HashSet <int>(), 0) { MinValue = intFrom, MaxValue = intTo }; localIndexIterator = new IndexIterator(new HashSet <int>(), 0) { IndexList = indexList }; IndexIterator = localIndexIterator; } break; case enForEachType.InCSV: var csvIndexedsItr = CreateDataListEvaluateIterator(csvNumbers, dlID, compiler, colItr, errors); colItr.AddIterator(csvIndexedsItr); ErrorResultTO allErrors; List <int> listOfIndexes = SplitOutCsvIndexes(colItr.FetchNextRow(csvIndexedsItr).TheValue, out allErrors); if (allErrors.HasErrors()) { errors.MergeErrors(allErrors); break; } ListIndexIterator listLocalIndexIterator = new ListIndexIterator(listOfIndexes); ListOfIndex listOfIndex = new ListOfIndex(listOfIndexes); listLocalIndexIterator.IndexList = listOfIndex; IndexIterator = listLocalIndexIterator; break; default: if (numberOfExecutes != null && numberOfExecutes.Contains("(*)")) { errors.AddError("The Star notation is not accepted in the Numbers field."); break; } int intExNum; var numOfExItr = CreateDataListEvaluateIterator(numberOfExecutes, dlID, compiler, colItr, errors); colItr.AddIterator(numOfExItr); if (!int.TryParse(colItr.FetchNextRow(numOfExItr).TheValue, out intExNum)) { errors.AddError("Number of executes must be a whole number from 1 onwards."); } IndexIterator = new IndexIterator(new HashSet <int>(), intExNum); break; } }
private DsfForEachActivity SetupArguments(string currentDl, string testData, enForEachType type, bool isInputMapping = false, string inputMapping = null, string from = null, string to = null, string csvIndexes = null, string numberExecutions = null) { var activityFunction = new ActivityFunc<string, bool>(); DsfActivity activity = inputMapping != null ? CreateWorkflow(inputMapping, isInputMapping) : CreateWorkflow(); activityFunction.Handler = activity; var id = Guid.NewGuid().ToString(); DsfForEachActivity dsfForEachActivity = new DsfForEachActivity { DataFunc = activityFunction, ForEachType = type, NumOfExections = numberExecutions, From = @from, To = to, CsvIndexes = csvIndexes, UniqueID = id }; TestStartNode = new FlowStep { Action = dsfForEachActivity }; CurrentDl = testData; TestData = currentDl; return dsfForEachActivity; }
//MO - Changed : new ctor that accepts the new arguments public ForEachBootstrapTOOld(enForEachType forEachType, string from, string to, string csvNumbers, string numberOfExecutes, string recordsetName, Guid dlID, IDataListCompiler compiler, out ErrorResultTO errors) { errors = new ErrorResultTO(); ForEachType = forEachType; IDev2IteratorCollection colItr = Dev2ValueObjectFactory.CreateIteratorCollection(); IndexIterator localIndexIterator; IndexList indexList; switch(forEachType) { case enForEachType.InRecordset: IBinaryDataListEntry recordset = compiler.Evaluate(dlID, enActionType.User, recordsetName, false, out errors); if(recordset == null || !recordset.IsRecordset) { errors.AddError("When selecting a recordset only valid recordsets can be used"); break; } var isEmpty = recordset.IsEmpty(); if(isEmpty) { indexList = new IndexList(new HashSet<int> { 1 }, 0); localIndexIterator = new IndexIterator(new HashSet<int> { 1 }, 0); } else { indexList = new IndexList(new HashSet<int>(), 0) { MinValue = 1, MaxValue = recordset.FetchLastRecordsetIndex() }; localIndexIterator = new IndexIterator(new HashSet<int>(), 0); } localIndexIterator.IndexList = indexList; IndexIterator = localIndexIterator; break; case enForEachType.InRange: if(string.IsNullOrWhiteSpace(from)) { errors.AddError("The from field can not be left empty."); break; } if(string.IsNullOrWhiteSpace(to)) { errors.AddError("The to field can not be left empty."); break; } if(from.Contains("(*)")) { errors.AddError("The Star notation is not accepted in the From field."); break; } var fromItr = CreateDataListEvaluateIterator(from, dlID, compiler, colItr, errors); colItr.AddIterator(fromItr); int intFrom; if(!int.TryParse(colItr.FetchNextRow(fromItr).TheValue, out intFrom) || intFrom < 1) { errors.AddError("From range must be a whole number from 1 onwards."); break; } if(to.Contains("(*)")) { errors.AddError("The Star notation is not accepted in the To field."); break; } var toItr = CreateDataListEvaluateIterator(to, dlID, compiler, colItr, errors); colItr.AddIterator(toItr); int intTo; if(!int.TryParse(colItr.FetchNextRow(toItr).TheValue, out intTo) || intTo < 1) { errors.AddError("To range must be a whole number from 1 onwards."); break; } if(intFrom > intTo) { indexList = new IndexList(new HashSet<int>(), 0) { MinValue = intFrom, MaxValue = intTo }; ReverseIndexIterator revIdxItr = new ReverseIndexIterator(new HashSet<int>(), 0) { IndexList = indexList }; IndexIterator = revIdxItr; } else { indexList = new IndexList(new HashSet<int>(), 0) { MinValue = intFrom, MaxValue = intTo }; localIndexIterator = new IndexIterator(new HashSet<int>(), 0) { IndexList = indexList }; IndexIterator = localIndexIterator; } break; case enForEachType.InCSV: var csvIndexedsItr = CreateDataListEvaluateIterator(csvNumbers, dlID, compiler, colItr, errors); colItr.AddIterator(csvIndexedsItr); ErrorResultTO allErrors; List<int> listOfIndexes = SplitOutCsvIndexes(colItr.FetchNextRow(csvIndexedsItr).TheValue, out allErrors); if(allErrors.HasErrors()) { errors.MergeErrors(allErrors); break; } ListIndexIterator listLocalIndexIterator = new ListIndexIterator(listOfIndexes); ListOfIndex listOfIndex = new ListOfIndex(listOfIndexes); listLocalIndexIterator.IndexList = listOfIndex; IndexIterator = listLocalIndexIterator; break; default: if(numberOfExecutes != null && numberOfExecutes.Contains("(*)")) { errors.AddError("The Star notation is not accepted in the Numbers field."); break; } int intExNum; var numOfExItr = CreateDataListEvaluateIterator(numberOfExecutes, dlID, compiler, colItr, errors); colItr.AddIterator(numOfExItr); if(!int.TryParse(colItr.FetchNextRow(numOfExItr).TheValue, out intExNum)) { errors.AddError("Number of executes must be a whole number from 1 onwards."); } IndexIterator = new IndexIterator(new HashSet<int>(), intExNum); break; } }
//MO - Changed : new ctor that accepts the new arguments public ForEachBootstrapTO(enForEachType forEachType, string from, string to, string csvNumbers, string numberOfExecutes, string recordsetName, IExecutionEnvironment compiler, out ErrorResultTO errors, int update) { errors = new ErrorResultTO(); ForEachType = forEachType; IIndexIterator localIndexIterator; switch(forEachType) { case enForEachType.InRecordset: var records = compiler.EvalRecordSetIndexes(recordsetName, update); if (!compiler.HasRecordSet(recordsetName) ) { errors.AddError("When selecting a recordset only valid recordsets can be used"); break; } localIndexIterator = new IndexListIndexIterator(records); IndexIterator = localIndexIterator; break; case enForEachType.InRange: if(string.IsNullOrWhiteSpace(@from)) { errors.AddError("The from field can not be left empty."); break; } if(string.IsNullOrWhiteSpace(to)) { errors.AddError("The to field can not be left empty."); break; } if(@from.Contains("(*)")) { errors.AddError("The Star notation is not accepted in the From field."); break; } var evalledFrom = ExecutionEnvironment.WarewolfEvalResultToString( compiler.Eval(@from, update)); int intFrom; if (!int.TryParse(evalledFrom, out intFrom) || intFrom < 1) { errors.AddError("From range must be a whole number from 1 onwards."); break; } if(to.Contains("(*)")) { errors.AddError("The Star notation is not accepted in the To field."); break; } var evalledTo= ExecutionEnvironment.WarewolfEvalResultToString( compiler.Eval(@to, update)); int intTo; if (!int.TryParse(evalledTo, out intTo) || intTo < 1) { errors.AddError("To range must be a whole number from 1 onwards."); break; } IndexList indexList; if(intFrom > intTo) { indexList = new IndexList(new HashSet<int>(), 0) { MinValue = intFrom, MaxValue = intTo }; ReverseIndexIterator revIdxItr = new ReverseIndexIterator(new HashSet<int>(), 0) { IndexList = indexList }; IndexIterator = revIdxItr; } else { indexList = new IndexList(new HashSet<int>(), 0) { MinValue = intFrom, MaxValue = intTo }; localIndexIterator = new IndexIterator(new HashSet<int>(), 0) { IndexList = indexList }; IndexIterator = localIndexIterator; } break; case enForEachType.InCSV: var csvIndexedsItr = ExecutionEnvironment.WarewolfEvalResultToString( compiler.Eval(csvNumbers, update)); ErrorResultTO allErrors; List<int> listOfIndexes = SplitOutCsvIndexes(csvIndexedsItr, out allErrors); if(allErrors.HasErrors()) { errors.MergeErrors(allErrors); break; } ListIndexIterator listLocalIndexIterator = new ListIndexIterator(listOfIndexes); ListOfIndex listOfIndex = new ListOfIndex(listOfIndexes); listLocalIndexIterator.IndexList = listOfIndex; IndexIterator = listLocalIndexIterator; break; default: if(numberOfExecutes != null && numberOfExecutes.Contains("(*)")) { errors.AddError("The Star notation is not accepted in the Numbers field."); break; } int intExNum; var numOfExItr = ExecutionEnvironment.WarewolfEvalResultToString( compiler.Eval(numberOfExecutes, update)); if (!int.TryParse(numOfExItr, out intExNum)) { errors.AddError("Number of executes must be a whole number from 1 onwards."); } IndexIterator = new IndexIterator(new HashSet<int>(), intExNum); break; } }
//MO - Changed : new ctor that accepts the new arguments public ForEachBootstrapTO(enForEachType forEachType, string from, string to, string csvNumbers, string numberOfExecutes, string recordsetName, IExecutionEnvironment compiler, out ErrorResultTO errors, int update) { errors = new ErrorResultTO(); ForEachType = forEachType; IIndexIterator localIndexIterator; switch (forEachType) { case enForEachType.InRecordset: if (string.IsNullOrEmpty(recordsetName)) { errors.AddError(string.Format(ErrorResource.IsRequired, "The Recordset Field")); break; } var records = compiler.EvalRecordSetIndexes(recordsetName, update); if (!compiler.HasRecordSet(recordsetName)) { errors.AddError("When selecting a recordset only valid recordsets can be used"); break; } localIndexIterator = new IndexListIndexIterator(records); IndexIterator = localIndexIterator; break; case enForEachType.InRange: if (string.IsNullOrWhiteSpace(@from)) { errors.AddError(string.Format(ErrorResource.IsRequired, "The FROM field")); break; } if (string.IsNullOrWhiteSpace(to)) { errors.AddError(string.Format(ErrorResource.IsRequired, "The TO field")); break; } if (@from.Contains("(*)")) { errors.AddError(string.Format(ErrorResource.StarNotationNotAllowed, "From field")); break; } var evalledFrom = ExecutionEnvironment.WarewolfEvalResultToString(compiler.Eval(@from, update)); int intFrom; if (!int.TryParse(evalledFrom, out intFrom) || intFrom < 1) { errors.AddError(string.Format(ErrorResource.RangeFromOne, "FROM range")); break; } if (to.Contains("(*)")) { errors.AddError(string.Format(ErrorResource.StarNotationNotAllowed, "TO field.")); break; } var evalledTo = ExecutionEnvironment.WarewolfEvalResultToString(compiler.Eval(@to, update)); int intTo; if (!int.TryParse(evalledTo, out intTo) || intTo < 1) { errors.AddError(string.Format(ErrorResource.RangeFromOne, "TO range")); break; } IndexList indexList; if (intFrom > intTo) { indexList = new IndexList(new HashSet <int>(), 0) { MinValue = intFrom, MaxValue = intTo }; var revIdxItr = new ReverseIndexIterator(new HashSet <int>(), 0) { IndexList = indexList }; IndexIterator = revIdxItr; } else { indexList = new IndexList(new HashSet <int>(), 0) { MinValue = intFrom, MaxValue = intTo }; localIndexIterator = new IndexIterator(new HashSet <int>(), 0) { IndexList = indexList }; IndexIterator = localIndexIterator; } break; case enForEachType.InCSV: if (string.IsNullOrEmpty(csvNumbers)) { errors.AddError(string.Format(ErrorResource.IsRequired, "The CSV Field")); break; } var csvIndexedsItr = ExecutionEnvironment.WarewolfEvalResultToString(compiler.Eval(csvNumbers, update)); ErrorResultTO allErrors; var listOfIndexes = SplitOutCsvIndexes(csvIndexedsItr, out allErrors); if (allErrors.HasErrors()) { errors.MergeErrors(allErrors); break; } var listLocalIndexIterator = new ListIndexIterator(listOfIndexes); var listOfIndex = new ListOfIndex(listOfIndexes); listLocalIndexIterator.IndexList = listOfIndex; IndexIterator = listLocalIndexIterator; break; default: if (numberOfExecutes != null && numberOfExecutes.Contains("(*)")) { errors.AddError(string.Format(ErrorResource.StarNotationNotAllowed, "Numbers field.")); break; } int intExNum; var numOfExItr = ExecutionEnvironment.WarewolfEvalResultToString(compiler.Eval(numberOfExecutes, update)); if (!int.TryParse(numOfExItr, out intExNum) || intExNum < 1) { errors.AddError(string.Format(ErrorResource.RangeFromOne, "Number of executes")); } IndexIterator = new IndexIterator(new HashSet <int>(), intExNum); break; } }
//MO - Changed : new ctor that accepts the new arguments public ForEachBootstrapTO(enForEachType forEachType, string from, string to, string csvNumbers, string numberOfExecutes, string recordsetName, IExecutionEnvironment compiler, out ErrorResultTO errors, int update) { errors = new ErrorResultTO(); ForEachType = forEachType; IIndexIterator localIndexIterator; switch (forEachType) { case enForEachType.InRecordset: var records = compiler.EvalRecordSetIndexes(recordsetName, update); if (!compiler.HasRecordSet(recordsetName)) { errors.AddError("When selecting a recordset only valid recordsets can be used"); break; } localIndexIterator = new IndexListIndexIterator(records); IndexIterator = localIndexIterator; break; case enForEachType.InRange: if (string.IsNullOrWhiteSpace(@from)) { errors.AddError("The from field can not be left empty."); break; } if (string.IsNullOrWhiteSpace(to)) { errors.AddError("The to field can not be left empty."); break; } if (@from.Contains("(*)")) { errors.AddError("The Star notation is not accepted in the From field."); break; } var evalledFrom = ExecutionEnvironment.WarewolfEvalResultToString(compiler.Eval(@from, update)); int intFrom; if (!int.TryParse(evalledFrom, out intFrom) || intFrom < 1) { errors.AddError("From range must be a whole number from 1 onwards."); break; } if (to.Contains("(*)")) { errors.AddError("The Star notation is not accepted in the To field."); break; } var evalledTo = ExecutionEnvironment.WarewolfEvalResultToString(compiler.Eval(@to, update)); int intTo; if (!int.TryParse(evalledTo, out intTo) || intTo < 1) { errors.AddError("To range must be a whole number from 1 onwards."); break; } IndexList indexList; if (intFrom > intTo) { indexList = new IndexList(new HashSet <int>(), 0) { MinValue = intFrom, MaxValue = intTo }; ReverseIndexIterator revIdxItr = new ReverseIndexIterator(new HashSet <int>(), 0) { IndexList = indexList }; IndexIterator = revIdxItr; } else { indexList = new IndexList(new HashSet <int>(), 0) { MinValue = intFrom, MaxValue = intTo }; localIndexIterator = new IndexIterator(new HashSet <int>(), 0) { IndexList = indexList }; IndexIterator = localIndexIterator; } break; case enForEachType.InCSV: var csvIndexedsItr = ExecutionEnvironment.WarewolfEvalResultToString(compiler.Eval(csvNumbers, update)); ErrorResultTO allErrors; List <int> listOfIndexes = SplitOutCsvIndexes(csvIndexedsItr, out allErrors); if (allErrors.HasErrors()) { errors.MergeErrors(allErrors); break; } ListIndexIterator listLocalIndexIterator = new ListIndexIterator(listOfIndexes); ListOfIndex listOfIndex = new ListOfIndex(listOfIndexes); listLocalIndexIterator.IndexList = listOfIndex; IndexIterator = listLocalIndexIterator; break; default: if (numberOfExecutes != null && numberOfExecutes.Contains("(*)")) { errors.AddError("The Star notation is not accepted in the Numbers field."); break; } int intExNum; var numOfExItr = ExecutionEnvironment.WarewolfEvalResultToString(compiler.Eval(numberOfExecutes, update)); if (!int.TryParse(numOfExItr, out intExNum)) { errors.AddError("Number of executes must be a whole number from 1 onwards."); } IndexIterator = new IndexIterator(new HashSet <int>(), intExNum); break; } }