protected void FillSynchronizationRuleInboundTransformationsDataSet()

in src/MIMConfigDocumenter/MIMServicePolicyDocumenter.cs [2823:2876]


        protected void FillSynchronizationRuleInboundTransformationsDataSet(AttributeChange transformationsChange, bool pilotConfig)
        {
            Logger.Instance.WriteMethodEntry();

            try
            {
                var dataSet = pilotConfig ? this.PilotDataSet : this.ProductionDataSet;
                var table = dataSet.Tables[0];

                if (transformationsChange != null && transformationsChange.AttributeValues != null && transformationsChange.AttributeValues.Count > 0)
                {
                    foreach (var valueChange in transformationsChange.AttributeValues)
                    {
                        var importFlowXml = pilotConfig ? (valueChange.ValueModificationType != DataRowState.Deleted ? valueChange.NewValue : string.Empty) : valueChange.OldValue; // Deleted values should be processed only when it's production config.
                        if (!string.IsNullOrEmpty(importFlowXml))
                        {
                            try
                            {
                                var importFlow = XElement.Parse(importFlowXml);
                                if (!importFlow.Name.LocalName.Equals("import-flow", StringComparison.OrdinalIgnoreCase))
                                {
                                    continue;
                                }

                                var destination = (string)importFlow.Element("dest");
                                var directFlow = importFlow.Elements("fn").Count() == 0;
                                var source = string.Empty;
                                if (directFlow)
                                {
                                    source = importFlow.XPathSelectElement("src/attr") != null ? (string)importFlow.XPathSelectElement("src/attr") : (string)importFlow.Element("src");
                                }
                                else
                                {
                                    source = this.ParseSynchronizationRuleFunctionExpression(importFlow.Element("fn"));
                                }

                                Documenter.AddRow(table, new object[] { destination, source, "→", destination });
                            }
                            catch (XmlException e)
                            {
                                var errorMsg = "Error parsing import flow xml: '" + importFlowXml + "' Error: " + e.ToString();
                                Logger.Instance.WriteError(errorMsg);
                            }
                        }
                    }

                    table.AcceptChanges();
                }
            }
            finally
            {
                Logger.Instance.WriteMethodExit();
            }
        }