public override List <DebugItem> GetDebugOutputs(IBinaryDataList dataList) { IDev2LanguageParser parser = DataListFactory.CreateOutputParser(); IList <IDev2Definition> inputs = parser.Parse(OutputMapping); IDataListCompiler compiler = DataListFactory.CreateDataListCompiler(); var results = new List <DebugItem>(); foreach (IDev2Definition dev2Definition in inputs) { ErrorResultTO errors; IBinaryDataListEntry tmpEntry = compiler.Evaluate(dataList.UID, enActionType.User, dev2Definition.RawValue, false, out errors); if (tmpEntry != null) { DebugItem itemToAdd = new DebugItem(); AddDebugItem(new DebugItemVariableParams(dev2Definition.RawValue, "", tmpEntry, dataList.UID), itemToAdd); results.Add(itemToAdd); } else { if (errors.HasErrors()) { throw new Exception(errors.MakeDisplayReady()); } } } foreach (IDebugItem debugOutput in results) { debugOutput.FlushStringBuilder(); } return(results); }
public void GetDebugOutputsFromEnv(IExecutionEnvironment environment) { IDev2LanguageParser parser = DataListFactory.CreateOutputParser(); IList <IDev2Definition> outputs = parser.Parse(OutputMapping); var results = new List <DebugItem>(); foreach (IDev2Definition dev2Definition in outputs) { try { DebugItem itemToAdd = new DebugItem(); AddDebugItem(new DebugEvalResult(dev2Definition.RawValue, "", environment), itemToAdd); results.Add(itemToAdd); } catch (Exception e) { Dev2Logger.Log.Error(e.Message, e); } } foreach (IDebugItem debugOutput in results) { debugOutput.FlushStringBuilder(); } _debugOutputs = results; }
public override List <DebugItem> GetDebugInputs(IBinaryDataList dataList) { IDev2LanguageParser parser = DataListFactory.CreateInputParser(); IDataListCompiler compiler = DataListFactory.CreateDataListCompiler(); return(GetDebugInputs(dataList, compiler, parser).Select(a => (DebugItem)a).ToList()); }
public List <IDebugItem> GetDebugInputs(IExecutionEnvironment env, IDev2LanguageParser parser) { IList <IDev2Definition> inputs = parser.Parse(InputMapping); var results = new List <IDebugItem>(); foreach (IDev2Definition dev2Definition in inputs) { if (string.IsNullOrEmpty(dev2Definition.RawValue)) { continue; } var tmpEntry = env.Eval(dev2Definition.RawValue); DebugItem itemToAdd = new DebugItem(); if (tmpEntry.IsWarewolfAtomResult) { var warewolfAtomResult = tmpEntry as WarewolfDataEvaluationCommon.WarewolfEvalResult.WarewolfAtomResult; if (warewolfAtomResult != null) { var variableName = dev2Definition.Name; if (!string.IsNullOrEmpty(dev2Definition.RecordSetName)) { variableName = DataListUtil.CreateRecordsetDisplayValue(dev2Definition.RecordSetName, dev2Definition.Name, "1"); } AddDebugItem(new DebugItemWarewolfAtomResult(warewolfAtomResult.Item.ToString(), DataListUtil.AddBracketsToValueIfNotExist(variableName), ""), itemToAdd); } results.Add(itemToAdd); } else { var warewolfAtomListResult = tmpEntry as WarewolfDataEvaluationCommon.WarewolfEvalResult.WarewolfAtomListresult; if (warewolfAtomListResult != null) { var variableName = dev2Definition.Name; if (!string.IsNullOrEmpty(dev2Definition.RecordSetName)) { variableName = DataListUtil.CreateRecordsetDisplayValue(dev2Definition.RecordSetName, dev2Definition.Name, "*"); AddDebugItem(new DebugItemWarewolfAtomListResult(warewolfAtomListResult, "", "", DataListUtil.AddBracketsToValueIfNotExist(variableName), "", "", "="), itemToAdd); } else { var warewolfAtom = warewolfAtomListResult.Item.Last(); AddDebugItem(new DebugItemWarewolfAtomResult(warewolfAtom.ToString(), DataListUtil.AddBracketsToValueIfNotExist(variableName), ""), itemToAdd); } } results.Add(itemToAdd); } } foreach (IDebugItem debugInput in results) { debugInput.FlushStringBuilder(); } return(results); }
public void GetDebugOutputsFromEnv(IExecutionEnvironment environment, int update) { var results = new List <DebugItem>(); if (IsObject) { if (!string.IsNullOrEmpty(ObjectName) && !(this is DsfEnhancedDotNetDllActivity)) { DebugItem itemToAdd = new DebugItem(); AddDebugItem(new DebugEvalResult(ObjectName, "", environment, update), itemToAdd); results.Add(itemToAdd); } } else { if (Outputs != null && Outputs.Count > 0) { foreach (var serviceOutputMapping in Outputs) { try { DebugItem itemToAdd = new DebugItem(); AddDebugItem(new DebugEvalResult(serviceOutputMapping.MappedTo, "", environment, update), itemToAdd); results.Add(itemToAdd); } catch (Exception e) { Dev2Logger.Error(e.Message, e); } } } else { IDev2LanguageParser parser = DataListFactory.CreateOutputParser(); IList <IDev2Definition> outputs = parser.Parse(OutputMapping); foreach (IDev2Definition dev2Definition in outputs) { try { DebugItem itemToAdd = new DebugItem(); AddDebugItem(new DebugEvalResult(dev2Definition.RawValue, "", environment, update), itemToAdd); results.Add(itemToAdd); } catch (Exception e) { Dev2Logger.Error(e.Message, e); } } } } foreach (IDebugItem debugOutput in results) { debugOutput.FlushStringBuilder(); } _debugOutputs = results; }
#pragma warning disable S3776 // Cognitive Complexity of methods should not be too high public List <IDebugItem> GetDebugInputs(IExecutionEnvironment env, IDev2LanguageParser parser, int update) #pragma warning restore S3776 // Cognitive Complexity of methods should not be too high { var results = new List <IDebugItem>(); if (Inputs != null && Inputs.Count > 0) { foreach (var serviceInput in Inputs) { if (string.IsNullOrEmpty(serviceInput.Value)) { continue; } var tmpEntry = env.Eval(serviceInput.Value, update); var itemToAdd = new DebugItem(); if (tmpEntry.IsWarewolfAtomResult) { AddWarewolfAtomResults(results, serviceInput, tmpEntry, itemToAdd); } else { AddWarewolfAtomListResults(results, serviceInput, tmpEntry, itemToAdd); } } } else { var inputs = parser.Parse(InputMapping); foreach (IDev2Definition dev2Definition in inputs) { if (string.IsNullOrEmpty(dev2Definition.RawValue)) { continue; } var tmpEntry = env.Eval(dev2Definition.RawValue, update); var itemToAdd = new DebugItem(); if (tmpEntry.IsWarewolfAtomResult) { AddWarewolfAtomResults(results, dev2Definition, tmpEntry, itemToAdd); } else { AddWarewolfAtomList(results, dev2Definition, tmpEntry, itemToAdd); } } } foreach (IDebugItem debugInput in results) { debugInput.FlushStringBuilder(); } return(results); }
IList <IInputOutputViewModel> CreateMappingList(string mappingDefinitions, IDev2LanguageParser parser, bool autoAddBrackets, bool isOutputMapping, FuzzyMatchVo fuzzyMatch = null) { IList <IInputOutputViewModel> result = new List <IInputOutputViewModel>(); var concreteDefinitions = parser.ParseAndAllowBlanks(mappingDefinitions); foreach (var def in concreteDefinitions) { var injectValue = def.RawValue; if (autoAddBrackets) { injectValue = CreateInjectValue(isOutputMapping, fuzzyMatch, def); } var injectMapsTo = def.MapsTo; // no saved mappings add brackets ;) if (!string.IsNullOrEmpty(injectMapsTo) && string.IsNullOrEmpty(SavedInputMapping)) { injectMapsTo = DataListUtil.AddBracketsToValueIfNotExist(injectMapsTo); } else { if (def.IsRecordSet) { var tmp = injectValue.Replace("()", "(*)"); injectMapsTo = tmp; // tag it as the same ;) } else { injectMapsTo = injectValue; // tag it as the same ;) } } // def.RecordSetName -> recordsetName var viewModel = new InputOutputViewModel(def.Name, injectValue, injectMapsTo, def.DefaultValue, def.IsRequired, def.RecordSetName, def.EmptyToNull); viewModel.IsObject = def.IsObject; if (def.IsObject) { var complexObjectItemModel = _complexObjects.FirstOrDefault(model => model.Name == def.Name); if (complexObjectItemModel != null) { viewModel.JsonString = complexObjectItemModel.GetJson(); } } result.Add(viewModel); } return(result); }
public override List <string> GetOutputs() { if (Outputs == null) { if (IsObject) { return(new List <string> { ObjectName }); } IDev2LanguageParser parser = DataListFactory.CreateOutputParser(); IList <IDev2Definition> outputs = parser.Parse(OutputMapping); return(outputs.Select(definition => definition.MapsTo).ToList()); } return(Outputs.Select(mapping => mapping.MappedTo).ToList()); }
/// <summary> /// Creates the mapping list. /// </summary> /// <param name="mappingDefinitions">The mapping definitions.</param> /// <param name="parser">The parser.</param> /// <param name="autoAddBrackets">if set to <c>true</c> [automatic add brackets].</param> /// <param name="isOutputMapping">if set to <c>true</c> [is output mapping].</param> /// <param name="fuzzyMatch">The fuzzy match.</param> /// <returns></returns> private IList <IInputOutputViewModel> CreateMappingList(string mappingDefinitions, IDev2LanguageParser parser, bool autoAddBrackets, bool isOutputMapping, FuzzyMatchVo fuzzyMatch = null) { IList <IInputOutputViewModel> result = new List <IInputOutputViewModel>(); IList <IDev2Definition> concreteDefinitions = parser.ParseAndAllowBlanks(mappingDefinitions); var masterRecordsetName = string.Empty; foreach (var def in concreteDefinitions) { var injectValue = def.RawValue; if (!string.IsNullOrEmpty(injectValue) || IsWorkflow) { if (autoAddBrackets) { // When output mapping we need to replace the recordset name if present with MasterRecordset // if (isOutputMapping && def.IsRecordSet && fuzzyMatch != null) { var field = DataListUtil.ExtractFieldNameFromValue(injectValue); if (IsWorkflow) { field = def.Name; } string recordsetName = fuzzyMatch.FetchMatch(def.Name, def.RecordSetName); if (!string.IsNullOrEmpty(recordsetName)) { masterRecordsetName = recordsetName; } else { // we have no match, use the current mapping value ;) masterRecordsetName = !IsWorkflow?DataListUtil.ExtractRecordsetNameFromValue(injectValue) : def.RecordSetName; } injectValue = FormatString(masterRecordsetName, field); } else { if (def.IsRecordSet) { if (fuzzyMatch != null) { string recordsetName = fuzzyMatch.FetchMatch(def.Name, def.RecordSetName); masterRecordsetName = !String.IsNullOrEmpty(recordsetName) ? recordsetName : def.RecordSetName; } else { masterRecordsetName = def.RecordSetName; } injectValue = FormatString(masterRecordsetName, def.Name); } else { injectValue = DataListUtil.AddBracketsToValueIfNotExist(!IsWorkflow ? injectValue : def.Name); } } } } else { if (!def.IsRecordSet) { if (!String.IsNullOrEmpty(def.RawValue) && String.IsNullOrEmpty(SavedInputMapping)) { injectValue = DataListUtil.AddBracketsToValueIfNotExist(def.Name); } } else { if (!isOutputMapping) { var field = def.Name; if (fuzzyMatch != null && def.IsRecordSet) { if (string.IsNullOrEmpty(masterRecordsetName)) { string recordsetName = fuzzyMatch.FetchMatch(def.Name, def.RecordSetName); masterRecordsetName = !string.IsNullOrEmpty(recordsetName) ? recordsetName : def.RecordSetName; } injectValue = DataListUtil.ComposeIntoUserVisibleRecordset(masterRecordsetName, string.Empty, field); injectValue = DataListUtil.AddBracketsToValueIfNotExist(injectValue); } else { if (!String.IsNullOrEmpty(def.RawValue) && String.IsNullOrEmpty(SavedInputMapping)) { injectValue = FormatString(def.RecordSetName, def.Name); } } } else { if (!String.IsNullOrEmpty(def.RawValue) && String.IsNullOrEmpty(SavedOutputMapping)) { injectValue = FormatString(def.RecordSetName, def.Name); } } } } var injectMapsTo = def.MapsTo; // no saved mappings add brackets ;) if (!string.IsNullOrEmpty(injectMapsTo) && string.IsNullOrEmpty(SavedInputMapping)) { injectMapsTo = DataListUtil.AddBracketsToValueIfNotExist(injectMapsTo); } else { if (def.IsRecordSet) { var tmp = injectValue.Replace("()", "(*)"); injectMapsTo = tmp; // tag it as the same ;) } else { injectMapsTo = injectValue; // tag it as the same ;) } } // def.RecordSetName -> recordsetName var viewModel = new InputOutputViewModel(def.Name, injectValue, injectMapsTo, def.DefaultValue, def.IsRequired, def.RecordSetName, def.EmptyToNull); result.Add(viewModel); } return(result); }
/// <summary> /// Generates the mapping. /// </summary> /// <param name="savedMappingData">The mapping data.</param> /// <param name="mappingDefinitions">The mapping definitions.</param> /// <param name="isOutputMapping">if set to <c>true</c> [is output mapping].</param> /// <param name="parser">The parser.</param> /// <returns></returns> private IList <IInputOutputViewModel> GenerateMapping(string savedMappingData, string mappingDefinitions, bool isOutputMapping, IDev2LanguageParser parser) { IList <IInputOutputViewModel> result; if (string.IsNullOrEmpty(savedMappingData)) { // TODO : Inject fuzzy matching logic here ;) var fuzzyMatchDefinitions = GenerateMatchFragmentsFromDataList(); result = CreateMappingList(mappingDefinitions, parser, true, isOutputMapping, fuzzyMatchDefinitions); } else { // generate the master view ;) var masterView = CreateMappingList(mappingDefinitions, parser, true, isOutputMapping); // use existing data ;) var existingView = CreateMappingList(savedMappingData, parser, false, isOutputMapping); // Now adjust for the difference between the two views ;) result = ReconcileExistingAndMasterView(masterView, existingView); } return(result); }
public override List <DebugItem> GetDebugInputs(IExecutionEnvironment env) { IDev2LanguageParser parser = DataListFactory.CreateInputParser(); return(GetDebugInputs(env, parser).Select(a => (DebugItem)a).ToList()); }
/// <summary> /// Creates the mapping list. /// </summary> /// <param name="mappingDefinitions">The mapping definitions.</param> /// <param name="parser">The parser.</param> /// <param name="autoAddBrackets">if set to <c>true</c> [automatic add brackets].</param> /// <param name="isOutputMapping">if set to <c>true</c> [is output mapping].</param> /// <param name="fuzzyMatch">The fuzzy match.</param> /// <returns></returns> private IList <IInputOutputViewModel> CreateMappingList(string mappingDefinitions, IDev2LanguageParser parser, bool autoAddBrackets, bool isOutputMapping, FuzzyMatchVo fuzzyMatch = null) { IList <IInputOutputViewModel> result = new List <IInputOutputViewModel>(); IList <IDev2Definition> concreteDefinitions = parser.ParseAndAllowBlanks(mappingDefinitions); foreach (var def in concreteDefinitions) { var injectValue = def.RawValue; if (autoAddBrackets) { // When output mapping we need to replace the recordset name if present with MasterRecordset // string masterRecordsetName; if (isOutputMapping && def.IsRecordSet && fuzzyMatch != null) { var field = def.Name; string recordsetName = fuzzyMatch.FetchMatch(def.Name, def.RecordSetName); if (!string.IsNullOrEmpty(recordsetName)) { masterRecordsetName = recordsetName; } else { // we have no match, use the current mapping value ;) masterRecordsetName = def.RecordSetName; } injectValue = FormatString(masterRecordsetName, field); } else { if (def.IsRecordSet) { if (fuzzyMatch != null) { string recordsetName = fuzzyMatch.FetchMatch(def.Name, def.RecordSetName); masterRecordsetName = !String.IsNullOrEmpty(recordsetName) ? recordsetName : def.RecordSetName; } else { masterRecordsetName = def.RecordSetName; } injectValue = FormatString(masterRecordsetName, def.Name); } else { injectValue = DataListUtil.AddBracketsToValueIfNotExist(def.Name); } } } var injectMapsTo = def.MapsTo; // no saved mappings add brackets ;) if (!string.IsNullOrEmpty(injectMapsTo) && string.IsNullOrEmpty(SavedInputMapping)) { injectMapsTo = DataListUtil.AddBracketsToValueIfNotExist(injectMapsTo); } else { if (def.IsRecordSet) { var tmp = injectValue.Replace("()", "(*)"); injectMapsTo = tmp; // tag it as the same ;) } else { injectMapsTo = injectValue; // tag it as the same ;) } } // def.RecordSetName -> recordsetName var viewModel = new InputOutputViewModel(def.Name, injectValue, injectMapsTo, def.DefaultValue, def.IsRequired, def.RecordSetName, def.EmptyToNull); viewModel.IsObject = def.IsObject; if (def.IsObject) { var complexObjectItemModel = _complexObjects.FirstOrDefault(model => model.Name == def.Name); if (complexObjectItemModel != null) { viewModel.JsonString = complexObjectItemModel.GetJson(); } } result.Add(viewModel); } return(result); }
/// <summary> /// Generates the mapping. /// </summary> /// <param name="savedMappingData">The mapping data.</param> /// <param name="mappingDefinitions">The mapping definitions.</param> /// <param name="isOutputMapping">if set to <c>true</c> [is output mapping].</param> /// <param name="parser">The parser.</param> /// <returns></returns> private IList<IInputOutputViewModel> GenerateMapping(string savedMappingData, string mappingDefinitions, bool isOutputMapping, IDev2LanguageParser parser) { IList<IInputOutputViewModel> result; if(string.IsNullOrEmpty(savedMappingData)) { // TODO : Inject fuzzy matching logic here ;) var fuzzyMatchDefinitions = GenerateMatchFragmentsFromDataList(); result = CreateMappingList(mappingDefinitions, parser, true, isOutputMapping, fuzzyMatchDefinitions); } else { // generate the master view ;) var masterView = CreateMappingList(mappingDefinitions, parser, true, isOutputMapping); // use existing data ;) var existingView = CreateMappingList(savedMappingData, parser, false, isOutputMapping); // Now adjust for the difference between the two views ;) result = ReconcileExistingAndMasterView(masterView, existingView); } return result; }
/// <summary> /// Creates the mapping list. /// </summary> /// <param name="mappingDefinitions">The mapping definitions.</param> /// <param name="parser">The parser.</param> /// <param name="autoAddBrackets">if set to <c>true</c> [automatic add brackets].</param> /// <param name="isOutputMapping">if set to <c>true</c> [is output mapping].</param> /// <param name="fuzzyMatch">The fuzzy match.</param> /// <returns></returns> private IList<IInputOutputViewModel> CreateMappingList(string mappingDefinitions, IDev2LanguageParser parser, bool autoAddBrackets, bool isOutputMapping, FuzzyMatchVo fuzzyMatch = null) { IList<IInputOutputViewModel> result = new List<IInputOutputViewModel>(); IList<IDev2Definition> concreteDefinitions = parser.ParseAndAllowBlanks(mappingDefinitions); var masterRecordsetName = string.Empty; foreach(var def in concreteDefinitions) { var injectValue = def.RawValue; if(!string.IsNullOrEmpty(injectValue) || IsWorkflow) { if(autoAddBrackets) { // When output mapping we need to replace the recordset name if present with MasterRecordset // if(isOutputMapping && def.IsRecordSet && fuzzyMatch != null) { var field = DataListUtil.ExtractFieldNameFromValue(injectValue); if(IsWorkflow) { field = def.Name; } string recordsetName = fuzzyMatch.FetchMatch(def.Name,def.RecordSetName); if(!string.IsNullOrEmpty(recordsetName)) { masterRecordsetName = recordsetName; } else { // we have no match, use the current mapping value ;) masterRecordsetName = !IsWorkflow ? DataListUtil.ExtractRecordsetNameFromValue(injectValue) : def.RecordSetName; } injectValue = FormatString(masterRecordsetName, field); } else { if(def.IsRecordSet) { if(fuzzyMatch != null) { string recordsetName = fuzzyMatch.FetchMatch(def.Name, def.RecordSetName); masterRecordsetName = !String.IsNullOrEmpty(recordsetName) ? recordsetName : def.RecordSetName; } else { masterRecordsetName = def.RecordSetName; } injectValue = FormatString(masterRecordsetName, def.Name); } else { injectValue = DataListUtil.AddBracketsToValueIfNotExist(!IsWorkflow ? injectValue : def.Name); } } } } else { if(!def.IsRecordSet) { if(!String.IsNullOrEmpty(def.RawValue) && String.IsNullOrEmpty(SavedInputMapping)) { injectValue = DataListUtil.AddBracketsToValueIfNotExist(def.Name); } } else { if(!isOutputMapping) { var field = def.Name; if(fuzzyMatch != null && def.IsRecordSet) { if(string.IsNullOrEmpty(masterRecordsetName)) { string recordsetName = fuzzyMatch.FetchMatch(def.Name, def.RecordSetName); masterRecordsetName = !string.IsNullOrEmpty(recordsetName) ? recordsetName : def.RecordSetName; } injectValue = DataListUtil.ComposeIntoUserVisibleRecordset(masterRecordsetName, string.Empty, field); injectValue = DataListUtil.AddBracketsToValueIfNotExist(injectValue); } else { if(!String.IsNullOrEmpty(def.RawValue) && String.IsNullOrEmpty(SavedInputMapping)) { injectValue = FormatString(def.RecordSetName, def.Name); } } } else { if(!String.IsNullOrEmpty(def.RawValue) && String.IsNullOrEmpty(SavedOutputMapping)) { injectValue = FormatString(def.RecordSetName, def.Name); } } } } var injectMapsTo = def.MapsTo; // no saved mappings add brackets ;) if(!string.IsNullOrEmpty(injectMapsTo) && string.IsNullOrEmpty(SavedInputMapping)) { injectMapsTo = DataListUtil.AddBracketsToValueIfNotExist(injectMapsTo); } else { if(def.IsRecordSet) { var tmp = injectValue.Replace("()", "(*)"); injectMapsTo = tmp; // tag it as the same ;) } else { injectMapsTo = injectValue; // tag it as the same ;) } } // def.RecordSetName -> recordsetName var viewModel = new InputOutputViewModel(def.Name, injectValue, injectMapsTo, def.DefaultValue, def.IsRequired, def.RecordSetName, def.EmptyToNull); result.Add(viewModel); } return result; }
public List <IDebugItem> GetDebugInputs(IBinaryDataList dataList, IDataListCompiler compiler, IDev2LanguageParser parser) { IList <IDev2Definition> inputs = parser.Parse(InputMapping); var results = new List <IDebugItem>(); foreach (IDev2Definition dev2Definition in inputs) { ErrorResultTO errors; IBinaryDataListEntry tmpEntry = compiler.Evaluate(dataList.UID, enActionType.User, dev2Definition.RawValue, false, out errors); DebugItem itemToAdd = new DebugItem(); AddDebugItem(new DebugItemVariableParams(dev2Definition.RawValue, "", tmpEntry, dataList.UID), itemToAdd); if (errors.HasErrors()) { itemToAdd.FlushStringBuilder(); throw new DebugCopyException(errors.MakeDisplayReady(), itemToAdd); } results.Add(itemToAdd); } foreach (IDebugItem debugInput in results) { debugInput.FlushStringBuilder(); } return(results); }