Exemplo n.º 1
0
        /// <summary>
        /// Creates a one-dimensional <see cref="T:System.Array">Array</see> instance containing the collection items.
        /// </summary>
        /// <returns>Array of type SearchContentModuleInfo</returns>
        public SearchContentModuleInfo[] ToArray()
        {
            var arr = new SearchContentModuleInfo[Count];

            CopyTo(arr, 0);
            return(arr);
        }
Exemplo n.º 2
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Returns the collection of SearchDocuments for the portal.
        /// This replaces "GetSearchIndexItems" as a newer implementation of search.
        /// </summary>
        /// <param name="portalId"></param>
        /// <param name="startDate"></param>
        /// <returns></returns>
        /// <history>
        ///     [vnguyen]   04/16/2013  created
        /// </history>
        /// -----------------------------------------------------------------------------
        public override IEnumerable <SearchDocument> GetSearchDocuments(int portalId, DateTime startDate)
        {
            var searchDocuments        = new List <SearchDocument>();
            var searchModuleCollection = GetSearchModules(portalId);

            foreach (var module in searchModuleCollection)
            {
                try
                {
                    //Some modules update LastContentModifiedOnDate (e.g. Html module) when their content changes.
                    //We won't be calling into such modules if LastContentModifiedOnDate is prior to startDate
                    //LastContentModifiedOnDate remains minvalue for modules that don't update this property
                    if (module.LastContentModifiedOnDate != DateTime.MinValue && module.LastContentModifiedOnDate < startDate)
                    {
                        continue;
                    }

                    var controller  = Reflection.CreateObject(module.DesktopModule.BusinessControllerClass, module.DesktopModule.BusinessControllerClass);
                    var contentInfo = new SearchContentModuleInfo {
                        ModSearchBaseControllerType = (ModuleSearchBase)controller, ModInfo = module
                    };
                    var searchItems = contentInfo.ModSearchBaseControllerType.GetModifiedSearchDocuments(module, startDate);

                    if (searchItems != null)
                    {
                        //Add Module MetaData
                        foreach (var searchItem in searchItems)
                        {
                            searchItem.ModuleDefId = module.ModuleDefID;
                            searchItem.ModuleId    = module.ModuleID;
                            if (string.IsNullOrEmpty(searchItem.CultureCode))
                            {
                                searchItem.CultureCode = module.CultureCode;
                            }

                            if (Null.IsNull(searchItem.ModifiedTimeUtc))
                            {
                                searchItem.ModifiedTimeUtc = module.LastContentModifiedOnDate.ToUniversalTime();
                            }
                        }

                        Logger.Trace("ModuleIndexer: " + searchItems.Count + " search documents found for module [" + module.DesktopModule.ModuleName + " mid:" + module.ModuleID + "]");

                        searchDocuments.AddRange(searchItems);
                    }
                }
                catch (Exception ex)
                {
                    Exceptions.Exceptions.LogException(ex);
                }
            }

            return(searchDocuments);
        }
Exemplo n.º 3
0
        /// <summary>
        /// GetModuleList gets a collection of SearchContentModuleInfo Items for the Portal
        /// </summary>
        /// <remarks>
        /// Parses the Modules of the Portal, determining whetehr they are searchable.
        /// </remarks>
        /// <param name="PortalID">The Id of the Portal</param>
        /// <history>
        ///		[cnurse]	11/15/2004	documented
        /// </history>
        protected SearchContentModuleInfoCollection GetModuleList(int PortalID)
        {
            SearchContentModuleInfoCollection Results = new SearchContentModuleInfoCollection();

            ModuleController objModules          = new ModuleController();
            ArrayList        arrModules          = objModules.GetSearchModules(PortalID);
            Hashtable        businessControllers = new Hashtable();
            Hashtable        htModules           = new Hashtable();

            ModuleInfo objModule;

            foreach (ModuleInfo tempLoopVar_objModule in arrModules)
            {
                objModule = tempLoopVar_objModule;
                if (!htModules.ContainsKey(objModule.ModuleID))
                {
                    try
                    {
                        //Check if the business controller is in the Hashtable
                        object objController = businessControllers[objModule.BusinessControllerClass];

                        //If nothing create a new instance
                        if (objController == null)
                        {
                            objController = Framework.Reflection.CreateObject(objModule.BusinessControllerClass, objModule.BusinessControllerClass);

                            //Add to hashtable
                            businessControllers.Add(objModule.BusinessControllerClass, objController);
                        }

                        //Double-Check that module supports ISearchable
                        if (objController is ISearchable)
                        {
                            SearchContentModuleInfo ContentInfo = new SearchContentModuleInfo();
                            ContentInfo.ModControllerType = (ISearchable)objController;
                            ContentInfo.ModInfo           = objModule;
                            Results.Add(ContentInfo);
                        }
                    }
                    catch (Exception ex)
                    {
                        DotNetNuke.Services.Exceptions.Exceptions.LogException(ex);
                    }
                    finally
                    {
                        htModules.Add(objModule.ModuleID, objModule.ModuleID);
                    }
                }
            }

            return(Results);
        }
