/// <summary> Gets a fully built item aggregation object for a particular aggregation code and language code. </summary> /// <param name="AggregationCode">Code for this aggregation object</param> /// <param name="Language_Code">Code for the language for this aggregation object</param> /// <param name="CacheInstance">Instance of this item aggregation pulled from cache (or NULL)</param> /// <param name="IsRobot">Flag tells if this request is from a robot (which will vary cacheing time)</param> /// <param name="StoreInCache"> Flag indicates if this should be stored in the cache once built </param> /// <param name="Tracer">Trace object keeps a list of each method executed and important milestones in rendering</param> /// <returns>Fully built item aggregation object for the particular aggregation code and language code</returns> /// <remarks>Item aggregation object is also placed in the cache.<br /><br /> /// Building of an item aggregation always starts by pulling the item from the database ( either <see cref="SobekCM_Database.Get_Item_Aggregation"/> or <see cref="SobekCM_Database.Get_Main_Aggregation"/> ).<br /><br /> /// Then, either the Item Aggregation XML file is read (if present) or the entire folder hierarchy is analyzed to find the browses, infos, banners, etc..</remarks> public static Item_Aggregation Get_Item_Aggregation(string AggregationCode, string Language_Code, Item_Aggregation CacheInstance, bool IsRobot, bool StoreInCache, Custom_Tracer Tracer) { // Does this exist in the cache? if (CacheInstance == null) { if (Tracer != null) { Tracer.Add_Trace("Item_Aggregation_Builder.Get_Item_Aggregation", "Creating '" + AggregationCode + "' item aggregation"); } // Get the information about this collection and this entry point Item_Aggregation hierarchyObject; if ((AggregationCode.Length > 0) && (AggregationCode != "all")) hierarchyObject = SobekCM_Database.Get_Item_Aggregation(AggregationCode, false, IsRobot, Tracer); else hierarchyObject = SobekCM_Database.Get_Main_Aggregation(Tracer); // If no value was returned, don't do anything else here if (hierarchyObject != null) { // Add all the values to this object string xmlDataFile = SobekCM_Library_Settings.Base_Design_Location + hierarchyObject.ObjDirectory + "\\" + hierarchyObject.Code + ".xml"; if (File.Exists(xmlDataFile)) { if (Tracer != null) { Tracer.Add_Trace("Item_Aggregation_Builder.Get_Item_Aggregation", "Reading XML Configuration File"); } // Add the ALL and NEW browses Add_All_New_Browses(hierarchyObject); // Add all the other data from the XML file Item_Aggregation_XML_Reader reader = new Item_Aggregation_XML_Reader(); reader.Add_Info_From_XML_File(hierarchyObject, xmlDataFile); } else { if (Tracer != null) { Tracer.Add_Trace("Item_Aggregation_Builder.Get_Item_Aggregation", "Adding banner, home, and all/new browse information"); } Add_HTML(hierarchyObject); Add_All_New_Browses(hierarchyObject); if (!IsRobot) { if (Tracer != null) { Tracer.Add_Trace("Item_Aggregation_Builder.Get_Item_Aggregation", "Scanning Design Directory for browse and info files"); } Add_Browse_Files(hierarchyObject, Tracer); } // Since there was no configuration file, save one hierarchyObject.Write_Configuration_File(SobekCM_Library_Settings.Base_Design_Location + hierarchyObject.ObjDirectory); } // Now, save this to the cache if ((!IsRobot) && ( StoreInCache )) { Cached_Data_Manager.Store_Item_Aggregation(AggregationCode, Language_Code, hierarchyObject, Tracer); } else { if (Tracer != null) { Tracer.Add_Trace("Item_Aggregation_Builder.Get_Item_Aggregation", "Skipping storing item aggregation on cache due to robot flag"); } } // Return this built hierarchy object return hierarchyObject; } if (Tracer != null) { Tracer.Add_Trace("Item_Aggregation_Builder.Get_Item_Aggregation", "NULL value returned from database"); } return null; } if (Tracer != null) { Tracer.Add_Trace("Item_Aggregation_Builder.Get_Item_Aggregation", "Found '" + AggregationCode + "' item aggregation in cache"); } // Get the HTML element and search fields and return all this return CacheInstance; }
/// <summary> Gets a fully built item aggregation object for a particular aggregation code and language code. </summary> /// <param name="AggregationCode">Code for this aggregation object</param> /// <param name="Language_Code">Code for the language for this aggregation object</param> /// <param name="cacheInstance">Instance of this item aggregation pulled from cache (or NULL)</param> /// <param name="isRobot">Flag tells if this request is from a robot (which will vary cacheing time)</param> /// <param name="tracer">Trace object keeps a list of each method executed and important milestones in rendering</param> /// <returns>Fully built item aggregation object for the particular aggregation code and language code</returns> /// <remarks>Item aggregation object is also placed in the cache.<br /><br /> /// Building of an item aggregation always starts by pulling the item from the database ( either <see cref="SobekCM_Database.Get_Item_Aggregation"/> or <see cref="SobekCM_Database.Get_Main_Aggregation"/> ).<br /><br /> /// Then, either the Item Aggregation XML file is read (if present) or the entire folder hierarchy is analyzed to find the browses, infos, banners, etc..</remarks> public static Item_Aggregation Get_Item_Aggregation(string AggregationCode, string Language_Code, Item_Aggregation cacheInstance, bool isRobot, Custom_Tracer tracer) { // Does this exist in the cache? if (cacheInstance == null) { if (tracer != null) { tracer.Add_Trace("Item_Aggregation_Builder.Get_Item_Aggregation", "Creating '" + AggregationCode + "' item aggregation"); } // Get the information about this collection and this entry point Item_Aggregation hierarchyObject; if ((AggregationCode.Length > 0) && (AggregationCode != "all")) { hierarchyObject = SobekCM_Database.Get_Item_Aggregation(AggregationCode, false, isRobot, tracer); } else { hierarchyObject = SobekCM_Database.Get_Main_Aggregation(tracer); } // If no value was returned, don't do anything else here if (hierarchyObject != null) { // Add all the values to this object string xmlDataFile = SobekCM_Library_Settings.Base_Design_Location + hierarchyObject.objDirectory + "\\" + hierarchyObject.Code + ".xml"; if (File.Exists(xmlDataFile)) { if (tracer != null) { tracer.Add_Trace("Item_Aggregation_Builder.Get_Item_Aggregation", "Reading XML Configuration File"); } // Add the ALL and NEW browses Add_All_New_Browses(hierarchyObject); // Add all the other data from the XML file Item_Aggregation_XML_Reader reader = new Item_Aggregation_XML_Reader(); reader.Add_Info_From_XML_File(hierarchyObject, xmlDataFile); } else { if (tracer != null) { tracer.Add_Trace("Item_Aggregation_Builder.Get_Item_Aggregation", "Adding banner, home, and all/new browse information"); } Add_HTML(hierarchyObject); Add_All_New_Browses(hierarchyObject); if (!isRobot) { if (tracer != null) { tracer.Add_Trace("Item_Aggregation_Builder.Get_Item_Aggregation", "Scanning Design Directory for browse and info files"); } Add_Browse_Files(hierarchyObject, tracer); } // Since there was no configuration file, save one hierarchyObject.Write_Configuration_File(SobekCM.Library.SobekCM_Library_Settings.Base_Design_Location + hierarchyObject.objDirectory); } // Now, save this to the cache if (!isRobot) { Cached_Data_Manager.Store_Item_Aggregation(AggregationCode, Language_Code, hierarchyObject, tracer); } else { if (tracer != null) { tracer.Add_Trace("Item_Aggregation_Builder.Get_Item_Aggregation", "Skipping storing item aggregation on cache due to robot flag"); } } // Return this built hierarchy object return(hierarchyObject); } if (tracer != null) { tracer.Add_Trace("Item_Aggregation_Builder.Get_Item_Aggregation", "NULL value returned from database"); } return(null); } if (tracer != null) { tracer.Add_Trace("Item_Aggregation_Builder.Get_Item_Aggregation", "Found '" + AggregationCode + "' item aggregation in cache"); } // Get the HTML element and search fields and return all this return(cacheInstance); }