bulkrax 6.0.0 → 7.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +7 -7
  3. data/app/assets/javascripts/bulkrax/bulkrax.js +11 -0
  4. data/app/assets/javascripts/bulkrax/datatables.js +139 -0
  5. data/app/assets/javascripts/bulkrax/exporters.js +4 -4
  6. data/app/assets/javascripts/bulkrax/importers.js.erb +15 -1
  7. data/app/assets/stylesheets/bulkrax/import_export.scss +6 -1
  8. data/app/controllers/bulkrax/entries_controller.rb +52 -3
  9. data/app/controllers/bulkrax/exporters_controller.rb +19 -7
  10. data/app/controllers/bulkrax/importers_controller.rb +29 -11
  11. data/app/controllers/concerns/bulkrax/datatables_behavior.rb +201 -0
  12. data/app/helpers/bulkrax/application_helper.rb +7 -3
  13. data/app/jobs/bulkrax/create_relationships_job.rb +1 -1
  14. data/app/jobs/bulkrax/delete_and_import_collection_job.rb +8 -0
  15. data/app/jobs/bulkrax/delete_and_import_file_set_job.rb +8 -0
  16. data/app/jobs/bulkrax/delete_and_import_job.rb +20 -0
  17. data/app/jobs/bulkrax/delete_and_import_work_job.rb +8 -0
  18. data/app/jobs/bulkrax/delete_job.rb +5 -1
  19. data/app/jobs/bulkrax/download_cloud_file_job.rb +1 -1
  20. data/app/jobs/bulkrax/import_collection_job.rb +1 -1
  21. data/app/jobs/bulkrax/import_file_set_job.rb +1 -1
  22. data/app/jobs/bulkrax/import_job.rb +7 -0
  23. data/app/jobs/bulkrax/import_work_job.rb +1 -1
  24. data/app/jobs/bulkrax/importer_job.rb +1 -1
  25. data/app/models/bulkrax/csv_collection_entry.rb +1 -3
  26. data/app/models/bulkrax/csv_entry.rb +2 -1
  27. data/app/models/bulkrax/entry.rb +2 -0
  28. data/app/models/bulkrax/exporter.rb +9 -2
  29. data/app/models/bulkrax/importer.rb +48 -7
  30. data/app/models/bulkrax/oai_set_entry.rb +1 -3
  31. data/app/models/bulkrax/rdf_collection_entry.rb +1 -4
  32. data/app/models/bulkrax/status.rb +10 -1
  33. data/app/models/concerns/bulkrax/file_set_entry_behavior.rb +4 -2
  34. data/app/models/concerns/bulkrax/import_behavior.rb +4 -16
  35. data/app/models/concerns/bulkrax/status_info.rb +8 -0
  36. data/app/parsers/bulkrax/application_parser.rb +93 -22
  37. data/app/parsers/bulkrax/bagit_parser.rb +0 -23
  38. data/app/parsers/bulkrax/csv_parser.rb +0 -52
  39. data/app/parsers/bulkrax/oai_dc_parser.rb +26 -16
  40. data/app/parsers/bulkrax/parser_export_record_set.rb +2 -2
  41. data/app/parsers/bulkrax/xml_parser.rb +18 -21
  42. data/app/services/bulkrax/factory_class_finder.rb +90 -0
  43. data/app/views/bulkrax/exporters/_form.html.erb +10 -10
  44. data/app/views/bulkrax/exporters/index.html.erb +13 -57
  45. data/app/views/bulkrax/exporters/show.html.erb +2 -10
  46. data/app/views/bulkrax/importers/_csv_fields.html.erb +7 -1
  47. data/app/views/bulkrax/importers/_edit_form_buttons.html.erb +8 -1
  48. data/app/views/bulkrax/importers/_edit_item_buttons.html.erb +18 -0
  49. data/app/views/bulkrax/importers/index.html.erb +20 -64
  50. data/app/views/bulkrax/importers/show.html.erb +7 -13
  51. data/app/views/bulkrax/shared/_entries_tab.html.erb +16 -0
  52. data/config/routes.rb +8 -2
  53. data/db/migrate/20240208005801_denormalize_status_message.rb +7 -0
  54. data/db/migrate/20240209070952_update_identifier_index.rb +6 -0
  55. data/lib/bulkrax/engine.rb +6 -0
  56. data/lib/bulkrax/persistence_layer/active_fedora_adapter.rb +27 -0
  57. data/lib/bulkrax/persistence_layer/valkyrie_adapter.rb +8 -0
  58. data/lib/bulkrax/persistence_layer.rb +38 -0
  59. data/lib/bulkrax/version.rb +1 -1
  60. data/lib/bulkrax.rb +88 -2
  61. data/lib/tasks/bulkrax_tasks.rake +12 -0
  62. metadata +46 -6
  63. data/app/views/bulkrax/shared/_collection_entries_tab.html.erb +0 -39
  64. data/app/views/bulkrax/shared/_file_set_entries_tab.html.erb +0 -39
  65. data/app/views/bulkrax/shared/_work_entries_tab.html.erb +0 -39