Exemplo n.º 4
0
        protected SearchContentModuleInfoCollection GetModuleList(int portalId)
        {
            var results             = new SearchContentModuleInfoCollection();
            var objModules          = new ModuleController();
            var arrModules          = objModules.GetSearchModules(portalId);
            var businessControllers = new Hashtable();
            var htModules           = new Hashtable();

            foreach (var module in arrModules.Cast <ModuleInfo>().Where(module => !htModules.ContainsKey(module.ModuleID)))
            {
                try
                {
                    //Check if the business controller is in the Hashtable
                    var controller = businessControllers[module.DesktopModule.BusinessControllerClass];
                    if (!String.IsNullOrEmpty(module.DesktopModule.BusinessControllerClass))
                    {
                        //If nothing create a new instance
                        if (controller == null)
                        {
                            //Add to hashtable
                            controller = Reflection.CreateObject(module.DesktopModule.BusinessControllerClass, module.DesktopModule.BusinessControllerClass);
                            businessControllers.Add(module.DesktopModule.BusinessControllerClass, controller);
                        }
                        //Double-Check that module supports ISearchable

                        //Check if module inherits from ModuleSearchBase
                        if (controller is ISearchable && !(controller is ModuleSearchBase))
                        {
                            var contentInfo = new SearchContentModuleInfo {
                                ModControllerType = (ISearchable)controller, ModInfo = module
                            };
                            results.Add(contentInfo);
                        }
                    }
                }
                catch (Exception ex)
                {
                    Logger.Error(ex);
                    ThrowLogError(module, ex);
                }
                finally
                {
                    htModules.Add(module.ModuleID, module.ModuleID);
                }
            }
            return(results);
        }
Exemplo n.º 5
0
 /// <summary>
 /// Gets the index in the collection of the specified <see cref="SearchContentModuleInfoCollection">SearchContentModuleInfoCollection</see>, if it exists in the collection.
 /// </summary>
 /// <param name="value">The <see cref="SearchContentModuleInfoCollection">SearchContentModuleInfoCollection</see> to locate in the collection.</param>
 /// <returns>The index in the collection of the specified object, if found; otherwise, -1.</returns>
 public int IndexOf(SearchContentModuleInfo value)
 {
     return(List.IndexOf(value));
 }
Exemplo n.º 6
0
 /// <summary>
 /// Add an element of the specified <see cref="SearchContentModuleInfo">SearchContentModuleInfo</see> to the end of the collection.
 /// </summary>
 /// <param name="value">An object of type <see cref="SearchContentModuleInfo">SearchContentModuleInfo</see> to add to the collection.</param>
 public int Add(SearchContentModuleInfo value)
 {
     return(List.Add(value));
 }
        } //Insert

        /// <summary>
        /// Remove the specified object of type <see cref="SearchContentModuleInfo">SearchContentModuleInfo</see> from the collection.
        /// </summary>
        /// <param name="value">An object of type <see cref="SearchContentModuleInfo">SearchContentModuleInfo</see> to remove to the collection.</param>
        public void Remove( SearchContentModuleInfo value )
        {
            List.Remove( value );
        } //Remove
        } //IndexOf

        /// <summary>
        /// Add an element of the specified <see cref="SearchContentModuleInfo">SearchContentModuleInfo</see> to the collection at the designated index.
        /// </summary>
        /// <param name="index">An <see cref="system.int32">Integer</see> to indicate the location to add the object to the collection.</param>
        /// <param name="value">An object of type <see cref="SearchContentModuleInfo">SearchContentModuleInfo</see> to add to the collection.</param>
        public void Insert( int index, SearchContentModuleInfo value )
        {
            List.Insert( index, value );
        } //Insert
