Sha256: a4b8ed783cca07f3e4063f63791ea382673131f9a7faa6757f1a661c1ae65bb5

Contents?: true

Size: 1010 Bytes

Versions: 5

Compression:

Stored size: 1010 Bytes

Contents

module Dor
  module Geoable
    extend ActiveSupport::Concern

    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 = self.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 = self.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

5 entries across 5 versions & 1 rubygems

Version Path
dor-services-5.1.1 lib/dor/models/geoable.rb
dor-services-5.1.0 lib/dor/models/geoable.rb
dor-services-5.0.2 lib/dor/models/geoable.rb
dor-services-5.0.1 lib/dor/models/geoable.rb
dor-services-5.0.0 lib/dor/models/geoable.rb