private void RegularItem(IExecutionEnvironment environment, int update, bool isCalculate) { var evalToExpression = environment.EvalToExpression(_inputVariable, update); if (DataListUtil.IsEvaluated(evalToExpression)) { _inputVariable = evalToExpression; } _evalResult = environment.Eval(_inputVariable, update); string cleanExpression; var isCalcExpression = DataListUtil.IsCalcEvaluation(_inputVariable, out cleanExpression); if (isCalcExpression && !isCalculate) { if (_evalResult.IsWarewolfAtomResult) { var atomResult = _evalResult as CommonFunctions.WarewolfEvalResult.WarewolfAtomResult; if (atomResult != null) { var res = atomResult.Item.ToString(); string resValue; DataListUtil.IsCalcEvaluation(res, out resValue); _evalResult = CommonFunctions.WarewolfEvalResult.NewWarewolfAtomResult(DataStorage.WarewolfAtom.NewDataString(resValue)); } } _inputVariable = cleanExpression; } }
void AddSingleInputDebugItemAfterException(IExecutionEnvironment environment, IAssignValue assignValue, int update, DebugItem debugItem, string VariableLabelText, string NewFieldLabelText) { if (DataListUtil.IsEvaluated(assignValue.Value)) { var newValueResult = environment.Eval(assignValue.Value, update); if (newValueResult.IsWarewolfAtomResult) { if (newValueResult is CommonFunctions.WarewolfEvalResult.WarewolfAtomResult valueResult) { AddDebugItem(new DebugItemWarewolfAtomResult("", ExecutionEnvironment.WarewolfAtomToString(valueResult.Item), environment.EvalToExpression(assignValue.Name, update), assignValue.Value, VariableLabelText, NewFieldLabelText, "="), debugItem); } } else { if (newValueResult.IsWarewolfAtomListresult) { AddDebugItem(new DebugItemWarewolfAtomListResult(null, newValueResult, environment.EvalToExpression(assignValue.Value, update), assignValue.Name, VariableLabelText, NewFieldLabelText, "="), debugItem); } } } else { AddDebugItem(new DebugItemWarewolfAtomResult("", assignValue.Value, environment.EvalToExpression(assignValue.Name, update), "", VariableLabelText, NewFieldLabelText, "="), debugItem); } }
void CreateDebugInput(IExecutionEnvironment environment, int innerCount, IAssignValue assignValue, int update, DebugItem debugItem, string VariableLabelText, string NewFieldLabelText) { if (!DataListUtil.IsEvaluated(assignValue.Value)) { var evalResult = environment.Eval(assignValue.Name, update); AddDebugItem(new DebugItemStaticDataParams("", innerCount.ToString(CultureInfo.InvariantCulture)), debugItem); if (evalResult.IsWarewolfAtomResult) { if (evalResult is CommonFunctions.WarewolfEvalResult.WarewolfAtomResult scalarResult) { AddDebugItem(new DebugItemWarewolfAtomResult(ExecutionEnvironment.WarewolfAtomToString(scalarResult.Item), assignValue.Value, environment.EvalToExpression(assignValue.Name, update), "", VariableLabelText, NewFieldLabelText, "="), debugItem); } } else { AddWarewolfAtomListDebugResult(environment, assignValue, update, debugItem, VariableLabelText, NewFieldLabelText, evalResult); } } else { if (DataListUtil.IsEvaluated(assignValue.Value)) { AddEvaluatedDebugItem(environment, innerCount, assignValue, update, NewFieldLabelText, VariableLabelText, debugItem); } } }
private void AddErrorDebugItem(IExecutionEnvironment environment, int innerCount, IAssignValue assignValue, int update, DebugItem debugItem, string VariableLabelText, string NewFieldLabelText) { AddDebugItem(new DebugItemStaticDataParams("", innerCount.ToString(CultureInfo.InvariantCulture)), debugItem); if (DataListUtil.IsEvaluated(assignValue.Value)) { var newValueResult = environment.Eval(assignValue.Value, update); if (newValueResult.IsWarewolfAtomResult) { if (newValueResult is CommonFunctions.WarewolfEvalResult.WarewolfAtomResult valueResult) { AddDebugItem(new DebugItemWarewolfAtomResult("", ExecutionEnvironment.WarewolfAtomToString(valueResult.Item), environment.EvalToExpression(assignValue.Name, update), assignValue.Value, VariableLabelText, NewFieldLabelText, "="), debugItem); } } else { if (newValueResult.IsWarewolfAtomListresult) { AddDebugItem(new DebugItemWarewolfAtomListResult(null, newValueResult, environment.EvalToExpression(assignValue.Value, update), assignValue.Name, VariableLabelText, NewFieldLabelText, "="), debugItem); } } } else { AddDebugItem(new DebugItemWarewolfAtomResult("", assignValue.Value, environment.EvalToExpression(assignValue.Name, update), "", VariableLabelText, NewFieldLabelText, "="), debugItem); } }
public static List <string> FindAllLanguagePieces(string dataListRegion) { var allValidRegions = new List <string>(); if (!string.IsNullOrEmpty(dataListRegion)) { try { if (DataListUtil.IsEvaluated(dataListRegion)) { Dev2DataLanguageParser parser = new Dev2DataLanguageParser(); var allParts = parser.MakeParts(dataListRegion); foreach (var part in allParts) { var parseTO = part.Child; while (parseTO != null) { AddPart(parseTO, allValidRegions); parseTO = parseTO.Child; } AddPart(part, allValidRegions); } } } catch (Exception) { //Do Something usefull like log Dev2Logger.Log.Info("Error parsing"); } } return(allValidRegions); }
public DebugEvalResult(string inputVariable, string label, IExecutionEnvironment environment, int update, bool isDataMerge, bool isCalculate, bool mockSelected) { _inputVariable = inputVariable?.Trim(); LabelText = label; _isCalculate = isCalculate; MockSelected = mockSelected; try { if (ExecutionEnvironment.IsRecordsetIdentifier(_inputVariable) && DataListUtil.IsEvaluated(_inputVariable) && DataListUtil.GetRecordsetIndexType(_inputVariable) == enRecordsetIndexType.Blank) { var length = environment.GetLength(DataListUtil.ExtractRecordsetNameFromValue(_inputVariable)); _inputVariable = DataListUtil.ReplaceRecordsetBlankWithIndex(_inputVariable, length); } if (isDataMerge) { DataMergeItem(environment, update); } else { RegularItem(environment, update, isCalculate); } } catch (Exception e) { Dev2Logger.Error(e.Message, e, GlobalConstants.WarewolfError); _evalResult = CommonFunctions.WarewolfEvalResult.NewWarewolfAtomResult(DataStorage.WarewolfAtom.Nothing); } }
public DebugEvalResult(string inputVariable, string label, IExecutionEnvironment environment, bool isDataMerge = false) { _inputVariable = inputVariable.Trim(); _label = label; try { if (ExecutionEnvironment.IsRecordsetIdentifier(_inputVariable) && DataListUtil.IsEvaluated(_inputVariable)) { if (DataListUtil.GetRecordsetIndexType(_inputVariable) == enRecordsetIndexType.Blank) { var length = environment.GetLength(DataListUtil.ExtractRecordsetNameFromValue(_inputVariable)); _inputVariable = DataListUtil.ReplaceRecordsetBlankWithIndex(_inputVariable, length); } } if (isDataMerge) { var evalForDataMerge = environment.EvalForDataMerge(_inputVariable); var innerIterator = new WarewolfListIterator(); var innerListOfIters = new List <WarewolfIterator>(); foreach (var listOfIterator in evalForDataMerge) { var inIterator = new WarewolfIterator(listOfIterator); innerIterator.AddVariableToIterateOn(inIterator); innerListOfIters.Add(inIterator); } var atomList = new List <DataASTMutable.WarewolfAtom>(); while (innerIterator.HasMoreData()) { var stringToUse = ""; // ReSharper disable once LoopCanBeConvertedToQuery foreach (var warewolfIterator in innerListOfIters) { stringToUse += warewolfIterator.GetNextValue(); } atomList.Add(DataASTMutable.WarewolfAtom.NewDataString(stringToUse)); } var finalString = string.Join("", atomList); _evalResult = WarewolfDataEvaluationCommon.WarewolfEvalResult.NewWarewolfAtomListresult(new WarewolfAtomList <DataASTMutable.WarewolfAtom>(DataASTMutable.WarewolfAtom.Nothing, atomList)); if (DataListUtil.IsFullyEvaluated(finalString)) { _inputVariable = finalString; _evalResult = environment.Eval(finalString); } } else { var evalToExpression = environment.EvalToExpression(_inputVariable); if (DataListUtil.IsEvaluated(evalToExpression)) { _inputVariable = evalToExpression; } _evalResult = environment.Eval(_inputVariable); } } catch (Exception e) { Dev2Logger.Log.Error(e.Message, e); _evalResult = WarewolfDataEvaluationCommon.WarewolfEvalResult.NewWarewolfAtomResult(DataASTMutable.WarewolfAtom.Nothing); } }
#pragma warning disable S1541 // Methods and properties should not be too complex public override List <IDebugItemResult> GetDebugItemResult() #pragma warning restore S1541 // Methods and properties should not be too complex { if (_evalResult.IsWarewolfAtomResult) { if (_evalResult is CommonFunctions.WarewolfEvalResult.WarewolfAtomResult scalarResult && !scalarResult.Item.IsNothing) { var warewolfAtomToString = ExecutionEnvironment.WarewolfAtomToString(scalarResult.Item); if (warewolfAtomToString == _inputVariable && DataListUtil.IsEvaluated(_inputVariable)) { warewolfAtomToString = null; } if (!DataListUtil.IsEvaluated(_inputVariable)) { _inputVariable = null; } return(new DebugItemWarewolfAtomResult(warewolfAtomToString, _inputVariable, LabelText, _operand, MockSelected).GetDebugItemResult()); } } else if (_evalResult.IsWarewolfAtomListresult && _evalResult is CommonFunctions.WarewolfEvalResult.WarewolfAtomListresult atomListResult) { return(new DebugItemWarewolfAtomListResult(atomListResult, "", "", _inputVariable, LabelText, "", "=", _isCalculate, MockSelected).GetDebugItemResult()); } else if (_evalResult.IsWarewolfRecordSetResult && _evalResult is CommonFunctions.WarewolfEvalResult.WarewolfRecordSetResult recordsetResult) { return(new DebugItemWarewolfRecordset(recordsetResult.Item, _inputVariable, LabelText, "=", MockSelected).GetDebugItemResult()); } else { return(new DebugItemStaticDataParams("", _inputVariable, LabelText, MockSelected).GetDebugItemResult()); } return(new DebugItemStaticDataParams("", _inputVariable, LabelText, MockSelected).GetDebugItemResult()); }
DebugItem AddSingleInputDebugItem(IExecutionEnvironment environment, int innerCount, IAssignValue assignValue, int update) { var debugItem = new DebugItem(); const string VariableLabelText = "Variable"; const string NewFieldLabelText = "New Value"; try { if (!DataListUtil.IsEvaluated(assignValue.Value)) { AddNotEvaluatedDebugInputItem(environment, innerCount, assignValue, update, debugItem, VariableLabelText, NewFieldLabelText); } if (DataListUtil.IsEvaluated(assignValue.Value)) { AddEvaluatedDebugInputItem(environment, innerCount, assignValue, update, debugItem, VariableLabelText, NewFieldLabelText); } } catch (Exception e) { if (e.Message.Contains("ParseError")) { AddDebugItem(new DebugItemWarewolfAtomResult("", assignValue.Value, environment.EvalToExpression(assignValue.Name, update), "", VariableLabelText, NewFieldLabelText, "="), debugItem); return(debugItem); } if (!ExecutionEnvironment.IsValidVariableExpression(assignValue.Name, out string errorMessage, update)) { return(null); } AddDefaultDebugItem(innerCount, debugItem); AddSingleInputDebugItemAfterException(environment, assignValue, update, debugItem, VariableLabelText, NewFieldLabelText); } return(debugItem); }
void HasLeftLabel(List <IDebugItemResult> results) { if (!string.IsNullOrEmpty(_leftLabel)) { string groupName = null; var grpIdx = 0; if (_warewolfAtomListresult != null) { AddEachWarewolfAtomListResult(results, ref groupName, ref grpIdx); } else { results.Add(new DebugItemResult { Type = DebugItemResultType.Variable, Label = _leftLabel, Variable = DataListUtil.IsEvaluated(Variable) ? Variable : null, Operator = _operand, GroupName = null, Value = "", GroupIndex = grpIdx, MockSelected = _mockSelected }); } } }
void ProcessOldValue(List <IDebugItemResult> results) { if (_oldValue.IsWarewolfAtomResult) { if (_oldValue is CommonFunctions.WarewolfEvalResult.WarewolfAtomResult scalarResult) { results.Add(new DebugItemResult { Type = DebugItemResultType.Variable, Label = _rightLabel, Variable = DataListUtil.IsEvaluated(_assignedToVariableName) ? _assignedToVariableName : null, Operator = string.IsNullOrEmpty(_operand) ? "" : "=", GroupName = null, Value = ExecutionEnvironment.WarewolfAtomToString(scalarResult.Item), GroupIndex = 0, MockSelected = _mockSelected }); } } else { if (_oldValue.IsWarewolfAtomListresult) { OldValueAtomListResult(results); } } }
private void HasLeftLabel(List <IDebugItemResult> results) { if (!string.IsNullOrEmpty(_leftLabel)) { string groupName = null; int grpIdx = 0; if (_warewolfAtomListresult != null) { foreach (var atomItem in _warewolfAtomListresult.Item) { string displayExpression = _variable; string rawExpression = _variable; var item = atomItem.ToString(); displayExpression = GetGroupName(displayExpression, rawExpression, ref grpIdx, ref item, ref groupName); var debugOperator = ""; var debugType = DebugItemResultType.Value; if (DataListUtil.IsEvaluated(displayExpression)) { debugOperator = string.IsNullOrEmpty(item) ? "" : "="; debugType = DebugItemResultType.Variable; if (_isCalculate) { displayExpression = groupName ?? displayExpression; } } else { displayExpression = null; } results.Add(new DebugItemResult { Type = debugType, Label = _leftLabel, Variable = DataListUtil.IsEvaluated(displayExpression) ? displayExpression : null, Operator = debugOperator, GroupName = groupName, Value = item, GroupIndex = grpIdx, MockSelected = _mockSelected }); } } else { results.Add(new DebugItemResult { Type = DebugItemResultType.Variable, Label = _leftLabel, Variable = DataListUtil.IsEvaluated(Variable) ? Variable : null, Operator = _operand, GroupName = null, Value = "", GroupIndex = grpIdx, MockSelected = _mockSelected }); } } }
void AddDebugInputItem(string value, string label) { if (string.IsNullOrEmpty(value) || string.IsNullOrEmpty(label)) { return; } AddDebugInputItem(DataListUtil.IsEvaluated(value) ? new DebugItemStaticDataParams("", value, label) : new DebugItemStaticDataParams(value, label)); }
public override IActionableErrorInfo Check() { var value = GetValue(); if (string.IsNullOrEmpty(value)) { return(null); } var result = value.TryParseVariables(out _outputValue, DoError, LabelText, _variableValue, _inputs); if (result != null) { if (string.Equals(value, _outputValue)) { _outputValue = _variableValue; } return(result); } var parser = new Dev2DataLanguageParser(); var results = parser.ParseDataLanguageForIntellisense(value, _datalist); if (DataListUtil.IsEvaluated(value) && !DataListUtil.IsValueRecordset(value)) { var validRegions = Dev2.DataList.Contract.DataListCleaningUtils.SplitIntoRegions(value); foreach (var region in validRegions) { var intellisenseResult = parser.ValidateName(DataListUtil.RemoveLanguageBrackets(region), ""); if (intellisenseResult != null && intellisenseResult.Type == enIntellisenseResultType.Error) { results.Add(intellisenseResult); } } } var error = results.FirstOrDefault(r => r.Type == enIntellisenseResultType.Error); if (error != null) { if (string.Equals(value, _outputValue)) { _outputValue = _variableValue; } return(new ActionableErrorInfo(DoError) { ErrorType = ErrorType.Critical, Message = (string.IsNullOrEmpty(LabelText) ? "" : LabelText + " - ") + error.Message }); } return(null); }
static void CheckIndex(string toCheck) { if (!String.IsNullOrEmpty(toCheck) && DataListUtil.IsEvaluated(toCheck) && DataListUtil.IsValueRecordset(toCheck) && DataListUtil.GetRecordsetIndexType(toCheck) == enRecordsetIndexType.Numeric) { int index; if (!int.TryParse(DataListUtil.ExtractIndexRegionFromRecordset(toCheck), out index) || index < 0) { throw new Exception(string.Format("Invalid numeric index for Recordset {0}", toCheck)); } } }
void AddInputDebugItemResultsAfterEvaluate(List <IDebugItem> result, ref string userModel, IExecutionEnvironment env, string expression, out ErrorResultTO error, DebugItem parent = null) { error = new ErrorResultTO(); if (expression != null && DataListUtil.IsEvaluated(expression)) { DebugOutputBase debugResult; if (error.HasErrors()) { debugResult = new DebugItemStaticDataParams("", expression, ""); } else { string expressiomToStringValue; try { expressiomToStringValue = ExecutionEnvironment.WarewolfEvalResultToString(env.Eval(expression, 0, true)); } catch (NullValueInVariableException) { expressiomToStringValue = expression; } // EvaluateExpressiomToStringValue(expression, decisionMode, dataList); userModel = userModel.Replace(expression, expressiomToStringValue); debugResult = new DebugItemWarewolfAtomResult(expressiomToStringValue, expression, ""); } var itemResults = debugResult.GetDebugItemResult(); var allReadyAdded = new List <IDebugItemResult>(); itemResults.ForEach(a => { var found = result.SelectMany(r => r.FetchResultsList()) .SingleOrDefault(r => r.Variable.Equals(a.Variable)); if (found != null) { allReadyAdded.Add(a); } }); allReadyAdded.ForEach(i => itemResults.Remove(i)); if (parent == null) { result.Add(new DebugItem(itemResults)); } else { parent.AddRange(itemResults); } } }
private void BuildParameterIterators(int update, IEnumerable <MethodParameter> inputs, IWarewolfListIterator itrCollection, ICollection <IWarewolfIterator> itrs) { if (string.IsNullOrEmpty(InstanceInputDefinitions)) { if (Inputs != null) { foreach (var sai in Inputs) { string val = sai.Name; string toInject = null; if (val != null) { toInject = sai.Value; } else if (!sai.EmptyIsNull) { toInject = ""; } var paramIterator = new WarewolfIterator(DataObj.Environment.Eval(toInject, update)); itrCollection.AddVariableToIterateOn(paramIterator); itrs.Add(paramIterator); } } return; } var inputDefs = DataListFactory.CreateInputParser().Parse(InstanceInputDefinitions); foreach (MethodParameter sai in inputs) { string val = sai.Name; string toInject = "NULL"; if (val != null) { var sai1 = sai; var dev2Definitions = inputDefs.Where(definition => definition.Name == sai1.Name); var definitions = dev2Definitions as IDev2Definition[] ?? dev2Definitions.ToArray(); if (definitions.Length == 1) { toInject = DataListUtil.IsEvaluated(definitions[0].RawValue) ? DataListUtil.AddBracketsToValueIfNotExist(definitions[0].RawValue) : definitions[0].RawValue; } } else if (!sai.EmptyToNull) { toInject = sai.DefaultValue; } var paramIterator = new WarewolfIterator(DataObj.Environment.Eval(toInject, update)); itrCollection.AddVariableToIterateOn(paramIterator); itrs.Add(paramIterator); } }
void OldValueAtomListResult(List <IDebugItemResult> results) { var recSetResult = _oldValue as CommonFunctions.WarewolfEvalResult.WarewolfAtomListresult; string groupName = null; var grpIdx = 0; if (recSetResult != null) { foreach (var item in recSetResult.Item) { var displayExpression = _assignedToVariableName; var rawExpression = _assignedToVariableName; if (displayExpression.Contains("().") || displayExpression.Contains("(*).")) { RecordsetGroupName(ref grpIdx, ref displayExpression, rawExpression, ref groupName); } else { ObjectGroupName(ref grpIdx, displayExpression, ref groupName); } var debugOperator = ""; var debugType = DebugItemResultType.Value; if (DataListUtil.IsEvaluated(displayExpression)) { debugOperator = "="; debugType = DebugItemResultType.Variable; displayExpression = _isCalculate ? (groupName ?? displayExpression) : displayExpression; } else { displayExpression = null; } var debugItemResult = new DebugItemResult { Type = debugType, Label = _rightLabel, Variable = DataListUtil.IsEvaluated(displayExpression) ? displayExpression : null, Operator = debugOperator, GroupName = groupName, Value = ExecutionEnvironment.WarewolfAtomToString(item), GroupIndex = grpIdx, MockSelected = _mockSelected }; results.Add(debugItemResult); } } }
private void AddWarewolfAtomResults(List <IDebugItem> results, IServiceInput serviceInput, CommonFunctions.WarewolfEvalResult tmpEntry, DebugItem itemToAdd) { if (tmpEntry is CommonFunctions.WarewolfEvalResult.WarewolfAtomResult warewolfAtomResult) { var variableName = serviceInput.Value; if (DataListUtil.IsEvaluated(variableName)) { AddDebugItem(new DebugItemWarewolfAtomResult(warewolfAtomResult.Item.ToString(), DataListUtil.AddBracketsToValueIfNotExist(variableName), ""), itemToAdd); } else { AddDebugItem(new DebugItemStaticDataParams(warewolfAtomResult.Item.ToString(), ""), itemToAdd); } } results.Add(itemToAdd); }
public void GivenIHaveThisScriptToExecute(string scriptFileName) { string scriptToExecute; if (DataListUtil.IsEvaluated(scriptFileName)) { scriptToExecute = scriptFileName; } else { string resourceName = string.Format("Dev2.Activities.Specs.Toolbox.Scripting.Script.testfiles.{0}", scriptFileName); scriptToExecute = ReadFile(resourceName); } ScenarioContext.Current.Add("scriptToExecute", scriptToExecute); }
List <IDebugItemResult> BuildDebugItemFromAtomList() { var results = new List <IDebugItemResult>(); foreach (var item in _warewolfRecordset.Data) { if (item.Key == "WarewolfPositionColumn") { continue; } var grpIdx = 0; foreach (var warewolfAtom in item.Value) { var index = _warewolfRecordset.Data["WarewolfPositionColumn"][grpIdx]; var position = ExecutionEnvironment.WarewolfAtomToString(index); grpIdx++; var displayExpression = DataListUtil.AddBracketsToValueIfNotExist(DataListUtil.CreateRecordsetDisplayValue(DataListUtil.ExtractRecordsetNameFromValue(_variable), item.Key, position)); var debugType = DebugItemResultType.Value; if (DataListUtil.IsEvaluated(displayExpression)) { _operand = "="; debugType = DebugItemResultType.Variable; } else { displayExpression = null; } if (!warewolfAtom.IsNothing) { results.Add(new DebugItemResult { Type = debugType, Label = _labelText, Variable = displayExpression, Operator = _operand, GroupName = _variable, Value = ExecutionEnvironment.WarewolfAtomToString(warewolfAtom), GroupIndex = grpIdx, MockSelected = _mockSelected }); } } } return(results); }
void AddInputDebugItemResultsAfterEvaluate(List <IDebugItem> result, ref string userModel, IBinaryDataList dataList, Dev2DecisionMode decisionMode, string expression, out ErrorResultTO error, DebugItem parent = null) { error = new ErrorResultTO(); if (expression != null && DataListUtil.IsEvaluated(expression)) { DebugOutputBase debugResult; if (error.HasErrors()) { debugResult = new DebugItemStaticDataParams("", expression, ""); } else { var expressiomToStringValue = EvaluateExpressiomToStringValue(expression, decisionMode, dataList); userModel = userModel.Replace(expression, expressiomToStringValue); ErrorResultTO errors; IDataListCompiler compiler = DataListFactory.CreateDataListCompiler(); IBinaryDataListEntry expressionsEntry = compiler.Evaluate(dataList.UID, enActionType.User, expression, false, out errors); debugResult = new DebugItemVariableParams(expression, "", expressionsEntry, dataList.UID); } var itemResults = debugResult.GetDebugItemResult(); var allReadyAdded = new List <IDebugItemResult>(); itemResults.ForEach(a => { var found = result.SelectMany(r => r.FetchResultsList()) .SingleOrDefault(r => r.Variable.Equals(a.Variable)); if (found != null) { allReadyAdded.Add(a); } }); allReadyAdded.ForEach(i => itemResults.Remove(i)); if (parent == null) { result.Add(new DebugItem(itemResults)); } else { parent.AddRange(itemResults); } } }
public override List <IDebugItemResult> GetDebugItemResult() { var debugItemsResults = new List <IDebugItemResult>(); if (!string.IsNullOrEmpty(_leftLabel)) { var debugItem = new DebugItemResult { Type = Type, Value = _value, Label = _leftLabel, Variable = Variable, Operator = _operand, MockSelected = _mockSelected }; debugItemsResults.Add(debugItem); } else { var debugItem = new DebugItemResult { Type = Type, Value = _value, Variable = Variable, Operator = _operand, MockSelected = _mockSelected }; debugItemsResults.Add(debugItem); } if (!string.IsNullOrEmpty(_rightLabel)) { var debugItem = new DebugItemResult { Type = Type, Value = _newValue, Variable = DataListUtil.IsEvaluated(_assignFromVariable)?_assignFromVariable:null, Label = _rightLabel, Operator = DataListUtil.IsEvaluated(_assignFromVariable) ? "=" : "", MockSelected = _mockSelected }; debugItemsResults.Add(debugItem); } return(debugItemsResults); }
private void AddEvaluatedDebugOutputItem(IExecutionEnvironment environment, int innerCount, IAssignValue assignValue, int update, string VariableLabelText, string NewFieldLabelText, DebugItem debugItem) { if (DataListUtil.IsEvaluated(assignValue.Value)) { var evalResult = environment.Eval(assignValue.Name, update); AddDebugItem(new DebugItemStaticDataParams("", innerCount.ToString(CultureInfo.InvariantCulture)), debugItem); if (evalResult.IsWarewolfAtomResult && evalResult is CommonFunctions.WarewolfEvalResult.WarewolfAtomResult scalarResult) { AddDebugItem(new DebugItemWarewolfAtomResult(ExecutionEnvironment.WarewolfAtomToString(scalarResult.Item), "", environment.EvalToExpression(assignValue.Name, update), "", VariableLabelText, NewFieldLabelText, "="), debugItem); } var evalResult2 = environment.Eval(assignValue.Value, update); if (evalResult.IsWarewolfAtomListresult && evalResult is CommonFunctions.WarewolfEvalResult.WarewolfAtomListresult recSetResult) { AddDebugItem(DataListUtil.GetRecordsetIndexType(assignValue.Name) == enRecordsetIndexType.Blank ? new DebugItemWarewolfAtomListResult(recSetResult, evalResult2, "", assignValue.Name, VariableLabelText, NewFieldLabelText, "=") : new DebugItemWarewolfAtomListResult(recSetResult, environment.EvalToExpression(assignValue.Value, update), "", assignValue.Name, VariableLabelText, NewFieldLabelText, "="), debugItem); } } }
void DataMergeItem(IExecutionEnvironment environment, int update) { var evalForDataMerge = environment.EvalForDataMerge(_inputVariable, update); var innerIterator = new WarewolfListIterator(); var innerListOfIters = new List <WarewolfIterator>(); foreach (var listOfIterator in evalForDataMerge) { var inIterator = new WarewolfIterator(listOfIterator); innerIterator.AddVariableToIterateOn(inIterator); innerListOfIters.Add(inIterator); } var atomList = new List <DataStorage.WarewolfAtom>(); while (innerIterator.HasMoreData()) { var stringToUse = ""; foreach (var warewolfIterator in innerListOfIters) { stringToUse += warewolfIterator.GetNextValue(); } atomList.Add(DataStorage.WarewolfAtom.NewDataString(stringToUse)); } var finalString = string.Join("", atomList); _evalResult = CommonFunctions.WarewolfEvalResult.NewWarewolfAtomListresult(new WarewolfAtomList <DataStorage.WarewolfAtom>(DataStorage.WarewolfAtom.Nothing, atomList)); if (DataListUtil.IsFullyEvaluated(finalString)) { _inputVariable = finalString; _evalResult = environment.Eval(finalString, update); } else { var evalToExpression = environment.EvalToExpression(_inputVariable, update); if (DataListUtil.IsEvaluated(evalToExpression)) { _inputVariable = evalToExpression; } } }
IRuleSet GetRuleSet(string propertyName) { var ruleSet = new RuleSet(); switch (propertyName) { case "SourceString": ruleSet.Add(new IsStringEmptyOrWhiteSpaceRule(() => SourceString)); if (!string.IsNullOrEmpty(SourceString) && !DataListUtil.IsEvaluated(SourceString)) { ruleSet.Add(new IsValidXmlRule(() => SourceString)); } var outputExprRule = new IsValidExpressionRule(() => SourceString, GetDatalistString(), "1"); ruleSet.Add(outputExprRule); break; } return(ruleSet); }
public override List <IDebugItemResult> GetDebugItemResult() { if (_evalResult.IsWarewolfAtomResult) { var scalarResult = _evalResult as WarewolfDataEvaluationCommon.WarewolfEvalResult.WarewolfAtomResult; if (scalarResult != null && !scalarResult.Item.IsNothing) { var warewolfAtomToString = ExecutionEnvironment.WarewolfAtomToString(scalarResult.Item); if (warewolfAtomToString == _inputVariable && DataListUtil.IsEvaluated(_inputVariable)) { warewolfAtomToString = null; } if (!DataListUtil.IsEvaluated(_inputVariable)) { _inputVariable = null; } return(new DebugItemWarewolfAtomResult(warewolfAtomToString, _inputVariable, LabelText).GetDebugItemResult()); } } else if (_evalResult.IsWarewolfAtomListresult) { var listResult = _evalResult as WarewolfDataEvaluationCommon.WarewolfEvalResult.WarewolfAtomListresult; if (listResult != null) { return(new DebugItemWarewolfAtomListResult(listResult, "", "", _inputVariable, LabelText, "", "=").GetDebugItemResult()); } } else if (_evalResult.IsWarewolfRecordSetResult) { var listResult = _evalResult as WarewolfDataEvaluationCommon.WarewolfEvalResult.WarewolfRecordSetResult; if (listResult != null) { return(new DebugItemWarewolfRecordset(listResult.Item, _inputVariable, LabelText, "=").GetDebugItemResult()); } } return(new DebugItemStaticDataParams("", _inputVariable, LabelText).GetDebugItemResult()); }
void AddSingleDebugOutputItem(IExecutionEnvironment environment, int innerCount, IAssignValue assignValue, int update) { const string VariableLabelText = ""; const string NewFieldLabelText = ""; var debugItem = new DebugItem(); try { if (!DataListUtil.IsEvaluated(assignValue.Value)) { AddNotEvaluatedDebugOutputItem(environment, innerCount, assignValue, update, VariableLabelText, NewFieldLabelText, debugItem); } if (DataListUtil.IsEvaluated(assignValue.Value)) { AddEvaluatedDebugOutputItem(environment, innerCount, assignValue, update, VariableLabelText, NewFieldLabelText, debugItem); } } catch (NullValueInVariableException) { AddDebugItem(new DebugItemWarewolfAtomResult("", assignValue.Value, "", environment.EvalToExpression(assignValue.Name, update), VariableLabelText, NewFieldLabelText, "="), debugItem); } _debugOutputs.Add(debugItem); }
public void WhenISelectTheFollowingOption(string option) { var context = ScenarioContext.Current.Get <IntellisenseProviderContext>("context"); string result; if (ScenarioContext.Current.TryGetValue("isFileProvider", out bool isFileProvider)) { if (DataListUtil.IsEvaluated(option) || string.IsNullOrEmpty(option)) { result = new DefaultIntellisenseProvider().PerformResultInsertion(option, context); } else { result = new FileSystemIntellisenseProvider().PerformResultInsertion(option, context); } } else { result = new DefaultIntellisenseProvider().PerformResultInsertion(option, context); } ScenarioContext.Current.Add("result", result); }
void NoLabels(List <IDebugItemResult> results) { if (string.IsNullOrEmpty(_rightLabel) && string.IsNullOrEmpty(_leftLabel)) { if (_warewolfAtomListresult != null) { AtomListResultNoLabel(results); } else { results.Add(new DebugItemResult { Type = DebugItemResultType.Variable, Variable = DataListUtil.IsEvaluated(Variable) ? Variable : null, Operator = _operand, GroupName = null, Value = "", GroupIndex = 0, MockSelected = _mockSelected }); } } }