Class: BerkeleyLibrary::TIND::Mapping::TindMarc

Inherits:
Object
  • Object
show all
Includes:
Logging, AdditionalDatafieldProcess, CsvMapper, MatchTindField, Misc, TindFieldUtil, TindSubfieldUtil, Util
Defined in:
lib/berkeley_library/tind/mapping/tind_marc.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from MatchTindField

#check_abnormal_formated_subfield6, #un_matched_fields_880

Methods included from AdditionalDatafieldProcess

#clean_subfields, #clean_subfields_in_field, #remove_repeated_fields, #remove_repeats

Methods included from TindFieldUtil

#field_880_on_subfield6_tag, #field_on_tag, #rule, #tindfield_existed?, #tindfield_subfield_existed?

Methods included from Misc

#check_subfield6_format, #field_880_has_referred_tag?, #origin_mapping_tag, #referred_tag

Methods included from TindSubfieldUtil

#clean_subfield, #fields_880_subfield6, #the_first_subfield6

Methods included from Util

alma_datafield, collection_config_correct?, concatenation_symbol, csv_rows, datafield, from_xml, indicator, order_subfields, qualified_alma_record?, remove_extra_symbol, subfield, subfield_hash, symbols, tag_symbol

Methods included from AlmaBase

#base_save, #base_tind_record

Methods included from CsvMapper

#from_tags, #one_occurrence_tags, #rules

Constructor Details

#initialize(record) ⇒ TindMarc

input an alma record



22
23
24
25
26
# File 'lib/berkeley_library/tind/mapping/tind_marc.rb', line 22

def initialize(record)
  @source_marc_record = record
  @field_catalog = DataFieldsCatalog.new(@source_marc_record)
  @tind_external_datafields = []
end

Instance Attribute Details

#field_catalogObject (readonly)

Returns the value of attribute field_catalog.



18
19
20
# File 'lib/berkeley_library/tind/mapping/tind_marc.rb', line 18

def field_catalog
  @field_catalog
end

#mms_idObject (readonly)

Returns the value of attribute mms_id.



19
20
21
# File 'lib/berkeley_library/tind/mapping/tind_marc.rb', line 19

def mms_id
  @mms_id
end

#source_marc_recordObject

Returns the value of attribute source_marc_record.



16
17
18
# File 'lib/berkeley_library/tind/mapping/tind_marc.rb', line 16

def source_marc_record
  @source_marc_record
end

#tind_external_datafields=(value) ⇒ Object (writeonly)

Sets the attribute tind_external_datafields

Parameters:

  • value

    the value to set the attribute tind_external_datafields to.



17
18
19
# File 'lib/berkeley_library/tind/mapping/tind_marc.rb', line 17

def tind_external_datafields=(value)
  @tind_external_datafields = value
end

Instance Method Details

#tind_recordObject

return a TIND Marc record add external datafields flag to do additional TIND datafield process before generating a TIND Marc record



40
41
42
43
44
45
46
47
# File 'lib/berkeley_library/tind/mapping/tind_marc.rb', line 40

def tind_record
  fields = tindfields
  fields.concat @tind_external_datafields
  more_process(fields)
  record = ::MARC::Record.new
  fields.each { |f| record.append(f) }
  record
end

#tindfieldsObject

return mapped tind datafields keep the order of different mapping



30
31
32
33
34
35
# File 'lib/berkeley_library/tind/mapping/tind_marc.rb', line 30

def tindfields
  fields = []
  fields.concat tindfields_group
  fields.concat tindfields_group_880
  fields
end