app/parsers/bulkrax/xml_parser.rb in bulkrax-6.0.1 vs app/parsers/bulkrax/xml_parser.rb in bulkrax-7.0.0
- old
+ new
@@ -9,18 +9,34 @@
# @todo not yet supported
def collection_entry_class; end
# @todo not yet supported
- def create_collections; end
+ def create_collections
+ raise NotImplementedError
+ end
# @todo not yet supported
def file_set_entry_class; end
# @todo not yet supported
- def create_file_sets; end
+ def create_file_sets
+ raise NotImplementedError
+ end
+ def file_sets
+ raise NotImplementedError
+ end
+
+ def collections
+ raise NotImplementedError
+ end
+
+ def works
+ records
+ end
+
# TODO: change to differentiate between collection and work records when adding ability to import collection metadata
def works_total
total
end
@@ -88,28 +104,9 @@
end
end
def good_file_type?(path)
%w[.xml .xls .xsd].include?(File.extname(path)) || ::Marcel::MimeType.for(path).include?('application/xml')
- end
-
- def create_works
- records.each_with_index do |record, index|
- next unless record_has_source_identifier(record, index)
- break if !limit.nil? && index >= limit
-
- seen[record[source_identifier]] = true
- new_entry = find_or_create_entry(entry_class, record[source_identifier], 'Bulkrax::Importer', record)
- if record[:delete].present?
- DeleteWorkJob.send(perform_method, new_entry, current_run)
- else
- ImportWorkJob.send(perform_method, new_entry.id, current_run.id)
- end
- increment_counters(index, work: true)
- end
- importer.record_status
- rescue StandardError => e
- set_status_info(e)
end
def total
records.size
end