Module: BerkeleyLibrary::TIND::Mapping::AlmaBase

Includes:
Logging
Included in:
AlmaMultipleTIND, AlmaSingleTIND, FieldCatalogUtil, Util
Defined in:
lib/berkeley_library/tind/mapping/alma_base.rb

Class Attribute Summary collapse

Instance Method Summary collapse

Class Attribute Details

.collection_parameter_hashObject

Returns the value of attribute collection_parameter_hash.



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

def collection_parameter_hash
  @collection_parameter_hash
end

.excluding_origin_tagsObject

Returns the value of attribute excluding_origin_tags.



20
21
22
# File 'lib/berkeley_library/tind/mapping/alma_base.rb', line 20

def excluding_origin_tags
  @excluding_origin_tags
end

.including_origin_tagsObject

Returns the value of attribute including_origin_tags.



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

def including_origin_tags
  @including_origin_tags
end

.is_035_from_mms_idObject

Returns the value of attribute is_035_from_mms_id.



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

def is_035_from_mms_id
  @is_035_from_mms_id
end

.is_barcodeObject

Returns the value of attribute is_barcode.



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

def is_barcode
  @is_barcode
end

Instance Method Details

#base_save(id, tind_record, file) ⇒ Object

This is mainly for testing purpose, each collection can have a function to save it's record

Raises:

  • (ArgumentError)


45
46
47
48
49
50
51
# File 'lib/berkeley_library/tind/mapping/alma_base.rb', line 45

def base_save(id, tind_record, file)
  raise ArgumentError, "#{id} has no TIND record or not a qualified TIND record." unless tind_record

  BerkeleyLibrary::TIND::MARC::XMLWriter.open(file) do |writer|
    writer.write(tind_record)
  end
end

#base_tind_record(id, datafields, alma_record = nil) ⇒ Object

id can be: 1) Alma mms id 2) Oskicat No 3) BarCode No When alma record is nil or un-qualified, raise error Input datafields - an array of record specific datafields: for example, fft datafields, datafield 035 etc.

Raises:

  • (ArgumentError)


31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/berkeley_library/tind/mapping/alma_base.rb', line 31

def base_tind_record(id, datafields, alma_record = nil)
  marc_record = alma_record || alma_record_from(id)

  raise ArgumentError, "#{id} has no Alma record." unless marc_record

  unless Util.qualified_alma_record?(marc_record)
    raise ArgumentError,
          "#{id} belong to a host bibliographic record which should not be uploaded to TIND."
  end

  tind_record(id, marc_record, datafields)
end