Exemplo n.º 9
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Returns the number of indexed SearchDocuments for the portal.
        /// </summary>
        /// <remarks>This replaces "GetSearchIndexItems" as a newer implementation of search.</remarks>
        /// <returns></returns>
        /// -----------------------------------------------------------------------------
        public override int IndexSearchDocuments(
            int portalId,
            ScheduleHistoryItem schedule, DateTime startDateLocal, Action <IEnumerable <SearchDocument> > indexer)
        {
            Requires.NotNull("indexer", indexer);
            const int saveThreshold = 1024 * 2;
            var       totalIndexed  = 0;

            startDateLocal = this.GetLocalTimeOfLastIndexedItem(portalId, schedule.ScheduleID, startDateLocal);
            var searchDocuments        = new List <SearchDocument>();
            var searchModuleCollection = this._searchModules.ContainsKey(portalId)
                ? this._searchModules[portalId].Where(m => m.SupportSearch).Select(m => m.ModuleInfo)
                : this.GetSearchModules(portalId);

            // Some modules update LastContentModifiedOnDate (e.g. Html module) when their content changes.
            // We won't be calling into such modules if LastContentModifiedOnDate is prior to startDate.
            // LastContentModifiedOnDate remains MinValue for modules that don't update this property
            var modulesInDateRange = searchModuleCollection.Where(module =>
                                                                  !(SqlDateTime.MinValue.Value < module.LastContentModifiedOnDate && module.LastContentModifiedOnDate < startDateLocal))
                                     .OrderBy(m => m.LastContentModifiedOnDate).ThenBy(m => m.ModuleID).ToArray();

            if (modulesInDateRange.Any())
            {
                foreach (var module in modulesInDateRange)
                {
                    try
                    {
                        var controller  = Reflection.CreateObject(module.DesktopModule.BusinessControllerClass, module.DesktopModule.BusinessControllerClass);
                        var contentInfo = new SearchContentModuleInfo {
                            ModSearchBaseControllerType = (ModuleSearchBase)controller, ModInfo = module
                        };
                        var searchItems = contentInfo.ModSearchBaseControllerType.GetModifiedSearchDocuments(module, startDateLocal.ToUniversalTime());

                        if (searchItems != null && searchItems.Count > 0)
                        {
                            AddModuleMetaData(searchItems, module);
                            searchDocuments.AddRange(searchItems);

                            if (Logger.IsTraceEnabled)
                            {
                                Logger.TraceFormat(
                                    "ModuleIndexer: {0} search documents found for module [{1} mid:{2}]",
                                    searchItems.Count, module.DesktopModule.ModuleName, module.ModuleID);
                            }

                            if (searchDocuments.Count >= saveThreshold)
                            {
                                totalIndexed += this.IndexCollectedDocs(indexer, searchDocuments, portalId, schedule);
                                searchDocuments.Clear();
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        Exceptions.Exceptions.LogException(ex);
                    }
                }

                if (searchDocuments.Count > 0)
                {
                    totalIndexed += this.IndexCollectedDocs(indexer, searchDocuments, portalId, schedule);
                }
            }

            return(totalIndexed);
        }
Exemplo n.º 10
0
 /// <summary>
 /// Gets a value indicating whether the collection contains the specified <see cref="SearchContentModuleInfoCollection">SearchContentModuleInfoCollection</see>.
 /// </summary>
 /// <param name="value">The <see cref="SearchContentModuleInfoCollection">SearchContentModuleInfoCollection</see> to search for in the collection.</param>
 /// <returns><b>true</b> if the collection contains the specified object; otherwise, <b>false</b>.</returns>
 public bool Contains(SearchContentModuleInfo value)
 {
     //If value is not of type SearchContentModuleInfo, this will return false.
     return(List.Contains(value));
 }
        } //Contains

        /// <summary>
        /// Copies the elements of the specified <see cref="SearchContentModuleInfo">SearchContentModuleInfo</see> array to the end of the collection.
        /// </summary>
        /// <param name="value">An array of type <see cref="SearchContentModuleInfo">SearchContentModuleInfo</see> containing the objects to add to the collection.</param>
        public void AddRange( SearchContentModuleInfo[] value )
        {
            for( int i = 0; i <= value.Length - 1; i++ )
            {
                Add( value[ i ] );
            }
        }
 /// <summary>
 /// Add an element of the specified <see cref="SearchContentModuleInfo">SearchContentModuleInfo</see> to the end of the collection.
 /// </summary>
 /// <param name="value">An object of type <see cref="SearchContentModuleInfo">SearchContentModuleInfo</see> to add to the collection.</param>
 public int Add( SearchContentModuleInfo value )
 {
     return List.Add( value );
 } //Add
        } //Add

        /// <summary>
        /// Gets the index in the collection of the specified <see cref="SearchContentModuleInfoCollection">SearchContentModuleInfoCollection</see>, if it exists in the collection.
        /// </summary>
        /// <param name="value">The <see cref="SearchContentModuleInfoCollection">SearchContentModuleInfoCollection</see> to locate in the collection.</param>
        /// <returns>The index in the collection of the specified object, if found; otherwise, -1.</returns>
        public int IndexOf( SearchContentModuleInfo value )
        {
            return List.IndexOf( value );
        } //IndexOf
 /// <summary>
 /// Initializes a new instance of the <see cref="SearchContentModuleInfoCollection">SearchContentModuleInfoCollection</see> class containing the specified array of <see cref="SearchContentModuleInfo">SearchContentModuleInfo</see> objects.
 /// </summary>
 /// <param name="value">An array of <see cref="SearchContentModuleInfo">SearchContentModuleInfo</see> objects with which to initialize the collection. </param>
 public SearchContentModuleInfoCollection( SearchContentModuleInfo[] value )
 {
     AddRange( value );
 }
        /// <summary>
        /// Creates a one-dimensional <see cref="T:System.Array">Array</see> instance containing the collection items.
        /// </summary>
        /// <returns>Array of type SearchContentModuleInfo</returns>
        public SearchContentModuleInfo[] ToArray()
        {
            SearchContentModuleInfo[] arr = new SearchContentModuleInfo[Count - 1 + 1];
            
            CopyTo( arr, 0 );

            return arr;
        }
 /// <summary>
 /// Copies the collection objects to a one-dimensional <see cref="T:System.Array">Array</see> instance beginning at the specified index.
 /// </summary>
 /// <param name="array">The one-dimensional <see cref="T:System.Array">Array</see> that is the destination of the values copied from the collection.</param>
 /// <param name="index">The index of the array at which to begin inserting.</param>
 public void CopyTo( SearchContentModuleInfo[] array, int index )
 {
     List.CopyTo( array, index );
 }
