bulkrax 7.0.0 → 8.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/bulkrax/datatables.js +1 -1
  3. data/app/concerns/loggable.rb +25 -0
  4. data/app/controllers/bulkrax/exporters_controller.rb +1 -1
  5. data/app/controllers/bulkrax/importers_controller.rb +2 -1
  6. data/app/controllers/concerns/bulkrax/datatables_behavior.rb +15 -15
  7. data/app/factories/bulkrax/object_factory.rb +135 -163
  8. data/app/factories/bulkrax/object_factory_interface.rb +483 -0
  9. data/app/factories/bulkrax/valkyrie_object_factory.rb +402 -0
  10. data/app/factories/bulkrax/valkyrize-hyku.code-workspace +19 -0
  11. data/app/helpers/bulkrax/importers_helper.rb +1 -1
  12. data/app/helpers/bulkrax/validation_helper.rb +4 -4
  13. data/app/jobs/bulkrax/create_relationships_job.rb +27 -16
  14. data/app/jobs/bulkrax/delete_job.rb +3 -2
  15. data/app/jobs/bulkrax/download_cloud_file_job.rb +16 -3
  16. data/app/jobs/bulkrax/import_file_set_job.rb +23 -19
  17. data/app/jobs/bulkrax/importer_job.rb +18 -2
  18. data/app/matchers/bulkrax/application_matcher.rb +0 -2
  19. data/app/models/bulkrax/csv_collection_entry.rb +1 -1
  20. data/app/models/bulkrax/csv_entry.rb +7 -6
  21. data/app/models/bulkrax/entry.rb +7 -11
  22. data/app/models/bulkrax/exporter.rb +2 -2
  23. data/app/models/bulkrax/importer.rb +1 -3
  24. data/app/models/bulkrax/oai_entry.rb +0 -3
  25. data/app/models/bulkrax/oai_set_entry.rb +1 -1
  26. data/app/models/bulkrax/rdf_collection_entry.rb +1 -1
  27. data/app/models/bulkrax/rdf_entry.rb +70 -69
  28. data/app/models/bulkrax/xml_entry.rb +0 -1
  29. data/app/models/concerns/bulkrax/dynamic_record_lookup.rb +2 -19
  30. data/app/models/concerns/bulkrax/export_behavior.rb +2 -2
  31. data/app/models/concerns/bulkrax/file_factory.rb +178 -118
  32. data/app/models/concerns/bulkrax/file_set_entry_behavior.rb +2 -2
  33. data/app/models/concerns/bulkrax/has_matchers.rb +39 -25
  34. data/app/models/concerns/bulkrax/import_behavior.rb +10 -17
  35. data/app/models/concerns/bulkrax/importer_exporter_behavior.rb +3 -2
  36. data/app/parsers/bulkrax/application_parser.rb +31 -7
  37. data/app/parsers/bulkrax/bagit_parser.rb +175 -174
  38. data/app/parsers/bulkrax/csv_parser.rb +15 -5
  39. data/app/parsers/bulkrax/oai_dc_parser.rb +18 -0
  40. data/app/parsers/bulkrax/parser_export_record_set.rb +18 -22
  41. data/app/parsers/bulkrax/xml_parser.rb +0 -2
  42. data/app/services/bulkrax/factory_class_finder.rb +2 -0
  43. data/app/services/bulkrax/remove_relationships_for_importer.rb +3 -1
  44. data/app/services/hyrax/custom_queries/find_by_source_identifier.rb +50 -0
  45. data/app/services/wings/custom_queries/find_by_source_identifier.rb +32 -0
  46. data/app/views/bulkrax/entries/_parsed_metadata.html.erb +2 -2
  47. data/app/views/bulkrax/entries/_raw_metadata.html.erb +2 -2
  48. data/app/views/bulkrax/entries/show.html.erb +9 -8
  49. data/app/views/bulkrax/exporters/edit.html.erb +1 -1
  50. data/app/views/bulkrax/exporters/new.html.erb +1 -1
  51. data/app/views/bulkrax/exporters/show.html.erb +4 -2
  52. data/app/views/bulkrax/importers/_browse_everything.html.erb +2 -2
  53. data/app/views/bulkrax/importers/_csv_fields.html.erb +1 -1
  54. data/app/views/bulkrax/importers/edit.html.erb +1 -1
  55. data/app/views/bulkrax/importers/new.html.erb +1 -1
  56. data/app/views/bulkrax/importers/show.html.erb +1 -1
  57. data/app/views/bulkrax/importers/upload_corrected_entries.html.erb +2 -2
  58. data/app/views/bulkrax/shared/_bulkrax_errors.html.erb +1 -1
  59. data/app/views/bulkrax/shared/_bulkrax_field_mapping.html.erb +1 -1
  60. data/config/locales/bulkrax.en.yml +7 -0
  61. data/db/migrate/20230608153601_add_indices_to_bulkrax.rb +20 -9
  62. data/db/migrate/20240307053156_add_index_to_metadata_bulkrax_identifier.rb +18 -0
  63. data/lib/bulkrax/engine.rb +23 -6
  64. data/lib/bulkrax/version.rb +1 -1
  65. data/lib/bulkrax.rb +54 -52
  66. data/lib/generators/bulkrax/templates/config/initializers/bulkrax.rb +2 -0
  67. data/lib/tasks/bulkrax_tasks.rake +1 -0
  68. data/lib/tasks/reset.rake +4 -4
  69. metadata +25 -7
  70. data/lib/bulkrax/persistence_layer/active_fedora_adapter.rb +0 -27
  71. data/lib/bulkrax/persistence_layer/valkyrie_adapter.rb +0 -8
  72. data/lib/bulkrax/persistence_layer.rb +0 -38