@@ -25,13 +25,19 @@
25
25
  <h4>Add CSV File to Import:</h4>
26
26
  <%# accept a single file upload; data files and bags will need to be added another way %>
27
27
 
28
- <%= fi.input :file_style, collection: ['Upload a File', 'Specify a Path on the Server'], as: :radio_buttons, label: false %>
28
+ <% file_style_list = ['Upload a File', 'Specify a Path on the Server'] %>
29
+ <% file_style_list << 'Existing Entries' unless importer.new_record? %>
30
+ <%= fi.input :file_style, collection: file_style_list, as: :radio_buttons, label: false %>
29
31
  <div id='file_upload'>
30
32
  <%= fi.input 'file', as: :file, input_html: { accept: 'text/csv,application/zip' } %><br />
31
33
  </div>
32
34
  <div id='file_path'>
33
35
  <%= fi.input :import_file_path, as: :string, input_html: { value: importer.parser_fields['import_file_path'] } %>
34
36
  </div>
37
+ <div id='existing_options'>
38
+ <%= fi.collection_check_boxes :entry_statuses, [['Failed'], ['Pending'], ['Skipped'], ['Deleted'], ['Complete']], :first, :first %>
39
+ </div>
40
+
35
41
  <% if defined?(::Hyrax) && Hyrax.config.browse_everything? %>
36
42
  <h4>Add Files to Import:</h4>
37
43
  <p>Choose files to upload. The filenames must be unique, and the filenames must be referenced in a column called 'file' in the accompanying CSV file.</p>
@@ -34,7 +34,14 @@
34
34
  <%= form.button :submit,
35
35
  value: 'Update and Replace Files',
36
36
  class: 'btn btn-primary',
37
- data: {confirm: "Are you sure? This will remove all files before adding them from the import."} %>
37
+ data: {confirm: "Are you sure? This will remove all files before adding them from the import."} %>
38
+ <hr />
39
+ <p>Remove all works and then run the import again from a clean slate. This will remove all files and associations and any edits made since the last import will be lost.</p>
40
+ <%= form.button :submit,
41
+ value: 'Remove and Rerun',
42
+ class: 'btn btn-primary',
43
+ data: {confirm: "Are you sure? This will delete all the works and any associated files and relationships before re running."} %>
44
+
38
45
  <% end %>
39
46
  <hr />
40
47
 
@@ -0,0 +1,18 @@
1
+ <div class="modal fade" id="bulkraxItemModal" tabindex="-1" role="dialog" aria-labelledby="bulkraxItemModalLabel">
2
+ <div class="modal-dialog" role="document">
3
+ <div class="modal-content">
4
+ <div class="modal-body">
5
+ <h5>Options for Updating an Entry</h5>
6
+ <hr />
7
+ <p>Rebuild metadata and files.</p>
8
+ <%= link_to 'Build', item_entry_path(item, e), method: :patch, class: 'btn btn-primary' %>
9
+ <hr />
10
+ <p>Remove existing work and then recreate the works metadata and files.</p>
11
+ <%= link_to 'Remove and then Build', item_entry_path(item, e, destroy_first: true), method: :patch, class: 'btn btn-primary' %>
12
+ </div>
13
+ <div class="modal-footer">
14
+ <button type="button" class="btn btn-default" data-dismiss="modal"><%= t('helpers.action.cancel') %></button>
15
+ </div>
16
+ </div>
17
+ </div>
18
+ </div>
@@ -13,69 +13,25 @@
13
13
 
14
14
  <div class="panel panel-default">
15
15
  <div class="panel-body">