Exemplo n.º 17
0
 /// <summary>
 /// Add an element of the specified <see cref="SearchContentModuleInfo">SearchContentModuleInfo</see> to the collection at the designated index.
 /// </summary>
 /// <param name="index">An <see cref="System.Int32">Integer</see> to indicate the location to add the object to the collection.</param>
 /// <param name="value">An object of type <see cref="SearchContentModuleInfo">SearchContentModuleInfo</see> to add to the collection.</param>
 public void Insert(int index, SearchContentModuleInfo value)
 {
     List.Insert(index, value);
 }
Exemplo n.º 18
0
        protected SearchContentModuleInfoCollection GetModuleList(int portalId)
        {
            var results = new SearchContentModuleInfoCollection();
            var objModules = new ModuleController();
            var arrModules = objModules.GetSearchModules(portalId);
            var businessControllers = new Hashtable();
            var htModules = new Hashtable();
            
            foreach (var module in arrModules.Cast<ModuleInfo>().Where(module => !htModules.ContainsKey(module.ModuleID)))
            {
                try
                {
                    //Check if the business controller is in the Hashtable
                    var controller = businessControllers[module.DesktopModule.BusinessControllerClass];
                    if (!String.IsNullOrEmpty(module.DesktopModule.BusinessControllerClass))
                    {
                        //If nothing create a new instance
                        if (controller == null)
                        {
                            //Add to hashtable
                            controller = Reflection.CreateObject(module.DesktopModule.BusinessControllerClass, module.DesktopModule.BusinessControllerClass);                              
                            businessControllers.Add(module.DesktopModule.BusinessControllerClass, controller);
                        }                            
                        //Double-Check that module supports ISearchable

                        //Check if module inherits from ModuleSearchBase                        
                        if (controller is ISearchable && !(controller is ModuleSearchBase))
                        {
                            var contentInfo = new SearchContentModuleInfo {ModControllerType = (ISearchable) controller, ModInfo = module};
                            results.Add(contentInfo);
                        }                           
                    }
                }
                catch (Exception ex)
                {
                    Logger.Error(ex);
                    ThrowLogError(module, ex);
                }
                finally
                {
                    htModules.Add(module.ModuleID, module.ModuleID);
                }
            }
            return results;
        }
