Esempio n. 1
0
        /// <summary>
        ///			Displays the Taxonomy information for a specified TModelKey, begining
        ///			at a specified KeyValue.
        /// </summary>
        /// <param name="key">TModelKey for the the Taxonomy</param>
        /// <param name="value">KeyValue to start from.</param>
        /// <param name="tabs">Number or \t characters to prepend to the Output.</param>
        private static void DisplayTaxonomyItems(string key, string value, int tabs)
        {
            string line = "";

            for (int i = 0; i < tabs; i++)
            {
                line += "\t";
            }


            Category cat = new Category(key, value);

            cat.RelationshipQualifiers.Add(RelationshipQualifier.child);

            GetRelatedCategories grc = new GetRelatedCategories();

            grc.Categories.Add(cat);

            CategoryList list = grc.Send(_connection);

            foreach (CategoryInfo info in list.CategoryInfos)
            {
                foreach (CategoryValue cv in info.Children)
                {
                    Console.WriteLine(line + cv.KeyName + "(" + cv.KeyValue + ")");
                    DisplayTaxonomyItems(key, cv.KeyValue, tabs + 1);
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Gets the category items.
        /// </summary>
        /// <param name="UDDIConnection">The UDDI connection.</param>
        /// <param name="tModelKey">The t model key.</param>
        /// <param name="cKeyValue">The category key value.</param>
        /// <param name="cKeyName">Name of the category.</param>
        /// <returns></returns>
        public static string GetCategoryItems(UddiConnection UDDIConnection, string tModelKey, string cKeyValue, string cKeyName)
        {
            Category cat = new Category(tModelKey, cKeyValue);

            cat.RelationshipQualifiers.Add(RelationshipQualifier.child);

            GetRelatedCategories grc = new GetRelatedCategories();

            grc.Categories.Add(cat);

            CategoryList list = grc.Send(UDDIConnection);

            foreach (CategoryInfo info in list.CategoryInfos)
            {
                foreach (CategoryValue cv in info.Children)
                {
                    if (cv.KeyName.Equals(cKeyName))
                    {
                        return(cv.KeyValue);
                    }
                    GetCategoryItems(UDDIConnection, tModelKey, cv.KeyValue, cKeyName);
                }
            }

            return("");
        }
Esempio n. 3
0
        /// <summary>
        /// Gets the category.
        /// </summary>
        /// <param name="UDDIConnection">The UDDI connection.</param>
        /// <param name="tModelName">Name of the t model.</param>
        /// <param name="cKeyName">Name of the category key.</param>
        /// <returns></returns>
        public static string GetCategory(UddiConnection UDDIConnection, string tModelName, string cKeyName)
        {
            Category cat = new Category(GetTModelKey(UDDIConnection, tModelName));

            cat.RelationshipQualifiers.Add(RelationshipQualifier.root);

            GetRelatedCategories grc = new GetRelatedCategories();

            grc.Categories.Add(cat);

            CategoryList list           = grc.Send(UDDIConnection);
            string       categoryKeyVal = "";

            foreach (CategoryInfo info in list.CategoryInfos)
            {
                foreach (CategoryValue cv in info.Roots)
                {
                    categoryKeyVal = GetCategoryItems(UDDIConnection, info.TModelKey, cv.KeyValue, cKeyName);
                    if (!categoryKeyVal.Equals(String.Empty))
                    {
                        return(categoryKeyVal);
                    }
                }
            }

            return("");
        }
Esempio n. 4
0
        private void GetChildren(CategoryTreeNode node)
        {
            node.Nodes.Clear();

            GetRelatedCategories grc = new GetRelatedCategories();

            Category cat = new Category(node.CategoryValue.TModelKey, node.CategoryValue.KeyValue);

            grc.Categories.Add(cat);


            //
            // If the Parent is null, it is a root node (tModel)
            //
            if (node.IsSchemeNode)
            {
                grc.Categories[0].RelationshipQualifiers.Add(RelationshipQualifier.root);
            }
            else
            {
                grc.Categories[0].RelationshipQualifiers.Add(RelationshipQualifier.child);
            }

            CategoryList list = null;

            try
            {
                list = grc.Send(_connection);
            }
            catch (Exception e)
            {
                MessageBox.Show(this, e.Message, "Error Loading Tree Node");
                return;
            }


            CategoryValueCollection values;

            if (node.IsSchemeNode)
            {
                values = list.CategoryInfos[0].Roots;
            }
            else
            {
                values = list.CategoryInfos[0].Children;
            }

            foreach (CategoryValue val in values)
            {
                CategoryTreeNode subnode = new CategoryTreeNode(val);
                subnode.CategoryValue.TModelKey = node.CategoryValue.TModelKey;
                node.Nodes.Add(subnode);
            }

            node.HasDownloadedChildren = true;
        }
Esempio n. 5
0
        /// <summary>
        ///		Displays the Taxonomy information for a specified TModelKey.
        /// </summary>
        /// <param name="key">TModelKey to perferm the Categorization lookup on.</param>
        private static void DisplayTaxonomy(string key)
        {
            Category cat = new Category(key);

            cat.RelationshipQualifiers.Add(RelationshipQualifier.root);

            GetRelatedCategories grc = new GetRelatedCategories();

            grc.Categories.Add(cat);

            CategoryList list = grc.Send(_connection);

            foreach (CategoryInfo info in list.CategoryInfos)
            {
                Console.WriteLine(info.TModelKey);
                foreach (CategoryValue cv in info.Roots)
                {
                    Console.WriteLine("\t" + cv.KeyName + "(" + cv.KeyValue + ")");
                    DisplayTaxonomyItems(info.TModelKey, cv.KeyValue, 2);
                }
            }
        }
Esempio n. 6
0
        public CategoryList GetRelatedCategories(GetRelatedCategories getRelatedCategories)
        {
            object[] results = InvokeWebMethod("GetRelatedCategories", new object[] { getRelatedCategories });

            return((CategoryList)results[0]);
        }
Esempio n. 7
0
 /////////////////////////////////////////////////////////////////////////////////////////////////
 /// Uddi Extensions API messages
 /////////////////////////////////////////////////////////////////////////////////////////////////
 public CategoryList Send(GetRelatedCategories getRelatedCategories)
 {
     return(soapClient.GetRelatedCategories(getRelatedCategories));
 }
Esempio n. 8
0
        public void LoadTModels( )
        {
            FindTModel ft = new FindTModel();

            ft.CategoryBag.Add(CommonCanonical.UddiOrgTypes, "categorization", "Categorization (taxonomy)");

            TModelList list = null;

            try
            {
                list = ft.Send(_connection);
            }
            catch (Exception e)
            {
                MessageBox.Show(this, e.Message, @"Error loading Category Tree", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }

            if (null == list)
            {
                MessageBox.Show(this, @"An unknown error occurred while loading the Category Tree.", @"Error loading Category Tree", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }

            GetRelatedCategories grc = new GetRelatedCategories();
            Category             c   = new Category();

            c.RelationshipQualifiers.Add(RelationshipQualifier.root);

            foreach (TModelInfo info in list.TModelInfos)
            {
                bool categorization = false;
                c.TModelKey = info.TModelKey;
                grc.Categories.Add(c);

                CategoryList cl = null;
                try
                {
                    cl             = grc.Send(_connection);
                    categorization = true;
                }
                catch (InvalidKeyPassedException)
                {
                    //
                    // tModel doesn't represent a categorization.  So, don't show
                    // it in the tree.
                    //
                }
                catch (Exception e)
                {
                    //
                    // if anything else happened, re-throw & let the app deal with it.
                    //
                    throw e;
                }

                if (categorization)
                {
                    //
                    // Create a new node and wrap the tModelInfo into a
                    // CategoryInfo object.
                    //
                    CategoryTreeNode catnode = new CategoryTreeNode(new CategoryInfo(info.TModelKey));

                    catnode.Nodes.Clear();

                    //
                    // Set the Text of the node to the text of the tModel.
                    //
                    catnode.Text = info.Name.Text;

                    CategoryValueCollection values = cl.CategoryInfos[0].Roots;

                    foreach (CategoryValue val in values)
                    {
                        CategoryTreeNode subnode = new CategoryTreeNode(val);
                        subnode.CategoryValue.TModelKey = catnode.CategoryValue.TModelKey;
                        catnode.Nodes.Add(subnode);
                    }

                    catnode.HasDownloadedChildren = true;

                    //
                    // Add the node to the root.
                    //
                    Nodes.Add(catnode);
                }
            }
        }