16
- <% if @importers.present? %>
17
- <div class="table-responsive">
18
- <table class="table table-striped datatable">
19
- <thead>
20
- <tr>
21
- <th scope="col">Name</th>
22
- <th scope="col">Status</th>
23
- <th scope="col">Last Run</th>
24
- <th scope="col">Next Run</th>
25
- <th scope="col">Entries Enqueued</th>
26
- <th scope="col">Entries Processed</th>
27
- <th scope="col">Entries Failed</th>
28
- <th scope="col">Entries Deleted Upstream</th>
29
- <th scope="col">Total Collection Entries</th>
30
- <th scope="col">Total Work Entries</th>
31
- <th scope="col">Total File Set Entries</th>
32
- <th scope="col"></th>
33
- <th scope="col"></th>
34
- <th scope="col"></th>
35
- </tr>
36
- </thead>
37
- <tbody>
38
- <% @importers.each do |importer| %>
39
- <tr>
40
- <th scope="row"><%= link_to importer.name, importer_path(importer) %></th>
41
- <td><%= importer.status %></td>
42
- <td><%= importer.last_imported_at.strftime("%b %d, %Y") if importer.last_imported_at %></td>
43
- <td><%= importer.next_import_at.strftime("%b %d, %Y") if importer.next_import_at %></td>
44
- <td><%= importer.last_run&.enqueued_records %></td>
45
- <td><%= (importer.last_run&.processed_records || 0) %></td>
46
- <td><%= (importer.last_run&.failed_records || 0) %></td>
47
- <td><%= importer.last_run&.deleted_records %></td>
48
- <td><%= importer.last_run&.total_collection_entries %></td>
49
- <td><%= importer.last_run&.total_work_entries %></td>
50
- <td><%= importer.last_run&.total_file_set_entries %></td>
51
- <td><%= link_to raw('<span class="glyphicon glyphicon-info-sign"></span>'), importer_path(importer) %></td>
52
- <td><%= link_to raw('<span class="glyphicon glyphicon-pencil"></span>'), edit_importer_path(importer) %></td>
53
- <td><%= link_to raw('<span class="glyphicon glyphicon-remove"></span>'), importer, method: :delete, data: { confirm: 'Are you sure?' } %></td>
54
- </tr>
55
- <% end %>
56
- </tbody>
57
- </table>
58
- </div>
59
- <% else %>
60
- <p>No importers have been created.</p>
61
- <% end %>
16
+ <div class="table-responsive">
17
+ <table id='importers-table' class="table table-striped">
18
+ <thead>
19
+ <tr>
20
+ <th scope="col">Name</th>
21
+ <th scope="col">Status</th>
22
+ <th scope="col">Last Run</th>
23
+ <th scope="col">Next Run</th>
24
+ <th scope="col">Entries Enqueued</th>
25
+ <th scope="col">Entries Processed</th>
26
+ <th scope="col">Entries Failed</th>
27
+ <th scope="col">Entries Deleted Upstream</th>
28
+ <th scope="col">Total Collection Entries</th>
29
+ <th scope="col">Total Work Entries</th>
30
+ <th scope="col">Total File Set Entries</th>
31
+ <th scope="col">Actions</th>
32
+ </tr>
33
+ </thead>
34
+ </table>
35
+ </div>
62
36
  </div>
63
37
  </div>
64
-
65
- <script>
66
- $(function() {
67
- $('#DataTables_Table_0').DataTable({
68
- destroy: true, /* Reinitialize DataTable with config below */
69
- 'columnDefs': [
70
- { 'orderable': true, 'targets': [...Array(10).keys()] },
71
- { 'orderable': false, 'targets': [10, 11, 12] }
72
- ],
73
- 'language': {
74
- 'info': 'Showing _START_ to _END_ of _TOTAL_ importers',
75
- 'infoEmpty': 'No importers to show',
76
- 'infoFiltered': '(filtered from _MAX_ total importers)',
77
- 'lengthMenu': 'Show _MENU_ importers'
78
- }
79
- })
80
- })
81
- </script>
@@ -1,9 +1,10 @@
1
1
  <div class="col-xs-12 main-header">
2
2
  <h1><span class="fa fa-cloud-upload" aria-hidden="true"></span> Importer: <%= @importer.name %></h1>
3
- <% if @importer.parser_klass == 'Bulkrax::CsvParser' && @work_entries.map(&:failed?).any? %>
3
+
4
+ <% if @importer.failed_entries? %>
4
5
  <div class="pull-right">
