private static bool CheckRepo(Repositories.IRDMPPlatformRepositoryServiceLocator repo) { var logger = LogManager.GetCurrentClassLogger(); if (repo is LinkedRepositoryProvider l) { if (l.CatalogueRepository is TableRepository c) { if (!c.DiscoveredServer.Exists()) { logger.Error($"Could not reach {c.DiscoveredServer} (Database:{c.DiscoveredServer.GetCurrentDatabase()}). Ensure that you have configured RDMP database connections in Databases.yaml correctly and/or that you have run install to setup platform databases"); return(false); } } if (l.DataExportRepository is TableRepository d) { if (!d.DiscoveredServer.Exists()) { logger.Error($"Could not reach {d.DiscoveredServer} (Database:{d.DiscoveredServer.GetCurrentDatabase()}). Ensure that you have configured RDMP database connections in Databases.yaml correctly and/or that you have run install to setup platform databases"); return(false); } } } return(true); }
/// <summary> /// Returns the object that was the source of the given <paramref name="cohort"/>. /// May be a file or a <see cref="CohortIdentificationConfiguration"/> or other things or /// null if its not possible to work out what created the cohort. /// </summary> /// <param name="cohort"></param> /// <param name="repositoryLocator"></param> /// <returns></returns> public object GetObjectIfAny(IExtractableCohort cohort, Repositories.IRDMPPlatformRepositoryServiceLocator repositoryLocator) { var audit = cohort.AuditLog; // no audit means no object if (string.IsNullOrWhiteSpace(audit)) { return(null); } if (_legacyCic.IsMatch(audit)) { return(GetObjectFromLog <CohortIdentificationConfiguration>(_legacyCic.Match(audit), repositoryLocator.CatalogueRepository)); } if (audit.Contains(InCohortIdentificationConfiguration)) { return(GetObjectFromLog <CohortIdentificationConfiguration>(audit, repositoryLocator.CatalogueRepository)); } if (audit.Contains(InExtractionInformation)) { return(GetObjectFromLog <ExtractionInformation>(audit, repositoryLocator.CatalogueRepository)); } if (audit.Contains(InFile)) { var m = _regexGetFilePath.Match(audit); if (m.Success) { try { return(new FileInfo(m.Groups[1].Value)); } catch (System.Exception) { // its not a valid filename, maybe someone hacked the Audit Log by hand return(null); } } } // who knows how this cohort was created return(null); }