Exemplo n.º 19
0
 /// <summary>
 /// Remove the specified object of type <see cref="SearchContentModuleInfo">SearchContentModuleInfo</see> from the collection.
 /// </summary>
 /// <param name="value">An object of type <see cref="SearchContentModuleInfo">SearchContentModuleInfo</see> to remove to the collection.</param>
 public void Remove(SearchContentModuleInfo value)
 {
     List.Remove(value);
 }
        } //Remove

        /// <summary>
        /// Gets a value indicating whether the collection contains the specified <see cref="SearchContentModuleInfoCollection">SearchContentModuleInfoCollection</see>.
        /// </summary>
        /// <param name="value">The <see cref="SearchContentModuleInfoCollection">SearchContentModuleInfoCollection</see> to search for in the collection.</param>
        /// <returns><b>true</b> if the collection contains the specified object; otherwise, <b>false</b>.</returns>
        public bool Contains( SearchContentModuleInfo value )
        {
            // If value is not of type SearchContentModuleInfo, this will return false.
            return List.Contains( value );
        } //Contains
Exemplo n.º 21
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// GetModuleList gets a collection of SearchContentModuleInfo Items for the Portal
        /// </summary>
        /// <remarks>
        /// Parses the Modules of the Portal, determining whetehr they are searchable.
        /// </remarks>
        /// <param name="PortalID">The Id of the Portal</param>
        /// <history>
        ///		[cnurse]	11/15/2004	documented
        /// </history>
        /// -----------------------------------------------------------------------------
        protected SearchContentModuleInfoCollection GetModuleList(int PortalID)
        {
            var       Results             = new SearchContentModuleInfoCollection();
            var       objModules          = new ModuleController();
            ArrayList arrModules          = objModules.GetSearchModules(PortalID);
            var       businessControllers = new Hashtable();
            var       htModules           = new Hashtable();

            foreach (ModuleInfo objModule in arrModules)
            {
                if (!htModules.ContainsKey(objModule.ModuleID))
                {
                    try
                    {
                        //Check if the business controller is in the Hashtable
                        object objController = businessControllers[objModule.DesktopModule.BusinessControllerClass];
                        if (!String.IsNullOrEmpty(objModule.DesktopModule.BusinessControllerClass))
                        {
                            //If nothing create a new instance
                            if (objController == null)
                            {
                                objController = Reflection.CreateObject(objModule.DesktopModule.BusinessControllerClass, objModule.DesktopModule.BusinessControllerClass);

                                //Add to hashtable
                                businessControllers.Add(objModule.DesktopModule.BusinessControllerClass, objController);
                            }

                            //Double-Check that module supports ISearchable
                            if (objController is ISearchable)
                            {
                                var ContentInfo = new SearchContentModuleInfo();
                                ContentInfo.ModControllerType = (ISearchable)objController;
                                ContentInfo.ModInfo           = objModule;
                                Results.Add(ContentInfo);
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        Instrumentation.DnnLog.Error(ex);

                        try
                        {
                            string strMessage = string.Format("Error Creating BusinessControllerClass '{0}' of module({1}) id=({2}) in tab({3}) and portal({4}) ",
                                                              objModule.DesktopModule.BusinessControllerClass,
                                                              objModule.DesktopModule.ModuleName,
                                                              objModule.ModuleID,
                                                              objModule.TabID,
                                                              objModule.PortalID);
                            throw new Exception(strMessage, ex);
                        }
                        catch (Exception ex1)
                        {
                            Exceptions.Exceptions.LogException(ex1);
                        }
                    }
                    finally
                    {
                        htModules.Add(objModule.ModuleID, objModule.ModuleID);
                    }
                }
            }
            return(Results);
        }
Exemplo n.º 22
0
        /// <summary>
        /// GetModuleList gets a collection of SearchContentModuleInfo Items for the Portal
        /// </summary>
        /// <remarks>
        /// Parses the Modules of the Portal, determining whetehr they are searchable.
        /// </remarks>
        /// <param name="PortalID">The Id of the Portal</param>
        /// <history>
        ///		[cnurse]	11/15/2004	documented
        /// </history>
        protected SearchContentModuleInfoCollection GetModuleList( int PortalID )
        {
            SearchContentModuleInfoCollection Results = new SearchContentModuleInfoCollection();

            ModuleController objModules = new ModuleController();
            ArrayList arrModules = objModules.GetSearchModules( PortalID );
            Hashtable businessControllers = new Hashtable();
            Hashtable htModules = new Hashtable();

            ModuleInfo objModule;
            foreach( ModuleInfo tempLoopVar_objModule in arrModules )
            {
                objModule = tempLoopVar_objModule;
                if( ! htModules.ContainsKey( objModule.ModuleID ) )
                {
                    try
                    {
                        //Check if the business controller is in the Hashtable
                        object objController = businessControllers[objModule.BusinessControllerClass];

                        //If nothing create a new instance
                        if( objController == null )
                        {
                            objController = Framework.Reflection.CreateObject( objModule.BusinessControllerClass, objModule.BusinessControllerClass );

                            //Add to hashtable
                            businessControllers.Add( objModule.BusinessControllerClass, objController );
                        }

                        //Double-Check that module supports ISearchable
                        if( objController is ISearchable )
                        {
                            SearchContentModuleInfo ContentInfo = new SearchContentModuleInfo();
                            ContentInfo.ModControllerType = (ISearchable)objController;
                            ContentInfo.ModInfo = objModule;
                            Results.Add( ContentInfo );
                        }
                    }
                    catch( Exception ex )
                    {
                        DotNetNuke.Services.Exceptions.Exceptions.LogException(ex);
                    }
                    finally
                    {
                        htModules.Add( objModule.ModuleID, objModule.ModuleID );
                    }
                }
            }

            return Results;
        }
Exemplo n.º 23
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Returns the collection of SearchDocuments for the portal.
        /// This replaces "GetSearchIndexItems" as a newer implementation of search.
        /// </summary>
        /// <param name="portalId"></param>
        /// <param name="startDate"></param>
        /// <returns></returns>
        /// <history>
        ///     [vnguyen]   04/16/2013  created
        /// </history>
        /// -----------------------------------------------------------------------------
        public override IEnumerable<SearchDocument> GetSearchDocuments(int portalId, DateTime startDate)
        {
            var searchDocuments = new List<SearchDocument>();
            var searchModuleCollection = GetSearchModules(portalId);

            foreach (var module in searchModuleCollection)
            {
                try
                {
                    //Some modules update LastContentModifiedOnDate (e.g. Html module) when their content changes.
                    //We won't be calling into such modules if LastContentModifiedOnDate is prior to startDate
                    //LastContentModifiedOnDate remains minvalue for modules that don't update this property
                    if (module.LastContentModifiedOnDate != DateTime.MinValue && module.LastContentModifiedOnDate < startDate)
                    {
                        continue;
                    }

                    var controller =  Reflection.CreateObject(module.DesktopModule.BusinessControllerClass, module.DesktopModule.BusinessControllerClass);
                    var contentInfo = new SearchContentModuleInfo {ModSearchBaseControllerType= (ModuleSearchBase) controller, ModInfo = module};
                    var searchItems = contentInfo.ModSearchBaseControllerType.GetModifiedSearchDocuments(module, startDate);

                    if (searchItems != null)
                    {
                        //Add Module MetaData
                        foreach (var searchItem in searchItems)
                        {
                            searchItem.ModuleDefId = module.ModuleDefID;
                            searchItem.ModuleId = module.ModuleID;
                            if (string.IsNullOrEmpty(searchItem.CultureCode))
                            {
                                searchItem.CultureCode = module.CultureCode;
                            }

                            if (Null.IsNull(searchItem.ModifiedTimeUtc))
                            {
                                searchItem.ModifiedTimeUtc = module.LastContentModifiedOnDate.ToUniversalTime();
                            }
                        }

                        Logger.Trace("ModuleIndexer: " + searchItems.Count + " search documents found for module [" + module.DesktopModule.ModuleName + " mid:" + module.ModuleID + "]");

                        searchDocuments.AddRange(searchItems);
                    }
                }
                catch (Exception ex)
                {
                    Exceptions.Exceptions.LogException(ex);
                }
            }
            
            return searchDocuments;
        }
Exemplo n.º 24
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// GetModuleList gets a collection of SearchContentModuleInfo Items for the Portal
        /// </summary>
        /// <remarks>
        /// Parses the Modules of the Portal, determining whetehr they are searchable.
        /// </remarks>
        /// <param name="PortalID">The Id of the Portal</param>
        /// <history>
        ///		[cnurse]	11/15/2004	documented
        /// </history>
        /// -----------------------------------------------------------------------------
        protected SearchContentModuleInfoCollection GetModuleList(int PortalID)
        {
            var Results = new SearchContentModuleInfoCollection();
            var objModules = new ModuleController();
            ArrayList arrModules = objModules.GetSearchModules(PortalID);
            var businessControllers = new Hashtable();
            var htModules = new Hashtable();
            foreach (ModuleInfo objModule in arrModules)
            {
                if (!htModules.ContainsKey(objModule.ModuleID))
                {
                    try
                    {
                        //Check if the business controller is in the Hashtable
                        object objController = businessControllers[objModule.DesktopModule.BusinessControllerClass];
                        if (!String.IsNullOrEmpty(objModule.DesktopModule.BusinessControllerClass))
                        {
							//If nothing create a new instance
                            if (objController == null)
                            {
                                objController = Reflection.CreateObject(objModule.DesktopModule.BusinessControllerClass, objModule.DesktopModule.BusinessControllerClass);
                                
								//Add to hashtable
								businessControllers.Add(objModule.DesktopModule.BusinessControllerClass, objController);
                            }
                            
							//Double-Check that module supports ISearchable
							if (objController is ISearchable)
                            {
                                var ContentInfo = new SearchContentModuleInfo();
                                ContentInfo.ModControllerType = (ISearchable) objController;
                                ContentInfo.ModInfo = objModule;
                                Results.Add(ContentInfo);
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        Instrumentation.DnnLog.Error(ex);

                        try
                        {
                            string strMessage = string.Format("Error Creating BusinessControllerClass '{0}' of module({1}) id=({2}) in tab({3}) and portal({4}) ",
                                                              objModule.DesktopModule.BusinessControllerClass,
                                                              objModule.DesktopModule.ModuleName,
                                                              objModule.ModuleID,
                                                              objModule.TabID,
                                                              objModule.PortalID);
                            throw new Exception(strMessage, ex);
                        }
                        catch (Exception ex1)
                        {
                            Exceptions.Exceptions.LogException(ex1);
                        }
                    }
                    finally
                    {
                        htModules.Add(objModule.ModuleID, objModule.ModuleID);
                    }
                }
            }
            return Results;
        }