public SimpleMetadataViewModel GetMetadataModel(string uuid) { SimpleMetadata metadata = new SimpleMetadata(_geoNorge.GetRecordByUuid(uuid)); var model = new SimpleMetadataViewModel() { Uuid = metadata.Uuid, Title = metadata.Title, HierarchyLevel = metadata.HierarchyLevel, ParentIdentifier = metadata.ParentIdentifier, MetadataStandard = metadata.MetadataStandard, Abstract = metadata.Abstract != null ? metadata.Abstract.Replace("...", "") : "", ContactMetadata = new Contact(metadata.ContactMetadata, "pointOfContact"), ContactPublisher = new Contact(metadata.ContactPublisher, "publisher"), ContactOwner = new Contact(metadata.ContactOwner, "owner"), SupplementalDescription = metadata.SupplementalDescription, SpecificUsage = metadata.SpecificUsage, ProcessHistory = metadata.ProcessHistory, ProductPageUrl = metadata.ProductPageUrl, DistributionUrl = metadata.DistributionDetails != null ? metadata.DistributionDetails.URL : null, DistributionProtocol = metadata.DistributionDetails != null ? metadata.DistributionDetails.Protocol : null, MaintenanceFrequency = metadata.MaintenanceFrequency, DateUpdated = metadata.DateUpdated, DateMetadataUpdated = metadata.DateMetadataUpdated, KeywordsPlace = CreateListOfKeywords(SimpleKeyword.Filter(metadata.Keywords, SimpleKeyword.TYPE_PLACE, null)), KeywordsNationalInitiative = CreateListOfKeywords(SimpleKeyword.Filter(metadata.Keywords, null, SimpleKeyword.THESAURUS_NATIONAL_INITIATIVE)), KeywordsNationalTheme = CreateListOfKeywords(SimpleKeyword.Filter(metadata.Keywords, null, SimpleKeyword.THESAURUS_NATIONAL_THEME)), KeywordsEnglish = CreateDictionaryOfEnglishKeywords(metadata.Keywords), UseConstraints = metadata.Constraints != null ? metadata.Constraints.UseConstraints : null, OtherConstraintsLink = metadata.Constraints != null ? metadata.Constraints.OtherConstraintsLink : null, OtherConstraintsLinkText = metadata.Constraints != null ? metadata.Constraints.OtherConstraintsLinkText : null, OtherConstraintsAccess = metadata.Constraints != null ? metadata.Constraints.OtherConstraintsAccess : null, EnglishTitle = metadata.EnglishTitle, EnglishAbstract = metadata.EnglishAbstract, EnglishContactMetadataOrganization = metadata.ContactMetadata != null ? metadata.ContactMetadata.OrganizationEnglish : null, EnglishContactPublisherOrganization = metadata.ContactPublisher != null ? metadata.ContactPublisher.OrganizationEnglish : null, EnglishContactOwnerOrganization = metadata.ContactOwner != null ? metadata.ContactOwner.OrganizationEnglish : null }; if (metadata.BoundingBox != null) { model.BoundingBoxEast = ConvertCoordinateWithCommaToPoint(metadata.BoundingBox.EastBoundLongitude); model.BoundingBoxWest = ConvertCoordinateWithCommaToPoint(metadata.BoundingBox.WestBoundLongitude); model.BoundingBoxNorth = ConvertCoordinateWithCommaToPoint(metadata.BoundingBox.NorthBoundLatitude); model.BoundingBoxSouth = ConvertCoordinateWithCommaToPoint(metadata.BoundingBox.SouthBoundLatitude); } return model; }
internal List<WmsLayerViewModel> CreateMetadataForLayers(string uuid, List<WmsLayerViewModel> layers, string[] keywords, string username) { SimpleMetadata parentMetadata = new SimpleMetadata(_geoNorge.GetRecordByUuid(uuid)); List<SimpleKeyword> selectedKeywordsFromParent = CreateListOfKeywords(keywords); List<string> layerIdentifiers = new List<string>(); foreach (WmsLayerViewModel layer in layers) { try { SimpleMetadata simpleLayer = createMetadataForLayer(parentMetadata, selectedKeywordsFromParent, layer); MetadataTransaction transaction = _geoNorge.MetadataInsert(simpleLayer.GetMetadata(), CreateAdditionalHeadersWithUsername(username)); if (transaction.Identifiers != null && transaction.Identifiers.Count > 0) { layer.Uuid = transaction.Identifiers[0]; layerIdentifiers.Add(layer.Uuid); } } catch (Exception e) { layer.ErrorMessage = e.Message; Log.Error("Error while creating metadata for layer: " + layer.Title, e); } } parentMetadata.OperatesOn = layerIdentifiers; _geoNorge.MetadataUpdate(parentMetadata.GetMetadata()); return layers; }
public void SaveMetadataModel(MetadataViewModel model, string username) { SimpleMetadata metadata = new SimpleMetadata(_geoNorge.GetRecordByUuid(model.Uuid)); UpdateMetadataFromModel(model, metadata); var transaction = _geoNorge.MetadataUpdate(metadata.GetMetadata(), CreateAdditionalHeadersWithUsername(username, model.Published)); if (transaction.TotalUpdated == "0") throw new Exception("Kunne ikke lagre endringene - kontakt systemansvarlig"); Task.Run(() => ReIndexOperatesOn(model)); Task.Run(() => RemoveCache(model)); }
public Stream SaveMetadataAsXml(MetadataViewModel model) { var simpleMetadata = new SimpleMetadata(_geoNorge.GetRecordByUuid(model.Uuid)); UpdateMetadataFromModel(model, simpleMetadata); return SerializeUtil.SerializeToStream(simpleMetadata.GetMetadata()); }
private void UpdateMetadataFromModel(MetadataViewModel model, SimpleMetadata metadata) { metadata.Title = model.Title; metadata.Abstract = model.Abstract; if (!string.IsNullOrEmpty(model.ParentIdentifier)) metadata.ParentIdentifier = model.ParentIdentifier; metadata.Purpose = !string.IsNullOrWhiteSpace(model.Purpose) ? model.Purpose : " "; if (!string.IsNullOrWhiteSpace(model.TopicCategory)) metadata.TopicCategory = model.TopicCategory; if(!string.IsNullOrWhiteSpace(model.SupplementalDescription)) metadata.SupplementalDescription = model.SupplementalDescription; metadata.SpecificUsage = !string.IsNullOrWhiteSpace(model.SpecificUsage) ? model.SpecificUsage : " "; var contactMetadata = model.ContactMetadata.ToSimpleContact(); if (!string.IsNullOrWhiteSpace(model.EnglishContactMetadataOrganization)) { contactMetadata.OrganizationEnglish = model.EnglishContactMetadataOrganization; } metadata.ContactMetadata = contactMetadata; var contactPublisher = model.ContactPublisher.ToSimpleContact(); if (!string.IsNullOrWhiteSpace(model.EnglishContactPublisherOrganization)) { contactPublisher.OrganizationEnglish = model.EnglishContactPublisherOrganization; } metadata.ContactPublisher = contactPublisher; var contactOwner = model.ContactOwner.ToSimpleContact(); if (!string.IsNullOrWhiteSpace(model.EnglishContactOwnerOrganization)) { contactOwner.OrganizationEnglish = model.EnglishContactOwnerOrganization; } metadata.ContactOwner = contactOwner; // documents metadata.ProductSpecificationUrl = model.ProductSpecificationUrl; metadata.ApplicationSchema = model.ApplicationSchema; if (metadata.IsDataset()) { metadata.ProductSpecificationOther = new SimpleOnlineResource { Name = model.ProductSpecificationOther.Name, URL = model.ProductSpecificationOther.URL }; } metadata.ProductSheetUrl = model.ProductSheetUrl; metadata.ProductPageUrl = model.ProductPageUrl; metadata.LegendDescriptionUrl = model.LegendDescriptionUrl; metadata.CoverageUrl = model.CoverageUrl; metadata.Thumbnails = Thumbnail.ToSimpleThumbnailList(model.Thumbnails); // distribution //if (!string.IsNullOrWhiteSpace(model.SpatialRepresentation)) metadata.SpatialRepresentation = model.SpatialRepresentation; //if (!string.IsNullOrWhiteSpace(model.ReferenceSystemCoordinateSystem)) //{ // metadata.ReferenceSystem = new SimpleReferenceSystem // { // CoordinateSystem = model.ReferenceSystemCoordinateSystem, // Namespace = model.ReferenceSystemNamespace // }; //} var refsys = model.GetReferenceSystems(); if (refsys != null) metadata.ReferenceSystems = refsys; //Upgraded to multiple distribution formats //if (!string.IsNullOrWhiteSpace(model.DistributionFormatName) || // !string.IsNullOrWhiteSpace(model.DistributionFormatVersion)) //{ // metadata.DistributionFormat = new SimpleDistributionFormat // { // Name = model.DistributionFormatName, // Version = model.DistributionFormatVersion // }; //} metadata.DistributionFormats = model.GetDistributionFormats(); metadata.DistributionDetails = new SimpleDistributionDetails { URL = model.DistributionUrl, Protocol = model.DistributionProtocol, Name = model.DistributionName, UnitsOfDistribution = model.UnitsOfDistribution }; // quality List<SimpleQualitySpecification> qualityList = new List<SimpleQualitySpecification>(); if (!string.IsNullOrWhiteSpace(model.QualitySpecificationTitleInspire)) { qualityList.Add(new SimpleQualitySpecification { Title = model.QualitySpecificationTitleInspire, Date = string.Format("{0:yyyy-MM-dd}", model.QualitySpecificationDateInspire), DateType = model.QualitySpecificationDateTypeInspire, Explanation = model.QualitySpecificationExplanationInspire, Result = model.QualitySpecificationResultInspire, Responsible = "inspire" }); } if (!string.IsNullOrWhiteSpace(model.QualitySpecificationTitleSosi)) { qualityList.Add(new SimpleQualitySpecification { Title = model.QualitySpecificationTitleSosi, Date = string.Format("{0:yyyy-MM-dd}", model.QualitySpecificationDateSosi), DateType = model.QualitySpecificationDateTypeSosi, Explanation = model.QualitySpecificationExplanationSosi, Result = model.QualitySpecificationResultSosi, Responsible = "sosi" }); } if (model.QualitySpecificationResultSosiConformApplicationSchema) { qualityList.Add(new SimpleQualitySpecification { Title = "Sosi applikasjonsskjema", Date = string.Format("{0:yyyy-MM-dd}", model.QualitySpecificationDateSosi), DateType = model.QualitySpecificationDateTypeSosi, Explanation = "SOSI-filer er i henhold til applikasjonsskjema", Result = true, Responsible = "uml-sosi" }); } if (model.QualitySpecificationResultSosiConformGmlApplicationSchema) { qualityList.Add(new SimpleQualitySpecification { Title = "Sosi applikasjonsskjema", Date = string.Format("{0:yyyy-MM-dd}", model.QualitySpecificationDateSosi), DateType = model.QualitySpecificationDateTypeSosi, Explanation = "GML-filer er i henhold til applikasjonsskjema", Result = true, Responsible = "uml-gml" }); } if (!string.IsNullOrWhiteSpace(model.QualitySpecificationTitle)) { qualityList.Add(new SimpleQualitySpecification { Title = model.QualitySpecificationTitle, Date = string.Format("{0:yyyy-MM-dd}", model.QualitySpecificationDate), DateType = model.QualitySpecificationDateType, Explanation = model.QualitySpecificationExplanation, Result = model.QualitySpecificationResult, Responsible = "other" }); } metadata.QualitySpecifications = qualityList; metadata.ProcessHistory = !string.IsNullOrWhiteSpace(model.ProcessHistory) ? model.ProcessHistory : " "; if (!string.IsNullOrWhiteSpace(model.MaintenanceFrequency)) metadata.MaintenanceFrequency = model.MaintenanceFrequency; if (!model.IsService()) metadata.ResolutionScale = !string.IsNullOrWhiteSpace(model.ResolutionScale) ? model.ResolutionScale : " "; if (!string.IsNullOrWhiteSpace(model.Status)) metadata.Status = model.Status; metadata.DateCreated = model.DateCreated; metadata.DatePublished = model.DatePublished; metadata.DateUpdated = model.DateUpdated; DateTime? DateMetadataValidFrom = model.DateMetadataValidFrom; DateTime? DateMetadataValidTo = model.DateMetadataValidTo; metadata.ValidTimePeriod = new SimpleValidTimePeriod() { ValidFrom = DateMetadataValidFrom != null ? String.Format("{0:yyyy-MM-dd}", DateMetadataValidFrom) : "", ValidTo = DateMetadataValidTo != null ? String.Format("{0:yyyy-MM-dd}", DateMetadataValidTo) : "" }; if (!string.IsNullOrWhiteSpace(model.BoundingBoxEast)) { metadata.BoundingBox = new SimpleBoundingBox { EastBoundLongitude = model.BoundingBoxEast, WestBoundLongitude = model.BoundingBoxWest, NorthBoundLatitude = model.BoundingBoxNorth, SouthBoundLatitude = model.BoundingBoxSouth }; } var accessConstraintsSelected = model.AccessConstraints; string otherConstraintsAccess = model.OtherConstraintsAccess; if (!string.IsNullOrEmpty(accessConstraintsSelected)) { if (accessConstraintsSelected.ToLower() == "no restrictions" || accessConstraintsSelected.ToLower() == "norway digital restricted") { otherConstraintsAccess = accessConstraintsSelected; accessConstraintsSelected = "otherRestrictions"; } } metadata.Constraints = new SimpleConstraints { AccessConstraints = !string.IsNullOrWhiteSpace(accessConstraintsSelected) ? accessConstraintsSelected : "", OtherConstraints = !string.IsNullOrWhiteSpace(model.OtherConstraints) ? model.OtherConstraints : "", EnglishOtherConstraints = !string.IsNullOrWhiteSpace(model.EnglishOtherConstraints) ? model.EnglishOtherConstraints : "", OtherConstraintsLink = !string.IsNullOrWhiteSpace(model.OtherConstraintsLink) ? model.OtherConstraintsLink : null, OtherConstraintsLinkText = !string.IsNullOrWhiteSpace(model.OtherConstraintsLinkText) ? model.OtherConstraintsLinkText : null, SecurityConstraints = !string.IsNullOrWhiteSpace(model.SecurityConstraints) ? model.SecurityConstraints : "", SecurityConstraintsNote = !string.IsNullOrWhiteSpace(model.SecurityConstraintsNote) ? model.SecurityConstraintsNote : "", UseConstraints = !string.IsNullOrWhiteSpace(model.UseConstraints) ? model.UseConstraints : "", UseLimitations = !string.IsNullOrWhiteSpace(model.UseLimitations) ? model.UseLimitations : "", EnglishUseLimitations = !string.IsNullOrWhiteSpace(model.EnglishUseLimitations) ? model.EnglishUseLimitations : "", OtherConstraintsAccess = !string.IsNullOrWhiteSpace(otherConstraintsAccess) ? otherConstraintsAccess : "", }; if(model.IsService() && !string.IsNullOrEmpty(model.DistributionProtocol)) { model.KeywordsOther = AddKeywordForService(model.DistributionProtocol, model.KeywordsOther); metadata.ServiceType = GetServiceType(model.DistributionProtocol); } metadata.Keywords = model.GetAllKeywords(); bool hasEnglishFields = false; // don't create PT_FreeText fields if it isn't necessary if (!string.IsNullOrWhiteSpace(model.EnglishTitle)) { metadata.EnglishTitle = model.EnglishTitle; hasEnglishFields = true; } if (!string.IsNullOrWhiteSpace(model.EnglishAbstract)) { metadata.EnglishAbstract = model.EnglishAbstract; hasEnglishFields = true; } if (!string.IsNullOrWhiteSpace(model.EnglishPurpose)) { metadata.EnglishPurpose = model.EnglishPurpose; hasEnglishFields = true; } if (!string.IsNullOrWhiteSpace(model.EnglishSupplementalDescription)) { metadata.EnglishSupplementalDescription = model.EnglishSupplementalDescription; hasEnglishFields = true; } if (!string.IsNullOrWhiteSpace(model.EnglishSpecificUsage)) { metadata.EnglishSpecificUsage = model.EnglishSpecificUsage; hasEnglishFields = true; } if (!string.IsNullOrWhiteSpace(model.EnglishProcessHistory)) { metadata.EnglishProcessHistory = model.EnglishProcessHistory; hasEnglishFields = true; } if (hasEnglishFields) metadata.SetLocale(SimpleMetadata.LOCALE_ENG); if (model.OperatesOn != null) metadata.OperatesOn = model.OperatesOn; if (!string.IsNullOrWhiteSpace(model.ResourceReferenceCode) || !string.IsNullOrWhiteSpace(model.ResourceReferenceCodespace)) { metadata.ResourceReference = new SimpleResourceReference { Code = model.ResourceReferenceCode != null ? model.ResourceReferenceCode : null, Codespace = model.ResourceReferenceCodespace != null ? model.ResourceReferenceCodespace : null }; } if (model.IsService()) metadata.AccessProperties = new SimpleAccessProperties { OrderingInstructions = model.OrderingInstructions } ; SetDefaultValuesOnMetadata(metadata); }
private SimpleMetadata createDuplicateOfMetadata(SimpleMetadata parentMetadata, WmsLayerViewModel layerModel) { MD_Metadata_Type parent = parentMetadata.GetMetadata(); MD_Metadata_Type layer = parent.Copy(); layer.parentIdentifier = new CharacterString_PropertyType { CharacterString = parent.fileIdentifier.CharacterString }; layer.fileIdentifier = new CharacterString_PropertyType { CharacterString = Guid.NewGuid().ToString() }; SimpleMetadata simpleLayer = new SimpleMetadata(layer); string title = layerModel.Title; if (string.IsNullOrWhiteSpace(title)) { title = layerModel.Name; } simpleLayer.Title = title; if (!string.IsNullOrWhiteSpace(layerModel.Abstract)) { simpleLayer.Abstract = layerModel.Abstract; } if (layerModel.Keywords.Count > 0) { var existingKeywords = simpleLayer.Keywords; foreach (var keyword in layerModel.Keywords) { existingKeywords.Add(new SimpleKeyword { Keyword = keyword }); } simpleLayer.Keywords = existingKeywords; } simpleLayer.DistributionDetails = new SimpleDistributionDetails { Name = layerModel.Name, Protocol = parentMetadata.DistributionDetails.Protocol, URL = parentMetadata.DistributionDetails.URL }; if (!string.IsNullOrWhiteSpace(layerModel.BoundingBoxEast)) { simpleLayer.BoundingBox = new SimpleBoundingBox { EastBoundLongitude = layerModel.BoundingBoxEast, WestBoundLongitude = layerModel.BoundingBoxWest, NorthBoundLatitude = layerModel.BoundingBoxNorth, SouthBoundLatitude = layerModel.BoundingBoxSouth }; } if (!string.IsNullOrWhiteSpace(layerModel.EnglishTitle)) { simpleLayer.EnglishTitle = layerModel.EnglishTitle; } if (!string.IsNullOrWhiteSpace(layerModel.EnglishAbstract)) { simpleLayer.EnglishAbstract = layerModel.EnglishAbstract; } return simpleLayer; }
private void getQualitySpecifications(MetadataViewModel model, SimpleMetadata metadata) { if (metadata.QualitySpecifications != null && metadata.QualitySpecifications.Count > 0) { foreach (var qualitySpecification in metadata.QualitySpecifications) { string responsible = !string.IsNullOrEmpty(qualitySpecification.Responsible) ? qualitySpecification.Responsible : ""; responsible = responsible.ToLower(); string title = qualitySpecification.Title != null ? qualitySpecification.Title : ""; title = title.ToLower(); if (title.Contains("commission regulation") || title.Contains("Inspire")) responsible = "inspire"; else if (title.Contains("sosi") && title != "sosi applikasjonsskjema") responsible = "sosi"; if (responsible == "inspire") { model.QualitySpecificationDateInspire = (!string.IsNullOrWhiteSpace(qualitySpecification.Date)) ? DateTime.Parse(qualitySpecification.Date) : (DateTime?)null; model.QualitySpecificationDateTypeInspire = (!string.IsNullOrWhiteSpace(qualitySpecification.DateType)) ? qualitySpecification.DateType : null; model.QualitySpecificationExplanationInspire = qualitySpecification.Explanation != null ? qualitySpecification.Explanation : null; model.QualitySpecificationResultInspire = qualitySpecification.Result; model.QualitySpecificationTitleInspire = qualitySpecification.Title != null ? qualitySpecification.Title : null; } else if (responsible == "sosi") { model.QualitySpecificationDateSosi = (!string.IsNullOrWhiteSpace(qualitySpecification.Date)) ? DateTime.Parse(qualitySpecification.Date) : (DateTime?)null; model.QualitySpecificationDateTypeSosi = (!string.IsNullOrWhiteSpace(qualitySpecification.DateType)) ? qualitySpecification.DateType : null; model.QualitySpecificationExplanationSosi = qualitySpecification.Explanation != null ? qualitySpecification.Explanation : null; model.QualitySpecificationResultSosi = qualitySpecification.Result; model.QualitySpecificationTitleSosi = qualitySpecification.Title != null ? qualitySpecification.Title : null; } else if (responsible == "uml-sosi") { model.QualitySpecificationResultSosiConformApplicationSchema = qualitySpecification.Result; } else if (responsible == "uml-gml") { model.QualitySpecificationResultSosiConformGmlApplicationSchema = qualitySpecification.Result; } else { model.QualitySpecificationDate = (!string.IsNullOrWhiteSpace(qualitySpecification.Date)) ? DateTime.Parse(qualitySpecification.Date) : (DateTime?)null; model.QualitySpecificationDateType = (!string.IsNullOrWhiteSpace(qualitySpecification.DateType)) ? qualitySpecification.DateType : null; model.QualitySpecificationExplanation = qualitySpecification.Explanation != null ? qualitySpecification.Explanation : null; model.QualitySpecificationResult = qualitySpecification.Result; model.QualitySpecificationTitle = qualitySpecification.Title != null ? qualitySpecification.Title : null; } } } }
public void ShouldReturnParentIdentifier() { string identifier = "testIdentifier"; MD_Metadata_Type metadata = new MD_Metadata_Type(); metadata.parentIdentifier = new CharacterString_PropertyType{ CharacterString = identifier}; SimpleMetadata simpleMetadata = new SimpleMetadata(metadata); Assert.AreEqual(identifier, simpleMetadata.ParentIdentifier); }
private static SimpleMetadata CreateSimpleMetadata(string hierarchyLevel, AbstractMD_Identification_Type identification) { MD_Metadata_Type md = new MD_Metadata_Type { fileIdentifier = new CharacterString_PropertyType { CharacterString = Guid.NewGuid().ToString() }, identificationInfo = new MD_Identification_PropertyType[] { new MD_Identification_PropertyType { AbstractMD_Identification = identification } } }; SimpleMetadata simpleMetadata = new SimpleMetadata(md); simpleMetadata.HierarchyLevel = hierarchyLevel; return simpleMetadata; }
public void ShouldThrowExceptionWhenSettingTitleOnMetadataWithEmptyIdentificationInfoElement() { _md = new SimpleMetadata(new MD_Metadata_Type()); Assert.Throws(typeof(NullReferenceException), new TestDelegate(UpdateTitle)); }
public void Init() { _md = new SimpleMetadata(MetadataExample.CreateMetadataExample()); }
public void ShouldSetTitleWhenMissingCitation() { _md = new SimpleMetadata(new MD_Metadata_Type() { identificationInfo = new MD_Identification_PropertyType[] { new MD_Identification_PropertyType() { AbstractMD_Identification = new MD_DataIdentification_Type() } } }); UpdateTitle(); Assert.AreEqual("This is the new title.", _md.Title); }
public void ShouldReturnValidTimePeriod() { MD_Metadata_Type metadata = new MD_Metadata_Type(); metadata.hierarchyLevel = new MD_ScopeCode_PropertyType[] { new MD_ScopeCode_PropertyType() { MD_ScopeCode = new CodeListValue_Type() { codeListValue = "service" } } }; metadata.identificationInfo = new MD_Identification_PropertyType[] { new MD_Identification_PropertyType{ AbstractMD_Identification = new SV_ServiceIdentification_Type() { extent = new EX_Extent_PropertyType[] { new EX_Extent_PropertyType { EX_Extent = new EX_Extent_Type() { temporalElement= new EX_TemporalExtent_PropertyType[] { new EX_TemporalExtent_PropertyType() { EX_TemporalExtent = new EX_TemporalExtent_Type() { extent = new TM_Primitive_PropertyType() { AbstractTimePrimitive = new TimePeriodType() { Item= new TimePositionType() { Value = "2010-01-01T12:00:00" }, Item1= new TimePositionType() { Value = "2018-01-01T12:00:00" } } } } } } } } } } } }; SimpleMetadata simpleMetadata = new SimpleMetadata(metadata); Assert.NotNull(simpleMetadata.ValidTimePeriod); Assert.AreEqual("2010-01-01T12:00:00", simpleMetadata.ValidTimePeriod.ValidFrom); Assert.AreEqual("2018-01-01T12:00:00", simpleMetadata.ValidTimePeriod.ValidTo); }
private void UpdateMetadataFromModel(SimpleMetadataViewModel model, SimpleMetadata metadata) { metadata.ParentIdentifier = model.ParentIdentifier; metadata.Title = model.Title; metadata.Abstract = model.Abstract; metadata.SupplementalDescription = model.SupplementalDescription; metadata.SpecificUsage = !string.IsNullOrWhiteSpace(model.SpecificUsage) ? model.SpecificUsage : " "; metadata.ProcessHistory = !string.IsNullOrWhiteSpace(model.ProcessHistory) ? model.ProcessHistory : " "; metadata.ProductPageUrl = model.ProductPageUrl; var contactMetadata = model.ContactMetadata.ToSimpleContact(); if (!string.IsNullOrWhiteSpace(model.EnglishContactMetadataOrganization)) { contactMetadata.OrganizationEnglish = model.EnglishContactMetadataOrganization; } metadata.ContactMetadata = contactMetadata; var contactPublisher = model.ContactPublisher.ToSimpleContact(); if (!string.IsNullOrWhiteSpace(model.EnglishContactPublisherOrganization)) { contactPublisher.OrganizationEnglish = model.EnglishContactPublisherOrganization; } metadata.ContactPublisher = contactPublisher; var contactOwner = model.ContactOwner.ToSimpleContact(); if (!string.IsNullOrWhiteSpace(model.EnglishContactOwnerOrganization)) { contactOwner.OrganizationEnglish = model.EnglishContactOwnerOrganization; } metadata.ContactOwner = contactOwner; if (!string.IsNullOrWhiteSpace(model.BoundingBoxEast)) { metadata.BoundingBox = new SimpleBoundingBox { EastBoundLongitude = model.BoundingBoxEast, WestBoundLongitude = model.BoundingBoxWest, NorthBoundLatitude = model.BoundingBoxNorth, SouthBoundLatitude = model.BoundingBoxSouth }; } string accessConstraintsSelected = ""; if (!string.IsNullOrEmpty(model.OtherConstraintsAccess)) { if (model.OtherConstraintsAccess.ToLower() == "no restrictions") { accessConstraintsSelected = "otherRestrictions"; } } if (!string.IsNullOrWhiteSpace(model.MaintenanceFrequency)) metadata.MaintenanceFrequency = model.MaintenanceFrequency; metadata.DateUpdated = model.DateUpdated; //Keep if other keywords than in model List<SimpleKeyword> keywordsNotInModel = metadata.Keywords.Where(k => k.Thesaurus != SimpleKeyword.THESAURUS_NATIONAL_INITIATIVE && k.Thesaurus != SimpleKeyword.THESAURUS_NATIONAL_THEME && k.Type != SimpleKeyword.TYPE_PLACE).ToList(); //Get keywords in model List<SimpleKeyword> keywordsToUpdate = model.GetAllKeywords(); bool hasEnglishFields = false; // don't create PT_FreeText fields if it isn't necessary if (!string.IsNullOrWhiteSpace(model.EnglishTitle)) { metadata.EnglishTitle = model.EnglishTitle; hasEnglishFields = true; } if (!string.IsNullOrWhiteSpace(model.EnglishAbstract)) { metadata.EnglishAbstract = model.EnglishAbstract; hasEnglishFields = true; } if (hasEnglishFields) metadata.SetLocale(SimpleMetadata.LOCALE_ENG); metadata.Keywords = keywordsNotInModel.Concat(keywordsToUpdate).ToList(); metadata.DistributionDetails = new SimpleDistributionDetails { URL = model.DistributionUrl, Protocol = model.DistributionProtocol }; metadata.Constraints = new SimpleConstraints { UseConstraints = "license", OtherConstraints = !string.IsNullOrWhiteSpace(accessConstraintsSelected) ? accessConstraintsSelected : null, OtherConstraintsLink = !string.IsNullOrWhiteSpace(model.OtherConstraintsLink) ? model.OtherConstraintsLink : null, OtherConstraintsLinkText = !string.IsNullOrWhiteSpace(model.OtherConstraintsLinkText) ? model.OtherConstraintsLinkText : null, OtherConstraintsAccess = !string.IsNullOrWhiteSpace(model.OtherConstraintsAccess) ? model.OtherConstraintsAccess : null }; SetDefaultValuesOnMetadata(metadata); }
public MetadataViewModel GetMetadataModel(string uuid) { SimpleMetadata metadata = new SimpleMetadata(_geoNorge.GetRecordByUuid(uuid)); var model = new MetadataViewModel() { Uuid = metadata.Uuid, Title = metadata.Title, HierarchyLevel = metadata.HierarchyLevel, ParentIdentifier = metadata.ParentIdentifier, MetadataStandard = metadata.MetadataStandard, Abstract = metadata.Abstract != null ? metadata.Abstract.Replace("...", "") : "", Purpose = metadata.Purpose, ContactMetadata = new Contact(metadata.ContactMetadata, "pointOfContact"), ContactPublisher = new Contact(metadata.ContactPublisher, "publisher"), ContactOwner = new Contact(metadata.ContactOwner, "owner"), KeywordsTheme = CreateListOfKeywords(SimpleKeyword.Filter(metadata.Keywords, SimpleKeyword.TYPE_THEME, null)), KeywordsPlace = CreateListOfKeywords(SimpleKeyword.Filter(metadata.Keywords, SimpleKeyword.TYPE_PLACE, null)), KeywordsNationalInitiative = CreateListOfKeywords(SimpleKeyword.Filter(metadata.Keywords, null, SimpleKeyword.THESAURUS_NATIONAL_INITIATIVE)), KeywordsNationalTheme = CreateListOfKeywords(SimpleKeyword.Filter(metadata.Keywords, null, SimpleKeyword.THESAURUS_NATIONAL_THEME)), KeywordsConcept = CreateListOfKeywords(SimpleKeyword.Filter(metadata.Keywords, null, SimpleKeyword.THESAURUS_CONCEPT)), KeywordsInspire = CreateListOfKeywords(SimpleKeyword.Filter(metadata.Keywords, null, SimpleKeyword.THESAURUS_GEMET_INSPIRE_V1)), KeywordsServiceTaxonomy = CreateListOfKeywords(SimpleKeyword.Filter(metadata.Keywords, null, SimpleKeyword.THESAURUS_SERVICES_TAXONOMY)), KeywordsOther = CreateListOfKeywords(SimpleKeyword.Filter(metadata.Keywords, null, null)), KeywordsEnglish = CreateDictionaryOfEnglishKeywords(metadata.Keywords), TopicCategory = metadata.TopicCategory, SupplementalDescription = metadata.SupplementalDescription, SpecificUsage = metadata.SpecificUsage, ProductPageUrl = metadata.ProductPageUrl, ProductSheetUrl = metadata.ProductSheetUrl, ProductSpecificationUrl = metadata.ProductSpecificationUrl, ApplicationSchema = metadata.ApplicationSchema, LegendDescriptionUrl = metadata.LegendDescriptionUrl, CoverageUrl = metadata.CoverageUrl, Thumbnails = Thumbnail.CreateFromList(metadata.Thumbnails), SpatialRepresentation = metadata.SpatialRepresentation, DistributionFormatName = metadata.DistributionFormat != null ? metadata.DistributionFormat.Name : null, DistributionFormatVersion = metadata.DistributionFormat != null ? metadata.DistributionFormat.Version : null, DistributionFormats = metadata.DistributionFormats != null ? metadata.DistributionFormats : new List<SimpleDistributionFormat> { new SimpleDistributionFormat() }, DistributionUrl = metadata.DistributionDetails != null ? metadata.DistributionDetails.URL : null, DistributionProtocol = metadata.DistributionDetails != null ? metadata.DistributionDetails.Protocol : null, DistributionName = metadata.DistributionDetails != null ? metadata.DistributionDetails.Name : null, UnitsOfDistribution = metadata.DistributionDetails != null ? metadata.DistributionDetails.UnitsOfDistribution : null, ReferenceSystemCoordinateSystem = metadata.ReferenceSystem != null ? metadata.ReferenceSystem.CoordinateSystem : null, ReferenceSystemNamespace = metadata.ReferenceSystem != null ? metadata.ReferenceSystem.Namespace : null, ReferenceSystems = metadata.ReferenceSystems != null && metadata.ReferenceSystems.Count == 0 ? null : metadata.ReferenceSystems, //QualitySpecificationDate = (metadata.QualitySpecification != null && !string.IsNullOrWhiteSpace(metadata.QualitySpecification.Date)) ? DateTime.Parse(metadata.QualitySpecification.Date) : (DateTime?)null, //QualitySpecificationDateType = metadata.QualitySpecification != null ? metadata.QualitySpecification.DateType : null, //QualitySpecificationExplanation = metadata.QualitySpecification != null ? metadata.QualitySpecification.Explanation : null, //QualitySpecificationResult = metadata.QualitySpecification != null ? metadata.QualitySpecification.Result : false, //QualitySpecificationTitle = metadata.QualitySpecification != null ? metadata.QualitySpecification.Title : null, ProcessHistory = metadata.ProcessHistory, MaintenanceFrequency = metadata.MaintenanceFrequency, ResolutionScale = metadata.ResolutionScale, UseLimitations = metadata.Constraints != null ? metadata.Constraints.UseLimitations : null, EnglishUseLimitations = metadata.Constraints != null ? metadata.Constraints.EnglishUseLimitations : null, UseConstraints = metadata.Constraints != null ? metadata.Constraints.UseConstraints : null, AccessConstraints = metadata.Constraints != null ? metadata.Constraints.AccessConstraints : null, SecurityConstraints = metadata.Constraints != null ? metadata.Constraints.SecurityConstraints : null, SecurityConstraintsNote = metadata.Constraints != null ? metadata.Constraints.SecurityConstraintsNote : null, OtherConstraints = metadata.Constraints != null ? metadata.Constraints.OtherConstraints : null, EnglishOtherConstraints = metadata.Constraints != null ? metadata.Constraints.EnglishOtherConstraints : null, OtherConstraintsLink = metadata.Constraints != null ? metadata.Constraints.OtherConstraintsLink : null, OtherConstraintsLinkText = metadata.Constraints != null ? metadata.Constraints.OtherConstraintsLinkText : null, OtherConstraintsAccess = metadata.Constraints != null ? metadata.Constraints.OtherConstraintsAccess : null, DateCreated = metadata.DateCreated, DatePublished = metadata.DatePublished, DateUpdated = metadata.DateUpdated, DateMetadataUpdated = metadata.DateMetadataUpdated, DateMetadataValidFrom = string.IsNullOrEmpty(metadata.ValidTimePeriod.ValidFrom) ? (DateTime?)null : DateTime.Parse(metadata.ValidTimePeriod.ValidFrom), DateMetadataValidTo = string.IsNullOrEmpty(metadata.ValidTimePeriod.ValidTo) ? (DateTime?)null : DateTime.Parse(metadata.ValidTimePeriod.ValidTo), Status = metadata.Status, OrderingInstructions = (metadata.AccessProperties != null && !string.IsNullOrEmpty(metadata.AccessProperties.OrderingInstructions)) ? metadata.AccessProperties.OrderingInstructions : "", BoundingBoxEast = metadata.BoundingBox != null ? metadata.BoundingBox.EastBoundLongitude : null, BoundingBoxWest = metadata.BoundingBox != null ? metadata.BoundingBox.WestBoundLongitude : null, BoundingBoxNorth = metadata.BoundingBox != null ? metadata.BoundingBox.NorthBoundLatitude : null, BoundingBoxSouth = metadata.BoundingBox != null ? metadata.BoundingBox.SouthBoundLatitude : null, EnglishTitle = metadata.EnglishTitle, EnglishAbstract = metadata.EnglishAbstract, EnglishPurpose = metadata.EnglishPurpose, EnglishSupplementalDescription = metadata.EnglishSupplementalDescription, EnglishSpecificUsage = metadata.EnglishSpecificUsage, EnglishProcessHistory = metadata.EnglishProcessHistory, EnglishContactMetadataOrganization = metadata.ContactMetadata != null ? metadata.ContactMetadata.OrganizationEnglish : null, EnglishContactPublisherOrganization = metadata.ContactPublisher != null ? metadata.ContactPublisher.OrganizationEnglish : null, EnglishContactOwnerOrganization = metadata.ContactOwner != null ? metadata.ContactOwner.OrganizationEnglish : null, }; if (metadata.BoundingBox != null) { model.BoundingBoxEast = ConvertCoordinateWithCommaToPoint(metadata.BoundingBox.EastBoundLongitude); model.BoundingBoxWest = ConvertCoordinateWithCommaToPoint(metadata.BoundingBox.WestBoundLongitude); model.BoundingBoxNorth = ConvertCoordinateWithCommaToPoint(metadata.BoundingBox.NorthBoundLatitude); model.BoundingBoxSouth = ConvertCoordinateWithCommaToPoint(metadata.BoundingBox.SouthBoundLatitude); } if (metadata.ProductSpecificationOther != null) { model.ProductSpecificationOther = new SimpleOnlineResource { Name = metadata.ProductSpecificationOther.Name, URL = metadata.ProductSpecificationOther.URL }; } model.FixThumbnailUrls(); model.OperatesOn = metadata.OperatesOn !=null ? metadata.OperatesOn : new List<string>(); if (metadata.ResourceReference != null) { model.ResourceReferenceCode = metadata.ResourceReference.Code != null ? metadata.ResourceReference.Code : null; model.ResourceReferenceCodespace = metadata.ResourceReference.Codespace != null ? metadata.ResourceReference.Codespace : null; } getQualitySpecifications(model, metadata); return model; }
public void SaveMetadataModel(MetadataViewModel model, string username) { SimpleMetadata metadata = new SimpleMetadata(_geoNorge.GetRecordByUuid(model.Uuid)); metadata.Title = model.Title; metadata.Abstract = model.Abstract; if (!string.IsNullOrWhiteSpace(model.Purpose)) metadata.Purpose = model.Purpose; if (!string.IsNullOrWhiteSpace(model.TopicCategory)) metadata.TopicCategory = model.TopicCategory; if (!string.IsNullOrWhiteSpace(model.SupplementalDescription)) metadata.SupplementalDescription = model.SupplementalDescription; if (!string.IsNullOrWhiteSpace(model.SpecificUsage)) metadata.SpecificUsage = model.SpecificUsage; var contactMetadata = model.ContactMetadata.ToSimpleContact(); if (!string.IsNullOrWhiteSpace(model.EnglishContactMetadataOrganization)) { contactMetadata.OrganizationEnglish = model.EnglishContactMetadataOrganization; } metadata.ContactMetadata = contactMetadata; var contactPublisher = model.ContactPublisher.ToSimpleContact(); if (!string.IsNullOrWhiteSpace(model.EnglishContactPublisherOrganization)) { contactPublisher.OrganizationEnglish = model.EnglishContactPublisherOrganization; } metadata.ContactPublisher = contactPublisher; var contactOwner = model.ContactOwner.ToSimpleContact(); if (!string.IsNullOrWhiteSpace(model.EnglishContactOwnerOrganization)) { contactOwner.OrganizationEnglish = model.EnglishContactOwnerOrganization; } metadata.ContactOwner = contactOwner; // documents if (!string.IsNullOrWhiteSpace(model.ProductSpecificationUrl)) metadata.ProductSpecificationUrl = model.ProductSpecificationUrl; if (!string.IsNullOrWhiteSpace(model.ProductSheetUrl)) metadata.ProductSheetUrl = model.ProductSheetUrl; if (!string.IsNullOrWhiteSpace(model.ProductPageUrl)) metadata.ProductPageUrl = model.ProductPageUrl; if (!string.IsNullOrWhiteSpace(model.LegendDescriptionUrl)) metadata.LegendDescriptionUrl = model.LegendDescriptionUrl; metadata.Thumbnails = Thumbnail.ToSimpleThumbnailList(model.Thumbnails); // distribution if (!string.IsNullOrWhiteSpace(model.SpatialRepresentation)) metadata.SpatialRepresentation = model.SpatialRepresentation; if (!string.IsNullOrWhiteSpace(model.ReferenceSystemCoordinateSystem)) { metadata.ReferenceSystem = new SimpleReferenceSystem { CoordinateSystem = model.ReferenceSystemCoordinateSystem, Namespace = model.ReferenceSystemNamespace }; } if (!string.IsNullOrWhiteSpace(model.DistributionFormatName) || !string.IsNullOrWhiteSpace(model.DistributionFormatVersion)) { metadata.DistributionFormat = new SimpleDistributionFormat { Name = model.DistributionFormatName, Version = model.DistributionFormatVersion }; } if (!string.IsNullOrWhiteSpace(model.DistributionUrl) || !string.IsNullOrWhiteSpace(model.DistributionProtocol) || !string.IsNullOrWhiteSpace(model.DistributionName)) { metadata.DistributionDetails = new SimpleDistributionDetails { URL = model.DistributionUrl, Protocol = model.DistributionProtocol, Name = model.DistributionName }; } // quality if (!string.IsNullOrWhiteSpace(model.QualitySpecificationTitle)) { metadata.QualitySpecification = new SimpleQualitySpecification { Title = model.QualitySpecificationTitle, Date = model.QualitySpecificationDate, DateType = model.QualitySpecificationDateType, Explanation = model.QualitySpecificationExplanation, Result = model.QualitySpecificationResult }; } if (!string.IsNullOrWhiteSpace(model.ProcessHistory)) metadata.ProcessHistory = model.ProcessHistory; if (!string.IsNullOrWhiteSpace(model.MaintenanceFrequency)) metadata.MaintenanceFrequency = model.MaintenanceFrequency; if (!string.IsNullOrWhiteSpace(model.ResolutionScale)) metadata.ResolutionScale = model.ResolutionScale; if (!string.IsNullOrWhiteSpace(model.Status)) metadata.Status = model.Status; metadata.DateCreated = model.DateCreated; metadata.DatePublished = model.DatePublished; metadata.DateUpdated = model.DateUpdated; if (!string.IsNullOrWhiteSpace(model.BoundingBoxEast)) { metadata.BoundingBox = new SimpleBoundingBox { EastBoundLongitude = model.BoundingBoxEast, WestBoundLongitude = model.BoundingBoxWest, NorthBoundLatitude = model.BoundingBoxNorth, SouthBoundLatitude = model.BoundingBoxSouth }; } if (!string.IsNullOrWhiteSpace(model.AccessConstraints) || !string.IsNullOrWhiteSpace(model.OtherConstraints) || !string.IsNullOrWhiteSpace(model.SecurityConstraints) || !string.IsNullOrWhiteSpace(model.UseConstraints) || !string.IsNullOrWhiteSpace(model.UseLimitations)) { metadata.Constraints = new SimpleConstraints { AccessConstraints = model.AccessConstraints, OtherConstraints = model.OtherConstraints, SecurityConstraints = model.SecurityConstraints, UseConstraints = model.UseConstraints, UseLimitations = model.UseLimitations }; } metadata.Keywords = model.GetAllKeywords(); bool hasEnglishFields = false; // don't create PT_FreeText fields if it isn't necessary if (!string.IsNullOrWhiteSpace(model.EnglishTitle)) { metadata.EnglishTitle = model.EnglishTitle; hasEnglishFields = true; } if (!string.IsNullOrWhiteSpace(model.EnglishAbstract)) { metadata.EnglishAbstract = model.EnglishAbstract; hasEnglishFields = true; } if (hasEnglishFields) metadata.SetLocale(SimpleMetadata.LOCALE_ENG); SetDefaultValuesOnMetadata(metadata); _geoNorge.MetadataUpdate(metadata.GetMetadata(), CreateAdditionalHeadersWithUsername(username)); }
private SimpleMetadata createMetadataForLayer(SimpleMetadata parentMetadata, List<SimpleKeyword> selectedKeywordsFromParent, WmsLayerViewModel layerModel) { MD_Metadata_Type parent = parentMetadata.GetMetadata(); MD_Metadata_Type layer = parent.Copy(); layer.parentIdentifier = new CharacterString_PropertyType { CharacterString = parent.fileIdentifier.CharacterString }; layer.fileIdentifier = new CharacterString_PropertyType { CharacterString = Guid.NewGuid().ToString() }; SimpleMetadata simpleLayer = new SimpleMetadata(layer); string title = layerModel.Title; if (string.IsNullOrWhiteSpace(title)) { title = layerModel.Name; } simpleLayer.Title = title; if (!string.IsNullOrWhiteSpace(layerModel.Abstract)) { simpleLayer.Abstract = layerModel.Abstract; } simpleLayer.Keywords = selectedKeywordsFromParent; if (layerModel.Keywords.Count > 0) { var existingKeywords = simpleLayer.Keywords; foreach (var keyword in layerModel.Keywords) { existingKeywords.Add(new SimpleKeyword { Keyword = keyword }); } simpleLayer.Keywords = existingKeywords; } simpleLayer.DistributionDetails = new SimpleDistributionDetails { Name = layerModel.Name, Protocol = parentMetadata.DistributionDetails.Protocol, URL = parentMetadata.DistributionDetails.URL }; if (!string.IsNullOrWhiteSpace(layerModel.BoundingBoxEast)) { string defaultWestBoundLongitude = "-20"; string defaultEastBoundLongitude = "38"; string defaultSouthBoundLatitude = "56"; string defaultNorthBoundLatitude = "90"; string parentWestBoundLongitude = defaultWestBoundLongitude; string parentEastBoundLongitude = defaultEastBoundLongitude; string parentSouthBoundLatitude = defaultSouthBoundLatitude; string parentNorthBoundLatitude = defaultNorthBoundLatitude; if (parentMetadata.BoundingBox != null) { parentWestBoundLongitude = parentMetadata.BoundingBox.WestBoundLongitude; parentEastBoundLongitude = parentMetadata.BoundingBox.EastBoundLongitude; parentSouthBoundLatitude = parentMetadata.BoundingBox.SouthBoundLatitude; parentNorthBoundLatitude = parentMetadata.BoundingBox.NorthBoundLatitude; } string WestBoundLongitude = layerModel.BoundingBoxWest; string EastBoundLongitude = layerModel.BoundingBoxEast; string SouthBoundLatitude = layerModel.BoundingBoxSouth; string NorthBoundLatitude = layerModel.BoundingBoxNorth; decimal number; if ( !Decimal.TryParse(WestBoundLongitude, out number) || !Decimal.TryParse(EastBoundLongitude, out number) || !Decimal.TryParse(SouthBoundLatitude, out number) || !Decimal.TryParse(NorthBoundLatitude, out number) ) { WestBoundLongitude = parentWestBoundLongitude; EastBoundLongitude = parentEastBoundLongitude; SouthBoundLatitude = parentSouthBoundLatitude; NorthBoundLatitude = parentNorthBoundLatitude; if ( !Decimal.TryParse(WestBoundLongitude, out number) || !Decimal.TryParse(EastBoundLongitude, out number) || !Decimal.TryParse(SouthBoundLatitude, out number) || !Decimal.TryParse(NorthBoundLatitude, out number) ) { WestBoundLongitude = defaultWestBoundLongitude; EastBoundLongitude = defaultEastBoundLongitude; SouthBoundLatitude = defaultSouthBoundLatitude; NorthBoundLatitude = defaultNorthBoundLatitude; } } simpleLayer.BoundingBox = new SimpleBoundingBox { EastBoundLongitude = EastBoundLongitude, WestBoundLongitude = WestBoundLongitude, NorthBoundLatitude = NorthBoundLatitude, SouthBoundLatitude = SouthBoundLatitude }; } if (!string.IsNullOrWhiteSpace(layerModel.EnglishTitle)) { simpleLayer.EnglishTitle = layerModel.EnglishTitle; } if (!string.IsNullOrWhiteSpace(layerModel.EnglishAbstract)) { simpleLayer.EnglishAbstract = layerModel.EnglishAbstract; } return simpleLayer; }
public MetadataViewModel GetMetadataModel(string uuid) { SimpleMetadata metadata = new SimpleMetadata(_geoNorge.GetRecordByUuid(uuid)); var model = new MetadataViewModel() { Uuid = metadata.Uuid, Title = metadata.Title, HierarchyLevel = metadata.HierarchyLevel, Abstract = metadata.Abstract, Purpose = metadata.Purpose, ContactMetadata = new Contact(metadata.ContactMetadata, "pointOfContact"), ContactPublisher = new Contact(metadata.ContactPublisher, "publisher"), ContactOwner = new Contact(metadata.ContactOwner, "owner"), KeywordsTheme = CreateListOfKeywords(SimpleKeyword.Filter(metadata.Keywords, SimpleKeyword.TYPE_THEME, null)), KeywordsPlace = CreateListOfKeywords(SimpleKeyword.Filter(metadata.Keywords, SimpleKeyword.TYPE_PLACE, null)), KeywordsNationalInitiative = CreateListOfKeywords(SimpleKeyword.Filter(metadata.Keywords, null, SimpleKeyword.THESAURUS_NATIONAL_INITIATIVE)), KeywordsInspire = CreateListOfKeywords(SimpleKeyword.Filter(metadata.Keywords, null, SimpleKeyword.THESAURUS_GEMET_INSPIRE_V1)), KeywordsServiceTaxonomy = CreateListOfKeywords(SimpleKeyword.Filter(metadata.Keywords, null, SimpleKeyword.THESAURUS_SERVICES_TAXONOMY)), KeywordsOther = CreateListOfKeywords(SimpleKeyword.Filter(metadata.Keywords, null, null)), KeywordsEnglish = CreateDictionaryOfEnglishKeywords(metadata.Keywords), TopicCategory = metadata.TopicCategory, SupplementalDescription = metadata.SupplementalDescription, SpecificUsage = metadata.SpecificUsage, ProductPageUrl = metadata.ProductPageUrl, ProductSheetUrl = metadata.ProductSheetUrl, ProductSpecificationUrl = metadata.ProductSpecificationUrl, LegendDescriptionUrl = metadata.LegendDescriptionUrl, Thumbnails = Thumbnail.CreateFromList(metadata.Thumbnails), SpatialRepresentation = metadata.SpatialRepresentation, DistributionFormatName = metadata.DistributionFormat != null ? metadata.DistributionFormat.Name : null, DistributionFormatVersion = metadata.DistributionFormat != null ? metadata.DistributionFormat.Version : null, DistributionUrl = metadata.DistributionDetails != null ? metadata.DistributionDetails.URL : null, DistributionProtocol = metadata.DistributionDetails != null ? metadata.DistributionDetails.Protocol : null, DistributionName = metadata.DistributionDetails != null ? metadata.DistributionDetails.Name : null, ReferenceSystemCoordinateSystem = metadata.ReferenceSystem != null ? metadata.ReferenceSystem.CoordinateSystem : null, ReferenceSystemNamespace = metadata.ReferenceSystem != null ? metadata.ReferenceSystem.Namespace: null, QualitySpecificationDate = metadata.QualitySpecification != null ? metadata.QualitySpecification.Date : null, QualitySpecificationDateType = metadata.QualitySpecification != null ? metadata.QualitySpecification.DateType : null, QualitySpecificationExplanation = metadata.QualitySpecification != null ? metadata.QualitySpecification.Explanation : null, QualitySpecificationResult = metadata.QualitySpecification != null ? metadata.QualitySpecification.Result : false, QualitySpecificationTitle = metadata.QualitySpecification != null ? metadata.QualitySpecification.Title : null, ProcessHistory = metadata.ProcessHistory, MaintenanceFrequency = metadata.MaintenanceFrequency, ResolutionScale = metadata.ResolutionScale, UseLimitations = metadata.Constraints != null ? metadata.Constraints.UseLimitations : null, UseConstraints = metadata.Constraints != null ? metadata.Constraints.UseConstraints : null, AccessConstraints = metadata.Constraints != null ? metadata.Constraints.AccessConstraints : null, SecurityConstraints = metadata.Constraints != null ? metadata.Constraints.SecurityConstraints : null, OtherConstraints = metadata.Constraints != null ? metadata.Constraints.OtherConstraints : null, DateCreated = metadata.DateCreated, DatePublished = metadata.DatePublished, DateUpdated = metadata.DateUpdated, DateMetadataUpdated = metadata.DateMetadataUpdated, Status = metadata.Status, BoundingBoxEast = metadata.BoundingBox != null ? metadata.BoundingBox.EastBoundLongitude : null, BoundingBoxWest = metadata.BoundingBox != null ? metadata.BoundingBox.WestBoundLongitude : null, BoundingBoxNorth = metadata.BoundingBox != null ? metadata.BoundingBox.NorthBoundLatitude : null, BoundingBoxSouth = metadata.BoundingBox != null ? metadata.BoundingBox.SouthBoundLatitude : null, EnglishTitle = metadata.EnglishTitle, EnglishAbstract = metadata.EnglishAbstract, EnglishContactMetadataOrganization = metadata.ContactMetadata != null ? metadata.ContactMetadata.OrganizationEnglish : null, EnglishContactPublisherOrganization = metadata.ContactPublisher != null ? metadata.ContactPublisher.OrganizationEnglish : null, EnglishContactOwnerOrganization = metadata.ContactOwner != null ? metadata.ContactOwner.OrganizationEnglish : null, }; model.FixThumbnailUrls(); return model; }
private void SetDefaultValuesOnMetadata(SimpleMetadata metadata) { metadata.DateMetadataUpdated = DateTime.Now; metadata.MetadataStandard = "ISO19115"; metadata.MetadataStandardVersion = "2003"; metadata.MetadataLanguage = "nor"; }
public void SaveMetadataModel(SimpleMetadataViewModel model, string username) { SimpleMetadata metadata = new SimpleMetadata(_geoNorge.GetRecordByUuid(model.Uuid)); UpdateMetadataFromModel(model, metadata); _geoNorge.MetadataUpdate(metadata.GetMetadata(), CreateAdditionalHeadersWithUsername(username, model.Published)); }