5
- <%= link_to 'Export Errored Entries', importer_export_errors_path(@importer.id), class: 'btn btn-primary' %>
6
- <%= link_to 'Upload Corrected Entries', importer_upload_corrected_entries_path(@importer.id), class: 'btn btn-primary' %>
6
+ <%= link_to 'Export Errored Entries', importer_export_errors_path(@importer.id), class: 'btn btn-primary', data: { turbolinks: false }%>
7
+ <%= link_to 'Upload Corrected Entries', importer_upload_corrected_entries_path(@importer.id), class: 'btn btn-primary' if @importer.parser.is_a?(Bulkrax::CsvParser) %>
7
8
  </div>
8
9
  <% end %>
9
10
  </div>
@@ -75,17 +76,10 @@
75
76
 
76
77
  <div class="bulkrax-nav-tab-bottom-margin">
77
78
  <!-- Nav tabs -->
78
- <ul class="bulkrax-nav-tab-top-margin tab-nav nav nav-tabs" role="tablist">
79
- <li role="presentation" class="nav-link active"><a href="#work-entries" aria-controls="work-entries" role="tab" data-toggle="tab"><%= t('bulkrax.importer.labels.work_entries') %></a></li>
80
- <li role="presentation" class="nav-link"><a href="#collection-entries" aria-controls="collection-entries" role="tab" data-toggle="tab"><%= t('bulkrax.importer.labels.collection_entries') %></a></li>
81
- <li role="presentation" class="nav-link"><a href="#file-set-entries" aria-controls="file-set-entries" role="tab" data-toggle="tab"><%= t('bulkrax.importer.labels.file_set_entries') %></a></li>
82
- </ul>
83
- <!-- Tab panes -->
84
- <div class="tab-content outline">
85
- <%= render partial: 'bulkrax/shared/work_entries_tab', locals: { item: @importer, entries: @work_entries } %>
86
- <%= render partial: 'bulkrax/shared/collection_entries_tab', locals: { item: @importer, entries: @collection_entries } %>
87
- <%= render partial: 'bulkrax/shared/file_set_entries_tab', locals: { item: @importer, entries: @file_set_entries } %>
79
+ <div class="outline">
80
+ <%= render partial: 'bulkrax/shared/entries_tab', locals: { item: @importer} %>
88
81
  </div>
82
+ <%= render partial: 'bulkrax/importers/edit_item_buttons', locals: { item: @importer, e: @first_entry } if @first_entry.present? %>
89
83
  </div>
90
84
 
91
85
  <p class="bulkrax-p-align">
@@ -0,0 +1,16 @@
1
+ <div class="tab-pane bulkrax-nav-tab-table-left-align" >
2
+ <table id='importer-show-table' class='table table-striped'>
3
+ <thead>
4
+ <tr>
5
+ <th><%= t('bulkrax.table_header.labels.identifier') %></th>
6
+ <th><%= t('bulkrax.table_header.labels.entry_id') %></th>
7
+ <th><%= t('bulkrax.table_header.labels.status') %></th>
8
+ <th><%= t('bulkrax.table_header.labels.type') %></th>
9
+ <th><%= t('bulkrax.table_header.labels.updated_at') %></th>
10
+ <th><%= t('bulkrax.table_header.labels.errors') %></th>
11
+ <th><%= t('bulkrax.table_header.labels.actions') %></th>
12
+ </tr>
13
+ </thead>
14
+ </table>
15
+ <div id='importer-entry-classes' class='hidden'><%= [item.parser.entry_class.to_s, item.parser.collection_entry_class.to_s, item.parser.file_set_entry_class.to_s].compact.join('|') %></div>
16
+ </div>
data/config/routes.rb CHANGED
@@ -3,15 +3,21 @@
3
3
  Bulkrax::Engine.routes.draw do
4
4
  resources :exporters do
5
5
  get :download
6
- resources :entries, only: %i[show]
6
+ get :entry_table
7
+ collection do
8
+ get :exporter_table
9
+ end
10
+ resources :entries, only: %i[show update destroy]
7
11
  end
8
12
  resources :importers do
9
13
  put :continue
14
+ get :entry_table
10
15
  get :export_errors
11
16
  collection do
17
+ get :importer_table
12
18
  post :external_sets
13
19
  end
14
- resources :entries, only: %i[show]
20
+ resources :entries, only: %i[show update destroy]
15
21
  get :upload_corrected_entries
