public void Constructor_With_Array_Expected_InitializesWithArray() { var result = new DebugItemResult { GroupName = "Hello", Value = "world" }; var item = new DebugItem(); item.Add(result); Assert.AreEqual(1, item.FetchResultsList().Count); Assert.AreSame(result, item.FetchResultsList()[0]); }
public void Constructor_With_Array_Expected_InitializesWithArray() { var result = new DebugItemResult { GroupName = "Hello", Value = "world" }; var item = new DebugItem(); item.Add(result); Assert.AreEqual(1, item.FetchResultsList().Count); Assert.AreSame(result, item.FetchResultsList()[0]); }
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); } } }
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 static List <IDebugItemResult> ProcessRecordSet(XElement recordSetElement, IEnumerable <XElement> elements) { var processRecordSet = new List <IDebugItemResult>(); var recSetName = recordSetElement.Name.LocalName; var index = recordSetElement.Attribute("Index").Value; foreach (var xElement in elements) { var debugItemResult = new DebugItemResult { GroupName = DataListUtil.AddBracketsToValueIfNotExist(DataListUtil.MakeValueIntoHighLevelRecordset(recSetName, true)), Value = xElement.Value, GroupIndex = int.Parse(index), Variable = DataListUtil.AddBracketsToValueIfNotExist(DataListUtil.CreateRecordsetDisplayValue(recSetName, xElement.Name.LocalName, index)), Operator = "=", Type = DebugItemResultType.Variable }; processRecordSet.Add(debugItemResult); } return(processRecordSet); }
static void AddSingleDebugResult(string rowValue, DebugItemResult debugItemResult) { var variableValuePair = rowValue.Split(new[] { " =" }, StringSplitOptions.None); debugItemResult.Variable = variableValuePair[0]; debugItemResult.Value = variableValuePair[1]; debugItemResult.Type = DebugItemResultType.Variable; var variable = debugItemResult.Variable; if (DataListUtil.IsValueRecordset(variable)) { var indexRegionFromRecordset = DataListUtil.ExtractIndexRegionFromRecordset(variable); if (!string.IsNullOrEmpty(indexRegionFromRecordset)) { int indexForRecset; int.TryParse(indexRegionFromRecordset, out indexForRecset); List <Tuple <string, string> > variableList; if (!ScenarioContext.Current.TryGetValue("variableList", out variableList)) { return; } var indexType = enRecordsetIndexType.Star; if (variableList.Find(tuple => tuple.Item1 == variable) != null) { indexType = enRecordsetIndexType.Numeric; } if (indexForRecset > 0 && indexType != enRecordsetIndexType.Numeric) { var indexOfOpenningBracket = variable.IndexOf("(", StringComparison.Ordinal) + 1; debugItemResult.GroupIndex = indexForRecset; var groupName = variable.Substring(0, indexOfOpenningBracket) + "*" + variable.Substring(indexOfOpenningBracket + indexRegionFromRecordset.Length); debugItemResult.GroupName = variableList.Find(tuple => tuple.Item1 == groupName) != null ? groupName : groupName.Replace("*", ""); } } } }
private static List<IDebugItemResult> ProcessRecordSet(XElement recordSetElement, IEnumerable<XElement> elements) { var processRecordSet = new List<IDebugItemResult>(); var recSetName = recordSetElement.Name.LocalName; var index = recordSetElement.Attribute("Index").Value; foreach(var xElement in elements) { var debugItemResult = new DebugItemResult { GroupName = DataListUtil.AddBracketsToValueIfNotExist(DataListUtil.MakeValueIntoHighLevelRecordset(recSetName, true)), Value = xElement.Value, GroupIndex = int.Parse(index), Variable = DataListUtil.AddBracketsToValueIfNotExist(DataListUtil.CreateRecordsetDisplayValue(recSetName, xElement.Name.LocalName, index)), Operator = "=", Type = DebugItemResultType.Variable }; processRecordSet.Add(debugItemResult); } return processRecordSet; }
private static void WriteDebugItems(string workflowName, string taskName, string result) { string user = Thread.CurrentPrincipal.Identity.Name.Replace("\\", "-"); var state = new DebugState { HasError = false, ID = Guid.NewGuid(), StartTime = DateTime.Now, EndTime = DateTime.Now, ActivityType = ActivityType.Workflow, ExecutingUser = user, Server = "localhost", ServerID = Guid.Empty, DisplayName = workflowName }; if(!string.IsNullOrEmpty(result)) { var data = DataListUtil.AdjustForEncodingIssues(result); bool isFragment; var isXml = DataListUtil.IsXml(data, out isFragment); if(isXml) { var xmlData = XElement.Parse(data); var allChildren = xmlData.Elements(); var groupedData = allChildren.GroupBy(element => element.Name); var recSets = groupedData as IGrouping<XName, XElement>[] ?? groupedData.ToArray(); foreach(var grouping in recSets) { var debugItem = new DebugItem(); foreach(var name in grouping) { if(name.HasElements) { var debugItemResult = ProcessRecordSet(name, name.Elements()); debugItem.ResultsList.AddRange(debugItemResult); } else { var debugItemResult = new DebugItemResult { Variable = DataListUtil.AddBracketsToValueIfNotExist(name.Name.LocalName), Value = name.Value, Operator = "=", Type = DebugItemResultType.Variable }; debugItem.ResultsList.Add(debugItemResult); } } state.Outputs.Add(debugItem); } } } var js = new Dev2JsonSerializer(); Thread.Sleep(5000); string correlation = GetCorrelationId(WarewolfTaskSchedulerPath + taskName); if(!Directory.Exists(OutputPath)) Directory.CreateDirectory(OutputPath); File.WriteAllText( string.Format("{0}DebugItems_{1}_{2}_{3}_{4}.txt", OutputPath, workflowName.Replace("\\", "_"), DateTime.Now.ToString("yyyy-MM-dd"), correlation, user), js.SerializeToBuilder(new List<DebugState> { state }).ToString()); }
void BuildDebugItems(TableRow row, int index, string columnHeader, List <IDebugItemResult> list) { if (!string.IsNullOrEmpty(row[index])) { var debugItemResult = new DebugItemResult { Label = columnHeader }; var rowValue = row[index]; if (columnHeader == "Username") { rowValue = rowValue.ResolveDomain(); } if (columnHeader == "Statement") { debugItemResult.Value = rowValue; debugItemResult.Type = DebugItemResultType.Value; list.Add(debugItemResult); return; } if (rowValue.Contains(" =")) { string[] multipleVarsOneLine; if (rowValue.Split('=').Length < 3 || rowValue.StartsWith("=")) { multipleVarsOneLine = new[] { rowValue }; } else { multipleVarsOneLine = rowValue.Split(','); } if (multipleVarsOneLine.Length > 0) { foreach (var singleRow in multipleVarsOneLine) { AddSingleDebugResult(singleRow, debugItemResult); list.Add(debugItemResult); } } } else if (rowValue.StartsWith("=")) { debugItemResult.Value = rowValue; debugItemResult.Type = DebugItemResultType.Value; debugItemResult.Variable = rowValue.Replace("=", ""); list.Add(debugItemResult); } else { if (!string.IsNullOrEmpty(columnHeader) && columnHeader.Equals("#")) { debugItemResult.Label = rowValue; debugItemResult.Value = ""; debugItemResult.Type = DebugItemResultType.Value; } else { // Handle async stuff if (rowValue.Contains("asynchronously:")) { var endIdx = rowValue.IndexOf(":", StringComparison.Ordinal); endIdx += 1; var label = rowValue.Substring(0, endIdx); var value = rowValue.Substring(endIdx); debugItemResult.Label = label; debugItemResult.Value = value; } else { debugItemResult.Value = rowValue.Replace("\\r", "").Replace("\n", Environment.NewLine); debugItemResult.Type = DebugItemResultType.Value; } } list.Add(debugItemResult); } } }
public void ReadXml(XmlReader reader) { reader.MoveToContent(); if(reader.ReadToDescendant("DebugItemResults")) { ResultsList = new List<IDebugItemResult>(); reader.ReadStartElement(); while(reader.MoveToContent() == XmlNodeType.Element && reader.LocalName == "DebugItemResult") { var item = new DebugItemResult(); item.ReadXml(reader); ResultsList.Add(item); } if(reader.NodeType == XmlNodeType.EndElement && reader.Name == "DebugItemResults") { reader.ReadEndElement(); } } reader.Read(); }
public void DispatchDebugState(IDSFDataObject dataObject, StateType stateType) { Guid remoteID; Guid.TryParse(dataObject.RemoteInvokerID, out remoteID); if (stateType == StateType.Before) { if (_debugState == null) { InitializeDebugState(stateType, dataObject, remoteID, false, ""); } if (_debugState != null) { // Bug 8595 - Juries var type = GetType(); var instance = Activator.CreateInstance(type); var activity = instance as Activity; if (activity != null) { _debugState.Name = activity.DisplayName; } var act = instance as DsfActivity; //End Bug 8595 try { Copy(GetDebugInputs(dataObject.Environment), _debugState.Inputs); } catch (Exception err) { Dev2Logger.Log.Error("DispatchDebugState", err); AddErrorToDataList(err, dataObject); var errorMessage = dataObject.Environment.FetchErrors(); _debugState.ErrorMessage = errorMessage; _debugState.HasError = true; var debugError = err as DebugCopyException; if (debugError != null) { _debugState.Inputs.Add(debugError.Item); } } if (dataObject.RemoteServiceType == "Workflow" && act != null && !_debugState.HasError) { var debugItem = new DebugItem(); var debugItemResult = new DebugItemResult { Type = DebugItemResultType.Value, Label = "Execute workflow asynchronously: ", Value = dataObject.RunWorkflowAsync ? "True" : "False" }; debugItem.Add(debugItemResult); _debugState.Inputs.Add(debugItem); } } } else { bool hasError = dataObject.Environment.HasErrors(); var errorMessage = String.Empty; if (hasError) { errorMessage = string.Join(Environment.NewLine, dataObject.Environment.Errors); } if (_debugState == null) { InitializeDebugState(stateType, dataObject, remoteID, hasError, errorMessage); } if (_debugState != null) { _debugState.NumberOfSteps = IsWorkflow ? dataObject.NumberOfSteps : 0; _debugState.StateType = stateType; _debugState.EndTime = DateTime.Now; _debugState.HasError = hasError; _debugState.ErrorMessage = errorMessage; try { if (dataObject.RunWorkflowAsync && !_debugState.HasError) { var debugItem = new DebugItem(); var debugItemResult = new DebugItemResult { Type = DebugItemResultType.Value, Value = "Asynchronous execution started" }; debugItem.Add(debugItemResult); _debugState.Outputs.Add(debugItem); _debugState.NumberOfSteps = 0; } else { Copy(GetDebugOutputs(dataObject.Environment), _debugState.Outputs); } } catch (Exception e) { Dev2Logger.Log.Error("Debug Dispatch Error", e); AddErrorToDataList(e, dataObject); errorMessage = dataObject.Environment.FetchErrors(); _debugState.ErrorMessage = errorMessage; _debugState.HasError = true; } } } if (_debugState != null && (!(_debugState.ActivityType == ActivityType.Workflow || _debugState.Name == "DsfForEachActivity") && remoteID == Guid.Empty)) { _debugState.StateType = StateType.All; // Only dispatch 'before state' if it is a workflow or for each activity or a remote activity ;) if (stateType == StateType.Before) { return; } } // We know that if a if it is not a workflow it must be a service ;) if (dataObject.RemoteServiceType != "Workflow" && !String.IsNullOrWhiteSpace(dataObject.RemoteServiceType)) { if (_debugState != null) { _debugState.ActivityType = ActivityType.Service; } } if (_debugState != null) { if (remoteID == Guid.Empty) { switch (_debugState.StateType) { case StateType.Before: _debugState.Outputs.Clear(); break; case StateType.After: _debugState.Inputs.Clear(); break; } } // BUG 9706 - 2013.06.22 - TWR : refactored from here to DebugDispatcher _debugState.ClientID = dataObject.ClientID; _debugState.OriginatingResourceID = dataObject.ResourceID; _debugDispatcher.Write(_debugState, dataObject.RemoteInvoke, dataObject.RemoteInvokerID, dataObject.ParentInstanceID, dataObject.RemoteDebugItems); if (stateType == StateType.After) { // Free up debug state _debugState = null; } } }
static void WriteDebugItems(string workflowName, string taskName, string result) { var user = Thread.CurrentPrincipal.Identity.Name.Replace("\\", "-"); var state = new DebugState { HasError = result.Contains("Exception"), ID = Guid.NewGuid(), StartTime = StartTime, EndTime = DateTime.Now, ActivityType = ActivityType.Workflow, ExecutingUser = user, Server = "localhost", ServerID = Guid.Empty, DisplayName = workflowName }; if (!string.IsNullOrEmpty(result)) { var data = DataListUtil.AdjustForEncodingIssues(result); var isXml = DataListUtil.IsXml(data, out bool isFragment); if (isXml) { var xmlData = XElement.Parse(data); var allChildren = xmlData.Elements(); var groupedData = allChildren.GroupBy(element => element.Name); var recSets = groupedData as IGrouping <XName, XElement>[] ?? groupedData.ToArray(); foreach (var grouping in recSets) { var debugItem = new DebugItem(); foreach (var name in grouping) { if (name.HasElements) { var debugItemResult = ProcessRecordSet(name, name.Elements()); debugItem.ResultsList.AddRange(debugItemResult); } else { var debugItemResult = new DebugItemResult { Variable = DataListUtil.AddBracketsToValueIfNotExist(name.Name.LocalName), Value = name.Value, Operator = "=", Type = DebugItemResultType.Variable }; debugItem.ResultsList.Add(debugItemResult); } } state.Outputs.Add(debugItem); } } } var js = new Dev2JsonSerializer(); Thread.Sleep(5000); var correlation = GetCorrelationId(WarewolfTaskSchedulerPath + taskName); if (!Directory.Exists(OutputPath)) { Directory.CreateDirectory(OutputPath); } File.WriteAllText( $"{OutputPath}DebugItems_{workflowName.Replace("\\", "_")}_{DateTime.Now.ToString("yyyy-MM-dd")}_{correlation}_{user}.txt", js.SerializeToBuilder(new List <DebugState> { state }).ToString()); }
List<IDebugItemResult> BuildDebugItemFromAtomList() { var results = new List<IDebugItemResult>(); 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(); if (displayExpression.Contains("().") || displayExpression.Contains("(*).")) { grpIdx++; string index = grpIdx.ToString(CultureInfo.InvariantCulture); if (rawExpression.Contains(".WarewolfPositionColumn")) { index = item; item = ""; } groupName = rawExpression.Replace(".WarewolfPositionColumn",""); // ReSharper disable EmptyStatement displayExpression = DataListUtil.AddBracketsToValueIfNotExist(DataListUtil.CreateRecordsetDisplayValue(DataListUtil.ExtractRecordsetNameFromValue(_variable), DataListUtil.ExtractFieldNameFromValue(_variable), index)).Replace(".WarewolfPositionColumn", ""); ; // ReSharper restore EmptyStatement } else { string indexRegionFromRecordset = DataListUtil.ExtractIndexRegionFromRecordset(displayExpression); int indexForRecset; int.TryParse(indexRegionFromRecordset, out indexForRecset); if (indexForRecset > 0) { int indexOfOpenningBracket = displayExpression.IndexOf("(", StringComparison.Ordinal) + 1; string group = displayExpression.Substring(0, indexOfOpenningBracket) + "*" + displayExpression.Substring(indexOfOpenningBracket + indexRegionFromRecordset.Length); grpIdx++; groupName = @group; } } var debugOperator = ""; var debugType = DebugItemResultType.Value; if (DataListUtil.IsEvaluated(displayExpression)) { debugOperator = String.IsNullOrEmpty(item)?"": "="; debugType = DebugItemResultType.Variable; } 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 }); } } else { results.Add(new DebugItemResult { Type = DebugItemResultType.Variable, Label = _leftLabel, Variable = DataListUtil.IsEvaluated(Variable) ? Variable : null, Operator = _operand, GroupName = null, Value = "", GroupIndex = grpIdx }); } } if (!string.IsNullOrEmpty(_rightLabel)) { if (_oldValue != null) { if (_oldValue.IsWarewolfAtomResult) { var scalarResult = _oldValue as WarewolfDataEvaluationCommon.WarewolfEvalResult.WarewolfAtomResult; if (scalarResult != null) { 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 }); } } else if (_oldValue.IsWarewolfAtomListresult) { var recSetResult = _oldValue as WarewolfDataEvaluationCommon.WarewolfEvalResult.WarewolfAtomListresult; string groupName = null; int grpIdx = 0; if (recSetResult != null) { foreach (var item in recSetResult.Item) { string displayExpression = _assignedToVariableName; string rawExpression = _assignedToVariableName; if (displayExpression.Contains("().") || displayExpression.Contains("(*).")) { grpIdx++; groupName = rawExpression; displayExpression = DataListUtil.AddBracketsToValueIfNotExist(DataListUtil.CreateRecordsetDisplayValue(DataListUtil.ExtractRecordsetNameFromValue(_assignedToVariableName), DataListUtil.ExtractFieldNameFromValue(_assignedToVariableName), grpIdx.ToString())); } else { string indexRegionFromRecordset = DataListUtil.ExtractIndexRegionFromRecordset(displayExpression); int indexForRecset; int.TryParse(indexRegionFromRecordset, out indexForRecset); if (indexForRecset > 0) { int indexOfOpenningBracket = displayExpression.IndexOf("(", StringComparison.Ordinal) + 1; string group = displayExpression.Substring(0, indexOfOpenningBracket) + "*" + displayExpression.Substring(indexOfOpenningBracket + indexRegionFromRecordset.Length); grpIdx++; groupName = @group; } } var debugOperator = ""; var debugType = DebugItemResultType.Value; if (DataListUtil.IsEvaluated(displayExpression)) { debugOperator = "="; debugType = DebugItemResultType.Variable; } 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 }; results.Add(debugItemResult); } } } } if (_oldValue == null) { var debugItemResult = new DebugItemResult { Type = DebugItemResultType.Variable, Label = _rightLabel, Variable = null, Operator = "=", GroupName = null, Value = _newValue, GroupIndex = 0 }; results.Add(debugItemResult); } } if (string.IsNullOrEmpty(_rightLabel) && string.IsNullOrEmpty(_leftLabel)) { string groupName = null; int grpIdx = 0; if (_warewolfAtomListresult != null) { foreach (var item in _warewolfAtomListresult.Item) { string displayExpression = _variable; string rawExpression = _variable; if (displayExpression.Contains("().") || displayExpression.Contains("(*).")) { grpIdx++; groupName = rawExpression; displayExpression = DataListUtil.AddBracketsToValueIfNotExist(DataListUtil.CreateRecordsetDisplayValue(DataListUtil.ExtractRecordsetNameFromValue(_variable), DataListUtil.ExtractFieldNameOnlyFromValue(DataListUtil.AddBracketsToValueIfNotExist(_variable)), grpIdx.ToString())); if (DataListUtil.GetRecordsetIndexType(_variable) == enRecordsetIndexType.Star) { displayExpression += _variable.Replace(DataListUtil.ReplaceRecordsetIndexWithStar(displayExpression), ""); } else if (DataListUtil.GetRecordsetIndexType(_variable) == enRecordsetIndexType.Blank) { displayExpression += _variable.Replace(DataListUtil.ReplaceRecordsetIndexWithBlank(displayExpression), ""); } } else { string indexRegionFromRecordset = DataListUtil.ExtractIndexRegionFromRecordset(displayExpression); int indexForRecset; int.TryParse(indexRegionFromRecordset, out indexForRecset); if (indexForRecset > 0) { int indexOfOpenningBracket = displayExpression.IndexOf("(", StringComparison.Ordinal) + 1; string group = displayExpression.Substring(0, indexOfOpenningBracket) + "*" + displayExpression.Substring(indexOfOpenningBracket + indexRegionFromRecordset.Length); grpIdx++; groupName = @group; } } var debugOperator = ""; var debugType = DebugItemResultType.Value; if (DataListUtil.IsEvaluated(displayExpression)) { debugOperator = "="; debugType = DebugItemResultType.Variable; } else { displayExpression = null; } results.Add(new DebugItemResult { Type = debugType, Variable = DataListUtil.IsEvaluated(displayExpression) ? displayExpression : null, Operator = debugOperator, GroupName = groupName, Value = ExecutionEnvironment.WarewolfAtomToString(item), GroupIndex = grpIdx }); } } else { results.Add(new DebugItemResult { Type = DebugItemResultType.Variable, Variable = DataListUtil.IsEvaluated(Variable) ? Variable : null, Operator = _operand, GroupName = null, Value = "", GroupIndex = grpIdx }); } } return results; }
List <IDebugItemResult> BuildDebugItemFromAtomList() { var results = new List <IDebugItemResult>(); 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(); if (displayExpression.Contains("().") || displayExpression.Contains("(*).")) { grpIdx++; string index = grpIdx.ToString(CultureInfo.InvariantCulture); if (rawExpression.Contains(".WarewolfPositionColumn")) { index = item; item = ""; } groupName = rawExpression.Replace(".WarewolfPositionColumn", ""); // ReSharper disable EmptyStatement displayExpression = DataListUtil.AddBracketsToValueIfNotExist(DataListUtil.CreateRecordsetDisplayValue(DataListUtil.ExtractRecordsetNameFromValue(_variable), DataListUtil.ExtractFieldNameFromValue(_variable), index)).Replace(".WarewolfPositionColumn", "");; // ReSharper restore EmptyStatement } else { string indexRegionFromRecordset = DataListUtil.ExtractIndexRegionFromRecordset(displayExpression); int indexForRecset; int.TryParse(indexRegionFromRecordset, out indexForRecset); if (indexForRecset > 0) { int indexOfOpenningBracket = displayExpression.IndexOf("(", StringComparison.Ordinal) + 1; string group = displayExpression.Substring(0, indexOfOpenningBracket) + "*" + displayExpression.Substring(indexOfOpenningBracket + indexRegionFromRecordset.Length); grpIdx++; groupName = @group; } } var debugOperator = ""; var debugType = DebugItemResultType.Value; if (DataListUtil.IsEvaluated(displayExpression)) { debugOperator = String.IsNullOrEmpty(item)?"": "="; debugType = DebugItemResultType.Variable; } 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 }); } } else { results.Add(new DebugItemResult { Type = DebugItemResultType.Variable, Label = _leftLabel, Variable = DataListUtil.IsEvaluated(Variable) ? Variable : null, Operator = _operand, GroupName = null, Value = "", GroupIndex = grpIdx }); } } if (!string.IsNullOrEmpty(_rightLabel)) { if (_oldValue != null) { if (_oldValue.IsWarewolfAtomResult) { var scalarResult = _oldValue as WarewolfDataEvaluationCommon.WarewolfEvalResult.WarewolfAtomResult; if (scalarResult != null) { 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 }); } } else if (_oldValue.IsWarewolfAtomListresult) { var recSetResult = _oldValue as WarewolfDataEvaluationCommon.WarewolfEvalResult.WarewolfAtomListresult; string groupName = null; int grpIdx = 0; if (recSetResult != null) { foreach (var item in recSetResult.Item) { string displayExpression = _assignedToVariableName; string rawExpression = _assignedToVariableName; if (displayExpression.Contains("().") || displayExpression.Contains("(*).")) { grpIdx++; groupName = rawExpression; displayExpression = DataListUtil.AddBracketsToValueIfNotExist(DataListUtil.CreateRecordsetDisplayValue(DataListUtil.ExtractRecordsetNameFromValue(_assignedToVariableName), DataListUtil.ExtractFieldNameFromValue(_assignedToVariableName), grpIdx.ToString())); } else { string indexRegionFromRecordset = DataListUtil.ExtractIndexRegionFromRecordset(displayExpression); int indexForRecset; int.TryParse(indexRegionFromRecordset, out indexForRecset); if (indexForRecset > 0) { int indexOfOpenningBracket = displayExpression.IndexOf("(", StringComparison.Ordinal) + 1; string group = displayExpression.Substring(0, indexOfOpenningBracket) + "*" + displayExpression.Substring(indexOfOpenningBracket + indexRegionFromRecordset.Length); grpIdx++; groupName = @group; } } var debugOperator = ""; var debugType = DebugItemResultType.Value; if (DataListUtil.IsEvaluated(displayExpression)) { debugOperator = "="; debugType = DebugItemResultType.Variable; } 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 }; results.Add(debugItemResult); } } } } if (_oldValue == null) { var debugItemResult = new DebugItemResult { Type = DebugItemResultType.Variable, Label = _rightLabel, Variable = null, Operator = "=", GroupName = null, Value = _newValue, GroupIndex = 0 }; results.Add(debugItemResult); } } if (string.IsNullOrEmpty(_rightLabel) && string.IsNullOrEmpty(_leftLabel)) { string groupName = null; int grpIdx = 0; if (_warewolfAtomListresult != null) { foreach (var item in _warewolfAtomListresult.Item) { string displayExpression = _variable; string rawExpression = _variable; if (displayExpression.Contains("().") || displayExpression.Contains("(*).")) { grpIdx++; groupName = rawExpression; displayExpression = DataListUtil.AddBracketsToValueIfNotExist(DataListUtil.CreateRecordsetDisplayValue(DataListUtil.ExtractRecordsetNameFromValue(_variable), DataListUtil.ExtractFieldNameOnlyFromValue(DataListUtil.AddBracketsToValueIfNotExist(_variable)), grpIdx.ToString())); if (DataListUtil.GetRecordsetIndexType(_variable) == enRecordsetIndexType.Star) { displayExpression += _variable.Replace(DataListUtil.ReplaceRecordsetIndexWithStar(displayExpression), ""); } else if (DataListUtil.GetRecordsetIndexType(_variable) == enRecordsetIndexType.Blank) { displayExpression += _variable.Replace(DataListUtil.ReplaceRecordsetIndexWithBlank(displayExpression), ""); } } else { string indexRegionFromRecordset = DataListUtil.ExtractIndexRegionFromRecordset(displayExpression); int indexForRecset; int.TryParse(indexRegionFromRecordset, out indexForRecset); if (indexForRecset > 0) { int indexOfOpenningBracket = displayExpression.IndexOf("(", StringComparison.Ordinal) + 1; string group = displayExpression.Substring(0, indexOfOpenningBracket) + "*" + displayExpression.Substring(indexOfOpenningBracket + indexRegionFromRecordset.Length); grpIdx++; groupName = @group; } } var debugOperator = ""; var debugType = DebugItemResultType.Value; if (DataListUtil.IsEvaluated(displayExpression)) { debugOperator = "="; debugType = DebugItemResultType.Variable; } else { displayExpression = null; } results.Add(new DebugItemResult { Type = debugType, Variable = DataListUtil.IsEvaluated(displayExpression) ? displayExpression : null, Operator = debugOperator, GroupName = groupName, Value = ExecutionEnvironment.WarewolfAtomToString(item), GroupIndex = grpIdx }); } } else { results.Add(new DebugItemResult { Type = DebugItemResultType.Variable, Variable = DataListUtil.IsEvaluated(Variable) ? Variable : null, Operator = _operand, GroupName = null, Value = "", GroupIndex = grpIdx }); } } return(results); }
private void OldValueAtomListResult(List <IDebugItemResult> results) { var recSetResult = _oldValue as CommonFunctions.WarewolfEvalResult.WarewolfAtomListresult; string groupName = null; int grpIdx = 0; if (recSetResult != null) { foreach (var item in recSetResult.Item) { string displayExpression = _assignedToVariableName; string rawExpression = _assignedToVariableName; if (displayExpression.Contains("().") || displayExpression.Contains("(*).")) { grpIdx++; groupName = rawExpression; Dev2DataLanguageParser dataLanguageParser = new Dev2DataLanguageParser(); var vals = dataLanguageParser.ParseForActivityDataItems(_assignedToVariableName); if (vals != null) { foreach (var val in vals) { var repVal = DataListUtil.CreateRecordsetDisplayValue(DataListUtil.ExtractRecordsetNameFromValue(val), DataListUtil.ExtractFieldNameFromValue(val), grpIdx.ToString()); displayExpression = _assignedToVariableName.Replace(val, repVal); } } } else { string indexRegionFromRecordset = DataListUtil.ExtractIndexRegionFromRecordset(displayExpression); int indexForRecset; int.TryParse(indexRegionFromRecordset, out indexForRecset); if (indexForRecset > 0) { int indexOfOpenningBracket = displayExpression.IndexOf("(", StringComparison.Ordinal) + 1; string group = displayExpression.Substring(0, indexOfOpenningBracket) + "*" + displayExpression.Substring(indexOfOpenningBracket + indexRegionFromRecordset.Length); grpIdx++; groupName = @group; } } var debugOperator = ""; var debugType = DebugItemResultType.Value; if (DataListUtil.IsEvaluated(displayExpression)) { debugOperator = "="; debugType = DebugItemResultType.Variable; if (_isCalculate) { displayExpression = groupName ?? 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); } } }
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 }; debugItemsResults.Add(debugItem); } else { var debugItem = new DebugItemResult { Type = Type, Value = _value, Variable = Variable, Operator = _operand }; 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) ? "=" : "" }; debugItemsResults.Add(debugItem); } return debugItemsResults; }