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



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

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

Instance Method Details

#to_solr(solr_doc = Hash.new, *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=Hash.new, *args)
  self.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, [:searchable, :facetable])
    add_solr_value(solr_doc, "apo_role_#{role_type}", val, :string, [:searchable, :facetable])
    unless role_type =~ /^hydrus/
      add_solr_value(solr_doc, "apo_register_permissions", val, :string, [:searchable, :facetable])
    end
  end
  solr_doc
end