16
22
  post :upload_corrected_entries_file
17
23
  end
@@ -0,0 +1,7 @@
1
+ class DenormalizeStatusMessage < ActiveRecord::Migration[5.2]
2
+ def change
3
+ add_column :bulkrax_entries, :status_message, :string, default: 'Pending' unless column_exists?(:bulkrax_entries, :status_message)
4
+ add_column :bulkrax_importers, :status_message, :string, default: 'Pending' unless column_exists?(:bulkrax_importers, :status_message)
5
+ add_column :bulkrax_exporters, :status_message, :string, default: 'Pending' unless column_exists?(:bulkrax_exporters, :status_message)
6
+ end
7
+ end
@@ -0,0 +1,6 @@
1
+ class UpdateIdentifierIndex < ActiveRecord::Migration[5.2]
2
+ def change
3
+ remove_index :bulkrax_entries, :identifier if index_exists?(:bulkrax_entries, :identifier )
4
+ add_index :bulkrax_entries, [:identifier, :importerexporter_id, :importerexporter_type], name: 'bulkrax_identifier_idx' unless index_exists?(:bulkrax_entries, [:identifier, :importerexporter_id, :importerexporter_type], name: 'bulkrax_identifier_idx')
5
+ end
6
+ end
@@ -13,6 +13,12 @@ module Bulkrax
13
13
  end
14
14
  end
15
15
 
16
+ initializer 'requires' do
17
+ require 'bulkrax/persistence_layer'
18
+ require 'bulkrax/persistence_layer/active_fedora_adapter' if defined?(ActiveFedora)
19
+ require 'bulkrax/persistence_layer/valkyrie_adapter' if defined?(Valkyrie)
20
+ end
21
+
16
22
  config.generators do |g|
17
23
  g.test_framework :rspec
18
24
  begin
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bulkrax
4
+ module PersistenceLayer
5
+ class ActiveFedoraAdapter < AbstractAdapter
6
+ def self.find(id)
7
+ ActiveFedora::Base.find(id)
8
+ rescue ActiveFedora::ObjectNotFoundError => e
9
+ raise PersistenceLayer::RecordNotFound, e.message
10
+ end
11
+
12
+ def self.query(q, **kwargs)
13
+ ActiveFedora::SolrService.query(q, **kwargs)
14
+ end
15
+
16
+ def self.clean!
17
+ super do
18
+ ActiveFedora::Cleaner.clean!
19
+ end
20
+ end
21
+
22
+ def self.solr_name(field_name)
23
+ ActiveFedora.index_field_mapper.solr_name(field_name)
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bulkrax
4
+ module PersistenceLayer
5
+ class ValkyrieAdapter < AbstractAdapter
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bulkrax
4
+ ##
5
+ # The target data layer where we write and read our imported {Bulkrax::Entry} objects.
6
+ module PersistenceLayer
7
+ # We're inheriting from an ActiveRecord exception as that is something we know will be here; and
8
+ # something that the main_app will be expect to be able to handle.
9
+ class ObjectNotFoundError < ActiveRecord::RecordNotFound
10
+ end
11
+
12
+ # We're inheriting from an ActiveRecord exception as that is something we know will be here; and
13
+ # something that the main_app will be expect to be able to handle.
14
+ class RecordInvalid < ActiveRecord::RecordInvalid
15
+ end
16
+
17
+ class AbstractAdapter
18
+ # @see ActiveFedora::Base.find
19
+ def self.find(id)
20
+ raise NotImplementedError, "#{self}.#{__method__}"
21
+ end
22
+
23
+ def self.solr_name(field_name)
24
+ raise NotImplementedError, "#{self}.#{__method__}"
25
+ end
26
+
27
+ # @yield when Rails application is running in test environment.
28
+ def self.clean!
29
+ return true unless Rails.env.test?
30
+ yield
31
+ end
32
+
33
+ def self.query(q, **kwargs)
34
+ raise NotImplementedError, "#{self}.#{__method__}"
35
+ end
36
+ end
37
+ end
38
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Bulkrax
4
- VERSION = '6.0.0'
4
+ VERSION = '7.0.0'
5
5
  end
data/lib/bulkrax.rb CHANGED
@@ -3,7 +3,8 @@
3
3
  require "bulkrax/version"
4
4
  require "bulkrax/engine"
5
5
  require 'active_support/all'
