Ejemplo n.º 1
0
        /// <summary>
        /// List types available Modules.
        /// </summary>
        /// <returns></returns>
        public Dictionary <string, ListTypeInfo> doListTypes()
        {
            if (!getCheckLogin())
            {
                throw new Exception("Login error.");
            }

            var result = Get("listtypes", new Dictionary <string, string>());
            var info   = DeserializeJSON(result["information"].ToString()) as Dictionary <string, object>;

            var types = new Dictionary <string, ListTypeInfo>();

            foreach (var val in info)
            {
                string key  = val.Key;
                var    data = DeserializeJSON(val.Value.ToString()) as Dictionary <string, object>;

                var listTypeInfo = new ListTypeInfo();
                listTypeInfo.isEntity    = (bool)data["isEntity"];
                listTypeInfo.label       = (string)data["label"];
                listTypeInfo.singular    = (string)data["singular"];
                listTypeInfo.information = data;

                types.Add(key, listTypeInfo);
            }

            return(types);
        }
Ejemplo n.º 2
0
 public OrcListObjectInspector(ListTypeInfo info)
 {
     child = createObjectInspector(info.getListElementTypeInfo());
 }
        public MigrationConfiguration(XmlNode section)
        {
            //Convert the XmlNode to an XDocument (for LINQ).
            XDocument xmlDoc = XDocument.Parse(section.OuterXml);

            // **********************************
            // * V1 source connection.
            // **********************************
            var v1Source = from item in xmlDoc.Descendants("V1SourceConnection")
                           select new ConnectionInfo
                           {
                               Url = item.Element("Url").Value,
                               Username = string.IsNullOrEmpty(item.Element("Username").Value) ? string.Empty : item.Element("Username").Value,
                               Password = string.IsNullOrEmpty(item.Element("Password").Value) ? string.Empty : item.Element("Password").Value,
                               Project = string.IsNullOrEmpty(item.Element("Project").Value) ? string.Empty : item.Element("Project").Value,
                               AuthenticationType = string.IsNullOrEmpty(item.Attribute("authenticationType").Value) ? string.Empty : item.Attribute("authenticationType").Value
                           };
            if (v1Source.Count() == 0)
                throw new ConfigurationErrorsException("Missing V1SourceConnection information in application config file.");
            else
                V1SourceConnection = v1Source.First();

            // **********************************
            // * V1 target connection.
            // **********************************
            var v1Target = from item in xmlDoc.Descendants("V1TargetConnection")
                           select new ConnectionInfo
                           {
                               Url = item.Element("Url").Value,
                               Username = string.IsNullOrEmpty(item.Element("Username").Value) ? string.Empty : item.Element("Username").Value,
                               Password = string.IsNullOrEmpty(item.Element("Password").Value) ? string.Empty : item.Element("Password").Value,
                               Project = string.IsNullOrEmpty(item.Element("Project").Value) ? string.Empty : item.Element("Project").Value,
                               AuthenticationType = string.IsNullOrEmpty(item.Attribute("authenticationType").Value) ? string.Empty : item.Attribute("authenticationType").Value
                           };
            if (v1Target.Count() == 0)
                throw new ConfigurationErrorsException("Missing V1TargetConnection information in application config file.");
            else
                V1TargetConnection = v1Target.First();

            // **********************************
            // * V1 staging database.
            // **********************************
            var v1Database = from item in xmlDoc.Descendants("V1StagingDatabase")
                             select new StagingDatabaseInfo
                             {
                               Server = item.Element("Server").Value,
                               Database = item.Element("Database").Value,
                               Username = string.IsNullOrEmpty(item.Element("Username").Value) ? string.Empty : item.Element("Username").Value,
                               Password = string.IsNullOrEmpty(item.Element("Password").Value) ? string.Empty : item.Element("Password").Value,
                               TrustedConnection = System.Convert.ToBoolean(item.Attribute("trustedConnection").Value)
                             };
            if (v1Database.Count() == 0)
                throw new ConfigurationErrorsException("Missing V1StagingDatabase information in application config file.");
            else
                V1StagingDatabase = v1Database.First();

            // **********************************
            // * Rally source connection.
            // **********************************
            var rallySource = from item in xmlDoc.Descendants("RallySourceConnection")
                              select new RallyConnectionInfo
                              {
                                Url = item.Element("url").Value,
                                Username = string.IsNullOrEmpty(item.Element("username").Value) ? string.Empty : item.Element("username").Value,
                                Password = string.IsNullOrEmpty(item.Element("password").Value) ? string.Empty : item.Element("password").Value,
                                ExportFileDirectory = item.Element("exportFileDirectory").Value,
                                UserExportFilePrefix = item.Element("userExportFilePrefix").Value,
                                ProjectExportFilePrefix = item.Element("projectExportFilePrefix").Value,
                                ReleaseExportFilePrefix = item.Element("releaseExportFilePrefix").Value,
                                IterationExportFilePrefix = item.Element("iterationExportFilePrefix").Value,
                                EpicExportFilePrefix = item.Element("epicExportFilePrefix").Value,
                                StoryExportFilePrefix = item.Element("storyExportFilePrefix").Value,
                                DefectExportFilePrefix = item.Element("defectExportFilePrefix").Value,
                                TaskExportFilePrefix = item.Element("taskExportFilePrefix").Value,
                                TestExportFilePrefix = item.Element("testExportFilePrefix").Value,
                                RegressionTestExportFilePrefix = item.Element("regressiontestExportFilePrefix").Value,
                                TestStepExportFilePrefix = item.Element("teststepExportFilePrefix").Value,
                                ConversationExportFilePrefix = item.Element("conversationExportFilePrefix").Value,
                                OrphanedTestProject = item.Element("orphanedTestProject").Value
                              };
            RallySourceConnection = rallySource.First();

            // **********************************
            // * Jira Configuration.
            // **********************************
            var jiraConfig = from item in xmlDoc.Descendants("JiraConfiguration")
                           select new JiraConfigurationInfo
                           {
                               XmlFileName = item.Element("xmlFileName").Value,
                               ProjectName = item.Element("projectName").Value,
                               ProjectDescription = item.Element("projectDescription").Value,
                               DefaultSchedule = item.Element("defaultSchedule").Value,
                               JiraUrl = item.Element("jiraUrl").Value,
                               StoryIssueTypes = string.IsNullOrEmpty(item.Element("storyIssueTypes").Value) ? string.Empty : item.Element("storyIssueTypes").Value,
                               DefectIssueTypes = string.IsNullOrEmpty(item.Element("defectIssueTypes").Value) ? string.Empty : item.Element("defectIssueTypes").Value,
                               EpicIssueTypes = string.IsNullOrEmpty(item.Element("epicIssueTypes").Value) ? string.Empty : item.Element("epicIssueTypes").Value,
                               IssueIssueTypes = string.IsNullOrEmpty(item.Element("issueIssueTypes").Value) ? string.Empty : item.Element("issueIssueTypes").Value,
                               RequestIssueTypes = string.IsNullOrEmpty(item.Element("requestIssueTypes").Value) ? string.Empty : item.Element("requestIssueTypes").Value,
                               TaskIssueTypes = string.IsNullOrEmpty(item.Element("taskIssueTypes").Value) ? string.Empty : item.Element("taskIssueTypes").Value,
                               JiraTeamReference = string.IsNullOrEmpty(item.Element("jiraTeamReference").Value) ? string.Empty : item.Element("jiraTeamReference").Value,
                               JiraBacklogGroupReference = string.IsNullOrEmpty(item.Element("jiraBacklogGroupReference").Value) ? string.Empty : item.Element("jiraBacklogGroupReference").Value,
                               JiraBacklogGoalReference = string.IsNullOrEmpty(item.Element("jiraBacklogGoalReference").Value) ? string.Empty : item.Element("jiraBacklogGoalReference").Value
                           };
            if (jiraConfig.Count() == 0)
                throw new ConfigurationErrorsException("Missing JiraConfiguration information in application config file.");
            else
                JiraConfiguration = jiraConfig.First();

            // **********************************
            // * General configurations.
            // **********************************
            var v1Config = from item in xmlDoc.Descendants("configurations")
                           select new ConfigurationInfo
                           {
                               SourceConnectionToUse = item.Element("sourceConnectionToUse").Value,
                               PerformExport = System.Convert.ToBoolean(item.Element("performExport").Value),
                               PerformImport = System.Convert.ToBoolean(item.Element("performImport").Value),
                               PerformClose = System.Convert.ToBoolean(item.Element("performClose").Value),
                               PerformCleanup = System.Convert.ToBoolean(item.Element("performCleanup").Value),
                               MigrateTemplates = System.Convert.ToBoolean(item.Element("migrateTemplates").Value),
                               MigrateAttachmentBinaries = System.Convert.ToBoolean(item.Element("migrateAttachmentBinaries").Value),
                               MigrateProjectMembership = System.Convert.ToBoolean(item.Element("migrateProjectMembership").Value),
                               MigrateDuplicateSchedules = System.Convert.ToBoolean(item.Element("migrateDuplicateSchedules").Value),
                               UseNPIMasking = System.Convert.ToBoolean(item.Element("useNPIMasking").Value),
                               MergeRootProjects = System.Convert.ToBoolean(item.Element("mergeRootProjects").Value),
                               AddV1IDToTitles = System.Convert.ToBoolean(item.Element("addV1IDToTitles").Value),
                               PageSize = System.Convert.ToInt32(item.Element("pageSize").Value),
                               CustomV1IDField = string.IsNullOrEmpty(item.Element("customV1IDField").Value) ? string.Empty : item.Element("customV1IDField").Value,
                               ImportAttachmentsAsLinksURL = string.IsNullOrEmpty(item.Element("importAttachmentsAsLinksURL").Value) ? string.Empty : item.Element("importAttachmentsAsLinksURL").Value,
                               SetAllMembershipToRoot = System.Convert.ToBoolean(item.Element("setAllMembershipToRoot").Value),
                               SourceListTypeValue = string.IsNullOrEmpty(item.Element("sourceListTypeValue").Value) ? string.Empty : item.Element("sourceListTypeValue").Value,
                               MigrateUnauthoredConversationsAsAdmin = System.Convert.ToBoolean(item.Element("migrateUnauthoredConversationsAsAdmin").Value),
                               LogExceptions = System.Convert.ToBoolean(item.Element("logExceptions").Value)
                           };
            if (v1Config.Count() == 0)
                throw new ConfigurationErrorsException("Missing general configuration information in application config file.");
            else
                V1Configurations = v1Config.First();

            // **********************************
            // * Assets to migrate.
            // **********************************
            var assetData = from item in xmlDoc.Descendants("asset")
                            select item;
            if (assetData.Count() == 0)
                throw new ConfigurationErrorsException("Missing assets to migrate information in application config file.");

            foreach (var asset in assetData)
            {
                AssetInfo assetInfo = new AssetInfo();
                assetInfo.Name = asset.Attribute("name").Value;
                assetInfo.InternalName = asset.Attribute("internalName").Value;
                assetInfo.Enabled = System.Convert.ToBoolean(asset.Attribute("enabled").Value);
                assetInfo.DuplicateCheckField = asset.Attribute("duplicateCheckField").Value;
                assetInfo.EnableCustomFields = System.Convert.ToBoolean(asset.Attribute("enableCustomFields").Value);
                AssetsToMigrate.Add(assetInfo);
            }

            // **********************************
            // * List types to migrate.
            // **********************************
            var listTypeData = from item in xmlDoc.Descendants("listType")
                               select item;
            if (listTypeData.Count() == 0)
                throw new ConfigurationErrorsException("Missing list types to migrate information in application config file.");

            foreach (var listType in listTypeData)
            {
                ListTypeInfo listTypeInfo = new ListTypeInfo();
                listTypeInfo.Name = listType.Attribute("name").Value;
                listTypeInfo.Enabled = System.Convert.ToBoolean(listType.Attribute("enabled").Value);
                ListTypesToMigrate.Add(listTypeInfo);
            }

            // **********************************
            // * List Values
            // **********************************
            var listValueData = from item in xmlDoc.Descendants("listValue") select item;

            foreach (var listValue in listValueData)
            {
                ListValueInfo listValueInfo = new ListValueInfo();
                listValueInfo.AssetType = listValue.Attribute("assetType").Value;
                listValueInfo.FieldName = listValue.Attribute("fieldName").Value;
                listValueInfo.ListName = listValue.Attribute("listName").Value;
                listValueInfo.OldValue = listValue.Attribute("oldValue").Value;
                listValueInfo.NewValue = listValue.Attribute("newValue").Value;
                ListValues.Add(listValueInfo);
            }

            // **********************************
            // * Custom fields to migrate.
            // **********************************
            var customFieldData = from item in xmlDoc.Descendants("customField")
                                  select item;
            if (customFieldData.Count() == 0)
                throw new ConfigurationErrorsException("Missing custom fields to migrate information in application config file.");

            foreach (var customField in customFieldData)
            {
                CustomFieldInfo customFieldInfo = new CustomFieldInfo();
                customFieldInfo.SourceName = customField.Attribute("sourceName").Value;
                customFieldInfo.TargetName = customField.Attribute("targetName").Value;
                customFieldInfo.AssetType = customField.Attribute("assetType").Value;
                customFieldInfo.DataType = customField.Attribute("dataType").Value;
                customFieldInfo.RelationName = customField.Attribute("relationName").Value;
                CustomFieldsToMigrate.Add(customFieldInfo);
            }
        }
