/// <summary> /// Build the CatalogItemCollection structure from SRS /// </summary> public NCatalogItemCollection LookupCatalogItems(string itemPath, bool recursive, bool useHttpClient, ReportingServiceClient srsClient) { NCatalogItemCollection catalogItemCollection = new NCatalogItemCollection(); // If no ItemPath is specified, use the Root if (itemPath == null) { itemPath = "/"; } // Retrieve the full list of catalog items from SRS CatalogItem[] unsecureCatalogItems = null; if (srsClient != null) { unsecureCatalogItems = srsClient.ListChildren(itemPath, recursive); } else { if (useHttpClient) { unsecureCatalogItems = this.ReportingServiceClient.ListChildren(itemPath, recursive); } else { unsecureCatalogItems = this.ReportingServiceNonHttpClient.ListChildren(itemPath, recursive); } } // Secure the list List<CatalogItem> secureCatalogList = buildSecureCatalogList(unsecureCatalogItems); foreach (CatalogItem item in secureCatalogList) { NCatalogItem nItem = NCatalogItem.CreateNRCatalogItem(item); // TODO: Still not decided if it's wise to get all the parameters upon login // Supply the parameters /* if (nItem.ItemType.Equals(Constants.CatalogItemTypes.Report)) { try { nItem.ReportParameters = GetReportParameters(nItem.Path, null); } catch { //TODO: Prepare an error display for this //Error retrieving the parameters. nItem.ReportParameters = null; } } */ catalogItemCollection.Add(nItem); } /* // Create a map between SRS folders and Nodes collections in the tree Hashtable folderMapTable = new Hashtable(); if (itemPath == "/") { folderMapTable.Add("", catalogItemCollection); } else { folderMapTable.Add(itemPath, catalogItemCollection); } foreach (CatalogItem item in secureCatalogList) { // Get the path to the current item's folder string folderPath = item.Path.Substring(0, item.Path.LastIndexOf("/", StringComparison.OrdinalIgnoreCase)); // Get the node collection associated with that folder path NCatalogItemCollection nodes = folderMapTable[folderPath] as NCatalogItemCollection; if (nodes != null) { NCatalogItem nci = NCatalogItem.CreateNRCatalogItem(item); nodes.Add(nci); if (nci.ItemType == Constants.CatalogItemTypes.Folder) { if (folderMapTable.ContainsKey(nci.Path)) { throw new InvalidCatalogStructureException("Folder already exists"); } NFolder nf = nci as NFolder; folderMapTable.Add(nf.Path, nf.ChildCatalogItems); } } } */ return catalogItemCollection; }
private static void addUniqueItemToDependencyList(NCatalogItemCollection dependencyList, NCatalogItem catalogItem) { bool isUnique = true; foreach (NCatalogItem ci in dependencyList) { if (ci.Path == catalogItem.Path) { isUnique = false; break; } } if (isUnique) { dependencyList.Add(catalogItem); } }
public NCatalogItemCollection GetCatalogItems(bool recursive, bool useHttpClient, bool target) { NCatalogItemCollection catalog = new NCatalogItemCollection(); // Retrieve the full list of catalog items from SRS CatalogItem[] catalogItems = null; if (target) { //Get Target SRS if (useHttpClient) { catalogItems = this.ReportingTargetServiceClient.ListChildren(@"/", recursive); } else { catalogItems = this.ReportingTargetServiceNonHttpClient.ListChildren(@"/", recursive); } } else { //Get Source SRS if (useHttpClient) { catalogItems = this.ReportingSourceServiceClient.ListChildren(@"/", recursive); } else { catalogItems = this.ReportingSourceServiceNonHttpClient.ListChildren(@"/", recursive); } } foreach (CatalogItem item in catalogItems) { NCatalogItem nItem = NCatalogItem.CreateNRCatalogItem(item); catalog.Add(nItem); } return catalog; }