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;
}