6
-
6
+ require 'coderay'
7
+ require 'denormalize_fields'
7
8
  # rubocop:disable Metrics/ModuleLength
8
9
  module Bulkrax
9
10
  extend self # rubocop:disable Style/ModuleFunction
@@ -19,7 +20,6 @@ module Bulkrax
19
20
  :export_path,
20
21
  :field_mappings,
21
22
  :file_model_class,
22
- :fill_in_blank_source_identifiers,
23
23
  :generated_metadata_mapping,
24
24
  :import_path,
25
25
  :multi_value_element_join_on,
@@ -35,6 +35,86 @@ module Bulkrax
35
35
  :reserved_properties,
36
36
  :server_name
37
37
 
38
+ ##
39
+ # @return [#call] with arity 2. The first parameter is a {Bulkrax::ApplicationParser} and the
40
+ # second parameter is an Integer for the index of the record encountered in the import.
41
+ attr_accessor :fill_in_blank_source_identifiers
42
+
43
+ ##
44
+ # @param adapter [Class<Bulkrax::PersistenceLayer::AbstractAdapter>]
45
+ attr_writer :persistence_adapter
46
+
47
+ ##
48
+ # @param [String]
49
+ attr_writer :solr_key_for_member_file_ids
50
+
51
+ ##
52
+ # @return [String]
53
+ # @see https://github.com/samvera/hyrax/pull/6513
54
+ def solr_key_for_member_file_ids
55
+ return @solr_key_for_member_file_ids if @solr_key_for_member_file_ids.present?
56
+
57
+ return "member_ids_ssim" if defined?(Hyrax)
58
+
59
+ "#{file_model_class.name.to_s.underscore}_ids_ssim"
60
+ end
61
+
62
+ ##
63
+ # @param coercer [#call]
64
+ # @see Bulkrax::FactoryClassFinder
65
+ attr_writer :factory_class_name_coercer
66
+
67
+ ##
68
+ # A function responsible for converting the name of a factory class to the corresponding
69
+ # constant.
70
+ #
71
+ # @return [#call, Bulkrax::FactoryClassFinder::DefaultCoercer] an object responding to call,
72
+ # with one positional parameter (e.g. arity == 1)
73
+ #
74
+ # @example
75
+ # Bulkrax.factory_class_name_coercer.call("Work")
76
+ # => Work
77
+ def factory_class_name_coercer
78
+ @factory_class_name_coercer || Bulkrax::FactoryClassFinder::DefaultCoercer
79
+ end
80
+
81
+ attr_writer :ingest_queue_name
82
+ ##
83
+ # @return [String, Proc]
84
+ def ingest_queue_name
85
+ return @ingest_queue_name if @ingest_queue_name.present?
86
+ return Hyrax.config.ingest_queue_name if defined?(Hyrax)
87
+ :import
88
+ end
89
+
90
+ ##
91
+ # Configure the persistence adapter used for persisting imported data.
92
+ #
93
+ # @return [Class<Bulkrax::PersistenceLayer::AbstractAdapter>]
94
+ # @see Bulkrax::PersistenceLayer
95
+ def persistence_adapter
96
+ @persistence_adapter || derived_persistence_adapter
97
+ end
98
+
99
+ def derived_persistence_adapter
100
+ if defined?(Hyrax)
101
+ # There's probably some configuration of Hyrax we could use to better refine this; but it's
102
+ # likely a reasonable guess. The main goal is to not break existing implementations and
103
+ # maintain an upgrade path.
104
+ if Gem::Version.new(Hyrax::VERSION) >= Gem::Version.new('6.0.0')
105
+ Bulkrax::PersistenceLayer::ValkyrieAdapter
106
+ else
107
+ Bulkrax::PersistenceLayer::ActiveFedoraAdapter
108
+ end
109
+ elsif defined?(ActiveFedora)
110
+ Bulkrax::PersistenceLayer::ActiveFedoraAdapter
111
+ elsif defined?(Valkyrie)
112
+ Bulkrax::PersistenceLayer::ValkyrieAdapter
113
+ else
114
+ raise "Unable to derive a persistence adapter"
115
+ end
116
+ end
117
+
38
118
  attr_writer :use_locking
39
119
 
40
120
  def use_locking
@@ -63,6 +143,8 @@ module Bulkrax
63
143
  :default_work_type=,
64
144
  :export_path,
65
145
  :export_path=,
