Class: BerkeleyLibrary::TIND::Mapping::DataFieldsCatalog

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from MatchTindField

#check_abnormal_formated_subfield6, #un_matched_fields_880

Methods included from FieldCatalogUtil

#exluding_fields_with_fast_subject, #fields_to_map, #prepare_group

Methods included from AlmaBase

#base_save, #base_tind_record

Methods included from AdditionalDatafieldProcess

#clean_subfields, #clean_subfields_in_field, #remove_repeated_fields, #remove_repeats

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 CsvMapper

#from_tags, #one_occurrence_tags, #rules

Methods included from TindSubfieldUtil

#clean_subfield, #fields_880_subfield6, #the_first_subfield6

Methods included from Misc

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

Constructor Details

#initialize(record) ⇒ DataFieldsCatalog

Returns a new instance of DataFieldsCatalog.



26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/berkeley_library/tind/mapping/field_catalog.rb', line 26

def initialize(record)
  @control_fields = []
  @data_fields_group = []
  @data_fields_880_group = []
  @data_fields_880_00 = []
  @mms_id = ''

  @data_fields = []
  @data_fields_880 = []
  @alma_field_tags = []

  init(record)
end

Instance Attribute Details

#control_fieldsObject (readonly)

Returns the value of attribute control_fields.



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

def control_fields
  @control_fields
end

#data_fields_880_00Object (readonly)

Returns the value of attribute data_fields_880_00.



23
24
25
# File 'lib/berkeley_library/tind/mapping/field_catalog.rb', line 23

def data_fields_880_00
  @data_fields_880_00
end

#data_fields_880_groupObject (readonly)

Returns the value of attribute data_fields_880_group.



22
23
24
# File 'lib/berkeley_library/tind/mapping/field_catalog.rb', line 22

def data_fields_880_group
  @data_fields_880_group
end

#data_fields_groupObject (readonly)

Returns the value of attribute data_fields_group.



21
22
23
# File 'lib/berkeley_library/tind/mapping/field_catalog.rb', line 21

def data_fields_group
  @data_fields_group
end

#mms_idObject (readonly)

Returns the value of attribute mms_id.



24
25
26
# File 'lib/berkeley_library/tind/mapping/field_catalog.rb', line 24

def mms_id
  @mms_id
end

Instance Method Details

#init(record) ⇒ Object



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

def init(record)
  prepare_catalog(record)
  @data_fields_group = prepare_group(@data_fields)
  @data_fields_880_group = prepare_group(@data_fields_880)
  @mms_id = alma_mms_id
end

#prepare_catalog(record) ⇒ Object



47
48
49
50
51
52
53
# File 'lib/berkeley_library/tind/mapping/field_catalog.rb', line 47

def prepare_catalog(record)
  clean_fields = clean_subfields(record.fields)
  check_abnormal_formated_subfield6(clean_fields)
  final_fields_to_map = fields_to_map(clean_fields)
  allocate_fields(final_fields_to_map)
  remove_fields_with_subject_fast
end

#remove_fields_with_subject_fastObject



55
56
57
58
# File 'lib/berkeley_library/tind/mapping/field_catalog.rb', line 55

def remove_fields_with_subject_fast
  @data_fields = exluding_fields_with_fast_subject(@data_fields)
  @data_fields_880 = exluding_fields_with_fast_subject(@data_fields_880)
end