public ExecutePreservationReceiver(IReceiverMediator mediator) : base(mediator) { _preservationService = new PreservationService(); _preservationService.PulseHighFrequencyEnabled = true; _preservationService.OnPulse += PreservationService_OnPulse; }
public IDictionary <Guid, BiblosDsException> UpdateDocumentMetadata(Guid idArchive, IDictionary <Guid, BindingList <DocumentAttributeValue> > documentAttributes) { IDictionary <Guid, BiblosDsException> ret; try { ret = new PreservationService().UpdateDocumentMetadata(idArchive, documentAttributes); } catch (Exception ex) { logger.Error(ex); if (ex is FaultException) { throw ex; } else { throw new FaultException <BiblosDsException>(new BiblosDsException(ex), new FaultReason(ex.Message)); } } finally { logger.InfoFormat("EnablePreservationTaskByActivationPin - END"); } return(ret); }
public string GetClosingPreservationHash(Guid IdPreservation) { try { var info = new PreservationService().GetPreservation(IdPreservation, false); if (info == null) { throw new Exception("Nessuna conservazione presente con l'id passato."); } var dirInfo = new DirectoryInfo(info.Path); var files = dirInfo.GetFiles("*" + info.Label + ".txt.*"); if (files.Any(x => x.Extension.Contains("p7m") || x.Extension.Contains("x7m"))) { return(UtilityService.GetHash(File.ReadAllBytes(files.Where(x => x.Extension.Contains("p7m") || x.Extension.Contains("x7m")).FirstOrDefault().FullName), new PreservationService().MustUseSHA256Mark())); } else { return("File di chiusura firmato non ancora presente."); } } catch (Exception ex) { logger.Error(ex); throw new FaultException <BiblosDsException>(new BiblosDsException(ex), new FaultReason(ex.Message)); } }
public ActionResult ArchiveCompany(Guid archiveCompanyIdArchive, Guid archiveCompanySetIdCompany, string workingDir, string xmlFileTemplatePath, string templateXSLTFile, string awardBatchXSLTFile) { ArchiveCompanyViewModel model = new ArchiveCompanyViewModel(); var service = new PreservationService(); var company = service.GetCompany(archiveCompanySetIdCompany); ArchiveCompany archiveCompany = new Library.Common.Objects.ArchiveCompany() { Archive = ArchiveService.GetArchive(archiveCompanyIdArchive), IdArchive = archiveCompanyIdArchive, IdCompany = archiveCompanySetIdCompany, Company = company, CompanyName = company.CompanyName, WorkingDir = workingDir, TemplateXSLTFile = templateXSLTFile, XmlFileTemplatePath = xmlFileTemplatePath, AwardBatchXSLTFile = awardBatchXSLTFile }; model = new ArchiveCompanyViewModel() { ArchiveCompany = archiveCompany, Companies = new List <Company>() { company } }; try { ArchiveService.AddArchiveCompany(model.ArchiveCompany); } catch (Exception e) { View(model); } return(RedirectToAction("Index")); }
public ActionResult SignPreservationFilesToClose() { return(ActionResultHelper.TryCatchWithLogger(() => { try { CustomerCompanyViewModel customerCompany = Session["idCompany"] as CustomerCompanyViewModel; List <Preservation> preservations = PreservationService.PreservationToClose(customerCompany.CompanyId); Models.ArubaSignModel arubaSignModel = ArubaSignConfigurationHelper.GetArubaSignConfiguration(customerCompany.CompanyId, User.Identity.Name); _logger.InfoFormat("Initializing signing with Aruba Automatic"); ISignService _signService = new SignService((info) => _logger.Info(info), (err) => _logger.Error(err)); if (arubaSignModel == null) { return Json(ArubaSignConfigurationHelper.NO_CREDENTIALS, JsonRequestBehavior.AllowGet); } foreach (Preservation preservation in preservations) { SignDocuments(preservation, _signService, arubaSignModel); } return Json(ArubaSignConfigurationHelper.SIGN_COMPLETE, JsonRequestBehavior.AllowGet); } catch (Exception ex) { _loggerService.Error($"Exception caught in process of signing: { ex.Message}", ex); return Json(ArubaSignConfigurationHelper.SIGN_ERROR, JsonRequestBehavior.AllowGet); } }, _loggerService)); }
private List <PreservationSchedule> GetArchivePeriods(Guid archiveId) { var retval = new List <PreservationSchedule>(); try { var service = new PreservationService(); var periods = service.GetSchedule(); //PreservationSchedule previouslyUsedSchedule = null; var selSchedule = service.GetPreservationScheduleWithinArchive(archiveId); if (selSchedule != null) { foreach (var item in periods) { item.IsArchiveDefault = item.IdPreservationSchedule == selSchedule.IdPreservationSchedule; } } retval = new List <PreservationSchedule>(periods); } catch (Exception ex) { logger.Error(ex); throw; } return(retval); }
private PreservationTaskViewModel ArchivePreservationModel(Guid id) { var service = new PreservationService(); var archive = ArchiveService.GetArchive(id); var schedule = service.GetPreservationScheduleWithinArchive(id); var SelectedScheduleIndex = -1; var schedulePeriod = GetArchivePeriods(id); var tasks = service.GetPreservationTasks(new System.ComponentModel.BindingList <DocumentArchive> { new DocumentArchive(id) }, 0, 2); DateTime nextPreservationDate = DateTime.Now; PreservationSchedule objSched = null; if (schedule != null) { objSched = schedulePeriod.Where(x => x.IdPreservationSchedule == schedule.IdPreservationSchedule).FirstOrDefault(); if (objSched != null) { SelectedScheduleIndex = schedulePeriod.IndexOf(objSched); } } if (tasks.Tasks.Count > 0) { nextPreservationDate = tasks.Tasks.First().EndDocumentDate.Value.AddDays(1); } var viewModel = new PreservationTaskViewModel { IdArchive = id, ArchiveName = archive.Name, SelectedScheduleIndex = SelectedScheduleIndex, PeriodSchedulers = schedulePeriod, NextPreservationTaskStartDocumentDate = nextPreservationDate }; return(viewModel); }
public ActionResult PreservationToClose() { return(ActionResultHelper.TryCatchWithLogger(() => { IpdaPreservationToCloseViewModel model = new IpdaPreservationToCloseViewModel(); CustomerCompanyViewModel customerCompany = Session["idCompany"] as CustomerCompanyViewModel; IList <Preservation> preservationsToClose = PreservationService.PreservationToClose(customerCompany.CompanyId); model.PreservationsCount = preservationsToClose.Count; IList <string> files = new List <string>(); foreach (Preservation preservation in preservationsToClose) { if (Directory.GetFiles(preservation.Path, "IPDA*.tsd").Any()) { continue; } string fileName = Directory.GetFiles(preservation.Path, "IPDA*.xml").FirstOrDefault(); if (!String.IsNullOrEmpty(fileName)) { files.Add(fileName); } } model.CloseFiles = files.ToArray(); ViewBag.messageId = Guid.NewGuid().ToString(); return View(model); }, _loggerService)); }
public ActionResult CloseOpenPreservations() { CustomerCompanyViewModel customerCompany = Session["idCompany"] as CustomerCompanyViewModel; var preservations = PreservationService.PreservationToClose(customerCompany.CompanyId); var service = new PreservationService(); string res = ""; foreach (var preservation in preservations) { if (!preservation.CloseDate.HasValue) { if (service.VerifyExistingPreservation(preservation.IdPreservation)) { service.ClosePreservation(preservation.IdPreservation); string pattern = "Conservazione <b>{0}</b> del {1} <b>CHIUSA</b> in questa esecuzione.<br/>"; string filePath = Path.Combine(preservation.Path, preservation.Label); res += string.Format(pattern, preservation.IdPreservation, preservation.StartDate); //aggiunge informazioni sull'ipda res += GetIpdaInfo(service.verifiedIpda); } else { res += String.Join("<br/>", service.ErrorMessages); } } } return(Json(new { result = res })); }
public bool EnablePreservationTaskByActivationPin(Guid idTaskToEnable, Guid activationPin, short mininumDaysOffset) { var ret = false; try { ret = new PreservationService().EnablePreservationTaskByActivationPin(idTaskToEnable, activationPin, mininumDaysOffset); } catch (Exception ex) { logger.Error(ex); if (ex is FaultException) { throw ex; } else { throw new FaultException <BiblosDsException>(new BiblosDsException(ex), new FaultReason(ex.Message)); } } finally { logger.InfoFormat("EnablePreservationTaskByActivationPin - END {0}", (ret) ? "Ok" : "Ko"); } return(ret); }
public ActionResult GetPreservationVerifyTask([DataSourceRequest] DataSourceRequest request) { DataSourceResult result = new DataSourceResult(); CustomerCompanyViewModel customerCompany = Session["idCompany"] as CustomerCompanyViewModel; BindingList <DocumentArchive> archives = new BindingList <DocumentArchive>(); try { if (WCFUtility.GetSettingValue("DBAdminLoginConnection") == "false") { archives = CustomerService.GetCustomerArchivesByUsername(User.Identity.Name); } else { archives = new BindingList <DocumentArchive>(ArchiveService.GetLegalArchives("", customerCompany.CompanyId).Select(x => x.Archive).ToList()); } var tasks = new PreservationService().GetPreservationVerify(archives.Select(x => x.IdArchive).ToArray(), true); result.Total = tasks.Count; result.Data = tasks; } catch (Exception ex) { result.Errors = ex; } return(Json(result, JsonRequestBehavior.AllowGet)); }
public AwardBatchController() { _loggerService = new LoggerService(_logger); _preservationService = new PreservationService(); _savePDVXmlInteractor = new SavePDVXmlInteractor(_loggerService); _saveRDVXmlInteractor = new SaveRDVXmlInteractor(_loggerService); _uploadHelper = new UploadHelper(); }
public HomeController() { _preservationService = new PreservationService(); _loggerService = new LoggerService(_logger); _searchDocumentsInteractor = new SearchDocumentsInteractor(_loggerService); _savePDVXmlInteractor = new SavePDVXmlInteractor(_loggerService); _saveRDVXmlInteractor = new SaveRDVXmlInteractor(_loggerService); }
public ActionResult SetArchiveDefaultSchedule(Guid idArchive, Guid taskPeriodSetId) { var service = new PreservationService(); service.AddPreservationScheduleArchive(new PreservationScheduleArchive { IdSchedule = taskPeriodSetId, IdArchive = idArchive }); return(View("ArchivePreservationTask", ArchivePreservationModel(idArchive))); }
public ActionResult ResetTask(Guid idTask) { PreservationService service = new PreservationService(); PreservationTask task = service.GetPreservationTask(idTask); ArchiveConfiguration archiveConfiguration = JsonConvert.DeserializeObject <ArchiveConfiguration>(task.Archive.PreservationConfiguration); service.ResetPreservationTask(idTask, true, archiveConfiguration.ForceAutoInc); return(RedirectToAction("PreservationTaskDetails", new { id = idTask })); }
public BiblosDS.Library.Common.Objects.DocumentContent GetPreservationCloseFile(Guid idPreservation, BiblosDS.Library.Common.Enums.DocumentContentFormat outputFormat) { logger.InfoFormat("GetPreservationCloseFile - id preservation {0}", idPreservation); try { var info = new PreservationService().GetPreservationClosingFileInfo(idPreservation); if (info == null) { throw new BiblosDS.Library.Common.Exceptions.DocumentNotFound_Exception("File di chiusura non trovato"); } switch (outputFormat) { case BiblosDS.Library.Common.Enums.DocumentContentFormat.Binary: return(new BiblosDS.Library.Common.Objects.DocumentContent { Blob = info.File, Description = info.FileName }); case BiblosDS.Library.Common.Enums.DocumentContentFormat.ConformBinary: if (!string.IsNullOrEmpty(ConfigurationManager.AppSettings["BoblosDSConvWs.BiblosDSConv"])) { BiblosDS.WCF.WCFServices.BoblosDSConvWs.BiblosDSConv wsStampaConforme = new BiblosDS.WCF.WCFServices.BoblosDSConvWs.BiblosDSConv(); wsStampaConforme.Url = ConfigurationManager.AppSettings["BoblosDSConvWs.BiblosDSConv"].ToString(); var conformDoc = wsStampaConforme.ToRaster(new BiblosDS.WCF.WCFServices.BoblosDSConvWs.stDoc { Blob = Convert.ToBase64String(info.File), FileExtension = info.FileName }); return(new BiblosDS.Library.Common.Objects.DocumentContent { Description = ".pdf", Blob = Convert.FromBase64String(conformDoc.Blob) }); } else { return(new BiblosDS.Library.Common.Objects.DocumentContent { Blob = info.File, Description = info.FileName }); } default: throw new FormatException("Formato di output non supportato."); } } catch (Exception ex) { logger.Error(ex); if (ex is FaultException) { throw ex; } else { throw new FaultException <BiblosDsException>(new BiblosDsException(ex), new FaultReason(ex.Message)); } } finally { logger.Info("GetPreservationCloseFile - END"); } }
public ActionResult PreservationTaskEnable(Guid id) { PreservationTaskResponse query = new PreservationService().GetAllChildPreservationTasks(id, 0, 10); foreach (var item in query.Tasks) { new PreservationService().EnablePreservationTask(item.IdPreservationTask); } return(RedirectToAction("PreservationTaskDetails", new { id = id })); }
public ActionResult ClosePreviousArchiveTasks(Guid idPreservationTask, int selectedTaskYear) { return(ActionResultHelper.TryCatchWithLogger(() => { PreservationService service = new PreservationService(); PreservationTask preservationTask = service.GetPreservationTask(idPreservationTask); service.CreateClosePreviousPreservationTask(preservationTask, selectedTaskYear); return RedirectToAction("ArchivePreservationTask", new { id = preservationTask.Archive.IdArchive }); }, _loggerService)); }
public ActionResult ExistingPreservationVerifyDoAction(Guid id) { var service = new PreservationService(); Preservation pres = service.GetPreservation(id); service.VerifyExistingPreservation(id); TempData["ErrorMessages"] = service.ErrorMessages; return(RedirectToAction("PreservationDetails", new { id = id })); }
public IpdaController() { _uploadHelper = new UploadHelper(); _preservationService = new PreservationService(); _extractionOptions = new ExtractionOptions(); _extractionOptions.ExtractFullPath = true; _extractionOptions.Overwrite = true; _extractionOptions.PreserveFileTime = true; _loggerService = new LoggerService(_logger); }
public ActionResult ClosePreservation(Preservation preservation) { var service = new PreservationService(); preservation = service.GetPreservation(preservation.IdPreservation, false); if (!preservation.CloseDate.HasValue) { service.ClosePreservation(preservation.IdPreservation); } return(RedirectToAction("PreservationDetails", new { id = preservation.IdPreservation })); }
public void DeletePreservationStorageDevice(PreservationStorageDevice preservationStorageDevice) { try { var svc = new PreservationService(); svc.DeletePreservationStorageDevice(preservationStorageDevice); } catch (Exception ex) { throw CheckExceptionToThrow(ex); } }
public PreservationInStorageDevice AddPreservationInStorageDevice(PreservationInStorageDevice toAdd) { try { var svc = new PreservationService(); return(svc.AddPreservationInStorageDevice(toAdd)); } catch (Exception ex) { throw CheckExceptionToThrow(ex); } }
public void DeletePreservationJournaling(Guid idJournaling, string archiveName) { try { var svc = new PreservationService(); svc.DeletePreservationJournaling(idJournaling, svc.GetIdPreservationArchiveFromName(archiveName)); } catch (Exception ex) { throw CheckExceptionToThrow(ex); } }
public PreservationStorageDeviceStatus PreservationStorageDeviceChangeStatus(Guid idPreservation, PreservationStatus preservationStatus) { try { var svc = new PreservationService(); return(svc.PreservationStorageDeviceChangeStatus(idPreservation, preservationStatus)); } catch (Exception ex) { throw CheckExceptionToThrow(ex); } }
public void UpdatePreservationUser(PreservationUser user, string archiveName) { try { var svc = new PreservationService(); svc.UpdatePreservationUser(user, svc.GetIdPreservationArchiveFromName(archiveName)); } catch (Exception ex) { throw CheckExceptionToThrow(ex); } }
public PreservationUser AddPreservationUser(PreservationUser user, string archiveName) { try { var svc = new PreservationService(); return(svc.AddPreservationUser(user, svc.GetIdPreservationArchiveFromName(archiveName))); } catch (Exception ex) { throw CheckExceptionToThrow(ex); } }
public byte[] GetClosingFilesTimeStampFile(Guid idPreservationStorageDevice, long skip, int take, out long fileSize) { try { var svc = new PreservationService(); return(svc.GetClosingFilesTimeStampFile(idPreservationStorageDevice, skip, take, out fileSize)); } catch (Exception ex) { throw CheckExceptionToThrow(ex); } }
public bool CreateArchivePreservationMark(Guid idStorageDevice) { try { var svc = new PreservationService(); return(svc.CreateArchivePreservationMark(idStorageDevice)); } catch (Exception ex) { throw CheckExceptionToThrow(ex); } }
public void UpdatePreservationStorageDeviceLastVerifyDate(Guid idStorageDevice, Nullable <DateTime> verifyDate) { try { var svc = new PreservationService(); svc.UpdatePreservationStorageDeviceLastVerifyDate(idStorageDevice, verifyDate); } catch (Exception ex) { throw CheckExceptionToThrow(ex); } }