146
+ :factory_class_name_coercer,
147
+ :factory_class_name_coercer=,
66
148
  :field_mappings,
67
149
  :field_mappings=,
68
150
  :file_model_class,
@@ -81,6 +163,8 @@ module Bulkrax
81
163
  :object_factory=,
82
164
  :parsers,
83
165
  :parsers=,
166
+ :persistence_adapter,
167
+ :persistence_adapter=,
84
168
  :qa_controlled_properties,
85
169
  :qa_controlled_properties=,
86
170
  :related_children_field_mapping,
@@ -97,6 +181,8 @@ module Bulkrax
97
181
  :reserved_properties=,
98
182
  :server_name,
99
183
  :server_name=,
184
+ :solr_key_for_member_file_ids,
185
+ :solr_key_for_member_file_ids=,
100
186
  :use_locking,
101
187
  :use_locking=,
102
188
  :use_locking?
@@ -1,6 +1,18 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  namespace :bulkrax do
4
+ desc 'Update all status messages from the latest status. This is to refresh the denormalized field'
5
+ task update_status_messages: :environment do
6
+ @progress = ProgressBar.create(total: Bulkrax::Status.latest_by_statusable.count,
7
+ format: "%a %b\u{15E7}%i %c/%C %p%% %t",
8
+ progress_mark: ' ',
9
+ remainder_mark: "\u{FF65}")
10
+ Bulkrax::Status.latest_by_statusable.includes(:statusable).find_each do |status|
11
+ status.statusable.update(status_message: status.status_message)
12
+ @progress.increment
13
+ end
14
+ end
15
+
4
16
  # Usage example: rails bulkrax:generate_test_csvs['5','100','GenericWork']
5
17
  desc 'Generate CSVs with fake data for testing purposes'
6
18
  task :generate_test_csvs, [:num_of_csvs, :csv_rows, :record_type] => :environment do |_t, args|
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bulkrax
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.0.0
4
+ version: 7.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rob Kaufman
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-11-29 00:00:00.000000000 Z
11
+ date: 2024-03-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: denormalize_fields
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: iso8601
57
71
  requirement: !ruby/object:Gem::Requirement
@@ -210,6 +224,20 @@ dependencies:
210
224
  - - ">="
211
225
  - !ruby/object:Gem::Version
212
226
  version: '0'
227
+ - !ruby/object:Gem::Dependency
228
+ name: dry-monads
229
+ requirement: !ruby/object:Gem::Requirement
230
+ requirements:
231
+ - - ">="
232
+ - !ruby/object:Gem::Version
233
+ version: '0'
234
+ type: :development
235
+ prerelease: false
236
+ version_requirements: !ruby/object:Gem::Requirement
237
+ requirements:
238
+ - - ">="
239
+ - !ruby/object:Gem::Version
240
+ version: '0'
213
241
  - !ruby/object:Gem::Dependency
214
242
  name: sqlite3
215
243
  requirement: !ruby/object:Gem::Requirement
@@ -283,6 +311,7 @@ files:
283
311
  - app/assets/config/bulkrax_manifest.js
284
312
  - app/assets/javascripts/bulkrax/application.js
285
313
  - app/assets/javascripts/bulkrax/bulkrax.js
314
+ - app/assets/javascripts/bulkrax/datatables.js
286
315
  - app/assets/javascripts/bulkrax/entries.js
287
316
  - app/assets/javascripts/bulkrax/exporters.js
288
317
  - app/assets/javascripts/bulkrax/importers.js.erb
@@ -296,6 +325,7 @@ files:
296
325
  - app/controllers/bulkrax/exporters_controller.rb
297
326
  - app/controllers/bulkrax/importers_controller.rb
298
327
  - app/controllers/concerns/bulkrax/api.rb
328
+ - app/controllers/concerns/bulkrax/datatables_behavior.rb
299
329
  - app/controllers/concerns/bulkrax/download_behavior.rb
300
330
  - app/factories/bulkrax/object_factory.rb
301
331
  - app/helpers/bulkrax/application_helper.rb
@@ -304,6 +334,10 @@ files:
304
334
  - app/helpers/bulkrax/validation_helper.rb
305
335
  - app/jobs/bulkrax/application_job.rb
306
336
  - app/jobs/bulkrax/create_relationships_job.rb
