Class: Dor::RoleMetadataDS

Inherits:
ActiveFedora::OmDatastream
  • Object
show all
Includes:
SolrDocHelper
Defined in:
lib/dor/datastreams/role_metadata_ds.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from SolrDocHelper

#add_solr_value

Class Method Details

.xml_templateObject



31
32
33
34
35
# File 'lib/dor/datastreams/role_metadata_ds.rb', line 31

def self.xml_template
  Nokogiri::XML::Builder.new do |xml|
    xml. {}
  end.doc
end

Instance Method Details

#prefixObject

maintain AF < 8 indexing behavior



51
52
53
# File 'lib/dor/datastreams/role_metadata_ds.rb', line 51

def prefix
  ''
end

#to_solr(solr_doc = {}, *args) ⇒ Object



37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/dor/datastreams/role_metadata_ds.rb', line 37

def to_solr(solr_doc = {}, *args)
  find_by_xpath('/roleMetadata/role/*').each do |actor|
    role_type = actor.parent['type']
    val = [actor.at_xpath('identifier/@type'), actor.at_xpath('identifier/text()')].join ':'
    add_solr_value(solr_doc, "apo_role_#{actor.name}_#{role_type}", val, :string, [:symbol])
    add_solr_value(solr_doc, "apo_role_#{role_type}", val, :string, [:symbol])
    if ['dor-apo-manager', 'dor-apo-depositor'].include? role_type
      add_solr_value(solr_doc, 'apo_register_permissions', val, :string, [:symbol, :stored_searchable])
    end
  end
  solr_doc
end