Beispiel #1
0
        /// <summary>
        /// Gets the Tmodel key.
        /// </summary>
        /// <param name="UDDIConnection">The UDDI connection.</param>
        /// <param name="tMName">Name of the tModel.</param>
        /// <returns></returns>
        public static string GetTModelKey(UddiConnection UDDIConnection, string tMName)
        {
            FindTModel findTModel = new FindTModel(tMName);
            TModelList tMList     = findTModel.Send(UDDIConnection);

            if (tMList.TModelInfos.Count > 0)
            {
                return(tMList.TModelInfos[0].TModelKey);
            }
            return(String.Empty);
        }
Beispiel #2
0
        /// <summary>
        /// Gets all T models.
        /// </summary>
        /// <param name="UDDIConnection">The UDDI connection.</param>
        /// <returns></returns>
        public static List <string> GetAllTModels(UddiConnection UDDIConnection)
        {
            List <string> retList    = new List <string>();
            FindTModel    findTModel = new FindTModel("%");

            findTModel.FindQualifiers.Add(FindQualifier.ApproximateMatch);
            findTModel.FindQualifiers.Add(FindQualifier.SortByNameAscending);
            TModelList tMList = findTModel.Send(UDDIConnection);

            foreach (TModelInfo tMInfo in tMList.TModelInfos)
            {
                retList.Add(tMInfo.Name.Text);
            }
            return(retList);
        }
Beispiel #3
0
        public TModelList FindTModel(UDDI.API.ServiceType.FindTModel ftm)
        {
            Debug.Enter();
            TModelList tml = null;

            try
            {
                tml = ftm.Find();
            }
            catch (Exception e)
            {
                DispositionReport.Throw(e);
            }

            Debug.Leave();
            return(tml);
        }
Beispiel #4
0
        protected override void OnSearch(object sender, string query)
        {
            base.OnSearch(sender, query);

            if (query.IndexOf("%") < 0)
            {
                query += "%";
            }

            FindTModel find = new FindTModel();

            find.Name = query;

            TModelList list = find.Find();

            grid.DataSource = list.TModelInfos;
            grid.DataBind();

            count.Text = String.Format(
                Localization.GetString("TEXT_QUERY_COUNT"),
                list.TModelInfos.Count);
        }
Beispiel #5
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);
                }
            }
        }