Class: MarcXMLBibConverter

Inherits:
Converter show all
Extended by:
MarcXMLBibBaseMap
Includes:
ASpaceImport::XML::DOM
Defined in:
backend/app/converters/marcxml_bib_converter.rb

Direct Known Subclasses

MarcXMLBibAccessionConverter

Constant Summary

Constants included from MarcXMLBibBaseMap

MarcXMLBibBaseMap::AUTH_SUBJECT_SOURCE, MarcXMLBibBaseMap::BIB_SUBJECT_SOURCE

Class Method Summary collapse

Methods included from MarcXMLBibBaseMap

BASE_RECORD_MAP, adds_agent_term, adds_prefixed_qualifier, agent_as_subject, agent_template, appends_subordinate_name_2, bibliography_note_template, concatenate_subfields, corp_template, corp_variation, creators_and_sources, dates_of_existence_date_for, family_template, is_fallback_resource_title, langmaterial_note, make_term, multipart_note, name_corp_map, name_family_map, name_person_map, person_template, record_properties, sets_authority_properties, sets_conference_meeting, sets_name_order_from_ind1, sets_name_source_from_code, sets_other_name_source, sets_primary_and_rest_of_name, sets_subject_source, sets_use_date_from_code_d, singlepart_note, subfield_template, subject_template, trim

Methods included from ASpaceImport::XML::DOM

#config, included, #object, #process_field, #run

Methods inherited from Converter

for, #get_output_path, inherited, #initialize, list_import_types, register_converter, #remove_files, #run

Constructor Details

This class inherits a constructor from Converter

Class Method Details

.configureObject



49
50
51
52
53
54
55
# File 'backend/app/converters/marcxml_bib_converter.rb', line 49

def self.configure
  super do |config|
    config.doc_frag_nodes << 'record'
    config["/record"] = self.BASE_RECORD_MAP
    yield config if block_given?
  end
end

.for_subjects_and_agents_only(input_file) ⇒ Object



37
38
39
40
41
42
43
44
45
46
# File 'backend/app/converters/marcxml_bib_converter.rb', line 37

def self.for_subjects_and_agents_only(input_file)
  new(input_file).instance_eval do
    @batch.record_filter = ->(record) {
      AgentManager.known_agent_type?(record.class.record_type) ||
      record.class.record_type == 'subject'
    }

    self
  end
end

.import_types(show_hidden = false) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
# File 'backend/app/converters/marcxml_bib_converter.rb', line 12

def self.import_types(show_hidden = false)
  [
   {
     :name => "marcxml",
     :description => "Import all record types from a MARC XML file"
   },
   {
     :name => "marcxml_subjects_and_agents",
     :description => "Import only subjects and agents from a MARC XML file"
   }
  ]
end

.instance_for(type, input_file) ⇒ Object



26
27
28
29
30
31
32
33
34
# File 'backend/app/converters/marcxml_bib_converter.rb', line 26

def self.instance_for(type, input_file)
  if type == "marcxml"
    self.new(input_file)
  elsif type == "marcxml_subjects_and_agents"
    self.for_subjects_and_agents_only(input_file)
  else
    nil
  end
end