public void DeleteMareanoDataset(MareanoDataset MareanoDataset) { _dbContext.MareanoDatasets.Remove(MareanoDataset); //Todo, må slette deliveryDataset? _dbContext.SaveChanges(); }
private MetadataModel GetMetadata(MareanoDataset mareanoDataset) { MetadataModel metadata = new MetadataModel(); metadata.SimpleMetadata = MetadataService.FetchMetadata(mareanoDataset.Uuid); return(metadata); }
public MareanoDataset NewMareanoDataset(MareanoDatasetViewModel MareanoViewModel, string parentregister, string registername) { var MareanoDataset = new MareanoDataset(); MareanoDataset.SystemId = Guid.NewGuid(); MareanoDataset.Name = MareanoViewModel.Name; MareanoDataset.Seoname = RegisterUrls.MakeSeoFriendlyString(MareanoDataset.Name); MareanoDataset.Description = MareanoViewModel.Description; MareanoDataset.SubmitterId = _registerService.GetOrganizationIdByUserName(); MareanoDataset.OwnerId = MareanoViewModel.OwnerId; MareanoDataset.DateSubmitted = DateTime.Now; MareanoDataset.Modified = DateTime.Now; MareanoDataset.RegisterId = _registerService.GetRegisterId(parentregister, registername); MareanoDataset.VersioningId = _registerItemService.NewVersioningGroup(MareanoDataset); MareanoDataset.VersionNumber = 1; MareanoDataset.StatusId = "Submitted"; MareanoDataset.Uuid = MareanoViewModel.Uuid; MareanoDataset.Notes = MareanoViewModel.Notes; MareanoDataset.SpecificUsage = MareanoViewModel.SpecificUsage; MareanoDataset.ProductSheetUrl = MareanoViewModel.ProductSheetUrl; MareanoDataset.PresentationRulesUrl = MareanoViewModel.PresentationRulesUrl; MareanoDataset.ProductSpecificationUrl = MareanoViewModel.ProductSpecificationUrl; MareanoDataset.MetadataUrl = MareanoViewModel.MetadataUrl; MareanoDataset.DistributionFormat = MareanoViewModel.DistributionFormat; MareanoDataset.DistributionUrl = MareanoViewModel.DistributionUrl; MareanoDataset.DistributionArea = MareanoViewModel.DistributionArea; MareanoDataset.WmsUrl = MareanoViewModel.WmsUrl; MareanoDataset.ThemeGroupId = MareanoViewModel.ThemeGroupId; MareanoDataset.DatasetThumbnail = MareanoViewModel.DatasetThumbnail; MareanoDataset.DokStatusId = "Proposal"; MareanoDataset.UuidService = MareanoViewModel.UuidService; GetDeliveryStatuses(MareanoViewModel, MareanoDataset); MareanoDataset.MetadataStatusId = _datasetDeliveryService.CreateDatasetDelivery(MareanoViewModel.MetadataStatusId, MareanoViewModel.MetadataNote); MareanoDataset.ProductSpesificationStatusId = _datasetDeliveryService.CreateDatasetDelivery(MareanoViewModel.WmsStatusId, MareanoViewModel.WmsNote); MareanoDataset.SosiDataStatusId = _datasetDeliveryService.CreateDatasetDelivery(MareanoViewModel.WmsStatusId, MareanoViewModel.WmsNote); MareanoDataset.GmlDataStatusId = _datasetDeliveryService.CreateDatasetDelivery(MareanoViewModel.WmsStatusId, MareanoViewModel.WmsNote); MareanoDataset.WmsStatusId = _datasetDeliveryService.CreateDatasetDelivery(MareanoViewModel.WmsStatusId, MareanoViewModel.WmsNote); MareanoDataset.WfsStatusId = _datasetDeliveryService.CreateDatasetDelivery(MareanoViewModel.WfsStatusId, MareanoViewModel.WfsNote); MareanoDataset.AtomFeedStatusId = _datasetDeliveryService.CreateDatasetDelivery(MareanoViewModel.AtomFeedStatusId, MareanoViewModel.AtomFeedNote); MareanoDataset.CommonStatusId = _datasetDeliveryService.CreateDatasetDelivery(MareanoViewModel.WmsStatusId, MareanoViewModel.WmsNote); MareanoDataset.Grade = GetGrade(MareanoDataset); _dbContext.MareanoDatasets.Add(MareanoDataset); _dbContext.SaveChanges(); return(MareanoDataset); }
private void NewMareanoDatasetFromKartkatalogen(MareanoDataset MareanoDataset) { if (!_registerItemService.ItemNameIsValid(MareanoDataset)) { return; } MareanoDataset.SystemId = Guid.NewGuid(); MareanoDataset.Seoname = RegisterUrls.MakeSeoFriendlyString(MareanoDataset.Name); MareanoDataset.SubmitterId = _registerService.GetOrganizationIdByUserName(); MareanoDataset.DateSubmitted = DateTime.Now; MareanoDataset.Modified = DateTime.Now; MareanoDataset.RegisterId = _registerService.GetMareanoStatusRegisterId(); MareanoDataset.VersioningId = _registerItemService.NewVersioningGroup(MareanoDataset); MareanoDataset.VersionNumber = 1; MareanoDataset.StatusId = "Submitted"; MareanoDataset.DokStatusId = "Proposal"; var metadataStatusId = _datasetDeliveryService.GetMetadataStatus(MareanoDataset.Uuid); var productSpesificationStatusId = _registerService.GetDOKStatus(MareanoDataset.ProductSpecificationUrl, true, "deficient"); var productSheetStatusId = _registerService.GetDOKStatus(MareanoDataset.ProductSheetUrl, true, "deficient"); var presentationRulesStatusId = _registerService.GetDOKStatus(MareanoDataset.PresentationRulesUrl, true, "deficient"); var sosiDataStatusId = _registerService.GetSosiRequirements(MareanoDataset.Uuid, "", true, "deficient"); var gmlDataStatusId = _registerService.GetGmlRequirements(MareanoDataset.Uuid, true, "deficient"); var wmsStatusId = _datasetDeliveryService.GetDokDeliveryServiceStatus(MareanoDataset.Uuid, true, "deficient", MareanoDataset.UuidService); var wfsStatusId = _datasetDeliveryService.GetWfsStatus(MareanoDataset.Uuid); var atomFeedStatusId = _datasetDeliveryService.GetAtomFeedStatus(MareanoDataset.Uuid); var commonStatusId = _datasetDeliveryService.GetDownloadRequirementsStatus(wfsStatusId, atomFeedStatusId); MareanoDataset.MetadataStatusId = _datasetDeliveryService.CreateDatasetDelivery(metadataStatusId); MareanoDataset.ProductSpesificationStatusId = _datasetDeliveryService.CreateDatasetDelivery(productSpesificationStatusId); MareanoDataset.ProductSheetStatusId = _datasetDeliveryService.CreateDatasetDelivery(productSheetStatusId); MareanoDataset.PresentationRulesStatusId = _datasetDeliveryService.CreateDatasetDelivery(presentationRulesStatusId); MareanoDataset.SosiDataStatusId = _datasetDeliveryService.CreateDatasetDelivery(sosiDataStatusId); MareanoDataset.GmlDataStatusId = _datasetDeliveryService.CreateDatasetDelivery(gmlDataStatusId); MareanoDataset.WmsStatusId = _datasetDeliveryService.CreateDatasetDelivery(wmsStatusId); MareanoDataset.WfsStatusId = _datasetDeliveryService.CreateDatasetDelivery(wfsStatusId); MareanoDataset.AtomFeedStatusId = _datasetDeliveryService.CreateDatasetDelivery(atomFeedStatusId); MareanoDataset.CommonStatusId = _datasetDeliveryService.CreateDatasetDelivery(commonStatusId); MareanoDataset.Grade = GetGrade(MareanoDataset); SetFAIR(ref MareanoDataset); _dbContext.MareanoDatasets.Add(MareanoDataset); _dbContext.SaveChanges(); }
private MareanoDataset UpdateMareanoDataset(MareanoDataset originalDataset, MareanoDataset MareanoDatasetFromKartkatalogen) { originalDataset.Name = MareanoDatasetFromKartkatalogen.Name; originalDataset.Seoname = RegisterUrls.MakeSeoFriendlyString(originalDataset.Name); originalDataset.Description = MareanoDatasetFromKartkatalogen.Description; originalDataset.OwnerId = MareanoDatasetFromKartkatalogen.OwnerId; originalDataset.Modified = DateTime.Now; originalDataset.Uuid = MareanoDatasetFromKartkatalogen.Uuid; originalDataset.Notes = MareanoDatasetFromKartkatalogen.Notes; originalDataset.SpecificUsage = MareanoDatasetFromKartkatalogen.SpecificUsage; originalDataset.ProductSheetUrl = MareanoDatasetFromKartkatalogen.ProductSheetUrl; originalDataset.PresentationRulesUrl = MareanoDatasetFromKartkatalogen.PresentationRulesUrl; originalDataset.ProductSpecificationUrl = MareanoDatasetFromKartkatalogen.ProductSpecificationUrl; originalDataset.MetadataUrl = MareanoDatasetFromKartkatalogen.MetadataUrl; originalDataset.DistributionFormat = MareanoDatasetFromKartkatalogen.DistributionFormat; originalDataset.DistributionUrl = MareanoDatasetFromKartkatalogen.DistributionUrl; originalDataset.DistributionArea = MareanoDatasetFromKartkatalogen.DistributionArea; originalDataset.WmsUrl = MareanoDatasetFromKartkatalogen.WmsUrl; originalDataset.ThemeGroupId = MareanoDatasetFromKartkatalogen.ThemeGroupId; originalDataset.DatasetThumbnail = MareanoDatasetFromKartkatalogen.DatasetThumbnail; originalDataset.UuidService = MareanoDatasetFromKartkatalogen.UuidService; if (originalDataset.MetadataStatus != null) { originalDataset.MetadataStatus.StatusId = _datasetDeliveryService.GetMetadataStatus(MareanoDatasetFromKartkatalogen.Uuid, true, originalDataset.MetadataStatus.StatusId); } if (originalDataset.ProductSpesificationStatus != null) { originalDataset.ProductSpesificationStatus.StatusId = _registerService.GetDOKStatus(MareanoDatasetFromKartkatalogen.ProductSpecificationUrl, true, originalDataset.ProductSpesificationStatus.StatusId); } if (originalDataset.ProductSheetStatus == null) { originalDataset.ProductSheetStatus = CreateDatasetDelivery("notset", null, true); } if (originalDataset.PresentationRulesStatus == null) { originalDataset.PresentationRulesStatus = CreateDatasetDelivery("notset", null, true); } if (originalDataset.ProductSheetStatus != null) { originalDataset.ProductSheetStatus.StatusId = _registerService.GetDOKStatus(MareanoDatasetFromKartkatalogen.ProductSheetUrl, true, originalDataset.ProductSheetStatus.StatusId); } if (originalDataset.PresentationRulesStatus != null) { originalDataset.PresentationRulesStatus.StatusId = _registerService.GetDOKStatus(MareanoDatasetFromKartkatalogen.PresentationRulesUrl, true, originalDataset.PresentationRulesStatus.StatusId); } if (originalDataset.SosiDataStatus != null) { originalDataset.SosiDataStatus.StatusId = _registerService.GetSosiRequirements(MareanoDatasetFromKartkatalogen.Uuid, originalDataset.ProductSpecificationUrl, true, originalDataset.SosiDataStatus.StatusId); } if (originalDataset.GmlDataStatus != null) { originalDataset.GmlDataStatus.StatusId = _registerService.GetGmlRequirements(MareanoDatasetFromKartkatalogen.Uuid, true, originalDataset.GmlDataStatus.StatusId); } if (originalDataset.WmsStatus != null) { originalDataset.WmsStatus.StatusId = _datasetDeliveryService.GetDokDeliveryServiceStatus(MareanoDatasetFromKartkatalogen.Uuid, true, originalDataset.WmsStatus.StatusId, MareanoDatasetFromKartkatalogen.UuidService); } if (originalDataset.WfsStatus != null) { originalDataset.WfsStatus.StatusId = _datasetDeliveryService.GetWfsStatus(MareanoDatasetFromKartkatalogen.Uuid, true, originalDataset.WfsStatus.StatusId, MareanoDatasetFromKartkatalogen.UuidService); } if (originalDataset.AtomFeedStatus != null) { originalDataset.AtomFeedStatus.StatusId = _datasetDeliveryService.GetAtomFeedStatus(MareanoDatasetFromKartkatalogen.Uuid, true, originalDataset.AtomFeedStatus.StatusId); } if (originalDataset.CommonStatus != null) { originalDataset.CommonStatus.StatusId = _datasetDeliveryService.GetDownloadRequirementsStatus(originalDataset.WfsStatus?.StatusId, originalDataset.AtomFeedStatus?.StatusId); } originalDataset.Grade = GetGrade(originalDataset); SetFAIR(ref originalDataset); _dbContext.Entry(originalDataset).State = EntityState.Modified; _dbContext.SaveChanges(); return(originalDataset); }
private void SetFAIR(ref MareanoDataset mareanoDataset) { mareanoDataset.I1_c_Criteria = null; mareanoDataset.I3_a_Criteria = null; mareanoDataset.I3_b_Criteria = null; int findableWeight = 0; if (_metadata?.SimpleMetadata == null) { return; } mareanoDataset.F2_a_Criteria = SimpleKeyword.Filter(_metadata.SimpleMetadata.Keywords, SimpleKeyword.TYPE_THEME, null).ToList().Count() >= 3; mareanoDataset.F2_b_Criteria = _metadata.SimpleMetadata.Title.Count() <= 100; mareanoDataset.F2_c_Criteria = _metadata.SimpleMetadata.Abstract?.Count() >= 200 && _metadata.SimpleMetadata.Abstract?.Count() <= 600; mareanoDataset.F3_a_Criteria = _metadata.SimpleMetadata.ResourceReference != null ?_metadata.SimpleMetadata.ResourceReference?.Code != null && _metadata.SimpleMetadata.ResourceReference?.Codespace != null : false; if (mareanoDataset.F1_a_Criteria) { findableWeight += 25; } if (mareanoDataset.F2_a_Criteria) { findableWeight += 10; } if (mareanoDataset.F2_b_Criteria) { findableWeight += 5; } if (mareanoDataset.F2_c_Criteria) { findableWeight += 10; } if (mareanoDataset.F3_a_Criteria) { findableWeight += 25; } if (mareanoDataset.F4_a_Criteria) { findableWeight += 25; } mareanoDataset.FindableStatusPerCent = findableWeight; mareanoDataset.FindableStatusId = CreateFairDelivery(findableWeight); int accesibleWeight = 0; mareanoDataset.A1_a_Criteria = CheckWfs(mareanoDataset.Uuid, mareanoDataset.WfsStatus); mareanoDataset.A1_b_Criteria = CheckWms(mareanoDataset.Uuid, mareanoDataset.WmsStatus); mareanoDataset.A1_c_Criteria = _metadata.SimpleMetadata?.DistributionsFormats != null?_metadata.SimpleMetadata.DistributionsFormats.Where(p => !string.IsNullOrEmpty(p.Protocol) && p.Protocol.Contains("GEONORGE:DOWNLOAD")).Any() : false; mareanoDataset.A1_d_Criteria = mareanoDataset.AtomFeedStatus != null?mareanoDataset.AtomFeedStatus.IsGood() : false; mareanoDataset.A1_e_Criteria = CheckDistributionUrl(mareanoDataset.Uuid, _metadata.SimpleMetadata.DistributionsFormats.Where(f => !string.IsNullOrEmpty(f.Protocol) && f.Protocol.Contains("GEONORGE:DOWNLOAD") || !string.IsNullOrEmpty(f.Protocol) && f.Protocol.Contains("WWW:DOWNLOAD") || !string.IsNullOrEmpty(f.Protocol) && f.Protocol.Contains("GEONORGE:FILEDOWNLOAD"))); mareanoDataset.A1_f_Criteria = true; if (mareanoDataset.A1_a_Criteria) { accesibleWeight += 15; } if (mareanoDataset.A1_b_Criteria) { accesibleWeight += 15; } if (mareanoDataset.A1_c_Criteria) { accesibleWeight += 15; } if (mareanoDataset.A1_d_Criteria) { accesibleWeight += 5; } if (mareanoDataset.A1_e_Criteria) { accesibleWeight += 40; } if (mareanoDataset.A1_f_Criteria) { accesibleWeight += 10; } if (mareanoDataset.A2_a_Criteria) { accesibleWeight += 0; } mareanoDataset.AccesibleStatusPerCent = accesibleWeight; mareanoDataset.AccesibleStatusId = CreateFairDelivery(accesibleWeight); int interoperableWeight = 0; var spatialRepresentation = _metadata.SimpleMetadata.SpatialRepresentation; if (spatialRepresentation == "vector") { mareanoDataset.I1_b_Criteria = _metadata.SimpleMetadata.DistributionsFormats.Where(p => p.FormatName == "GML").Any(); } else if (spatialRepresentation == "grid") { mareanoDataset.I1_b_Criteria = _metadata.SimpleMetadata.DistributionsFormats.Where(p => p.FormatName == "GeoTIFF" || p.FormatName == "TIFF" || p.FormatName == "JPEG" || p.FormatName == "JPEG2000").Any(); } if (spatialRepresentation != "grid") { mareanoDataset.I1_c_Criteria = _metadata.SimpleMetadata.QualitySpecifications != null && _metadata.SimpleMetadata.QualitySpecifications.Count > 0 ? _metadata.SimpleMetadata.QualitySpecifications.Where(r => !string.IsNullOrEmpty(r.Explanation) && r.Explanation.StartsWith("GML-filer er i henhold")).Any() : false; } mareanoDataset.I2_a_Criteria = !string.IsNullOrEmpty(_metadata.SimpleMetadata.TopicCategory); mareanoDataset.I2_b_Criteria = SimpleKeyword.Filter(_metadata.SimpleMetadata.Keywords, null, SimpleKeyword.THESAURUS_NATIONAL_THEME).ToList().Count() >= 1; if (spatialRepresentation != "grid") { mareanoDataset.I3_a_Criteria = SimpleKeyword.Filter(_metadata.SimpleMetadata.Keywords, null, SimpleKeyword.THESAURUS_CONCEPT).ToList().Count() >= 1; mareanoDataset.I3_b_Criteria = !string.IsNullOrEmpty(_metadata.SimpleMetadata.ApplicationSchema); } if (mareanoDataset.I1_a_Criteria) { interoperableWeight += 20; } if (mareanoDataset.I1_b_Criteria) { interoperableWeight += 10; } if (!mareanoDataset.I1_c_Criteria.HasValue || (mareanoDataset.I1_c_Criteria.HasValue && mareanoDataset.I1_c_Criteria.Value)) { interoperableWeight += 20; } if (mareanoDataset.I2_a_Criteria) { interoperableWeight += 10; } if (mareanoDataset.I2_b_Criteria) { interoperableWeight += 10; } if (!mareanoDataset.I3_a_Criteria.HasValue || (mareanoDataset.I3_a_Criteria.HasValue && mareanoDataset.I3_a_Criteria.Value)) { interoperableWeight += 10; } if (!mareanoDataset.I3_b_Criteria.HasValue || (mareanoDataset.I3_b_Criteria.HasValue && mareanoDataset.I3_b_Criteria.Value)) { interoperableWeight += 20; } mareanoDataset.InteroperableStatusPerCent = interoperableWeight; mareanoDataset.InteroperableStatusId = CreateFairDelivery(interoperableWeight); int reusableWeight = 0; mareanoDataset.R1_a_Criteria = !string.IsNullOrEmpty(_metadata.SimpleMetadata.Constraints?.UseConstraintsLicenseLink); mareanoDataset.R2_a_Criteria = _metadata.SimpleMetadata?.ProcessHistory.Count() > 200; mareanoDataset.R2_b_Criteria = !string.IsNullOrEmpty(_metadata.SimpleMetadata?.MaintenanceFrequency); mareanoDataset.R2_c_Criteria = !string.IsNullOrEmpty(_metadata.SimpleMetadata?.ProductSpecificationUrl); mareanoDataset.R2_d_Criteria = !string.IsNullOrEmpty(_metadata.SimpleMetadata?.ResolutionScale); mareanoDataset.R2_e_Criteria = !string.IsNullOrEmpty(_metadata.SimpleMetadata?.CoverageUrl) || !string.IsNullOrEmpty(_metadata.SimpleMetadata?.CoverageGridUrl) || !string.IsNullOrEmpty(_metadata.SimpleMetadata?.CoverageCellUrl); mareanoDataset.R2_f_Criteria = !string.IsNullOrEmpty(_metadata.SimpleMetadata?.Purpose); mareanoDataset.R3_b_Criteria = _metadata.SimpleMetadata.DistributionsFormats.Where(p => p.FormatName == "GML" || p.FormatName == "GeoTIFF" || p.FormatName == "TIFF" || p.FormatName == "JPEG" || p.FormatName == "JPEG2000" || p.FormatName == "NetCDF" || p.FormatName == "NetCDF-CF").Any(); if (mareanoDataset.R1_a_Criteria) { reusableWeight += 30; } if (mareanoDataset.R2_a_Criteria) { reusableWeight += 10; } if (mareanoDataset.R2_b_Criteria) { reusableWeight += 5; } if (mareanoDataset.R2_c_Criteria) { reusableWeight += 10; } if (mareanoDataset.R2_d_Criteria) { reusableWeight += 5; } if (mareanoDataset.R2_e_Criteria) { reusableWeight += 5; } if (mareanoDataset.R2_f_Criteria) { reusableWeight += 5; } if (mareanoDataset.R3_a_Criteria) { reusableWeight += 15; } if (mareanoDataset.R3_b_Criteria) { reusableWeight += 15; } mareanoDataset.ReUseableStatusPerCent = reusableWeight; mareanoDataset.ReUseableStatusId = CreateFairDelivery(reusableWeight); int fairWeight = (findableWeight + accesibleWeight + interoperableWeight + reusableWeight) / 4; mareanoDataset.FAIRStatusPerCent = fairWeight; mareanoDataset.FAIRStatusId = CreateFairDelivery(fairWeight); }
public MareanoDataset UpdateMareanoDatasetFromKartkatalogen(MareanoDataset originalDataset) { var MareanoDatasetFromKartkatalogen = _metadataService.FetchMareanoDatasetFromKartkatalogen(originalDataset.Uuid); return(MareanoDatasetFromKartkatalogen == null ? originalDataset : UpdateMareanoDataset(originalDataset, MareanoDatasetFromKartkatalogen)); }
private float GetGrade(MareanoDataset dataset) { float grade = 0; float gradeGood = 1; float gradeUseable = 0.5F; var MetadataStatus = _dbContext.DatasetDeliveries.Where(s => s.DatasetDeliveryId == dataset.MetadataStatusId).FirstOrDefault(); var ProductSpesificationStatus = _dbContext.DatasetDeliveries.Where(s => s.DatasetDeliveryId == dataset.ProductSpesificationStatusId).FirstOrDefault(); var ProductSheetStatus = _dbContext.DatasetDeliveries.Where(s => s.DatasetDeliveryId == dataset.ProductSheetStatusId).FirstOrDefault(); var PresentationRulesStatus = _dbContext.DatasetDeliveries.Where(s => s.DatasetDeliveryId == dataset.PresentationRulesStatusId).FirstOrDefault(); var SosiDataStatus = _dbContext.DatasetDeliveries.Where(s => s.DatasetDeliveryId == dataset.SosiDataStatusId).FirstOrDefault(); var GmlDataStatus = _dbContext.DatasetDeliveries.Where(s => s.DatasetDeliveryId == dataset.GmlDataStatusId).FirstOrDefault(); var WmsStatus = _dbContext.DatasetDeliveries.Where(s => s.DatasetDeliveryId == dataset.WmsStatusId).FirstOrDefault(); var WfsStatus = _dbContext.DatasetDeliveries.Where(s => s.DatasetDeliveryId == dataset.WfsStatusId).FirstOrDefault(); var AtomFeedStatus = _dbContext.DatasetDeliveries.Where(s => s.DatasetDeliveryId == dataset.AtomFeedStatusId).FirstOrDefault(); var CommonStatus = _dbContext.DatasetDeliveries.Where(s => s.DatasetDeliveryId == dataset.CommonStatusId).FirstOrDefault(); if (MetadataStatus != null && MetadataStatus.IsGood()) { grade = grade + gradeGood; } else if (MetadataStatus != null && MetadataStatus.IsGoodOrUseable()) { grade = grade + gradeUseable; } if (ProductSpesificationStatus != null && ProductSpesificationStatus.IsGood()) { grade = grade + gradeGood; } else if (ProductSpesificationStatus != null && ProductSpesificationStatus.IsGoodOrUseable()) { grade = grade + gradeUseable; } if (ProductSheetStatus != null && ProductSheetStatus.IsGood()) { grade = grade + gradeGood; } else if (ProductSheetStatus != null && ProductSheetStatus.IsGoodOrUseable()) { grade = grade + gradeUseable; } if (PresentationRulesStatus != null && PresentationRulesStatus.IsGood()) { grade = grade + gradeGood; } else if (PresentationRulesStatus != null && PresentationRulesStatus.IsGoodOrUseable()) { grade = grade + gradeUseable; } if (SosiDataStatus != null && SosiDataStatus.IsGood()) { grade = grade + gradeGood; } else if (SosiDataStatus != null && SosiDataStatus.IsGoodOrUseable()) { grade = grade + gradeUseable; } if (GmlDataStatus != null && GmlDataStatus.IsGood()) { grade = grade + gradeGood; } else if (GmlDataStatus != null && GmlDataStatus.IsGoodOrUseable()) { grade = grade + gradeUseable; } if (WmsStatus != null && WmsStatus.IsGood()) { grade = grade + gradeGood; } else if (WmsStatus != null && WmsStatus.IsGoodOrUseable()) { grade = grade + gradeUseable; } if (WfsStatus != null && WfsStatus.IsGood()) { grade = grade + gradeGood; } else if (WfsStatus != null && WfsStatus.IsGoodOrUseable()) { grade = grade + gradeUseable; } if (AtomFeedStatus != null && AtomFeedStatus.IsGood()) { grade = grade + gradeGood; } else if (AtomFeedStatus != null && AtomFeedStatus.IsGoodOrUseable()) { grade = grade + gradeUseable; } if (CommonStatus != null && CommonStatus.IsGood()) { grade = grade + gradeGood; } else if (CommonStatus != null && CommonStatus.IsGoodOrUseable()) { grade = grade + gradeUseable; } return(grade); }
private void GetDeliveryStatuses(MareanoDatasetViewModel MareanoDatasetViewModel, MareanoDataset MareanoDataset) { MareanoDatasetViewModel.MetadataStatusId = _datasetDeliveryService.GetMetadataStatus(MareanoDataset.Uuid, true, MareanoDatasetViewModel.MetadataStatusId); MareanoDatasetViewModel.ProductSpesificationStatusId = _registerService.GetDOKStatus(MareanoDataset.ProductSpecificationUrl, true, MareanoDatasetViewModel.ProductSpesificationStatusId); MareanoDatasetViewModel.ProductSheetStatusId = _registerService.GetDOKStatus(MareanoDataset.ProductSheetUrl, true, MareanoDatasetViewModel.ProductSpesificationStatusId); MareanoDatasetViewModel.PresentationRulesStatusId = _registerService.GetDOKStatus(MareanoDataset.PresentationRulesUrl, true, MareanoDatasetViewModel.PresentationRulesStatusId); MareanoDatasetViewModel.SosiDataStatusId = _registerService.GetSosiRequirements(MareanoDataset.Uuid, MareanoDatasetViewModel.ProductSpecificationUrl, true, MareanoDatasetViewModel.SosiDataStatusId); MareanoDatasetViewModel.GmlDataStatusId = _registerService.GetGmlRequirements(MareanoDataset.Uuid, true, MareanoDatasetViewModel.GmlDataStatusId); MareanoDatasetViewModel.WmsStatusId = _datasetDeliveryService.GetDokDeliveryServiceStatus(MareanoDataset.Uuid, true, MareanoDatasetViewModel.WmsStatusId, MareanoDataset.UuidService); MareanoDatasetViewModel.WfsStatusId = _datasetDeliveryService.GetWfsStatus(MareanoDataset.Uuid, true, MareanoDatasetViewModel.WfsStatusId); MareanoDatasetViewModel.AtomFeedStatusId = _datasetDeliveryService.GetAtomFeedStatus(MareanoDataset.Uuid, true, MareanoDatasetViewModel.AtomFeedStatusId); MareanoDatasetViewModel.CommonStatusId = _datasetDeliveryService.GetDownloadRequirementsStatus(MareanoDatasetViewModel.WfsStatusId, MareanoDatasetViewModel.AtomFeedStatusId); if (MareanoDataset.Grade.HasValue) { MareanoDatasetViewModel.Grade = MareanoDataset.Grade.Value; } }
public void Update(MareanoDataset mareanoDataset) { if (mareanoDataset != null) { F1_a_Criteria = mareanoDataset.F1_a_Criteria; F2_a_Criteria = mareanoDataset.F2_a_Criteria; F2_b_Criteria = mareanoDataset.F2_b_Criteria; F2_c_Criteria = mareanoDataset.F2_c_Criteria; F3_a_Criteria = mareanoDataset.F3_a_Criteria; F4_a_Criteria = mareanoDataset.F4_a_Criteria; A1_a_Criteria = mareanoDataset.A1_a_Criteria; A1_b_Criteria = mareanoDataset.A1_b_Criteria; A1_c_Criteria = mareanoDataset.A1_c_Criteria; A1_d_Criteria = mareanoDataset.A1_d_Criteria; A1_e_Criteria = mareanoDataset.A1_e_Criteria; A1_f_Criteria = mareanoDataset.A1_f_Criteria; A2_a_Criteria = mareanoDataset.A2_a_Criteria; I1_a_Criteria = mareanoDataset.I1_a_Criteria; I1_b_Criteria = mareanoDataset.I1_b_Criteria; if (mareanoDataset.I1_c_Criteria.HasValue) { I1_c_Criteria = mareanoDataset.I1_c_Criteria.Value; } I2_a_Criteria = mareanoDataset.I2_a_Criteria; I2_b_Criteria = mareanoDataset.I2_b_Criteria; if (mareanoDataset.I3_a_Criteria.HasValue) { I3_a_Criteria = mareanoDataset.I3_a_Criteria.Value; } if (mareanoDataset.I3_b_Criteria.HasValue) { I3_b_Criteria = mareanoDataset.I3_b_Criteria.Value; } R1_a_Criteria = mareanoDataset.R1_a_Criteria; R2_a_Criteria = mareanoDataset.R2_a_Criteria; R2_b_Criteria = mareanoDataset.R2_b_Criteria; R2_c_Criteria = mareanoDataset.R2_c_Criteria; R2_d_Criteria = mareanoDataset.R2_d_Criteria; R2_e_Criteria = mareanoDataset.R2_e_Criteria; R2_f_Criteria = mareanoDataset.R2_f_Criteria; R3_a_Criteria = mareanoDataset.R3_a_Criteria; R3_b_Criteria = mareanoDataset.R3_b_Criteria; if (mareanoDataset.FAIRStatus != null) { FAIRStatusId = mareanoDataset.FAIRStatus.StatusId; FAIRStatus = mareanoDataset.FAIRStatus.Status; FAIRStatusPerCent = mareanoDataset.FAIRStatusPerCent; } if (mareanoDataset.FindableStatus != null) { FindableStatusId = mareanoDataset.FindableStatus.StatusId; FindableStatus = mareanoDataset.FindableStatus.Status; FindableNote = mareanoDataset.FindableStatus.Note; FindableAutoUpdate = mareanoDataset.FindableStatus.AutoUpdate; FindableStatusPerCent = mareanoDataset.FindableStatusPerCent; } if (mareanoDataset.AccesibleStatus != null) { AccesibleStatusId = mareanoDataset.AccesibleStatus.StatusId; AccesibleStatus = mareanoDataset.AccesibleStatus.Status; AccesibleNote = mareanoDataset.AccesibleStatus.Note; AccesibleAutoUpdate = mareanoDataset.AccesibleStatus.AutoUpdate; AccesibleStatusPerCent = mareanoDataset.AccesibleStatusPerCent; } if (mareanoDataset.InteroperableStatus != null) { InteroperableStatusId = mareanoDataset.InteroperableStatus.StatusId; InteroperableStatus = mareanoDataset.InteroperableStatus.Status; InteroperableNote = mareanoDataset.InteroperableStatus.Note; InteroperableAutoUpdate = mareanoDataset.InteroperableStatus.AutoUpdate; InteroperableStatusPerCent = mareanoDataset.InteroperableStatusPerCent; } if (mareanoDataset.ReUseableStatus != null) { ReUseableStatusId = mareanoDataset.ReUseableStatus.StatusId; ReUseableStatus = mareanoDataset.ReUseableStatus.Status; ReUseableNote = mareanoDataset.ReUseableStatus.Note; ReUseableAutoUpdate = mareanoDataset.ReUseableStatus.AutoUpdate; ReUseableStatusPerCent = mareanoDataset.ReUseableStatusPerCent; } if (mareanoDataset.MetadataStatus != null) { MetadataStatusId = mareanoDataset.MetadataStatus.StatusId; MetadataStatus = mareanoDataset.MetadataStatus.Status; MetadataNote = mareanoDataset.MetadataStatus.Note; MetadataAutoUpdate = mareanoDataset.MetadataStatus.AutoUpdate; } if (mareanoDataset.ProductSpesificationStatus != null) { ProductSpesificationStatusId = mareanoDataset.ProductSpesificationStatus.StatusId; ProductSpesificationStatus = mareanoDataset.ProductSpesificationStatus.Status; ProduktspesifikasjonNote = mareanoDataset.ProductSpesificationStatus.Note; ProduktspesifikasjonAutoUpdate = mareanoDataset.ProductSpesificationStatus.AutoUpdate; } if (mareanoDataset.ProductSheetStatus != null) { ProductSheetStatusId = mareanoDataset.ProductSheetStatus.StatusId; ProductSheetStatus = mareanoDataset.ProductSheetStatus.Status; ProductSheetNote = mareanoDataset.ProductSheetStatus.Note; ProductSheetAutoUpdate = mareanoDataset.ProductSheetStatus.AutoUpdate; } if (mareanoDataset.PresentationRulesStatus != null) { PresentationRulesStatusId = mareanoDataset.PresentationRulesStatus.StatusId; PresentationRulesStatus = mareanoDataset.PresentationRulesStatus.Status; PresentationRulesNote = mareanoDataset.PresentationRulesStatus.Note; PresentationRulesAutoUpdate = mareanoDataset.PresentationRulesStatus.AutoUpdate; } if (mareanoDataset.SosiDataStatus != null) { SosiDataStatusId = mareanoDataset.SosiDataStatus.StatusId; SosiDataStatus = mareanoDataset.SosiDataStatus.Status; SosiDataNote = mareanoDataset.SosiDataStatus.Note; SosiDataAutoUpdate = mareanoDataset.SosiDataStatus.AutoUpdate; } if (mareanoDataset.GmlDataStatus != null) { GmlDataStatusId = mareanoDataset.GmlDataStatus.StatusId; GmlDataStatus = mareanoDataset.GmlDataStatus.Status; GmlDataNote = mareanoDataset.GmlDataStatus.Note; GmlDataAutoUpdate = mareanoDataset.GmlDataStatus.AutoUpdate; } if (mareanoDataset.WmsStatus != null) { WmsStatusId = mareanoDataset.WmsStatus.StatusId; WmsStatus = mareanoDataset.WmsStatus.Status; WmsNote = mareanoDataset.WmsStatus.Note; WmsAutoUpdate = mareanoDataset.WmsStatus.AutoUpdate; } if (mareanoDataset.WfsStatus != null) { WfsStatusId = mareanoDataset.WfsStatus.StatusId; WfsStatus = mareanoDataset.WfsStatus.Status; WfsNote = mareanoDataset.WfsStatus.Note; WfsAutoUpdate = mareanoDataset.WfsStatus.AutoUpdate; } if (mareanoDataset.AtomFeedStatus != null) { AtomFeedStatusId = mareanoDataset.AtomFeedStatus.StatusId; AtomFeedStatus = mareanoDataset.AtomFeedStatus.Status; AtomFeedNote = mareanoDataset.AtomFeedStatus.Note; AtomFeedAutoUpdate = mareanoDataset.AtomFeedStatus.AutoUpdate; } if (mareanoDataset.CommonStatus != null) { CommonStatusId = mareanoDataset.CommonStatus.StatusId; CommonStatus = mareanoDataset.CommonStatus.Status; CommonNote = mareanoDataset.CommonStatus.Note; CommonAutoUpdate = mareanoDataset.CommonStatus.AutoUpdate; } if (mareanoDataset.Grade.HasValue) { Grade = mareanoDataset.Grade.Value; } UpdateDataset(mareanoDataset); } }
public MareanoDatasetViewModel(MareanoDataset item) { Update(item); }
public MareanoDataset FetchMareanoDatasetFromKartkatalogen(string uuid) { var mareanoDataset = new MareanoDataset(); var url = WebConfigurationManager.AppSettings["KartkatalogenUrl"] + "api/getdata/" + uuid; var c = new System.Net.WebClient { Encoding = System.Text.Encoding.UTF8 }; try { var json = c.DownloadString(url); dynamic data = Newtonsoft.Json.Linq.JObject.Parse(json); if (data != null) { mareanoDataset.Name = data.Title; mareanoDataset.Description = data.Abstract; mareanoDataset.PresentationRulesUrl = data.LegendDescriptionUrl; mareanoDataset.ProductSheetUrl = data.ProductSheetUrl; mareanoDataset.ProductSpecificationUrl = data.ProductSpecificationUrl; mareanoDataset.SpecificUsage = data.SpecificUsage; mareanoDataset.Uuid = data.Uuid; mareanoDataset.MetadataUrl = WebConfigurationManager.AppSettings["KartkatalogenUrl"] + "metadata/uuid/" + mareanoDataset.Uuid; var thumbnails = data.Thumbnails; if (thumbnails != null && thumbnails.Count > 0) { mareanoDataset.DatasetThumbnail = thumbnails[0].URL.Value; } mareanoDataset.OwnerId = mapOrganizationNameToId( data.ContactOwner != null && data.ContactOwner.Organization != null ? data.ContactOwner.Organization.Value : "Kartverket"); mareanoDataset.ThemeGroupId = AddTheme(data.KeywordsNationalTheme != null && data.KeywordsNationalTheme.Count > 0 ? data.KeywordsNationalTheme[0].KeywordValue.Value : "Annen"); if (data.ServiceUuid != null) { mareanoDataset.UuidService = data.ServiceUuid; } if (data.ServiceDistributionUrlForDataset != null) { mareanoDataset.WmsUrl = data.ServiceDistributionUrlForDataset; } if (data.DistributionDetails != null) { mareanoDataset.DistributionUrl = data.DistributionDetails.URL; } if (data.UnitsOfDistribution != null) { mareanoDataset.DistributionArea = data.UnitsOfDistribution.Value; } var distributionFormat = data.DistributionFormat; if (distributionFormat != null) { if (distributionFormat.Name != null) { mareanoDataset.DistributionFormat = distributionFormat.Name.Value; } } } } catch (Exception e) { System.Diagnostics.Debug.WriteLine(e); System.Diagnostics.Debug.WriteLine(url); return(null); } return(mareanoDataset); }
public MareanoDatasetStatusReport(MareanoDataset MareanoDataset) { if (MareanoDataset != null) { UuidMareanoDataset = MareanoDataset.Uuid; if (MareanoDataset.FindableStatus != null) { FindableMareanoDataset = MareanoDataset.FindableStatus.StatusId; } if (MareanoDataset.AccesibleStatus != null) { AccesibleMareanoDataset = MareanoDataset.AccesibleStatus.StatusId; } if (MareanoDataset.InteroperableStatus != null) { InteroperableMareanoDataset = MareanoDataset.InteroperableStatus.StatusId; } if (MareanoDataset.ReUseableStatus != null) { ReUsableMareanoDataset = MareanoDataset.ReUseableStatus.StatusId; } if (MareanoDataset.MetadataStatus != null) { MetadataMareanoDataset = MareanoDataset.MetadataStatus.StatusId; } if (MareanoDataset.ProductSpesificationStatus != null) { ProductSpesificationMareanoDataset = MareanoDataset.ProductSpesificationStatus.StatusId; } if (MareanoDataset.ProductSheetStatus != null) { ProductSheetMareanoDataset = MareanoDataset.ProductSheetStatus.StatusId; } if (MareanoDataset.PresentationRulesStatus != null) { PresentationRulesMareanoDataset = MareanoDataset.PresentationRulesStatus.StatusId; } if (MareanoDataset.SosiDataStatus != null) { SosiDataMareanoDataset = MareanoDataset.SosiDataStatus.StatusId; } if (MareanoDataset.GmlDataStatus != null) { GmlDataMareanoDataset = MareanoDataset.GmlDataStatus.StatusId; } if (MareanoDataset.WmsStatus != null) { WmsMareanoDataset = MareanoDataset.WmsStatus.StatusId; } if (MareanoDataset.WfsStatus != null) { WfsMareanoDataset = MareanoDataset.WfsStatus.StatusId; } if (MareanoDataset.AtomFeedStatus != null) { AtomFeedMareanoDataset = MareanoDataset.AtomFeedStatus.StatusId; } if (MareanoDataset.CommonStatus != null) { CommonStatusMareanoDataset = MareanoDataset.CommonStatus.StatusId; } if (MareanoDataset.Grade.HasValue) { Grade = MareanoDataset.Grade.Value; } } }