/// <summary> Constructor for a new instance of the UF_Archives_ItemViewer class, used display /// the tracking milestones information for a digital resource </summary> /// <param name="BriefItem"> Digital resource object </param> /// <param name="CurrentUser"> Current user, who may or may not be logged on </param> /// <param name="CurrentRequest"> Information about the current request </param> /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering </param> public UF_Archives_ItemViewer(BriefItemInfo BriefItem, User_Object CurrentUser, Navigation_Object CurrentRequest, Custom_Tracer Tracer) { // Save the arguments for use later this.BriefItem = BriefItem; this.CurrentUser = CurrentUser; this.CurrentRequest = CurrentRequest; // Set the behavior properties to the empy behaviors ( in the base class ) Behaviors = EmptyBehaviors; // Get the archives information Tracer.Add_Trace("UF_Archives_ItemViewer.Constructor", "Try to pull the archives details for this item"); DataSet data = Engine_Database.Tracking_Get_History_Archives(BriefItem.Web.ItemID, Tracer); if ((data == null) || (data.Tables.Count < 3)) { Tracer.Add_Trace("Constructor.Constructor", "Unable to pull tracking details"); CurrentRequest.Mode = Display_Mode_Enum.Error; CurrentRequest.Error_Message = "Internal Error : Unable to pull tracking information for " + BriefItem.BibID + ":" + BriefItem.VID; return; } // Save this table archiveTable = data.Tables[2]; }
/// <summary> Processes any incoming FDA (Florida Dark Archive) reports, saves the data to the database, and archives the report in the resource folder </summary> /// <param name="Settings"> Instance-wide settings which may be required for this process </param> public override void DoWork(InstanceWide_Settings Settings) { // Step through each incoming folder and look for FDA reports if ((!String.IsNullOrEmpty(Settings.Florida.FDA_Report_DropBox)) && (Directory.Exists(Settings.Florida.FDA_Report_DropBox))) { // Create the FDA process FDA_Report_Processor fdaProcessor = new FDA_Report_Processor(); // Process all pending FDA reports fdaProcessor.Process(Settings.Florida.FDA_Report_DropBox); // Log successes and failures if ((fdaProcessor.Error_Count > 0) || (fdaProcessor.Success_Count > 0)) { // Clear any previous report Engine_Database.Builder_Clear_Item_Error_Log("FDA REPORT", "", "SobekCM Builder"); if (fdaProcessor.Error_Count > 0) { OnError("Processed " + fdaProcessor.Success_Count + " FDA reports with " + fdaProcessor.Error_Count + " errors", String.Empty, String.Empty, -1); } else { OnProcess("Processed " + fdaProcessor.Success_Count + " FDA reports", "Standard", String.Empty, String.Empty, -1); } } } }
/// <summary> Refresh the hierarchy of non-aggregational web content pages by pulling the data back from the database </summary> /// <returns> TRUE if successful, otherwise FALSE </returns> public static bool RefreshWebContentHierarchy() { try { lock (webContentHierarchyLock) { // Either create a new hierarchy object , or clear the existing if (webContentHierarchy == null) { webContentHierarchy = new WebContent_Hierarchy(); } else { webContentHierarchy.Clear(); } if (!Engine_Database.WebContent_Populate_All_Hierarchy(webContentHierarchy, null)) { webContentHierarchy = null; return(false); } } return(true); } catch { return(false); } }
private void ReportLastRun() { // Save information about this last run Engine_Database.Set_Setting("Builder Version", Engine_ApplicationCache_Gateway.Settings.Static.Current_Builder_Version); Engine_Database.Set_Setting("Builder Last Run Finished", DateTime.Now.ToString()); Engine_Database.Set_Setting("Builder Last Message", finalmessage); }
/// <summary> Method returns the table of results for the browse indicated </summary> /// <param name = "ItemAggr">Object with all the information about the browse</param> /// <param name = "Page"> Page of results requested for the indicated browse </param> /// <param name = "Sort"> Sort applied to the results before being returned </param> /// <param name="Potentially_Include_Facets"> Flag indicates if facets could be included in this browse results </param> /// <param name = "Need_Browse_Statistics"> Flag indicates if the browse statistics (facets and total counts) are required for this browse as well </param> /// <param name = "Tracer">Trace object keeps a list of each method executed and important milestones in rendering</param> /// <param name="Results_Per_Page"> Number of results to retrieve per page</param> /// <returns> Resutls for the browse or info in table form </returns> public static Multiple_Paged_Results_Args Gat_All_Browse(Complete_Item_Aggregation ItemAggr, int Page, int Sort, int Results_Per_Page, bool Potentially_Include_Facets, bool Need_Browse_Statistics, Custom_Tracer Tracer) { if (Tracer != null) { Tracer.Add_Trace("Item_Aggregation_Utilities.Get_Browse_Results", String.Empty); } // Get the list of facets first List <short> facetsList = ItemAggr.Facets; if (!Potentially_Include_Facets) { facetsList = null; } // Pull data from the database if necessary // Get this browse from the database if ((ItemAggr.ID < 0) || (ItemAggr.Code.ToUpper() == "ALL")) { return(Engine_Database.Get_All_Browse_Paged(false, false, Results_Per_Page, Page, Sort, Need_Browse_Statistics, facetsList, Need_Browse_Statistics, Tracer)); } return(Engine_Database.Get_Item_Aggregation_Browse_Paged(ItemAggr.Code, false, false, Results_Per_Page, Page, Sort, Need_Browse_Statistics, facetsList, Need_Browse_Statistics, Tracer)); }
private void Process_Single_Incoming_Package(Incoming_Digital_Resource ResourcePackage) { ResourcePackage.BuilderLogId = Add_NonError_To_Log("........Processing '" + ResourcePackage.Folder_Name + "'", "Standard", ResourcePackage.BibID + ":" + ResourcePackage.VID, ResourcePackage.METS_Type_String, -1); // Clear any existing error linked to this item Engine_Database.Builder_Clear_Item_Error_Log(ResourcePackage.BibID, ResourcePackage.VID, "SobekCM Builder"); // Before we save this or anything, let's see if this is truly a new resource ResourcePackage.NewPackage = (Engine_Database.Get_Item_Information(ResourcePackage.BibID, ResourcePackage.VID, null) == null); ResourcePackage.Package_Time = DateTime.Now; try { // Do all the item processing per instance config foreach (iSubmissionPackageModule thisModule in builderModules.ItemProcessModules) { //if ( superverbose) //{ // Add_NonError_To_Log("Running module " + thisModule.GetType().ToString(), true, ResourcePackage.BibID + ":" + ResourcePackage.VID, String.Empty, ResourcePackage.BuilderLogId); //} if (!thisModule.DoWork(ResourcePackage)) { Add_Error_To_Log("Unable to complete new/replacement for " + ResourcePackage.BibID + ":" + ResourcePackage.VID, ResourcePackage.BibID + ":" + ResourcePackage.VID, String.Empty, ResourcePackage.BuilderLogId); // Try to move the whole package to the failures folder string final_failures_folder = Path.Combine(ResourcePackage.Source_Folder.Failures_Folder, ResourcePackage.BibID + "_" + ResourcePackage.VID); if (Directory.Exists(final_failures_folder)) { final_failures_folder = final_failures_folder + "_" + DateTime.Now.Year + "_" + DateTime.Now.Month.ToString().PadLeft(2, '0') + "_" + DateTime.Now.Day.ToString().PadLeft(2, '0') + "_" + DateTime.Now.Hour.ToString().PadLeft(2, '0') + "_" + DateTime.Now.Minute.ToString().PadLeft(2, '0') + "_" + DateTime.Now.Second.ToString().PadLeft(2, '0'); } try { Directory.Move(ResourcePackage.Resource_Folder, final_failures_folder); } catch { } return; } } // Save these collections to mark them for refreshing the RSS feeds, etc.. Add_Process_Info_To_PostProcess_Lists(ResourcePackage.BibID, ResourcePackage.VID, ResourcePackage.Metadata.Behaviors.Aggregation_Code_List); // Finally, clear the memory a little bit ResourcePackage.Clear_METS(); } catch (Exception ee) { StreamWriter errorWriter = new StreamWriter(logFileDirectory + "\\error.log", true); errorWriter.WriteLine("Message: " + ee.Message); errorWriter.WriteLine("Stack Trace: " + ee.StackTrace); errorWriter.Flush(); errorWriter.Close(); Add_Error_To_Log("Unable to complete new/replacement for " + ResourcePackage.BibID + ":" + ResourcePackage.VID, ResourcePackage.BibID + ":" + ResourcePackage.VID, String.Empty, ResourcePackage.BuilderLogId, ee); } }
/// <summary> Add the HTML to be displayed below the search box </summary> /// <param name="Output"> Textwriter to write the HTML for this viewer</param> /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering</param> /// <remarks> This writes the HTML from the static browse or info page here </remarks> public override void Add_Secondary_HTML(TextWriter Output, Custom_Tracer Tracer) { if (Tracer != null) { Tracer.Add_Trace("Item_Count_AggregationViewer.Add_Secondary_HTML", "Adding HTML"); } DataTable value = Engine_Database.Tracking_Get_Milestone_Report(ViewBag.Hierarchy_Object.Code, Tracer); Output.WriteLine("<div class=\"SobekText\">"); Output.WriteLine("<br />"); Output.WriteLine("<p>Below is the number of titles and items for all items within this aggregation, including currently online items as well as items in process.</p>"); Output.WriteLine("<br />"); Output.WriteLine("</div>"); // Start the table Output.WriteLine("<table width=\"700px\" border=\"0px\" cellspacing=\"0px\" class=\"statsTable\">"); Output.WriteLine(" <tr align=\"left\" bgcolor=\"#0022a7\">"); Output.WriteLine(" <th align=\"left\"><span style=\"color: White\"><b>LAST MILESTONE</b></span></th>"); Output.WriteLine(" <th align=\"left\"><span style=\"color: White\"><b>TITLE COUNT</b></span></th>"); Output.WriteLine(" <th align=\"left\"><span style=\"color: White\"><b>ITEM COUNT</b></span></th>"); Output.WriteLine(" <th align=\"left\"><span style=\"color: White\"><b>PAGE COUNT</b></span></th>"); Output.WriteLine(" <th align=\"left\"><span style=\"color: White\"><b>FILE COUNT</b></span></th>"); Output.WriteLine(" </tr>"); foreach (DataRow thisRow in value.Rows) { Output.WriteLine(" <tr><td bgcolor=\"#e7e7e7\" colspan=\"5\"></td></tr>"); Output.WriteLine(" <tr align=\"left\">"); Output.WriteLine(" <td>" + thisRow[0] + "</td>"); Output.WriteLine(" <td>" + Int_To_Comma_String(Convert.ToInt32(thisRow[1])) + "</td>"); Output.WriteLine(" <td>" + Int_To_Comma_String(Convert.ToInt32(thisRow[2])) + "</td>"); if (thisRow[3] != DBNull.Value) { Output.WriteLine(" <td>" + Int_To_Comma_String(Convert.ToInt32(thisRow[3])) + "</td>"); } else { Output.WriteLine(" <td>0</td>"); } if (thisRow[4] != DBNull.Value) { Output.WriteLine(" <td>" + Int_To_Comma_String(Convert.ToInt32(thisRow[4])) + "</td>"); } else { Output.WriteLine(" <td>0</td>"); } Output.WriteLine(" </tr>"); } // End the table Output.WriteLine(" <tr><td bgcolor=\"#e7e7e7\" colspan=\"5\"></td></tr>"); Output.WriteLine("</table>"); Output.WriteLine("<br />"); Output.WriteLine("<br />"); }
/// <summary> Clears the old logs that are ready to be expired, per instance-wide settings </summary> /// <param name="Settings"> Instance-wide settings which may be required for this process </param> public override void DoWork(InstanceWide_Settings Settings) { // Clear the old logs OnProcess("ExpireOldLogEntriesModule : Expiring old log entries", "Standard", null, null, -1); // Clear the logs Engine_Database.Builder_Expire_Log_Entries(Settings.Builder.Log_Expiration_Days); }
/// <summary> Constructor for a new instance of the Metadata_Browse_AggregationViewer class </summary> /// <param name="RequestSpecificValues"> All the necessary, non-global data specific to the current request </param> /// <param name="ViewBag"> Aggregation-specific request information, such as aggregation object and any browse object requested </param> public Metadata_Browse_AggregationViewer(RequestCache RequestSpecificValues, AggregationViewBag ViewBag) : base(RequestSpecificValues, ViewBag) { // If there is not info browse mode listed, use the default if (String.IsNullOrEmpty(RequestSpecificValues.Current_Mode.Info_Browse_Mode)) { string defaultBrowseBy = ViewBag.Hierarchy_Object.Default_BrowseBy ?? String.Empty; RequestSpecificValues.Current_Mode.Info_Browse_Mode = defaultBrowseBy; // Still length of zero? if (String.IsNullOrEmpty(RequestSpecificValues.Current_Mode.Info_Browse_Mode)) { // Just look for the first browse by foreach (Item_Aggregation_Child_Page browse in ViewBag.Hierarchy_Object.Child_Pages) { if (browse.Browse_Type == Item_Aggregation_Child_Visibility_Enum.Metadata_Browse_By) { RequestSpecificValues.Current_Mode.Info_Browse_Mode = browse.Code; break; } } } } if ((String.IsNullOrEmpty(RequestSpecificValues.Current_Mode.Info_Browse_Mode)) && (ViewBag.Hierarchy_Object.Has_Browse_By_Pages)) { RequestSpecificValues.Current_Mode.Info_Browse_Mode = ViewBag.Hierarchy_Object.Child_Page_By_Code(RequestSpecificValues.Current_Mode.Info_Browse_Mode).Code; } // Get this browse browseObject = ViewBag.Hierarchy_Object.Child_Page_By_Code(RequestSpecificValues.Current_Mode.Info_Browse_Mode); // Was this a metadata browseby, or just a static html? if ((browseObject == null) || (browseObject.Source_Data_Type != Item_Aggregation_Child_Source_Data_Enum.Static_HTML)) { // Determine the correct metadata code string metadata_code = RequestSpecificValues.Current_Mode.Info_Browse_Mode.Trim().Replace("_", " "); RequestSpecificValues.Current_Mode.Info_Browse_Mode = metadata_code; // Only get values if there was a metadata code if (metadata_code.Length > 0) { // Check the cache for this value List <string> cacheInstance = CachedDataManager.Retrieve_Aggregation_Metadata_Browse(RequestSpecificValues.Current_Mode.Aggregation, RequestSpecificValues.Current_Mode.Info_Browse_Mode, RequestSpecificValues.Tracer); if (cacheInstance != null) { results = cacheInstance; } else { results = Engine_Database.Get_Item_Aggregation_Metadata_Browse(RequestSpecificValues.Current_Mode.Aggregation, RequestSpecificValues.Current_Mode.Info_Browse_Mode, RequestSpecificValues.Tracer); CachedDataManager.Store_Aggregation_Metadata_Browse(RequestSpecificValues.Current_Mode.Aggregation, RequestSpecificValues.Current_Mode.Info_Browse_Mode, results, RequestSpecificValues.Tracer); } } } }
/// <summary> Reloads the basic behavior information from the database into the /// digital resource, such as collections and thumbnails </summary> /// <param name="Resource"> Incoming digital resource object </param> /// <returns> TRUE if processing can continue, FALSE if a critical error occurred which should stop all processing </returns> public override bool DoWork(Incoming_Digital_Resource Resource) { // Load the METS file if (!Resource.Load_METS()) { OnError("Error reading most recent METS file from " + Resource.BibID + ":" + Resource.VID, Resource.BibID + ":" + Resource.VID, String.Empty, Resource.BuilderLogId); return(false); } // Add thumbnail, aggregation informaiton, and dark/access information from the database if (!Resource.NewPackage) { Engine_Database.Add_Minimum_Builder_Information(Resource.Metadata); } else { // Check for any access/restriction/embargo date in the RightsMD section RightsMD_Info rightsInfo = Resource.Metadata.Get_Metadata_Module(GlobalVar.PALMM_RIGHTSMD_METADATA_MODULE_KEY) as RightsMD_Info; if ((rightsInfo != null) && (rightsInfo.hasData)) { switch (rightsInfo.Access_Code) { case RightsMD_Info.AccessCode_Enum.Campus: // Was there an embargo date? if (rightsInfo.Has_Embargo_End) { if (DateTime.Compare(DateTime.Now, rightsInfo.Embargo_End) < 0) { Resource.Metadata.Behaviors.IP_Restriction_Membership = 1; } } else { Resource.Metadata.Behaviors.IP_Restriction_Membership = 1; } break; case RightsMD_Info.AccessCode_Enum.Private: // Was there an embargo date? if (rightsInfo.Has_Embargo_End) { if (DateTime.Compare(DateTime.Now, rightsInfo.Embargo_End) < 0) { Resource.Metadata.Behaviors.Dark_Flag = true; } } else { Resource.Metadata.Behaviors.Dark_Flag = true; } break; } } } return(true); }
private void Create_Complete_MarcXML_Feed(bool Test_Feed_Flag) { // Determine some values based on whether this is for thr test feed or something else string feed_name = "Production MarcXML Feed"; string file_name = "complete_marc.xml"; string error_file_name = "complete_marc_last_error.html"; if (Test_Feed_Flag) { feed_name = "Test MarcXML Feed"; file_name = "test_marc.xml"; error_file_name = "test_marc_last_error.html"; } // Before doing this, create the Mango load try { // Create the Mango load stuff Console.WriteLine("Building " + feed_name); MarcXML_Load_Creator createEndeca = new MarcXML_Load_Creator(); bool reportSuccess = createEndeca.Create_MarcXML_Data_File(Test_Feed_Flag, Path.Combine(logFileDirectory, file_name)); // Publish this feed if (reportSuccess) { Engine_Database.Builder_Clear_Item_Error_Log(feed_name.ToUpper(), "", "UFDC Builder"); File.Copy(Path.Combine(logFileDirectory, file_name), Engine_ApplicationCache_Gateway.Settings.MarcGeneration.MarcXML_Feed_Location + file_name, true); } else { string errors = createEndeca.Errors; if (errors.Length > 0) { StreamWriter writer = new StreamWriter(Engine_ApplicationCache_Gateway.Settings.MarcGeneration.MarcXML_Feed_Location + error_file_name, false); writer.WriteLine("<html><head><title>" + feed_name + " Errors</title></head><body><h1>" + feed_name + " Errors</h1>"); writer.Write(errors.Replace("\r\n", "<br />").Replace("\n", "<br />").Replace("<br />", "<br />\r\n")); writer.Write("</body></html>"); writer.Flush(); writer.Close(); Engine_Database.Builder_Add_Log_Entry(-1, feed_name.ToUpper(), "Error", "Resulting file failed validation", ""); File.Copy(Path.Combine(logFileDirectory, file_name), Engine_ApplicationCache_Gateway.Settings.MarcGeneration.MarcXML_Feed_Location + file_name.Replace(".xml", "_error.xml"), true); } } } catch { Engine_Database.Builder_Add_Log_Entry(-1, feed_name.ToUpper(), "Error", "Unknown exception caught", ""); Console.WriteLine("ERROR BUILDING THE " + feed_name.ToUpper()); } }
private void Recreate_Library_XML_and_RSS(long Builderid, InstanceWide_Settings Settings, string WorkSpaceDirectory, string PrimaryUrl) { // Update the RSS Feeds and Item Lists for ALL // Build the simple XML result for this build OnProcess("........Building XML list for all digital resources", Builderid); try { DataSet simple_list = Engine_Database.Simple_Item_List(String.Empty, null); if (simple_list != null) { try { string aggregation_list_file = Settings.Servers.Static_Pages_Location + "\\all.xml"; if (File.Exists(aggregation_list_file)) { File.Delete(aggregation_list_file); } simple_list.WriteXml(aggregation_list_file, XmlWriteMode.WriteSchema); } catch (Exception ee) { OnError("........Error in building XML list for all digital resources on " + Settings.Servers.Static_Pages_Location + "\n" + ee.Message, Builderid); } } } catch (Exception ee) { OnError("........Error in building XML list for all digital resources\n" + ee.Message, Builderid); } // Create the RSS feed for all ufdc items try { OnProcess("........Building RSS feed for all digital resources", Builderid); DataSet complete_list = Engine_Database.Simple_Item_List(String.Empty, null); Create_RSS_Feed("all", WorkSpaceDirectory, "All Items", complete_list, PrimaryUrl); try { File.Copy(Path.Combine(WorkSpaceDirectory, "all_rss.xml"), Path.Combine(Settings.Servers.Static_Pages_Location, "rss", "all_rss.xml"), true); File.Copy(Path.Combine(WorkSpaceDirectory, "all_short_rss.xml"), Path.Combine(Settings.Servers.Static_Pages_Location, "rss", "all_short_rss.xml"), true); } catch (Exception ee) { OnError("........Error in copying RSS feed for all digital resources to " + Settings.Servers.Static_Pages_Location + "\n" + ee.Message, Builderid); } } catch (Exception ee) { OnError("........Error in building RSS feed for all digital resources\n" + ee.Message, Builderid); } }
private static int Send_Usage_Emails(int year, int month, string SystemUrl, string SystemName, string FromAddress, string FromName) { // Get the list of all users linked to items DataTable usersLinkedToItems = Engine_Database.Get_Users_Linked_To_Items(null); // If NULL, then no data linked to users if (usersLinkedToItems == null) { return(0); } // Determine the FROM string fromAddr = FromAddress; if (!String.IsNullOrEmpty(FromName)) { fromAddr = FromName + " <" + FromAddress + ">"; } // Step through each row and pull data about the usage stats for this user int emails_sent = 0; foreach (DataRow thisRow in usersLinkedToItems.Rows) { Thread.Sleep(1000); // Pull out the user information from this row string firstName = thisRow[0].ToString(); string lastName = thisRow[1].ToString(); string nickName = thisRow[2].ToString(); int userid = Convert.ToInt32(thisRow[4]); string email = thisRow[5].ToString(); // Compose the name string name = firstName + " " + lastName; if (nickName.Length > 0) { name = nickName + " " + lastName; } // Try to compose and send the email. The email will only be sent if there was // some total usage this month, as well as total if (Usage_Stats_Email_Helper.Send_Individual_Usage_Email(userid, name, email, year, month, 10, SystemUrl, SystemName, fromAddr)) { emails_sent++; } } return(emails_sent); }
private long Add_Error_To_Log(string LogStatement, string BibID_VID, string MetsType, long RelatedLogID) { if (multiInstanceBuilder) { Console.WriteLine(instanceInfo.Name + " - " + LogStatement); logger.AddError(instanceInfo.Name + " - " + LogStatement.Replace("\t", ".....")); } else { Console.WriteLine(LogStatement); logger.AddError(LogStatement.Replace("\t", ".....")); } return(Engine_Database.Builder_Add_Log_Entry(RelatedLogID, BibID_VID, "Error", LogStatement.Replace("\t", ""), MetsType)); }
private void Complete_Any_Recent_Loads_Requiring_Additional_Work() { // Get the list of recent loads requiring additional work DataTable additionalWorkRequired = Engine_Database.Items_Needing_Aditional_Work; if ((additionalWorkRequired != null) && (additionalWorkRequired.Rows.Count > 0)) { Add_NonError_To_Log("Processing recently loaded items needing additional work", "Standard", String.Empty, String.Empty, -1); // Create the incoming digital folder object which will be used for all these Actionable_Builder_Source_Folder sourceFolder = new Actionable_Builder_Source_Folder(); // Step through each one foreach (DataRow thisRow in additionalWorkRequired.Rows) { // Get the information about this item string bibID = thisRow["BibID"].ToString(); string vid = thisRow["VID"].ToString(); // Determine the file root for this string file_root = bibID.Substring(0, 2) + "\\" + bibID.Substring(2, 2) + "\\" + bibID.Substring(4, 2) + "\\" + bibID.Substring(6, 2) + "\\" + bibID.Substring(8, 2); // Determine the source folder for this resource string resource_folder = settings.Servers.Image_Server_Network + file_root + "\\" + vid; // Determine the METS file name string mets_file = resource_folder + "\\" + bibID + "_" + vid + ".mets.xml"; // Ensure these both exist if ((Directory.Exists(resource_folder)) && (File.Exists(mets_file))) { // Create the incoming digital resource object Incoming_Digital_Resource additionalWorkResource = new Incoming_Digital_Resource(resource_folder, sourceFolder) { BibID = bibID, VID = vid, File_Root = bibID.Substring(0, 2) + "\\" + bibID.Substring(2, 2) + "\\" + bibID.Substring(4, 2) + "\\" + bibID.Substring(6, 2) + "\\" + bibID.Substring(8, 2) }; Complete_Single_Recent_Load_Requiring_Additional_Work(additionalWorkResource); } else { Add_Error_To_Log("Unable to find valid resource files for reprocessing " + bibID + ":" + vid, bibID + ":" + vid, "Reprocess", -1); int itemID = Engine_Database.Get_ItemID_From_Bib_VID(bibID, vid); SobekCM_Item_Database.Update_Additional_Work_Needed_Flag(itemID, false); } } } }
private void Add_Complete_To_Log(string LogStatement, string DbLogType, string BibID_VID, string MetsType, long RelatedLogID) { if (multiInstanceBuilder) { Console.WriteLine(instanceInfo.Name + " - " + LogStatement); logger.AddComplete(instanceInfo.Name + " - " + LogStatement.Replace("\t", ".....")); } else { Console.WriteLine(LogStatement); logger.AddComplete(LogStatement.Replace("\t", ".....")); } Engine_Database.Builder_Add_Log_Entry(RelatedLogID, BibID_VID, DbLogType, LogStatement.Replace("\t", ""), MetsType); }
/// <summary> Returns a flag indicating if an abort was requested </summary> /// <returns> TRUE if the flag is currently ABORT REQUESTED, ABORTING, or NO BUILDER REQUESTED</returns> public static bool Abort_Requested() { Dictionary <string, string> builder_settings = Engine_Database.Get_Settings(null); if (builder_settings.ContainsKey(setting_key)) { switch (builder_settings[setting_key].ToUpper().Replace("_", " ")) { case "ABORT REQUESTED": case "ABORTING": case "NO BUILDING REQUESTED": return(true); } } return(false); }
private static void load_metadata_template() { // Get the list of all projects DataSet projectsSet = Engine_Database.Get_All_Template_DefaultMetadatas(null); if (projectsSet != null) { if (templateList == null) { templateList = new List <Template>(); } else { templateList.Clear(); } if (defaultMetadataList == null) { defaultMetadataList = new List <Default_Metadata>(); } else { defaultMetadataList.Clear(); } // Add each default metadata set foreach (DataRow thisRow in projectsSet.Tables[0].Rows) { string code = thisRow["MetadataCode"].ToString(); string name = thisRow["MetadataName"].ToString(); string description = thisRow["Description"].ToString(); defaultMetadataList.Add(new Default_Metadata(code, name, description)); } // Add each project foreach (DataRow thisRow in projectsSet.Tables[1].Rows) { string code = thisRow["TemplateCode"].ToString(); string name = thisRow["TemplateName"].ToString(); string description = thisRow["Description"].ToString(); templateList.Add(new Template(code, name, description)); } } }
private void Complete_Single_Recent_Load_Requiring_Additional_Work(Incoming_Digital_Resource AdditionalWorkResource) { AdditionalWorkResource.METS_Type_String = "Reprocess"; AdditionalWorkResource.BuilderLogId = Add_NonError_To_Log("Reprocessing '" + AdditionalWorkResource.BibID + ":" + AdditionalWorkResource.VID + "'", "Standard", AdditionalWorkResource.BibID + ":" + AdditionalWorkResource.VID, AdditionalWorkResource.METS_Type_String, -1); try { // Load the METS file if ((!AdditionalWorkResource.Load_METS()) || (AdditionalWorkResource.BibID.Length == 0)) { Add_Error_To_Log("Error reading METS file from " + AdditionalWorkResource.Folder_Name.Replace("_", ":"), AdditionalWorkResource.Folder_Name.Replace("_", ":"), "Reprocess", AdditionalWorkResource.BuilderLogId); return; } AdditionalWorkResource.METS_Type_String = "Reprocess"; // Add thumbnail and aggregation informaiton from the database Engine_Database.Add_Minimum_Builder_Information(AdditionalWorkResource.Metadata); // Do all the item processing per instance config foreach (iSubmissionPackageModule thisModule in builderModules.ItemProcessModules) { if (verbose) { Add_NonError_To_Log("Running module " + thisModule.GetType(), true, AdditionalWorkResource.BibID + ":" + AdditionalWorkResource.VID, String.Empty, AdditionalWorkResource.BuilderLogId); } if (!thisModule.DoWork(AdditionalWorkResource)) { Add_Error_To_Log("Unable to complete additional work for " + AdditionalWorkResource.BibID + ":" + AdditionalWorkResource.VID, AdditionalWorkResource.BibID + ":" + AdditionalWorkResource.VID, String.Empty, AdditionalWorkResource.BuilderLogId); return; } } // Save these collections to mark them for refreshing the RSS feeds, etc.. Add_Process_Info_To_PostProcess_Lists(AdditionalWorkResource.BibID, AdditionalWorkResource.VID, AdditionalWorkResource.Metadata.Behaviors.Aggregation_Code_List); // Finally, clear the memory a little bit AdditionalWorkResource.Clear_METS(); } catch (Exception ee) { Add_Error_To_Log("Unable to complete additional work for " + AdditionalWorkResource.BibID + ":" + AdditionalWorkResource.VID, AdditionalWorkResource.BibID + ":" + AdditionalWorkResource.VID, AdditionalWorkResource.METS_Type_String, AdditionalWorkResource.BuilderLogId, ee); } }
/// <summary> Refreshes the values from the database settings </summary> /// <returns> A fully builder instance-wide setting object </returns> public static InstanceWide_Settings Build_Settings(Database_Instance_Configuration DbInstance) { InstanceWide_Settings returnValue = new InstanceWide_Settings(); // Don't read the configuration file now.. we already have the db data Engine_Database.Connection_String = DbInstance.Connection_String; DataSet sobekCMSettings = Engine_Database.Get_Settings_Complete(false, null); if (sobekCMSettings == null) { return(null); } Refresh(returnValue, sobekCMSettings); return(returnValue); }
private void Add_Error_To_Log(string LogStatement, string BibID_VID, string MetsType, long RelatedLogID, Exception Ee) { if (multiInstanceBuilder) { Console.WriteLine(instanceInfo.Name + " - " + LogStatement); logger.AddError(instanceInfo.Name + " - " + LogStatement.Replace("\t", ".....")); } else { Console.WriteLine(LogStatement); logger.AddError(LogStatement.Replace("\t", ".....")); } long mainErrorId = Engine_Database.Builder_Add_Log_Entry(RelatedLogID, BibID_VID, "Error", LogStatement.Replace("\t", ""), MetsType); string[] split = Ee.ToString().Split("\n".ToCharArray()); foreach (string thisSplit in split) { Engine_Database.Builder_Add_Log_Entry(mainErrorId, BibID_VID, "Error", thisSplit, MetsType); } // Determine, and create the local work space string localLogArea = Path.Combine(MultiInstance_Builder_Settings.Builder_Executable_Directory, "logs"); if (!Directory.Exists(localLogArea)) { Directory.CreateDirectory(localLogArea); } // Save the exception to an exception file StreamWriter exception_writer = new StreamWriter(Path.Combine(localLogArea, "exceptions_log.txt"), true); exception_writer.WriteLine(String.Empty); exception_writer.WriteLine(String.Empty); exception_writer.WriteLine("----------------------------------------------------------"); exception_writer.WriteLine("EXCEPTION CAUGHT " + DateTime.Now.ToString() + " BY PRELOADER"); exception_writer.WriteLine(LogStatement.ToUpper().Replace("\t", "").Trim()); exception_writer.WriteLine(Ee.ToString()); exception_writer.Flush(); exception_writer.Close(); }
/// <summary> Constructor for a new instance of the Builder_AdminViewer class </summary> /// <param name="RequestSpecificValues"> All the necessary, non-global data specific to the current request </param> public Builder_AdminViewer(RequestCache RequestSpecificValues) : base(RequestSpecificValues) { // Ensure the user is the system admin if ((RequestSpecificValues.Current_User == null) || ((!RequestSpecificValues.Current_User.Is_System_Admin) && (!RequestSpecificValues.Current_User.Is_Portal_Admin))) { RequestSpecificValues.Current_Mode.Mode = Display_Mode_Enum.My_Sobek; RequestSpecificValues.Current_Mode.My_Sobek_Type = My_Sobek_Type_Enum.Home; UrlWriterHelper.Redirect(RequestSpecificValues.Current_Mode); return; } // If this is a postback, handle any events first if (RequestSpecificValues.Current_Mode.isPostBack) { if (((RequestSpecificValues.Current_User.Is_System_Admin) && (!UI_ApplicationCache_Gateway.Settings.Servers.isHosted)) || (RequestSpecificValues.Current_User.Is_Host_Admin)) { // Pull the hidden value string save_value = HttpContext.Current.Request.Form["admin_builder_tosave"].ToUpper().Trim(); if (save_value.Length > 0) { // Set this value Engine_Database.Set_Setting("Builder Operation Flag", save_value); UrlWriterHelper.Redirect(RequestSpecificValues.Current_Mode); } } } page = 1; if (!String.IsNullOrEmpty(RequestSpecificValues.Current_Mode.My_Sobek_SubMode)) { switch (RequestSpecificValues.Current_Mode.My_Sobek_SubMode.ToLower()) { case "b": page = 2; break; case "c": page = 3; break; } } }
/// <summary> Refresh the list of search stop words for database searching by pulling the data back from the database </summary> /// <returns> TRUE if successful, otherwise FALSE </returns> public static bool RefreshStopWords() { try { lock (searchStopWordsLock) { if (searchStopWords != null) { searchStopWords.Clear(); } searchStopWords = Engine_Database.Search_Stop_Words(null); } return(true); } catch { return(false); } }
/// <summary> Refresh the list of all user groups by pulling the data back from the database </summary> /// <returns> TRUE if successful, otherwise FALSE </returns> public static bool RefreshUserGroups() { try { lock (userGroupsLock) { if (userGroups != null) { userGroups.Clear(); } userGroups = Engine_Database.Get_All_User_Groups(null); } return(true); } catch { return(false); } }
/// <summary> Refresh the aggregation code list by pulling the data back from the database </summary> /// <returns> TRUE if successful, otherwise FALSE </returns> public static bool RefreshCodes() { try { lock (codesLock) { if (codes == null) { codes = new Aggregation_Code_Manager(); } Engine_Database.Populate_Code_Manager(codes, null); } return(true); } catch (Exception ee) { return(ee.Message.Length > 0); } }
protected DataSet get_recent_builder_logs(DateTime?StartDate, DateTime?EndDate, string Filter, bool Include_No_Work, Custom_Tracer Tracer) { // Look in the cache first DataSet fromCache = CachedDataManager.Builder.Retrieve_Builder_Logs(StartDate, EndDate, Filter, Include_No_Work, Tracer); if (fromCache != null) { return(fromCache); } // Try to pull from the database DataSet fromDb = Engine_Database.Builder_Log_Search(StartDate, EndDate, Filter, Include_No_Work, Tracer); // Store in the cache if not null if (fromDb != null) { CachedDataManager.Builder.Store_Builder_Logs(fromDb, StartDate, EndDate, Filter, Include_No_Work, Tracer); } return(fromDb); }
/// <summary> Populates/builds the main default HTML skin during application startup </summary> /// <param name="SkinList"> List of skin to populate with the default, commonly used skin</param> /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering </param> /// <returns> TRUE if successful, otherwise FALSE </returns> /// <remarks> Most HTML skins are built as they are needed and then cached for a period of time. The main default skins are /// permanently stored in this global <see cref="Web_Skin_Collection"/> object.</remarks> public static bool Populate_Default_Skins(Web_Skin_Collection SkinList, Custom_Tracer Tracer) { if (Tracer != null) { Tracer.Add_Trace("SobekCM_Skin_Collection_Builder.Populate_Default_Skins", "Build the standard interfaces"); } // Get the data from the database DataTable skinData = Engine_Database.Get_All_Web_Skins(Tracer); // Just return if the data appears bad.. if ((skinData == null) || (skinData.Rows.Count == 0)) { return(false); } // Clear existing interfaces SkinList.Initialize(skinData); return(true); }
/// <summary> Refresh the list of icon/wordmarks by pulling the data back from the database </summary> /// <returns> TRUE if successful, otherwise FALSE </returns> public static bool RefreshIcons() { try { lock (iconListLock) { if (iconList == null) { iconList = new Dictionary <string, Wordmark_Icon>(StringComparer.OrdinalIgnoreCase); } Engine_Database.Populate_Icon_List(iconList, null); } return(true); } catch { return(false); } }
/// <summary> Refresh the list of mime types by pulling the data back from the database </summary> /// <returns> TRUE if successful, otherwise FALSE </returns> public static bool RefreshMimeTypes() { try { lock (mimeTypesLock) { if (mimeTypes == null) { mimeTypes = new Dictionary <string, Mime_Type_Info>(); } Engine_Database.Populate_MIME_List(mimeTypes, null); } return(true); } catch { return(false); } }
/// <summary> Refresh the list of aggregation/collection aliases by pulling the data back from the database </summary> /// <returns> TRUE if successful, otherwise FALSE </returns> public static bool RefreshCollectionAliases() { try { lock (collectionAliasesLock) { if (collectionAliases == null) { collectionAliases = new Dictionary <string, string>(); } Engine_Database.Populate_Aggregation_Aliases(collectionAliases, null); } return(true); } catch { return(false); } }