Class: Bulkrax::Entry
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- Bulkrax::Entry
- Includes:
- ExportBehavior, HasLocalProcessing, HasMatchers, ImportBehavior, StatusInfo
- Defined in:
- app/models/bulkrax/entry.rb
Instance Attribute Summary collapse
-
#all_attrs ⇒ Object
Returns the value of attribute all_attrs.
Class Method Summary collapse
-
.data_for_entry(_data, _source_id, _parser) ⇒ Object
Returns formatted data from the given file for a single Entry.
-
.fields_from_data(_data) ⇒ Object
Retrieve fields from the file.
- .parent_field(parser) ⇒ Object
-
.read_data(_path) ⇒ Object
Read the data from the supplied path.
Instance Method Summary collapse
- #build ⇒ Object
- #exporter? ⇒ Boolean
-
#fetch_field_mapping ⇒ Object
Returns field_mapping hash based on whether or not generated metadata should be included.
- #find_collection(collection_identifier) ⇒ Object
- #importer? ⇒ Boolean
- #last_run ⇒ Object
- #source_identifier ⇒ Object
- #work_identifier ⇒ Object
Methods included from HasLocalProcessing
Methods included from StatusInfo
#current_status, #failed?, #last_error, #set_status_info, #skipped?, #status, #status_at, #succeeded?
Methods included from ExportBehavior
#build_export_metadata, #build_for_exporter, #filename, #hyrax_record
Methods included from ImportBehavior
#active_id_for_authority?, #add_admin_set_id, #add_collections, #add_rights_statement, #add_user_to_permission_templates!, #add_visibility, #build_for_importer, #build_metadata, #child_jobs, #collections_created?, #factory, #factory_class, #find_collection_ids, #override_rights_statement, #parent_jobs, #rights_statement, #sanitize_controlled_uri_value, #sanitize_controlled_uri_values!, #validate_value
Methods included from HasMatchers
#add_metadata, #excluded?, #field_supported?, #field_to, #fields_that_are_always_multiple, #fields_that_are_always_singular, #get_object_name, #matched_metadata, #multiple?, #multiple_metadata, #schema_form_definitions, #set_parsed_data, #set_parsed_object_data, #single_metadata, #supported_bulkrax_fields
Instance Attribute Details
#all_attrs ⇒ Object
Returns the value of attribute all_attrs.
27 28 29 |
# File 'app/models/bulkrax/entry.rb', line 27 def all_attrs @all_attrs end |
Class Method Details
.data_for_entry(_data, _source_id, _parser) ⇒ Object
Returns formatted data from the given file for a single Entry
65 66 67 |
# File 'app/models/bulkrax/entry.rb', line 65 def self.data_for_entry(_data, _source_id, _parser) raise StandardError, 'Not Implemented' end |
.fields_from_data(_data) ⇒ Object
Retrieve fields from the file
50 51 52 |
# File 'app/models/bulkrax/entry.rb', line 50 def self.fields_from_data(_data) raise StandardError, 'Not Implemented' end |
.parent_field(parser) ⇒ Object
86 87 88 |
# File 'app/models/bulkrax/entry.rb', line 86 def self.parent_field(parser) parser. end |
.read_data(_path) ⇒ Object
Read the data from the supplied path
57 58 59 |
# File 'app/models/bulkrax/entry.rb', line 57 def self.read_data(_path) raise StandardError, 'Not Implemented' end |
Instance Method Details
#build ⇒ Object
90 91 92 93 94 95 96 |
# File 'app/models/bulkrax/entry.rb', line 90 def build return if type.nil? self.save if self.new_record? # must be saved for statuses return build_for_importer if importer? return build_for_exporter if exporter? end |
#exporter? ⇒ Boolean
102 103 104 |
# File 'app/models/bulkrax/entry.rb', line 102 def exporter? self.importerexporter_type == 'Bulkrax::Exporter' end |
#fetch_field_mapping ⇒ Object
Returns field_mapping hash based on whether or not generated metadata should be included
78 79 80 81 82 83 84 |
# File 'app/models/bulkrax/entry.rb', line 78 def fetch_field_mapping return self.mapping if importerexporter. self.mapping.each do |key, value| self.mapping.delete(key) if value[] end end |
#find_collection(collection_identifier) ⇒ Object
110 111 112 113 114 115 116 117 118 |
# File 'app/models/bulkrax/entry.rb', line 110 def find_collection(collection_identifier) Bulkrax.object_factory.search_by_property( klass: Bulkrax.collection_model_class, value: collection_identifier, search_field: work_identifier, name_field: work_identifier, verify_property: true ) end |
#importer? ⇒ Boolean
98 99 100 |
# File 'app/models/bulkrax/entry.rb', line 98 def importer? self.importerexporter_type == 'Bulkrax::Importer' end |
#last_run ⇒ Object
106 107 108 |
# File 'app/models/bulkrax/entry.rb', line 106 def last_run self.importerexporter&.last_run end |
#source_identifier ⇒ Object
69 70 71 |
# File 'app/models/bulkrax/entry.rb', line 69 def source_identifier parser&.source_identifier&.to_s || 'source_identifier' end |
#work_identifier ⇒ Object
73 74 75 |
# File 'app/models/bulkrax/entry.rb', line 73 def work_identifier parser&.work_identifier&.to_s || 'source' end |