Class: MarcXMLConverter

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

Direct Known Subclasses

MarcXMLAccessionConverter

Constant Summary

Constants included from MarcXMLBaseMap

MarcXMLBaseMap::AUTH_SUBJECT_SOURCE, MarcXMLBaseMap::BIB_SUBJECT_SOURCE

Class Method Summary (collapse)

Methods included from MarcXMLBaseMap

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, family_template, is_fallback_resource_title, make_term, multipart_note, name_corp_map, name_family_map, name_person_map, person_template, record_type, 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

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

Constructor Details

This class inherits a constructor from Converter

Class Method Details

+ (Object) configure



54
55
56
57
58
59
60
# File 'backend/app/converters/marcxml_converter.rb', line 54

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

+ (Object) for_subjects_and_agents_only(input_file)



37
38
39
40
41
42
43
44
45
46
# File 'backend/app/converters/marcxml_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

+ (Object) import_types(show_hidden = false)



12
13
14
15
16
17
18
19
20
21
22
23
# File 'backend/app/converters/marcxml_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

+ (Object) instance_for(type, input_file)



26
27
28
29
30
31
32
33
34
# File 'backend/app/converters/marcxml_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

+ (Object) profile



49
50
51
# File 'backend/app/converters/marcxml_converter.rb', line 49

def self.profile
  "Convert MARC XML To ArchivesSpace JSONModel records"
end