337
+ - app/jobs/bulkrax/delete_and_import_collection_job.rb
338
+ - app/jobs/bulkrax/delete_and_import_file_set_job.rb
339
+ - app/jobs/bulkrax/delete_and_import_job.rb
340
+ - app/jobs/bulkrax/delete_and_import_work_job.rb
307
341
  - app/jobs/bulkrax/delete_collection_job.rb
308
342
  - app/jobs/bulkrax/delete_file_set_job.rb
309
343
  - app/jobs/bulkrax/delete_job.rb
@@ -313,6 +347,7 @@ files:
313
347
  - app/jobs/bulkrax/exporter_job.rb
314
348
  - app/jobs/bulkrax/import_collection_job.rb
315
349
  - app/jobs/bulkrax/import_file_set_job.rb
350
+ - app/jobs/bulkrax/import_job.rb
316
351
  - app/jobs/bulkrax/import_work_job.rb
317
352
  - app/jobs/bulkrax/importer_job.rb
318
353
  - app/jobs/bulkrax/schedule_relationships_job.rb
@@ -358,6 +393,7 @@ files:
358
393
  - app/parsers/bulkrax/oai_qualified_dc_parser.rb
359
394
  - app/parsers/bulkrax/parser_export_record_set.rb
360
395
  - app/parsers/bulkrax/xml_parser.rb
396
+ - app/services/bulkrax/factory_class_finder.rb
361
397
  - app/services/bulkrax/remove_relationships_for_importer.rb
362
398
  - app/views/bulkrax/entries/_parsed_metadata.html.erb
363
399
  - app/views/bulkrax/entries/_raw_metadata.html.erb
@@ -372,6 +408,7 @@ files:
372
408
  - app/views/bulkrax/importers/_browse_everything.html.erb
373
409
  - app/views/bulkrax/importers/_csv_fields.html.erb
374
410
  - app/views/bulkrax/importers/_edit_form_buttons.html.erb
411
+ - app/views/bulkrax/importers/_edit_item_buttons.html.erb
375
412
  - app/views/bulkrax/importers/_form.html.erb
376
413
  - app/views/bulkrax/importers/_oai_fields.html.erb
377
414
  - app/views/bulkrax/importers/_xml_fields.html.erb
@@ -382,9 +419,7 @@ files:
382
419
  - app/views/bulkrax/importers/upload_corrected_entries.html.erb
383
420
  - app/views/bulkrax/shared/_bulkrax_errors.html.erb
384
421
  - app/views/bulkrax/shared/_bulkrax_field_mapping.html.erb
385
- - app/views/bulkrax/shared/_collection_entries_tab.html.erb
386
- - app/views/bulkrax/shared/_file_set_entries_tab.html.erb
387
- - app/views/bulkrax/shared/_work_entries_tab.html.erb
422
+ - app/views/bulkrax/shared/_entries_tab.html.erb
388
423
  - app/views/hyrax/dashboard/sidebar/_bulkrax_sidebar_additions.html.erb
389
424
  - app/views/hyrax/dashboard/sidebar/_repository_content.html.erb
390
425
  - app/views/layouts/bulkrax/application.html.erb
@@ -425,9 +460,14 @@ files:
425
460
  - db/migrate/20220413180915_add_generated_metadata_to_bulkrax_exporters.rb
426
461
  - db/migrate/20220609001128_rename_bulkrax_importer_run_to_importer_run.rb
427
462
  - db/migrate/20230608153601_add_indices_to_bulkrax.rb
463
+ - db/migrate/20240208005801_denormalize_status_message.rb
464
+ - db/migrate/20240209070952_update_identifier_index.rb
428
465
  - lib/bulkrax.rb
429
466
  - lib/bulkrax/engine.rb
430
467
  - lib/bulkrax/entry_spec_helper.rb
468
+ - lib/bulkrax/persistence_layer.rb
469
+ - lib/bulkrax/persistence_layer/active_fedora_adapter.rb
470
+ - lib/bulkrax/persistence_layer/valkyrie_adapter.rb
431
471
  - lib/bulkrax/version.rb
432
472
  - lib/generators/bulkrax/install_generator.rb
433
473
  - lib/generators/bulkrax/templates/README
@@ -457,7 +497,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
457
497
  - !ruby/object:Gem::Version
458
498
  version: '0'
459
499
  requirements: []
460
- rubygems_version: 3.1.6
500
+ rubygems_version: 3.4.10
461
501
  signing_key:
462
502
  specification_version: 4
463
503
  summary: Import and export tool for Hyrax and Hyku