Ejemplo n.º 4
0
 public OrcListObjectInspector(ListTypeInfo info)
 {
     child = createObjectInspector(info.getListElementTypeInfo());
 }
Ejemplo n.º 5
0
        public MigrationConfiguration(XmlNode section)
        {
            //Convert the XmlNode to an XDocument (for LINQ).
            XDocument xmlDoc = XDocument.Parse(section.OuterXml);

            // **********************************
            // * V1 source connection.
            // **********************************
            var v1Source = from item in xmlDoc.Descendants("V1SourceConnection")
                           select new ConnectionInfo
            {
                Url                = item.Element("Url").Value,
                Username           = string.IsNullOrEmpty(item.Element("Username").Value) ? string.Empty : item.Element("Username").Value,
                Password           = string.IsNullOrEmpty(item.Element("Password").Value) ? string.Empty : item.Element("Password").Value,
                Project            = string.IsNullOrEmpty(item.Element("Project").Value) ? string.Empty : item.Element("Project").Value,
                AuthenticationType = string.IsNullOrEmpty(item.Attribute("authenticationType").Value) ? string.Empty : item.Attribute("authenticationType").Value
            };

            if (v1Source.Count() == 0)
            {
                throw new ConfigurationErrorsException("Missing V1SourceConnection information in application config file.");
            }
            else
            {
                V1SourceConnection = v1Source.First();
            }


            // **********************************
            // * V1 target connection.
            // **********************************
            var v1Target = from item in xmlDoc.Descendants("V1TargetConnection")
                           select new ConnectionInfo
            {
                Url                = item.Element("Url").Value,
                Username           = string.IsNullOrEmpty(item.Element("Username").Value) ? string.Empty : item.Element("Username").Value,
                Password           = string.IsNullOrEmpty(item.Element("Password").Value) ? string.Empty : item.Element("Password").Value,
                Project            = string.IsNullOrEmpty(item.Element("Project").Value) ? string.Empty : item.Element("Project").Value,
                AuthenticationType = string.IsNullOrEmpty(item.Attribute("authenticationType").Value) ? string.Empty : item.Attribute("authenticationType").Value
            };

            if (v1Target.Count() == 0)
            {
                throw new ConfigurationErrorsException("Missing V1TargetConnection information in application config file.");
            }
            else
            {
                V1TargetConnection = v1Target.First();
            }

            // **********************************
            // * V1 staging database.
            // **********************************
            var v1Database = from item in xmlDoc.Descendants("V1StagingDatabase")
                             select new StagingDatabaseInfo
            {
                Server            = item.Element("Server").Value,
                Database          = item.Element("Database").Value,
                Username          = string.IsNullOrEmpty(item.Element("Username").Value) ? string.Empty : item.Element("Username").Value,
                Password          = string.IsNullOrEmpty(item.Element("Password").Value) ? string.Empty : item.Element("Password").Value,
                TrustedConnection = System.Convert.ToBoolean(item.Attribute("trustedConnection").Value)
            };

            if (v1Database.Count() == 0)
            {
                throw new ConfigurationErrorsException("Missing V1StagingDatabase information in application config file.");
            }
            else
            {
                V1StagingDatabase = v1Database.First();
            }

            // **********************************
            // * Rally source connection.
            // **********************************
            var rallySource = from item in xmlDoc.Descendants("RallySourceConnection")
                              select new RallyConnectionInfo
            {
                Url                            = item.Element("url").Value,
                Username                       = string.IsNullOrEmpty(item.Element("username").Value) ? string.Empty : item.Element("username").Value,
                Password                       = string.IsNullOrEmpty(item.Element("password").Value) ? string.Empty : item.Element("password").Value,
                ExportFileDirectory            = item.Element("exportFileDirectory").Value,
                UserExportFilePrefix           = item.Element("userExportFilePrefix").Value,
                ProjectExportFilePrefix        = item.Element("projectExportFilePrefix").Value,
                ReleaseExportFilePrefix        = item.Element("releaseExportFilePrefix").Value,
                IterationExportFilePrefix      = item.Element("iterationExportFilePrefix").Value,
                EpicExportFilePrefix           = item.Element("epicExportFilePrefix").Value,
                StoryExportFilePrefix          = item.Element("storyExportFilePrefix").Value,
                DefectExportFilePrefix         = item.Element("defectExportFilePrefix").Value,
                TaskExportFilePrefix           = item.Element("taskExportFilePrefix").Value,
                TestExportFilePrefix           = item.Element("testExportFilePrefix").Value,
                RegressionTestExportFilePrefix = item.Element("regressiontestExportFilePrefix").Value,
                TestStepExportFilePrefix       = item.Element("teststepExportFilePrefix").Value,
                ConversationExportFilePrefix   = item.Element("conversationExportFilePrefix").Value,
                OrphanedTestProject            = item.Element("orphanedTestProject").Value
            };

            RallySourceConnection = rallySource.First();

            // **********************************
            // * Jira Configuration.
            // **********************************
            var jiraConfig = from item in xmlDoc.Descendants("JiraConfiguration")
                             select new JiraConfigurationInfo
            {
                XmlFileName        = item.Element("xmlFileName").Value,
                ProjectName        = item.Element("projectName").Value,
                ProjectDescription = item.Element("projectDescription").Value,
                DefaultSchedule    = item.Element("defaultSchedule").Value,
                JiraUrl            = item.Element("jiraUrl").Value
            };

            if (jiraConfig.Count() == 0)
            {
                throw new ConfigurationErrorsException("Missing JiraConfiguration information in application config file.");
            }
            else
            {
                JiraConfiguration = jiraConfig.First();
            }


            // **********************************
            // * General configurations.
            // **********************************
            var v1Config = from item in xmlDoc.Descendants("configurations")
                           select new ConfigurationInfo
            {
                SourceConnectionToUse     = item.Element("sourceConnectionToUse").Value,
                PerformExport             = System.Convert.ToBoolean(item.Element("performExport").Value),
                PerformImport             = System.Convert.ToBoolean(item.Element("performImport").Value),
                PerformClose              = System.Convert.ToBoolean(item.Element("performClose").Value),
                PerformCleanup            = System.Convert.ToBoolean(item.Element("performCleanup").Value),
                MigrateTemplates          = System.Convert.ToBoolean(item.Element("migrateTemplates").Value),
                MigrateAttachmentBinaries = System.Convert.ToBoolean(item.Element("migrateAttachmentBinaries").Value),
                MigrateProjectMembership  = System.Convert.ToBoolean(item.Element("migrateProjectMembership").Value),
                MigrateDuplicateSchedules = System.Convert.ToBoolean(item.Element("migrateDuplicateSchedules").Value),
                UseNPIMasking             = System.Convert.ToBoolean(item.Element("useNPIMasking").Value),
                MergeRootProjects         = System.Convert.ToBoolean(item.Element("mergeRootProjects").Value),
                AddV1IDToTitles           = System.Convert.ToBoolean(item.Element("addV1IDToTitles").Value),
                PageSize                              = System.Convert.ToInt32(item.Element("pageSize").Value),
                CustomV1IDField                       = string.IsNullOrEmpty(item.Element("customV1IDField").Value) ? string.Empty : item.Element("customV1IDField").Value,
                ImportAttachmentsAsLinksURL           = string.IsNullOrEmpty(item.Element("importAttachmentsAsLinksURL").Value) ? string.Empty : item.Element("importAttachmentsAsLinksURL").Value,
                SetAllMembershipToRoot                = System.Convert.ToBoolean(item.Element("setAllMembershipToRoot").Value),
                SourceListTypeValue                   = string.IsNullOrEmpty(item.Element("sourceListTypeValue").Value) ? string.Empty : item.Element("sourceListTypeValue").Value,
                MigrateUnauthoredConversationsAsAdmin = System.Convert.ToBoolean(item.Element("migrateUnauthoredConversationsAsAdmin").Value),
                LogExceptions                         = System.Convert.ToBoolean(item.Element("logExceptions").Value)
            };

            if (v1Config.Count() == 0)
            {
                throw new ConfigurationErrorsException("Missing general configuration information in application config file.");
            }
            else
            {
                V1Configurations = v1Config.First();
            }

            // **********************************
            // * Assets to migrate.
            // **********************************
            var assetData = from item in xmlDoc.Descendants("asset")
                            select item;

            if (assetData.Count() == 0)
            {
                throw new ConfigurationErrorsException("Missing assets to migrate information in application config file.");
            }

            foreach (var asset in assetData)
            {
                AssetInfo assetInfo = new AssetInfo();
                assetInfo.Name                = asset.Attribute("name").Value;
                assetInfo.InternalName        = asset.Attribute("internalName").Value;
                assetInfo.Enabled             = System.Convert.ToBoolean(asset.Attribute("enabled").Value);
                assetInfo.DuplicateCheckField = asset.Attribute("duplicateCheckField").Value;
                assetInfo.EnableCustomFields  = System.Convert.ToBoolean(asset.Attribute("enableCustomFields").Value);
                AssetsToMigrate.Add(assetInfo);
            }

            // **********************************
            // * List types to migrate.
            // **********************************
            var listTypeData = from item in xmlDoc.Descendants("listType")
                               select item;

            if (listTypeData.Count() == 0)
            {
                throw new ConfigurationErrorsException("Missing list types to migrate information in application config file.");
            }

            foreach (var listType in listTypeData)
            {
                ListTypeInfo listTypeInfo = new ListTypeInfo();
                listTypeInfo.Name    = listType.Attribute("name").Value;
                listTypeInfo.Enabled = System.Convert.ToBoolean(listType.Attribute("enabled").Value);
                ListTypesToMigrate.Add(listTypeInfo);
            }

            // **********************************
            // * Custom fields to migrate.
            // **********************************
            var customFieldData = from item in xmlDoc.Descendants("customField")
                                  select item;

            if (customFieldData.Count() == 0)
            {
                throw new ConfigurationErrorsException("Missing custom fields to migrate information in application config file.");
            }

            foreach (var customField in customFieldData)
            {
                CustomFieldInfo customFieldInfo = new CustomFieldInfo();
                customFieldInfo.SourceName   = customField.Attribute("sourceName").Value;
                customFieldInfo.TargetName   = customField.Attribute("targetName").Value;
                customFieldInfo.AssetType    = customField.Attribute("assetType").Value;
                customFieldInfo.DataType     = customField.Attribute("dataType").Value;
                customFieldInfo.RelationName = customField.Attribute("relationName").Value;
                CustomFieldsToMigrate.Add(customFieldInfo);
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// List types available Modules.
        /// </summary>
        /// <returns></returns>
        public Dictionary<string, ListTypeInfo> doListTypes()
        {
            if (!getCheckLogin())
                throw new Exception("Login error.");

            var result = Get("listtypes", new Dictionary<string, string>());
            var info = DeserializeJSON(result["information"].ToString()) as Dictionary<string, object>;

            var types = new Dictionary<string, ListTypeInfo>();

            foreach(var val in info)
            {
                string key = val.Key;
                var data = DeserializeJSON(val.Value.ToString()) as Dictionary<string, object>;

                var listTypeInfo = new ListTypeInfo();
                listTypeInfo.isEntity   = (bool)data["isEntity"];
                listTypeInfo.label      = (string)data["label"];
                listTypeInfo.singular   = (string)data["singular"];
                listTypeInfo.information = data;

                types.Add(key, listTypeInfo);
            }

            return types;
        }
Ejemplo n.º 7
0
        public static TypeDescription convertTypeInfo(TypeInfo info)
        {
            switch (info.getCategory())
            {
            case ObjectInspectorCategory.PRIMITIVE:
            {
                PrimitiveTypeInfo pinfo = (PrimitiveTypeInfo)info;
                switch (pinfo.getPrimitiveCategory())
                {
                case PrimitiveCategory.BOOLEAN:
                    return(TypeDescription.createBoolean());

                case PrimitiveCategory.BYTE:
                    return(TypeDescription.createByte());

                case PrimitiveCategory.SHORT:
                    return(TypeDescription.createShort());

                case PrimitiveCategory.INT:
                    return(TypeDescription.createInt());

                case PrimitiveCategory.LONG:
                    return(TypeDescription.createLong());

                case PrimitiveCategory.FLOAT:
                    return(TypeDescription.createFloat());

                case PrimitiveCategory.DOUBLE:
                    return(TypeDescription.createDouble());

                case PrimitiveCategory.STRING:
                    return(TypeDescription.createString());

                case PrimitiveCategory.DATE:
                    return(TypeDescription.createDate());

                case PrimitiveCategory.TIMESTAMP:
                    return(TypeDescription.createTimestamp());

                case PrimitiveCategory.BINARY:
                    return(TypeDescription.createBinary());

                case PrimitiveCategory.DECIMAL:
                {
                    DecimalTypeInfo dinfo = (DecimalTypeInfo)pinfo;
                    return(TypeDescription.createDecimal()
                           .withScale(dinfo.scale())
                           .withPrecision(dinfo.precision()));
                }

                case PrimitiveCategory.VARCHAR:
                {
                    BaseCharTypeInfo cinfo = (BaseCharTypeInfo)pinfo;
                    return(TypeDescription.createVarchar()
                           .withMaxLength(cinfo.getLength()));
                }

                case PrimitiveCategory.CHAR:
                {
                    BaseCharTypeInfo cinfo = (BaseCharTypeInfo)pinfo;
                    return(TypeDescription.createChar()
                           .withMaxLength(cinfo.getLength()));
                }

                default:
                    throw new ArgumentException("ORC doesn't handle primitive" +
                                                " category " + pinfo.getPrimitiveCategory());
                }
            }

            case ObjectInspectorCategory.LIST:
            {
                ListTypeInfo linfo = (ListTypeInfo)info;
                return(TypeDescription.createList
                           (convertTypeInfo(linfo.getListElementTypeInfo())));
            }

            case ObjectInspectorCategory.MAP:
            {
                MapTypeInfo minfo = (MapTypeInfo)info;
                return(TypeDescription.createMap
                           (convertTypeInfo(minfo.getMapKeyTypeInfo()),
                           convertTypeInfo(minfo.getMapValueTypeInfo())));
            }

            case ObjectInspectorCategory.UNION:
            {
                UnionTypeInfo   minfo  = (UnionTypeInfo)info;
                TypeDescription result = TypeDescription.createUnion();
                foreach (TypeInfo child in minfo.getAllUnionObjectTypeInfos())
                {
                    result.addUnionChild(convertTypeInfo(child));
                }
                return(result);
            }

            case ObjectInspectorCategory.STRUCT:
            {
                StructTypeInfo  sinfo  = (StructTypeInfo)info;
                TypeDescription result = TypeDescription.createStruct();
                foreach (string fieldName in sinfo.getAllStructFieldNames())
                {
                    result.addField(fieldName,
                                    convertTypeInfo(sinfo.getStructFieldTypeInfo(fieldName)));
                }
                return(result);
            }

            default:
                throw new ArgumentException("ORC doesn't handle " +
                                            info.getCategory());
            }
        }