Esempio n. 1
0
        /// <summary>
        /// Get the detailed information of collections for a domain
        /// </summary>
        /// <param name="domainID">ID of the domain whose collection info needed</param>
        /// <param name="catalogInfoArray">Details of the catalog</param>
        /// <param name="dService">object of Discovery service</param>
        /// <returns></returns>
        public static ArrayList GetDetailedCollectionInformation(string domainID, CatalogInfo[] catalogInfoArray, DiscoveryService dService)
        {
            ArrayList        colInfo    = new ArrayList();
            DiscoveryService locService = dService;

            NameValueCollection collectionsOnHost = new NameValueCollection();

            Member member = Store.GetStore().GetDomain(domainID).GetCurrentMember();

            foreach (CatalogInfo ci in catalogInfoArray)
            {
                //Collect all the CollectionIDs for HostID.
                collectionsOnHost.Add(ci.HostID, ci.CollectionID);
            }

            foreach (string hostID in collectionsOnHost.AllKeys)
            {
                try
                {
                    if (member.HomeServer != null && hostID == member.HomeServer.UserID)
                    {
                        //We already have a connection. Reuse it.
                        colInfo.AddRange(locService.GetAllCollectionInfo(collectionsOnHost.GetValues(hostID), member.UserID));
                    }
                    else
                    {
                        //Get all collection info in one call.
                        HostNode         hNode  = HostNode.GetHostByID(domainID, hostID);
                        SimiasConnection smConn = new SimiasConnection(domainID,
                                                                       member.UserID,
                                                                       SimiasConnection.AuthType.BASIC,
                                                                       hNode);
                        DiscoveryService discService = new DiscoveryService();
                        smConn.InitializeWebClient(discService, "DiscoveryService.asmx");
                        colInfo.AddRange(discService.GetAllCollectionInfo(collectionsOnHost.GetValues(hostID), member.UserID));
                    }
                }
                catch (Exception ex)
                {
                    log.Error(ex.Message);
                }
            }

            locService = null;
            return(colInfo);
        }