Class: Bulkrax::Entry
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
#add_local
Methods included from StatusInfo
#current_status, #failed?, #last_error, #status, #status_at, #status_info, #succeeded?
#build_export_metadata, #build_for_exporter, #filename, #hyrax_record, #write_files
#add_admin_set_id, #add_collections, #add_rights_statement, #add_visibility, #build_for_importer, #build_metadata, #collections_created?, #factory, #factory_class, #find_or_create_collection_ids, #override_rights_statement, #rights_statement
#add_metadata, #excluded?, #field_supported?, #field_to, #get_object_name, #matched_metadata, #multiple?, #multiple_metadata, #set_parsed_data, #single_metadata
Instance Attribute Details
#all_attrs ⇒ Object
Returns the value of attribute all_attrs.
24
25
26
|
# File 'app/models/bulkrax/entry.rb', line 24
def all_attrs
@all_attrs
end
|
Class Method Details
.children_field ⇒ Object
67
68
69
|
# File 'app/models/bulkrax/entry.rb', line 67
def self.children_field
Bulkrax.parent_child_field_mapping[self.to_s]
end
|
.collection_field ⇒ Object
63
64
65
|
# File 'app/models/bulkrax/entry.rb', line 63
def self.collection_field
Bulkrax.collection_field_mapping[self.to_s]
end
|
.data_for_entry(_data, _source_id) ⇒ Object
Returns formatted data from the given file for a single Entry
51
52
53
|
# File 'app/models/bulkrax/entry.rb', line 51
def self.data_for_entry(_data, _source_id)
raise StandardError, 'Not Implemented'
end
|
.fields_from_data(_data) ⇒ Object
Retrieve fields from the file
36
37
38
|
# File 'app/models/bulkrax/entry.rb', line 36
def self.fields_from_data(_data)
raise StandardError, 'Not Implemented'
end
|
.read_data(_path) ⇒ Object
Read the data from the supplied path
43
44
45
|
# File 'app/models/bulkrax/entry.rb', line 43
def self.read_data(_path)
raise StandardError, 'Not Implemented'
end
|
Instance Method Details
#build ⇒ Object
71
72
73
74
75
76
77
|
# File 'app/models/bulkrax/entry.rb', line 71
def build
return if type.nil?
self.save if self.new_record?
return build_for_importer if importer?
return build_for_exporter if exporter?
end
|
#exporter? ⇒ Boolean
83
84
85
|
# File 'app/models/bulkrax/entry.rb', line 83
def exporter?
self.importerexporter_type == 'Bulkrax::Exporter'
end
|
#find_collection(collection_identifier) ⇒ Object
98
99
100
101
102
|
# File 'app/models/bulkrax/entry.rb', line 98
def find_collection(collection_identifier)
Collection.where(
work_identifier => collection_identifier
).detect { |m| m.send(work_identifier).include?(collection_identifier) }
end
|
#importer? ⇒ Boolean
79
80
81
|
# File 'app/models/bulkrax/entry.rb', line 79
def importer?
self.importerexporter_type == 'Bulkrax::Importer'
end
|
#last_run ⇒ Object
94
95
96
|
# File 'app/models/bulkrax/entry.rb', line 94
def last_run
self.importerexporter&.last_run
end
|
#source_identifier ⇒ Object
55
56
57
|
# File 'app/models/bulkrax/entry.rb', line 55
def source_identifier
parser&.source_identifier&.to_s || 'source_identifier'
end
|
#valid_system_id(model_class) ⇒ Object
87
88
89
90
91
92
|
# File 'app/models/bulkrax/entry.rb', line 87
def valid_system_id(model_class)
return true if model_class.properties.keys.include?(work_identifier)
raise(
"#{model_class} does not implement the system_identifier_field: #{work_identifier}"
)
end
|
#work_identifier ⇒ Object
59
60
61
|
# File 'app/models/bulkrax/entry.rb', line 59
def work_identifier
parser&.work_identifier&.to_s || 'source'
end
|