示例#1
0
        public static List <DataObject> SetLineageRelatedDataObjectList(DataTable dataObjectMappingDataTable, string targetDataObjectName, JsonExportSetting jsonExportSetting)
        {
            List <DataObject> dataObjectList = new List <DataObject>();

            if (jsonExportSetting.AddUpstreamDataObjectsAsRelatedDataObject == "True")
            {
                // Find the corresponding row in the Data Object Mapping grid
                DataRow[] DataObjectMappings = dataObjectMappingDataTable.Select("[" + TableMappingMetadataColumns.SourceTable + "] = '" + targetDataObjectName + "'");

                foreach (DataRow DataObjectMapping in DataObjectMappings)
                {
                    var localDataObjectName = DataObjectMapping[TableMappingMetadataColumns.TargetTable.ToString()].ToString();
                    var localDataObjectConnectionInternalId = DataObjectMapping[TableMappingMetadataColumns.TargetConnection.ToString()].ToString();

                    TeamConnection localConnection = FormBase.GetTeamConnectionByConnectionId(localDataObjectConnectionInternalId);

                    // Set the name and further settings.
                    dataObjectList.Add(CreateDataObject(localDataObjectName, localConnection, jsonExportSetting));
                }
            }

            return(dataObjectList);
        }
示例#2
0
        private void ColourGridView()
        {
            var counter = 0;

            var presentationLayerLabelArray = Utility.SplitLabelIntoArray(FormBase.TeamConfiguration.PresentationLayerLabels);
            var transformationLabelArray    = Utility.SplitLabelIntoArray(FormBase.TeamConfiguration.TransformationLabels);

            foreach (DataGridViewRow row in Rows)
            {
                if (!row.IsNewRow)
                {
                    // Target info
                    string targetDataObjectName =
                        row.Cells[(int)TableMappingMetadataColumns.TargetTable].Value.ToString();
                    var targetConnectionId =
                        row.Cells[(int)TableMappingMetadataColumns.TargetConnection].Value.ToString();
                    TeamConnection targetConnection = FormBase.GetTeamConnectionByConnectionId(targetConnectionId);
                    KeyValuePair <string, string> targetDataObjectFullyQualifiedKeyValuePair = MetadataHandling
                                                                                               .GetFullyQualifiedDataObjectName(targetDataObjectName, targetConnection).FirstOrDefault();

                    // Only the name (e.g. without the schema) should be evaluated.
                    string targetDataObjectNonQualifiedName = targetDataObjectFullyQualifiedKeyValuePair.Value;


                    var businessKeySyntax = row.Cells[(int)TableMappingMetadataColumns.BusinessKeyDefinition].Value;

                    if (targetDataObjectNonQualifiedName != null && businessKeySyntax != null && row.IsNewRow == false)
                    {
                        // Hub
                        if (
                            (FormBase.TeamConfiguration.TableNamingLocation == "Prefix" &&
                             targetDataObjectNonQualifiedName.StartsWith(FormBase.TeamConfiguration
                                                                         .HubTablePrefixValue)) ||
                            (FormBase.TeamConfiguration.TableNamingLocation == "Suffix" &&
                             targetDataObjectNonQualifiedName.EndsWith(FormBase.TeamConfiguration
                                                                       .HubTablePrefixValue))
                            )
                        {
                            this[(int)TableMappingMetadataColumns.TargetTable, counter].Style.BackColor =
                                Color.CornflowerBlue;
                            row.Cells[(int)TableMappingMetadataColumns.DrivingKeyDefinition].ReadOnly        = true;
                            row.Cells[(int)TableMappingMetadataColumns.DrivingKeyDefinition].Style.BackColor =
                                Color.LightGray;
                        }
                        // Link-Sat
                        else if (
                            (FormBase.TeamConfiguration.TableNamingLocation == "Prefix" &&
                             targetDataObjectNonQualifiedName.StartsWith(FormBase.TeamConfiguration
                                                                         .LsatTablePrefixValue)) ||
                            (FormBase.TeamConfiguration.TableNamingLocation == "Suffix" &&
                             targetDataObjectNonQualifiedName.EndsWith(FormBase.TeamConfiguration
                                                                       .LsatTablePrefixValue))
                            )
                        {
                            this[(int)TableMappingMetadataColumns.TargetTable, counter].Style.BackColor = Color.Gold;
                        }
                        // Context
                        else if (
                            (FormBase.TeamConfiguration.TableNamingLocation == "Prefix" &&
                             targetDataObjectNonQualifiedName.StartsWith(FormBase.TeamConfiguration
                                                                         .SatTablePrefixValue)) ||
                            (FormBase.TeamConfiguration.TableNamingLocation == "Suffix" &&
                             targetDataObjectNonQualifiedName.EndsWith(FormBase.TeamConfiguration
                                                                       .SatTablePrefixValue))
                            )
                        {
                            this[(int)TableMappingMetadataColumns.TargetTable, counter].Style.BackColor      = Color.Yellow;
                            row.Cells[(int)TableMappingMetadataColumns.DrivingKeyDefinition].ReadOnly        = true;
                            row.Cells[(int)TableMappingMetadataColumns.DrivingKeyDefinition].Style.BackColor =
                                Color.LightGray;
                        }
                        // Natural Business Relationship
                        else if (
                            (FormBase.TeamConfiguration.TableNamingLocation == "Prefix" &&
                             targetDataObjectNonQualifiedName.StartsWith(FormBase.TeamConfiguration
                                                                         .LinkTablePrefixValue)) ||
                            (FormBase.TeamConfiguration.TableNamingLocation == "Suffix" &&
                             targetDataObjectNonQualifiedName.EndsWith(FormBase.TeamConfiguration
                                                                       .LinkTablePrefixValue))
                            )
                        {
                            this[(int)TableMappingMetadataColumns.TargetTable, counter].Style.BackColor =
                                Color.OrangeRed;
                            row.Cells[(int)TableMappingMetadataColumns.DrivingKeyDefinition].ReadOnly        = true;
                            row.Cells[(int)TableMappingMetadataColumns.DrivingKeyDefinition].Style.BackColor =
                                Color.LightGray;
                        }
                        // PSA
                        else if (
                            (FormBase.TeamConfiguration.TableNamingLocation == "Prefix" &&
                             targetDataObjectNonQualifiedName.StartsWith(FormBase.TeamConfiguration
                                                                         .PsaTablePrefixValue)) ||
                            (FormBase.TeamConfiguration.TableNamingLocation == "Suffix" &&
                             targetDataObjectNonQualifiedName.EndsWith(FormBase.TeamConfiguration
                                                                       .PsaTablePrefixValue))
                            )
                        {
                            this[(int)TableMappingMetadataColumns.TargetTable, counter].Style.BackColor =
                                Color.AntiqueWhite;
                            row.Cells[(int)TableMappingMetadataColumns.DrivingKeyDefinition].ReadOnly        = true;
                            row.Cells[(int)TableMappingMetadataColumns.DrivingKeyDefinition].Style.BackColor =
                                Color.LightGray;
                        }
                        // Staging
                        else if (
                            (FormBase.TeamConfiguration.TableNamingLocation == "Prefix" &&
                             targetDataObjectNonQualifiedName.StartsWith(FormBase.TeamConfiguration
                                                                         .StgTablePrefixValue)) ||
                            (FormBase.TeamConfiguration.TableNamingLocation == "Suffix" &&
                             targetDataObjectNonQualifiedName.EndsWith(FormBase.TeamConfiguration
                                                                       .StgTablePrefixValue))
                            )
                        {
                            this[(int)TableMappingMetadataColumns.TargetTable, counter].Style.BackColor =
                                Color.WhiteSmoke;
                            row.Cells[(int)TableMappingMetadataColumns.DrivingKeyDefinition].ReadOnly        = true;
                            row.Cells[(int)TableMappingMetadataColumns.DrivingKeyDefinition].Style.BackColor =
                                Color.LightGray;
                        }
                        // Presentation Layer
                        else if (

                            (FormBase.TeamConfiguration.TableNamingLocation == "Prefix" &&
                             presentationLayerLabelArray.Any(s => targetDataObjectNonQualifiedName.StartsWith(s)))
                            ||
                            (FormBase.TeamConfiguration.TableNamingLocation == "Suffix" &&
                             presentationLayerLabelArray.Any(s => targetDataObjectNonQualifiedName.EndsWith(s)))
                            )
                        {
                            this[(int)TableMappingMetadataColumns.TargetTable, counter].Style.BackColor =
                                Color.Aquamarine;
                            row.Cells[(int)TableMappingMetadataColumns.DrivingKeyDefinition].ReadOnly        = true;
                            row.Cells[(int)TableMappingMetadataColumns.DrivingKeyDefinition].Style.BackColor =
                                Color.LightGray;
                        }
                        // Derived objects / transformations
                        else if (

                            (FormBase.TeamConfiguration.TableNamingLocation == "Prefix" &&
                             transformationLabelArray.Any(s => targetDataObjectNonQualifiedName.StartsWith(s)))
                            ||
                            (FormBase.TeamConfiguration.TableNamingLocation == "Suffix" &&
                             transformationLabelArray.Any(s => targetDataObjectNonQualifiedName.EndsWith(s)))
                            )
                        {
                            this[(int)TableMappingMetadataColumns.TargetTable, counter].Style.BackColor =
                                Color.LightGreen;
                            row.Cells[(int)TableMappingMetadataColumns.DrivingKeyDefinition].ReadOnly        = true;
                            row.Cells[(int)TableMappingMetadataColumns.DrivingKeyDefinition].Style.BackColor =
                                Color.LightGray;
                        }
                        else
                        {
                            // Catch
                        }


                        //Syntax highlighting for code
                        if (businessKeySyntax.ToString().Contains("CONCATENATE") ||
                            businessKeySyntax.ToString().Contains("COMPOSITE"))
                        {
                            this[(int)TableMappingMetadataColumns.BusinessKeyDefinition, counter].Style.ForeColor =
                                Color.DarkBlue;
                            this[(int)TableMappingMetadataColumns.BusinessKeyDefinition, counter].Style.Font =
                                new Font("Microsoft Sans Serif", 8.25F, FontStyle.Bold);
                        }
                    }

                    counter++;
                }
            }
        }