data/lib/tasks/reset.rake CHANGED
@@ -12,8 +12,7 @@ namespace :hyrax do
12
12
  desc 'Reset fedora / solr and corresponding database tables w/o clearing other active record tables like users'
13
13
  task works_and_collections: [:environment] do
14
14
  confirm('You are about to delete all works and collections, this is not reversable!')
15
- require 'active_fedora/cleaner'
16
- ActiveFedora::Cleaner.clean!
15
+ Bulkrax.object_factory.clean!
17
16
  Hyrax::PermissionTemplateAccess.delete_all
18
17
  Hyrax::PermissionTemplate.delete_all
19
18
  Bulkrax::PendingRelationship.delete_all
@@ -33,16 +32,17 @@ namespace :hyrax do
33
32
  Mailboxer::Conversation::OptOut.delete_all
34
33
  Mailboxer::Conversation.delete_all
35
34
  AccountElevator.switch!(Site.instance.account) if defined?(AccountElevator)
35
+
36
36
  # we need to wait till Fedora is done with its cleanup
37
37
  # otherwise creating the admin set will fail
38
- while AdminSet.exists?(AdminSet::DEFAULT_ID)
38
+ while Bulkrax.object_factory.default_admin_set_or_nil
39
39
  puts 'waiting for delete to finish before reinitializing Fedora'
40
40
  sleep 20
41
41
  end
42
42
 
43
43
  Hyrax::CollectionType.find_or_create_default_collection_type
44
44
  Hyrax::CollectionType.find_or_create_admin_set_type
45
- AdminSet.find_or_create_default_admin_set_id
45
+ Bulkrax.object_factory.find_or_create_default_admin_set
46
46
 
47
47
  collection_types = Hyrax::CollectionType.all
48
48
  collection_types.each do |c|
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: 7.0.0
4
+ version: 8.1.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: 2024-03-02 00:00:00.000000000 Z
11
+ date: 2024-06-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0.4'
33
+ version: 0.4.6
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '0.4'
40
+ version: 0.4.6
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: coderay
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: marcel
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: iso8601
71
85
  requirement: !ruby/object:Gem::Requirement
@@ -320,6 +334,7 @@ files:
320
334
  - app/assets/stylesheets/bulkrax/application.css
321
335
  - app/assets/stylesheets/bulkrax/coderay.scss
322
336
  - app/assets/stylesheets/bulkrax/import_export.scss
337
+ - app/concerns/loggable.rb
323
338
  - app/controllers/bulkrax/application_controller.rb
324
339
  - app/controllers/bulkrax/entries_controller.rb
325
340
  - app/controllers/bulkrax/exporters_controller.rb
@@ -328,6 +343,9 @@ files:
328
343
  - app/controllers/concerns/bulkrax/datatables_behavior.rb
329
344
  - app/controllers/concerns/bulkrax/download_behavior.rb
330
345
  - app/factories/bulkrax/object_factory.rb
346
+ - app/factories/bulkrax/object_factory_interface.rb
347
+ - app/factories/bulkrax/valkyrie_object_factory.rb
348
+ - app/factories/bulkrax/valkyrize-hyku.code-workspace
331
349
  - app/helpers/bulkrax/application_helper.rb
332
350
  - app/helpers/bulkrax/exporters_helper.rb
333
351
  - app/helpers/bulkrax/importers_helper.rb
@@ -395,6 +413,8 @@ files:
395
413
  - app/parsers/bulkrax/xml_parser.rb
396
414
  - app/services/bulkrax/factory_class_finder.rb
397
415
  - app/services/bulkrax/remove_relationships_for_importer.rb
416
+ - app/services/hyrax/custom_queries/find_by_source_identifier.rb
417
+ - app/services/wings/custom_queries/find_by_source_identifier.rb
398
418
  - app/views/bulkrax/entries/_parsed_metadata.html.erb
399
419
  - app/views/bulkrax/entries/_raw_metadata.html.erb
400
420
  - app/views/bulkrax/entries/show.html.erb
@@ -462,12 +482,10 @@ files:
462
482
  - db/migrate/20230608153601_add_indices_to_bulkrax.rb
463
483
  - db/migrate/20240208005801_denormalize_status_message.rb
464
484
  - db/migrate/20240209070952_update_identifier_index.rb
485
+ - db/migrate/20240307053156_add_index_to_metadata_bulkrax_identifier.rb
465
486
  - lib/bulkrax.rb
466
487
  - lib/bulkrax/engine.rb
467
488
  - 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
471
489
  - lib/bulkrax/version.rb
472
490
  - lib/generators/bulkrax/install_generator.rb
473
491
  - lib/generators/bulkrax/templates/README
@@ -1,27 +0,0 @@
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
@@ -1,8 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Bulkrax
4
- module PersistenceLayer
5
- class ValkyrieAdapter < AbstractAdapter
6
- end
7
- end
8
- end
@@ -1,38 +0,0 @@
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