Class keeps all the system-wide quality control profiles which can be used within the system
コード例 #1
0
        /// <summary> Constructor for a new instance of the InstanceWide_Configuration class </summary>
        public InstanceWide_Configuration()
        {
            // Create some of the configuration stuff
            Authentication     = new Authentication_Configuration();
            BriefItemMapping   = new BriefItemMapping_Configuration();
            ContactForm        = new ContactForm_Configuration();
            Engine             = new Engine_Server_Configuration();
            Extensions         = new Extension_Configuration();
            QualityControlTool = new QualityControl_Configuration();
            Metadata           = new Metadata_Configuration();
            OAI_PMH            = new OAI_PMH_Configuration();
            UI     = new InstanceWide_UI_Configuration();
            Source = new Configuration_Source_Info();

            // Set some defaults
            HasData = false;
        }
        /// <summary> Constructor for a new instance of the InstanceWide_Configuration class </summary>
        public InstanceWide_Configuration()
        {
            // Create some of the configuration stuff
            Authentication = new Authentication_Configuration();
            BriefItemMapping = new BriefItemMapping_Configuration();
            ContactForm = new ContactForm_Configuration();
            Engine = new Engine_Server_Configuration();
            Extensions = new Extension_Configuration();
            QualityControlTool = new QualityControl_Configuration();
            Metadata = new Metadata_Configuration();
            OAI_PMH = new OAI_PMH_Configuration();
            UI = new InstanceWide_UI_Configuration();
            Source = new Configuration_Source_Info();

            // Set some defaults
            HasData = false;
        }
        private static void read_qc_profiles(XmlReader ReaderXml, QualityControl_Configuration Config )
        {
            int unnamed_profile_counter = 1;

            while (ReaderXml.Read())
            {
                if (ReaderXml.NodeType == XmlNodeType.Element)
                {
                    switch (ReaderXml.Name.ToLower())
                    {
                        case "profile":
                            QualityControl_Profile profile = new QualityControl_Profile();
                            XmlReader child_readerXml = ReaderXml.ReadSubtree();
                            if (ReaderXml.MoveToAttribute("name"))
                                profile.Profile_Name = ReaderXml.Value.Trim();
                            if (ReaderXml.MoveToAttribute("description"))
                                profile.Profile_Description = ReaderXml.Value;
                            if (ReaderXml.MoveToAttribute("isDefault"))
                            {
                                bool tempValue;
                                if (bool.TryParse(ReaderXml.Value, out tempValue))
                                {
                                    profile.Default_Profile = tempValue;
                                }
                            }
                            // Enforce a name for this profile (should have one according to XSD)
                            if (profile.Profile_Name.Length == 0)
                            {
                                profile.Profile_Name = "Unnamed" + unnamed_profile_counter;
                                unnamed_profile_counter++;
                            }

                            QualityControl_Division_Config thisConfig = new QualityControl_Division_Config();
                            while (child_readerXml.Read())
                            {
                                if (child_readerXml.NodeType == XmlNodeType.Element && child_readerXml.Name.ToLower() == "divisiontype")
                                {
                                    thisConfig = new QualityControl_Division_Config();

                                    if (child_readerXml.MoveToAttribute("type"))
                                    {
                                        thisConfig.TypeName = child_readerXml.Value;
                                    }
                                    if (child_readerXml.MoveToAttribute("isNameable"))
                                        thisConfig.isNameable = Convert.ToBoolean(child_readerXml.Value);
                                    if (child_readerXml.MoveToAttribute("base"))
                                    {
                                        string baseType = child_readerXml.Value;
                                        if (!String.Equals(baseType, thisConfig.TypeName, StringComparison.OrdinalIgnoreCase))
                                        {
                                            thisConfig.BaseTypeName = baseType;
                                        }
                                    }
                                    profile.Add_Division_Type(thisConfig);
                                }
                                else if (child_readerXml.NodeType == XmlNodeType.Element && child_readerXml.Name.ToLower() == "translation")
                                {
                                    if (thisConfig != null)
                                    {
                                        string language = (child_readerXml.MoveToAttribute("language")) ? child_readerXml.Value : String.Empty;
                                        string text = (child_readerXml.MoveToAttribute("text")) ? child_readerXml.Value : String.Empty;

                                        if ((!String.IsNullOrEmpty(language)) && (!String.IsNullOrEmpty(text)))
                                        {
                                            thisConfig.Add_Translation(Web_Language_Enum_Converter.Code_To_Enum(language), text );
                                        }
                                    }
                                }
                            }

                            Config.Add_Profile(profile);
                            break;

                    }
                }
            }
        }