Exemple #1
0
        public bool CheckTreeForCategory(IComponentLibraryFilter filter)
        {
            bool CategoryExists = false;

            try
            {
                VFOntologyTreeNode vfOntologyTree = this.m_vfWebClient.SendGetRequest <VFOntologyTreeNode>("/rest/exchange/ontology/domain/root/json_tree");

                CategoryExists = this.searchTreeRecursive(vfOntologyTree, filter.Category);
            }
            catch (Exception)
            {
                throw;
            }

            return(CategoryExists);
        }
Exemple #2
0
        private bool searchTreeRecursive(VFOntologyTreeNode treeNode, string category)
        {
            // Check 'this' label, return true if match
            if (treeNode.label == category)
            {
                return(true);
            }

            // search child nodes
            foreach (VFOntologyTreeNode childNode in treeNode.children)
            {
                if (searchTreeRecursive(childNode, category))
                {
                    return(true);
                }
            }

            return(false);
        }