private void WalkCatalogNodes(ICatalogSystem catalogSystem, CatalogNodeDto nodes, CatalogDto.CatalogRow catalog, Dictionary <int, CatalogEntryDto.CatalogEntryRow> catalogEntryRows) { foreach (CatalogNodeDto.CatalogNodeRow node in nodes.CatalogNode) { CatalogSearchParameters pars = new CatalogSearchParameters(); CatalogSearchOptions options = new CatalogSearchOptions { CacheResults = false }; pars.CatalogNames.Add(catalog.Name); pars.CatalogNodes.Add(node.Code); //CatalogEntryDto entries = CatalogContext.Current.FindItemsDto( // pars, // options, // ref count, // new CatalogEntryResponseGroup(CatalogEntryResponseGroup.ResponseGroup.CatalogEntryFull)); CatalogEntryDto entries = catalogSystem.GetCatalogEntriesDto(catalog.CatalogId, node.CatalogNodeId, new CatalogEntryResponseGroup( CatalogEntryResponseGroup.ResponseGroup.CatalogEntryInfo)); _log.DebugFormat("Entries in Node: {0} (Count: {1})", node.Name, entries.CatalogEntry.Rows.Count); foreach (CatalogEntryDto.CatalogEntryRow entry in entries.CatalogEntry) { // _log.DebugFormat("{3}: {0} ({1} - {2})", entry.Name, entry.Code, entry.CatalogEntryId, entry.ClassTypeId); if (catalogEntryRows.ContainsKey(entry.CatalogEntryId) == false) { catalogEntryRows.Add(entry.CatalogEntryId, entry); } } // Get Subnodes CatalogNodeDto subNodes = catalogSystem.GetCatalogNodesDto(catalog.CatalogId, node.CatalogNodeId); WalkCatalogNodes(catalogSystem, subNodes, catalog, catalogEntryRows); } }
public void Search_JoinQuery() { ICatalogSystem system = CatalogContext.Current; // Get catalog lists CatalogDto catalogs = system.GetCatalogDto(); foreach (CatalogDto.CatalogRow catalog in catalogs.Catalog) { string catalogName = catalog.Name; // Get Catalog Nodes CatalogNodeDto nodes = system.GetCatalogNodesDto(catalogName); foreach (CatalogNodeDto.CatalogNodeRow node in nodes.CatalogNode) { CatalogSearchParameters pars = new CatalogSearchParameters(); CatalogSearchOptions options = new CatalogSearchOptions(); options.CacheResults = true; pars.CatalogNames.Add(catalogName); pars.CatalogNodes.Add(node.Code); pars.JoinType = "inner join"; pars.Language = "en-us"; pars.JoinSourceTable = "CatalogEntry"; pars.JoinTargetQuery = "(select distinct ObjectId, DisplayName from CatalogEntryEx) CatalogEntryEx"; pars.JoinSourceTableKey = "CatalogEntryId"; pars.JoinTargetTableKey = "CatalogEntryEx.ObjectId"; pars.OrderByClause = "CatalogEntryEx.DisplayName"; Entries entries = CatalogContext.Current.FindItems(pars, options, new CatalogEntryResponseGroup(CatalogEntryResponseGroup.ResponseGroup.CatalogEntryFull)); } } }
public void Search_BrowseEntries() { ICatalogSystem system = CatalogContext.Current; // Get catalog lists CatalogDto catalogs = system.GetCatalogDto(); foreach (CatalogDto.CatalogRow catalog in catalogs.Catalog) { string catalogName = catalog.Name; // Get Catalog Nodes CatalogNodeDto nodes = system.GetCatalogNodesDto(catalogName); foreach (CatalogNodeDto.CatalogNodeRow node in nodes.CatalogNode) { CatalogSearchParameters pars = new CatalogSearchParameters(); CatalogSearchOptions options = new CatalogSearchOptions(); options.CacheResults = true; pars.CatalogNames.Add(catalogName); pars.CatalogNodes.Add(node.Code); Entries entries = CatalogContext.Current.FindItems(pars, options, new CatalogEntryResponseGroup(CatalogEntryResponseGroup.ResponseGroup.CatalogEntryFull)); } } }
protected void WalkCatalog(ICatalogSystem catalogSystem, Dictionary <int, CatalogEntryDto.CatalogEntryRow> catalogEntryRows) { // Get all catalogs CatalogDto catalogs = catalogSystem.GetCatalogDto(); foreach (CatalogDto.CatalogRow catalog in catalogs.Catalog) { // string catalogName = catalog.Name; int catalogId = catalog.CatalogId; // Get Catalog Nodes CatalogNodeDto nodes = catalogSystem.GetCatalogNodesDto(catalogId); WalkCatalogNodes(catalogSystem, nodes, catalog, catalogEntryRows); } }
public void CatalogSystem_UnitTest_BrowseEntries() { ICatalogSystem system = CatalogContext.Current; // Get catalog lists CatalogDto catalogs = system.GetCatalogDto(); // Number of entries in CatalogEntry table int entryCount = 0; foreach (CatalogDto.CatalogRow catalog in catalogs.Catalog) { string catalogName = catalog.Name; // Get Catalog Nodes CatalogNodeDto nodes = system.GetCatalogNodesDto(catalogName); foreach (CatalogNodeDto.CatalogNodeRow node in nodes.CatalogNode) { CatalogSearchParameters pars = new CatalogSearchParameters(); CatalogSearchOptions options = new CatalogSearchOptions(); options.CacheResults = true; pars.Language = "en-us"; pars.CatalogNames.Add(catalogName); pars.CatalogNodes.Add(node.Code); // Test does not seem to be working: entries are mostly returning empty. Entries entries = CatalogContext.Current.FindItems(pars, options, new CatalogEntryResponseGroup(CatalogEntryResponseGroup.ResponseGroup.CatalogEntryFull)); try { foreach (Entry entry in entries.Entry) { // Something to do? Just looking at entries entryCount++; } } catch (Exception e) { Assert.IsFalse(new NullReferenceException().Equals(e)); } } } // As of testing 4/19/09, entryCount incremented 22 times (there are over 1300 entries in the table CatalogEntry) Console.WriteLine("Number of entries browsed: {0:d}", entryCount); Assert.Inconclusive("Verify the correctness of this test method."); }
/// <summary> /// Gets the catalog nodes dto. /// </summary> /// <param name="catalogId">The catalog id.</param> /// <param name="parentNodeId">The parent node id.</param> /// <returns></returns> public CatalogNodeDto GetCatalogNodesDto(int catalogId, int parentNodeId) { return(_Proxy.GetCatalogNodesDto(catalogId, parentNodeId)); }