Sha256: d105b6d882a2d9ca69b598c9b72fad8287eefd430ea87e43eee0f39981fca335

Contents?: true

Size: 1011 Bytes

Versions: 7

Compression:

Stored size: 1011 Bytes

Contents

module Dor
  module Geoable
    extend ActiveSupport::Concern
    include SolrDocHelper

    class CrosswalkError < Exception; end

    included do
      has_metadata  :name => 'geoMetadata',
                    :type => Dor::GeoMetadataDS,
                    :label => 'Geographic Information Metadata in ISO 19139',
                    :control_group => 'M'
    end

    # @return [String] XML
    def fetch_geoMetadata_datastream
      candidates = datastreams['identityMetadata'].otherId.collect { |oid| oid.to_s }
      metadata_id = Dor::MetadataService.resolvable(candidates).first
      unless metadata_id.nil?
        return Dor::MetadataService.fetch(metadata_id.to_s)
      else
        return nil
      end
    end

    def build_geoMetadata_datastream(ds)
      content = fetch_geoMetadata_datastream
      unless content.nil?
        ds.dsLabel = label
        ds.ng_xml = Nokogiri::XML(content)
        ds.ng_xml.normalize_text!
        ds.content = ds.ng_xml.to_xml
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
dor-services-4.25.1 lib/dor/models/geoable.rb
dor-services-4.25.0 lib/dor/models/geoable.rb
dor-services-4.24.0 lib/dor/models/geoable.rb
dor-services-4.23.0 lib/dor/models/geoable.rb
dor-services-4.22.6 lib/dor/models/geoable.rb
dor-services-4.22.5 lib/dor/models/geoable.rb
dor-services-4.22.4 lib/dor/models/geoable.rb